This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Conditional compiling in Keil MDK-ARM

Hi,

We are using LPC2478 in our system with Keil RTX OS. We use Keil uVision v474. Our code is C based with above 300 files segregated in different folders.

Currently, our project is such that we have different features that we enable once on runtime based on configuration file. These features amount to a lot of code but in final application only few features are used.

So, we would like to have some mechanism where we read the configuration first and based on that only selectively compile that feature.

Based on what we learned one way would be to add pre-processor directives in code. But we do not want to change anything in code. Also this may need a lot of pre-processor directives to be added in code based on features.

The other way that we intend to do is create a mapping of features with files, read the configuration, and then have some sort of compilation/linker script that will enable/disable these files during building.

I need help on starting point for creating such script that will allow us to selectively compile files or even may discard some variables declared. Our project needs optimization level to be set to 0 only.

Any existing script or starting point on this could be much helpful.

Thanks,
blueshift