C Macro definition for Compiler & uC compiled for.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C Macro definition for Compiler & uC compiled for.

1,964 Views
johnwhitmore
Contributor III

I have libraries of C Source which use #define settings auto generated by C Compiler so that the source can be switched in and out of compilation process depending on the compiler and the micro-controller being compiled for. I don't have to manually define them as the compiler does this automatically.

Are there similar defines for the MCXpresso tool chain? I've not been able to find them, if they are there.

Labels (1)
Tags (1)
1 Reply

1,835 Views
lpcxpresso_supp
NXP Employee
NXP Employee

MCUXpresso IDE sits on top of the GCC compiler -  so all of the standard GCC defines will be available to you to check, which will change depending on the options being passed into the compiler.

Beyond that, depending upon the target MCU your project is configured for and whether this is provided by the "legacy" internal part support or by importing an SDK - a variety of defines will be available inside a project (either created from the new project wizard, or from the configuration of an imported example). This may include either family or device defines (or sometimes both).

Projects created using internal part support will generally define the symbol __CODE_RED, and those created from SDK imported part support the symbol __MCUXPRESSO.

But if you explicitly want to know the exact MCU a project is configured you can add the build macro "${TargetChip}" to the "Defined Symbols (-D)" box:

Project -> Properties -> C/C++ Build -> Settings -> MCU C Compiler -> Preprocessor

Similarly, you can use "${TargetProc}" for the configured cpu (eg "cortex_m3")

Regards,

MCUXpresso IDE Support