hi,
i’m in the process of creating a custom board for the WeActStudio ESP32 C3FH4
I’ve created a new board.json (placed in a boards
directory in the project folder
I’ve created a pins_arduino.h
inside a weactstudio_esp32c3fh4
directory in
boards/variants` directory
all seems to work and basic code compile
I’ve just a question regardin the extra_flags in boards.json
"extra_flags": [
"-DARDUINO_WEACTSTUDIO_ESP32C3FH4",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"]
what the purpose of the first DARDUINO_XXXXX
flag, in my understanding it’s some buildflag passed to the compiler
in all .json I’ve looked at, this flag match by its name with the board_build.variant value
Do I have to follow the same logic for my custom board, or do I miss something here ?
here my “custom” .json file for reference
WeActStudio_ESP32C3FH4_core.json
"build": {
"arduino": {
"ldscript": "esp32c3_out.ld"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_WEACTSTUDIO_ESP32C3FH4",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"
],
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0X303A",
"0x1001"
]
],
"mcu": "esp32c3",
"variant": "weactstudio_esp32c3fh4"
},
"connectivity": [
"wifi"
],
"debug": {
"openocd_target": "esp32c3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "WeActStudio ESP32-C3FH4 CoreBoard",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://github.com/WeActStudio/WeActStudio.ESP32C3CoreBoard",
"vendor": "WEACTSTUDIO"
}
and the platformio.ini
[env:WeActStudio_ESP32C3FH4_core]
platform = espressif32
board = WeActStudio_ESP32C3FH4_core
framework = arduino
; set where the folder with all the board variants is
board_build.variants_dir = ./boards/variants
; change which exact variant to use default is set in board.json file
;board_build.variant = my_custom_mega