-
Notifications
You must be signed in to change notification settings - Fork 52
Description
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
When defining options related to the USB Mode and CDC engine, the build flags appear to be ignored if I set them as build variables and are only heeded if they are set as explicit extra_flags
instead.
If we look at the Arduino core from upstream we can see how these flags should work:
However, this board definition does not work (instead, CDC defaults to 0):
{
"build": {
"arduino": {
"partitions": "partitions/no_spiffs_16mb.csv",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32S3_DEV",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1",
"-DBOARD_HAS_PSRAM"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"psram_type": "opi",
"usb_mode": "1",
"cdc_on_boot": "1",
"msc_on_boot": "0",
"dfu_on_boot": "0",
"hwids": [
["0x303A", "0x1001"]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"frameworks": ["arduino"],
"name": "ESP32-S3 N16R8",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"protocol": "esptool",
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf",
"vendor": "Espressif"
}
This board definition which instead removes the build variables and replaces them with explicit extra_flags
works:
{
"build": {
"arduino": {
"partitions": "partitions/no_spiffs_16mb.csv",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32S3_DEV",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_USB_MSC_ON_BOOT=0",
"-DARDUINO_USB_DFU_ON_BOOT=0",
"-DBOARD_HAS_PSRAM"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"psram_type": "opi",
"hwids": [
["0x303A", "0x1001"]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"frameworks": ["arduino"],
"name": "ESP32-S3 N16R8",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"protocol": "esptool",
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf",
"vendor": "Espressif"
}
TO REPRODUCE
Steps to reproduce the behavior:
1, Create a custom board definition json that attempts to set build variables such as usb_mode
, cdc_on_boot
, etc.
2. Build.
3. Upload to ESP32-S3.
4. Connect to terminal and inspect ROM messages, seeing that CDC engine is not set as configured.
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
USB-CDC build options should be set correctly at build time when defined as build variables.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
platform.ini file
non-working board def
working board def
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)