9 years, 4 months ago.

Definition for platform in c-source

Hi, can I find out, what kind of compiling-platform is chosen without looking into monitor? When using web-based compiler I can change between different platforms like "ST Nucelo F411RE". Exists there a definition made by compiler like

"#define PLATFORM NUCLEO_XXX"

and I could use an if-clause

if (PLATFORM == XYZ) ...

if (PLATFORM = ZZY) ...

1 Answer

9 years, 4 months ago.

Yes, easiest option to figure the most common ones out is looking at the mbed folder structure: https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/targets/hal. Each folder name is also defined as macro. So for example TARGET_STM is defined for a nucleo target, and for the F411 also TARGET_STM32F411RE and TARGET_NUCLEO_F411RE.

Accepted Answer