8 years, 9 months ago.

List of mc definitions i.e "if defined(STM32F401xE)"

Hi,

I'm making some modifications to a library designed for a STM32F401RE and I noticed it used a very nifty library definition to check if the micro controller used was supported by the library. It looked more or less like this:

#if defined(STM32F401xE)

...

#else

#error "Not supported device"

#endif

I was wondering what the corresponding name was for the STM32F042K6 series and if there was a doc with a list of these. I could just completely remove the F401RE parts, but it would be really nice just to keep that.

Thanks,

K

1 Answer

8 years, 9 months ago.

If you look in the mbed library code for the different targets there are 2 or 3 levels of directories called TARGET_something. All of those that apply for a given target will be defined in the compiler options. e.g.

#ifdef TARGET_STM
// included for all STM boards
#endif
#ifdef TARGET_STM32F4
// included for all STM32F4 boards
#endif
#ifdef TARGET_DISCO_F429ZI
// only included for that one specific board
#endif

For your specific request you probably want

#ifdef TARGET_NUCLEO_F042K6
//something
#else
// something else
#endif