Kai Liu

Too many conditional compilations

Discussion created by Kai Liu on Jan 16, 2014
Latest reply on Jan 16, 2014 by Kai Liu

FSL has many MCU to support. I found many conditional compilation in source code, such as USB stack and bootloaders.


Conditional compilation macros are useful in simple build time customization.


However it becomes more and more confusion as more and more custom code are added, because of MCU families, peripherals, application customization, compilers. The developers will find these conditions are mess up and hard to read.


I would like to suggest FSL team to use seperate folder to replace conditional compilation macros.


For example,


Conditional compilation:

#if defined(MCU_KL25Z)

#elif defined(MCU_K20D50M)

#elif defined(MCU_MK70F12)