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?
kiraversace:
#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?
The board macro is autogenerated from the file name of the board json file and MCU name data.
if len(mcu) > 12:
board_id += mcu[5:12] + "X"
else:
if len(mcu) > 10:
board_id += mcu[5:11] + "TX"
else:
board_id += mcu
print(
"Warning! Couldn't generate proper internal board id from the `%s` MCU "
"field! At least 12 symbols are required!" % mcu
)
print("Falling back to `%s`." % board_id)
return board_id.upper()
board_id = get_arduino_board_id(board_config, mcu)
machine_flags = [
"-mcpu=%s" % board_config.get("build.cpu"),
This file has been truncated. show original
CPPDEFINES=[
series,
("ARDUINO", 10808),
"ARDUINO_ARCH_STM32",
"ARDUINO_%s" % board_id,
("BOARD_NAME", '\\"%s\\"' % board_id),
If you want the macro to be defined, just add build_flags = -DARDUINO_GENERIC_G070CBTX
to your platformio.ini
.