Custom board variant for STM32F407VG


I tried to make a custom board variant. I did the following:

  • find the folder where the variants of similar boards are located
  • copy and rename the variant_xxx.cpp, variant_xxx.h, variant_xxx.c from the closest board and made the pinout changes according to the actual HW in variant_xxx.h
  • add the new variant to board.txt (copy and modified from the closest variant)
  • copied and renamed the new xxx.json board definition and defined the correct variant

A few hours later it worked as intended … but:

variant_xxx.c and variant_xxx.cpp ask for a define like:

#if defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG)”

what is obviously used to separate variants.

Where are those “ARDUINO_BLACK_F407VG” defines made? I couldn’t find it …


Same question + answer as in

1 Like


Do I interpret correctly that this definition should be autogenerated during the built so I don’t have to do something?

The funny thing is it works today. Yesterday I needed to comment the " #if defined(ARDUINO_MY_BOARD)" out but today it works w/o that. But most likely I have looked wrongly yesterday and the bug was something else … Anyway thanks for the help and the fast response!