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
I use my cutom board, and I create the variant folder, and the boad.json like the picture
then I complie my project, there are some errors, at last, I find that in variant_STM32G070CB.cpp and generic_clock.c I shoud use the macro #define ARDUINO_GENERIC_G070CBTX, but in the other offical boards it was defined automatic, I do not konw where I was wrong, although I can slove the problem temporarily by adding macro?
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!