From d92c4783ed0ea4a26f3406fc74461e937187b01f Mon Sep 17 00:00:00 2001 From: Peter B Date: Mon, 4 Jul 2022 11:03:46 +0200 Subject: [PATCH 01/14] Update flash memory size for adafruit_feather_esp32s3 --- boards/adafruit_feather_esp32s3.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/adafruit_feather_esp32s3.json b/boards/adafruit_feather_esp32s3.json index d6e5e97..85d530a 100644 --- a/boards/adafruit_feather_esp32s3.json +++ b/boards/adafruit_feather_esp32s3.json @@ -50,9 +50,9 @@ ] ] }, - "flash_size": "4MB", + "flash_size": "8MB", "maximum_ram_size": 327680, - "maximum_size": 4194304, + "maximum_size": 8388608, "use_1200bps_touch": true, "wait_for_upload_port": true, "require_upload_port": true, From 019ee098c35b5f442a73ca65f6c19f8227266ae3 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Thu, 14 Jul 2022 21:16:39 +0300 Subject: [PATCH 02/14] Propagate Arduino build flags to global scope for mixed IDF/Arduino projects Resolve #848 --- builder/frameworks/espidf.py | 73 +++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 21cad67..19e2998 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -1246,7 +1246,6 @@ project_defines = get_app_defines(project_config) project_flags = get_app_flags(project_config, default_config) link_args = extract_link_args(elf_config) app_includes = get_app_includes(elf_config) -project_lib_includes = get_project_lib_includes(env) # # Compile bootloader @@ -1301,32 +1300,6 @@ def _skip_prj_source_files(node): env.AddBuildMiddleware(_skip_prj_source_files) -# Project files should be compiled only when a special -# option is enabled when running 'test' command -if "__test" not in COMMAND_LINE_TARGETS or env.GetProjectOption( - "test_build_project_src" -): - project_env = env.Clone() - if project_target_name != "__idf_main": - # Manually add dependencies to CPPPATH since ESP-IDF build system doesn't generate - # this info if the folder with sources is not named 'main' - # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main - project_env.AppendUnique(CPPPATH=app_includes["plain_includes"]) - - # Add include dirs from PlatformIO build system to project CPPPATH so - # they're visible to PIOBUILDFILES - project_env.Append( - CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR"] + project_lib_includes - ) - - env.Append( - PIOBUILDFILES=compile_source_files( - target_configs.get(project_target_name), - project_env, - project_env.subst("$PROJECT_DIR"), - ) - ) - # # Generate partition table # @@ -1387,6 +1360,52 @@ env.Prepend( ], ) +# +# Propagate Arduino defines to the main build environment +# + +if "arduino" in env.subst("$PIOFRAMEWORK"): + arduino_config_name = list( + filter( + lambda config_name: config_name.startswith( + "__idf_framework-arduinoespressif32" + ), + target_configs, + ) + )[0] + env.AppendUnique( + CPPDEFINES=extract_defines( + target_configs.get(arduino_config_name, {}).get("compileGroups", [])[0] + ) + ) + +# Project files should be compiled only when a special +# option is enabled when running 'test' command +if "__test" not in COMMAND_LINE_TARGETS or env.GetProjectOption( + "test_build_project_src" +): + project_env = env.Clone() + if project_target_name != "__idf_main": + # Manually add dependencies to CPPPATH since ESP-IDF build system doesn't generate + # this info if the folder with sources is not named 'main' + # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main + project_env.AppendUnique(CPPPATH=app_includes["plain_includes"]) + + # Add include dirs from PlatformIO build system to project CPPPATH so + # they're visible to PIOBUILDFILES + project_env.AppendUnique( + CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR"] + + get_project_lib_includes(env) + ) + + env.Append( + PIOBUILDFILES=compile_source_files( + target_configs.get(project_target_name), + project_env, + project_env.subst("$PROJECT_DIR"), + ) + ) + # # Generate mbedtls bundle # From bba9d55babfcf1298fd20e7ebe04e03593243e20 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Tue, 19 Jul 2022 15:20:05 +0300 Subject: [PATCH 03/14] Update Arduino core to v2.0.4 --- boards/adafruit_feather_esp32s2_tft.json | 11 +--- boards/adafruit_feather_esp32s3.json | 29 ++++----- boards/adafruit_feather_esp32s3_nopsram.json | 63 +++++++++++++++++++ boards/adafruit_funhouse_esp32s2.json | 11 +--- boards/adafruit_magtag29_esp32s2.json | 11 +--- boards/adafruit_metro_esp32s2.json | 11 +--- boards/adafruit_qtpy_esp32s2.json | 11 +--- ...son => adafruit_qtpy_esp32s3_nopsram.json} | 2 +- boards/atmegazero_esp32s2.json | 11 +--- boards/cnrs_aw2eth.json | 36 +++++++++++ boards/featheresp32-s2.json | 3 +- boards/wemos_d1_mini32.json | 2 +- platform.json | 2 +- platform.py | 4 +- 14 files changed, 130 insertions(+), 77 deletions(-) create mode 100644 boards/adafruit_feather_esp32s3_nopsram.json rename boards/{adafruit_qtpy_esp32s3.json => adafruit_qtpy_esp32s3_nopsram.json} (98%) create mode 100644 boards/cnrs_aw2eth.json diff --git a/boards/adafruit_feather_esp32s2_tft.json b/boards/adafruit_feather_esp32s2_tft.json index 6f141b0..aee4431 100644 --- a/boards/adafruit_feather_esp32s2_tft.json +++ b/boards/adafruit_feather_esp32s2_tft.json @@ -1,7 +1,8 @@ { "build": { "arduino": { - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-4MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ @@ -41,14 +42,6 @@ ], "name": "Adafruit Feather ESP32-S2 TFT", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x2d0000", - "variants/adafruit_feather_esp32s2_tft/tinyuf2.bin" - ] - ] - }, "flash_size": "4MB", "maximum_ram_size": 327680, "maximum_size": 4194304, diff --git a/boards/adafruit_feather_esp32s3.json b/boards/adafruit_feather_esp32s3.json index 85d530a..9c14bd3 100644 --- a/boards/adafruit_feather_esp32s3.json +++ b/boards/adafruit_feather_esp32s3.json @@ -1,11 +1,12 @@ { "build": { "arduino":{ - "ldscript": "esp32s3_out.ld" + "ldscript": "esp32s3_out.ld", + "partitions": "partitions.csv" }, "core": "esp32", "extra_flags": [ - "-DARDUINO_ADAFRUIT_FEATHER_ESP32S3_NOPSRAM", + "-DARDUINO_ADAFRUIT_FEATHER_ESP32S3", "-DARDUINO_USB_CDC_ON_BOOT=1", "-DARDUINO_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=1" @@ -16,19 +17,19 @@ "hwids": [ [ "0x239A", - "0x8113" + "0x811B" ], [ "0x239A", - "0x0113" + "0x011B" ], [ "0x239A", - "0x8114" + "0x811C" ] ], "mcu": "esp32s3", - "variant": "adafruit_feather_esp32s3_nopsram" + "variant": "adafruit_feather_esp32s3" }, "connectivity": [ "wifi" @@ -40,24 +41,16 @@ "arduino", "espidf" ], - "name": "Adafruit Feather ESP32-S3 No PSRAM", + "name": "Adafruit Feather ESP32-S3 2MB PSRAM", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x410000", - "variants/adafruit_feather_esp32s3_nopsram/tinyuf2.bin" - ] - ] - }, - "flash_size": "8MB", + "flash_size": "4MB", "maximum_ram_size": 327680, - "maximum_size": 8388608, + "maximum_size": 4194304, "use_1200bps_touch": true, "wait_for_upload_port": true, "require_upload_port": true, "speed": 460800 }, - "url": "https://www.adafruit.com/product/5323", + "url": "https://www.adafruit.com/product/5477", "vendor": "Adafruit" } diff --git a/boards/adafruit_feather_esp32s3_nopsram.json b/boards/adafruit_feather_esp32s3_nopsram.json new file mode 100644 index 0000000..29541e5 --- /dev/null +++ b/boards/adafruit_feather_esp32s3_nopsram.json @@ -0,0 +1,63 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32s3_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ADAFRUIT_FEATHER_ESP32S3_NOPSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x239A", + "0x811B" + ], + [ + "0x239A", + "0x011B" + ], + [ + "0x239A", + "0x811C" + ] + ], + "mcu": "esp32s3", + "variant": "adafruit_feather_esp32s3_nopsram" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Adafruit Feather ESP32-S3 No PSRAM", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x2d0000", + "variants/adafruit_feather_esp32s3_nopsram/tinyuf2.bin" + ] + ] + }, + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.adafruit.com/product/5323", + "vendor": "Adafruit" +} diff --git a/boards/adafruit_funhouse_esp32s2.json b/boards/adafruit_funhouse_esp32s2.json index 9747612..eb5ee1d 100644 --- a/boards/adafruit_funhouse_esp32s2.json +++ b/boards/adafruit_funhouse_esp32s2.json @@ -1,7 +1,8 @@ { "build": { "arduino":{ - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-4MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ @@ -41,14 +42,6 @@ ], "name": "Adafruit FunHouse", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x2d0000", - "variants/adafruit_funhouse_esp32s2/tinyuf2.bin" - ] - ] - }, "flash_size": "4MB", "maximum_ram_size": 327680, "maximum_size": 4194304, diff --git a/boards/adafruit_magtag29_esp32s2.json b/boards/adafruit_magtag29_esp32s2.json index 5e2dd71..fc51f61 100644 --- a/boards/adafruit_magtag29_esp32s2.json +++ b/boards/adafruit_magtag29_esp32s2.json @@ -1,7 +1,8 @@ { "build": { "arduino":{ - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-4MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ @@ -41,14 +42,6 @@ ], "name": "Adafruit MagTag 2.9", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x2d0000", - "variants/adafruit_magtag29_esp32s2/tinyuf2.bin" - ] - ] - }, "flash_size": "4MB", "maximum_ram_size": 327680, "maximum_size": 4194304, diff --git a/boards/adafruit_metro_esp32s2.json b/boards/adafruit_metro_esp32s2.json index af8df22..7f75dfb 100644 --- a/boards/adafruit_metro_esp32s2.json +++ b/boards/adafruit_metro_esp32s2.json @@ -1,7 +1,8 @@ { "build": { "arduino":{ - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-4MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ @@ -41,14 +42,6 @@ ], "name": "Adafruit Metro ESP32-S2", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x2d0000", - "variants/adafruit_metro_esp32s2/tinyuf2.bin" - ] - ] - }, "flash_size": "4MB", "maximum_ram_size": 327680, "maximum_size": 4194304, diff --git a/boards/adafruit_qtpy_esp32s2.json b/boards/adafruit_qtpy_esp32s2.json index 30f51dc..51beac6 100644 --- a/boards/adafruit_qtpy_esp32s2.json +++ b/boards/adafruit_qtpy_esp32s2.json @@ -1,7 +1,8 @@ { "build": { "arduino": { - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-4MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ @@ -41,14 +42,6 @@ ], "name": "Adafruit QT Py ESP32-S2", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x2d0000", - "variants/adafruit_qtpy_esp32s2/tinyuf2.bin" - ] - ] - }, "flash_size": "4MB", "maximum_ram_size": 327680, "maximum_size": 4194304, diff --git a/boards/adafruit_qtpy_esp32s3.json b/boards/adafruit_qtpy_esp32s3_nopsram.json similarity index 98% rename from boards/adafruit_qtpy_esp32s3.json rename to boards/adafruit_qtpy_esp32s3_nopsram.json index 067d8a6..4412a31 100644 --- a/boards/adafruit_qtpy_esp32s3.json +++ b/boards/adafruit_qtpy_esp32s3_nopsram.json @@ -1,6 +1,6 @@ { "build": { - "arduino":{ + "arduino": { "ldscript": "esp32s3_out.ld" }, "core": "esp32", diff --git a/boards/atmegazero_esp32s2.json b/boards/atmegazero_esp32s2.json index bfc4069..a23a6ce 100644 --- a/boards/atmegazero_esp32s2.json +++ b/boards/atmegazero_esp32s2.json @@ -1,7 +1,8 @@ { "build": { "arduino":{ - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-16MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ @@ -32,14 +33,6 @@ ], "name": "EspinalLab ATMegaZero ESP32-S2", "upload": { - "arduino": { - "flash_extra_images": [ - [ - "0x2d0000", - "variants/atmegazero_esp32s2/tinyuf2.bin" - ] - ] - }, "flash_size": "16MB", "maximum_ram_size": 327680, "maximum_size": 16777216, diff --git a/boards/cnrs_aw2eth.json b/boards/cnrs_aw2eth.json new file mode 100644 index 0000000..3669347 --- /dev/null +++ b/boards/cnrs_aw2eth.json @@ -0,0 +1,36 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ESP32_PICO" + ], + "f_cpu": "240000000L", + "f_flash": "40000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "cnrs_aw2eth" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "frameworks": [ + "arduino", + "espidf" + ], + "name": "CNRS AW2ETH", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://en.wikipedia.org/wiki/ESP32", + "vendor": "CNRS" +} diff --git a/boards/featheresp32-s2.json b/boards/featheresp32-s2.json index bf6f0cb..f645bf6 100644 --- a/boards/featheresp32-s2.json +++ b/boards/featheresp32-s2.json @@ -1,7 +1,8 @@ { "build": { "arduino":{ - "ldscript": "esp32s2_out.ld" + "ldscript": "esp32s2_out.ld", + "partitions": "partitions-4MB-tinyuf2.csv" }, "core": "esp32", "extra_flags": [ diff --git a/boards/wemos_d1_mini32.json b/boards/wemos_d1_mini32.json index 4770623..90b1d6b 100644 --- a/boards/wemos_d1_mini32.json +++ b/boards/wemos_d1_mini32.json @@ -24,7 +24,7 @@ "arduino", "espidf" ], - "name": "WeMos D1 MINI ESP32", + "name": "WEMOS D1 MINI ESP32", "upload": { "flash_size": "4MB", "maximum_ram_size": 327680, diff --git a/platform.json b/platform.json index cdff993..311c107 100644 --- a/platform.json +++ b/platform.json @@ -72,7 +72,7 @@ "type": "framework", "optional": true, "owner": "platformio", - "version": "~3.20003.0" + "version": "~3.20004.0" }, "framework-arduino-mbcwb": { "type": "framework", diff --git a/platform.py b/platform.py index 07b0a4c..1963baa 100644 --- a/platform.py +++ b/platform.py @@ -88,7 +88,9 @@ class Espressif32Platform(PlatformBase): sys.exit(1) if "espidf" in frameworks: - # Common package for IDF and mixed Arduino+IDF projects + if "arduino" in frameworks: + self.packages["framework-arduinoespressif32"]["version"] = "~3.20003.0" + # Common packages for IDF and mixed Arduino+IDF projects for p in self.packages: if p in ("tool-cmake", "tool-ninja", "toolchain-%sulp" % mcu): self.packages[p]["optional"] = False From b06a0fa225e37a8082cd058bd3deef5a64c74e04 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lalonde Date: Tue, 19 Jul 2022 08:56:06 -0400 Subject: [PATCH 04/14] Add suport for Connaxio's Espoir (#827) --- boards/connaxio_espoir.json | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 boards/connaxio_espoir.json diff --git a/boards/connaxio_espoir.json b/boards/connaxio_espoir.json new file mode 100644 index 0000000..e9e7265 --- /dev/null +++ b/boards/connaxio_espoir.json @@ -0,0 +1,47 @@ + +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_CONNAXIO_ESPOIR", + "-DCONFIG_FREERTOS_UNICORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "connaxio_espoir", + "hwids": [ + [ + "0x10C4", + "0x8D9A" + ] + ] + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "debug": { + "openocd_board": "esp32-solo-1.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Connaxio's Espoir", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://www.connaxio.com/electronics/espoir/", + "vendor": "Connaxio" +} From 768afe6283498cf9202f59c53da01136c7247119 Mon Sep 17 00:00:00 2001 From: Daniel Egnor Date: Tue, 19 Jul 2022 05:58:45 -0700 Subject: [PATCH 05/14] add Adafruit Feather ESP32-S3 TFT board (#851) --- boards/adafruit_feather_esp32s3_tft.json | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 boards/adafruit_feather_esp32s3_tft.json diff --git a/boards/adafruit_feather_esp32s3_tft.json b/boards/adafruit_feather_esp32s3_tft.json new file mode 100644 index 0000000..4e38ae0 --- /dev/null +++ b/boards/adafruit_feather_esp32s3_tft.json @@ -0,0 +1,64 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "partitions.csv" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ADAFRUIT_FEATHER_ESP32S3_TFT", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x239A", + "0x811D" + ], + [ + "0x239A", + "0x011D" + ], + [ + "0x239A", + "0x811E" + ] + ], + "mcu": "esp32s3", + "variant": "adafruit_feather_esp32s3_tft" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Adafruit Feather ESP32-S3 TFT", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x2d0000", + "variants/adafruit_feather_esp32s3_tft/tinyuf2.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.adafruit.com/product/5483", + "vendor": "Adafruit" +} From 8e6633b43a06655dcd1d7bd08e80b312f8fb4747 Mon Sep 17 00:00:00 2001 From: sublettj <71276779+sublettj@users.noreply.github.com> Date: Tue, 19 Jul 2022 09:00:22 -0400 Subject: [PATCH 06/14] Fix typo in name field for M5Stack (#853) --- boards/m5stack-coreink.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/m5stack-coreink.json b/boards/m5stack-coreink.json index f5aee0d..e7b3cbb 100644 --- a/boards/m5stack-coreink.json +++ b/boards/m5stack-coreink.json @@ -21,7 +21,7 @@ "arduino", "espidf" ], - "name": "M5Stick-Core Ink", + "name": "M5Stack-Core Ink", "upload": { "flash_size": "4MB", "maximum_ram_size": 327680, From cb3583813d0dad75edc0853cfec865c89b221263 Mon Sep 17 00:00:00 2001 From: Jiang Sheng Date: Tue, 19 Jul 2022 21:09:19 +0800 Subject: [PATCH 07/14] Update for DFRobot ESP32 boards (#829) * fix: correcting hardware config for firebeetle-32 * add: DFRobot Beetle 32C --- boards/dfrobot_beetle_esp32c3.json | 47 ++++++++++++++++++++++++++++++ boards/firebeetle32.json | 12 ++++---- 2 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 boards/dfrobot_beetle_esp32c3.json diff --git a/boards/dfrobot_beetle_esp32c3.json b/boards/dfrobot_beetle_esp32c3.json new file mode 100644 index 0000000..a5b884f --- /dev/null +++ b/boards/dfrobot_beetle_esp32c3.json @@ -0,0 +1,47 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32c3_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ESP32C3_DEV", + "-DARDUINO_USB_MODE=1" + ], + "f_cpu": "160000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x3343", + "0x8364" + ], + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32c3", + "variant": "dfrobot_beetle_esp32c3" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32c3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "DFRobot Beetle ESP32-C3", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.dfrobot.com/product-2566.html", + "vendor": "DFRobot" +} diff --git a/boards/firebeetle32.json b/boards/firebeetle32.json index d580c39..3463fa1 100644 --- a/boards/firebeetle32.json +++ b/boards/firebeetle32.json @@ -13,9 +13,7 @@ }, "connectivity": [ "wifi", - "bluetooth", - "ethernet", - "can" + "bluetooth" ], "debug": { "openocd_board": "esp-wroom-32.cfg" @@ -26,12 +24,12 @@ ], "name": "FireBeetle-ESP32", "upload": { - "flash_size": "4MB", - "maximum_ram_size": 327680, - "maximum_size": 4194304, + "flash_size": "16MB", + "maximum_ram_size": 532480, + "maximum_size": 16777216, "require_upload_port": true, "speed": 460800 }, - "url": "https://dfrobotblog.wordpress.com", + "url": "https://wiki.dfrobot.com/FireBeetle_ESP32_IOT_Microcontroller(V3.0)__Supports_Wi-Fi_&_Bluetooth__SKU__DFR0478", "vendor": "DFRobot" } From 4d0b78a9cb69a8bf0f38c2252e2841ac249f2290 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Tue, 19 Jul 2022 16:12:34 +0300 Subject: [PATCH 08/14] Add new boards - Wemos D1 R32 - Seeed Studio XIAO ESP32C3 - DFRobot Firebeetle 2 ESP32-S3 --- boards/dfrobot_firebeetle2_esp32s3.json | 49 +++++++++++++++++++++++++ boards/seeed_xiao_esp32c3.json | 44 ++++++++++++++++++++++ boards/wemos_d1_uno32.json | 37 +++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 boards/dfrobot_firebeetle2_esp32s3.json create mode 100644 boards/seeed_xiao_esp32c3.json create mode 100644 boards/wemos_d1_uno32.json diff --git a/boards/dfrobot_firebeetle2_esp32s3.json b/boards/dfrobot_firebeetle2_esp32s3.json new file mode 100644 index 0000000..0f87150 --- /dev/null +++ b/boards/dfrobot_firebeetle2_esp32s3.json @@ -0,0 +1,49 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ESP32S3_DEV", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x303A", + "0x83CF" + ], + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "dfrobot_firebeetle2_esp32s3" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "DFRobot Firebeetle 2 ESP32-S3", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.dfrobot.com/product-1590.html", + "vendor": "DFRobot" +} diff --git a/boards/seeed_xiao_esp32c3.json b/boards/seeed_xiao_esp32c3.json new file mode 100644 index 0000000..4d8ded0 --- /dev/null +++ b/boards/seeed_xiao_esp32c3.json @@ -0,0 +1,44 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32c3_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_XIAO_ESP32C3", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_USB_CDC_ON_BOOT=1" + ], + "f_cpu": "160000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x2886", + "0x0047" + ] + ], + "mcu": "esp32c3", + "variant": "XIAO_ESP32C3" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32c3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Seeed Studio XIAO ESP32C3", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://wiki.seeedstudio.com/XIAO_ESP32C3_Getting_Started/", + "vendor": "Seeed Studio" +} diff --git a/boards/wemos_d1_uno32.json b/boards/wemos_d1_uno32.json new file mode 100644 index 0000000..2a38aa4 --- /dev/null +++ b/boards/wemos_d1_uno32.json @@ -0,0 +1,37 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32_out.ld" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_D1_UNO32", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "d1_uno32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "WEMOS D1 R32", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.wemos.cc", + "vendor": "WEMOS" +} From 60537fbd6b387de5069a087085009dce1d92a5a5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 19 Jul 2022 17:25:03 +0300 Subject: [PATCH 09/14] Create stale.yml --- .github/stale.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..6a58391 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,20 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - bug + - known issue + - feature + - enhancement + - board request +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. Please provide more details or it will be closed if no + further activity occurs. Thank you for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From e66e12cc579d3e5589b908ffb8a48c7cfe72719a Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Mon, 25 Jul 2022 21:54:16 +0300 Subject: [PATCH 10/14] Add default nameOnDisk value for external CMake projects Issue #863 --- builder/frameworks/espidf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 19e2998..59f6809 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -815,6 +815,8 @@ def get_targets_by_type(target_configs, target_types, ignore_targets=None): def get_components_map(target_configs, target_types, ignore_components=None): result = {} for config in get_targets_by_type(target_configs, target_types, ignore_components): + if "nameOnDisk" not in config: + config["nameOnDisk"] = "lib%s.a" % config["name"] result[config["id"]] = {"config": config} return result From f2a5977c918e837aeafd09151f4e3ea1a7ead90c Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Fri, 29 Jul 2022 17:53:19 +0300 Subject: [PATCH 11/14] Properly propagate additional data to configure debug session - Add extra data to "projenv" as well so that the extra data it can be overridden after the BuildProgram routine - Use the new INTEGRATION_EXTRA_DATA env variable instead of IDE_EXTRA_DATA --- builder/frameworks/arduino.py | 2 +- builder/frameworks/espidf.py | 2 +- builder/main.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index c6fc754..eea32aa 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -41,4 +41,4 @@ elif "espidf" not in env.subst("$PIOFRAMEWORK"): SConscript( join(DefaultEnvironment().PioPlatform().get_package_dir( "framework-arduinoespressif32"), "tools", "platformio-build.py")) - env["IDE_EXTRA_DATA"].update({"application_offset": env.subst("$ESP32_APP_OFFSET")}) + env["INTEGRATION_EXTRA_DATA"].update({"application_offset": env.subst("$ESP32_APP_OFFSET")}) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 59f6809..a80a616 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -1470,4 +1470,4 @@ env.Replace( ) # Propagate application offset to debug configurations -env["IDE_EXTRA_DATA"].update({"application_offset": env.subst("$ESP32_APP_OFFSET")}) +env["INTEGRATION_EXTRA_DATA"].update({"application_offset": env.subst("$ESP32_APP_OFFSET")}) diff --git a/builder/main.py b/builder/main.py index 19d88b3..5940c31 100644 --- a/builder/main.py +++ b/builder/main.py @@ -169,6 +169,9 @@ filesystem = board.get("build.filesystem", "spiffs") if mcu == "esp32c3": toolchain_arch = "riscv32-esp" +if "INTEGRATION_EXTRA_DATA" not in env: + env["INTEGRATION_EXTRA_DATA"] = {} + env.Replace( __get_board_boot_mode=_get_board_boot_mode, __get_board_f_flash=_get_board_f_flash, @@ -501,6 +504,13 @@ if any("-Wl,-T" in f for f in env.get("LINKFLAGS", [])): print("Warning! '-Wl,-T' option for specifying linker scripts is deprecated. " "Please use 'board_build.ldscript' option in your 'platformio.ini' file.") +# +# A temporary workaround to propagate additional data to the debug configuration routine +# + +Import("projenv") +projenv["INTEGRATION_EXTRA_DATA"] = env.get("INTEGRATION_EXTRA_DATA") + # # Default targets # From 006d64e8b268e479703a0aac7eed8bef1ebea587 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Sat, 30 Jul 2022 21:09:01 +0300 Subject: [PATCH 12/14] Merge firmware before flashing via OpenOCD Arduino core v2.0.4 contains updated bootloader images that have innacurate default headers. This results in bootloops if firmware is flashed via OpenOCD (e.g. debugging or uploading via debug tools). For this reason, before uploading or debugging we need to merge all binaries (firmware, bootloader, partitions, etc.) via esptoolpy so that the image headers will be adjusted according to --flash-size and --flash-mode arguments. Note that this behavior doesn't occur if uploading is done via esptoolpy, as esptoolpy overrides the binary image headers before flashing. --- builder/main.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++-- platform.py | 21 +++++++++++++------- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/builder/main.py b/builder/main.py index 5940c31..fe25e80 100644 --- a/builder/main.py +++ b/builder/main.py @@ -160,6 +160,18 @@ def __fetch_fs_size(target, source, env): return (target, source) +def merge_binaries(source, target, env, for_signature): + return " ".join([ + '"$PYTHONEXE"', + join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"), + "--chip", mcu, "merge_bin", + "-o", "$TARGET", + "--flash_mode", "$BOARD_FLASH_MODE", + "--flash_size", board.get("upload.flash_size", "detect"), + "$ESP32_APP_OFFSET", "$SOURCES" + ] + ['"%s"' % itm for img in env.get("FLASH_EXTRA_IMAGES", []) for itm in img]) + + env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() @@ -169,6 +181,21 @@ filesystem = board.get("build.filesystem", "spiffs") if mcu == "esp32c3": toolchain_arch = "riscv32-esp" +# Arduino core v2.0.4 contains updated bootloader images that have innacurate default +# headers. This results in bootloops if firmware is flashed via OpenOCD (e.g. debugging +# or uploading via debug tools). For this reason, before uploading or debugging we need +# to merge binaries via esptoolpy so that the image headers will be adjusted according to +# --flash-size and --flash-mode arguments. +# Note: This behavior doesn't occur if uploading is done via esptoolpy, as esptoolpy +# overrides the binary image headers before flashing. +firmware_merge_required = bool( + env.get("PIOFRAMEWORK", []) == ["arduino"] + and ( + "debug" in env.GetBuildType() + or env.subst("$UPLOAD_PROTOCOL") in board.get("debug.tools", {}) + ) +) + if "INTEGRATION_EXTRA_DATA" not in env: env["INTEGRATION_EXTRA_DATA"] = {} @@ -264,6 +291,10 @@ env.Append( source_factory=env.Dir, suffix=".bin", ), + MergeBin=Builder( + generator=merge_binaries, + suffix=".bin", + ), ) ) @@ -275,6 +306,7 @@ if not env.get("PIOFRAMEWORK"): # target_elf = None +target_firm_merged = None if "nobuild" in COMMAND_LINE_TARGETS: target_elf = join("$BUILD_DIR", "${PROGNAME}.elf") if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): @@ -293,6 +325,14 @@ else: else: target_firm = env.ElfToBin( join("$BUILD_DIR", "${PROGNAME}"), target_elf) + if firmware_merge_required: + # Note: Default offset address must be set to 0x0 because debugging + # relies on OpenOCD that requires merged firmware + env["INTEGRATION_EXTRA_DATA"].update( + {"application_offset": "0x0", "merged_firmware": True} + ) + target_firm_merged = env.MergeBin(join( + "$BUILD_DIR", "${PROGNAME}_merged"), target_firm) env.Depends(target_firm, "checkprogsize") env.AddPlatformTarget("buildfs", target_firm, target_firm, "Build Filesystem Image") @@ -430,6 +470,10 @@ elif upload_protocol == "mbctool": elif upload_protocol in debug_tools: + if firmware_merge_required: + # Only merged firmware with proper headers will work when uploading is done via + # debug probes. The firmware offset address must be adjusted to 0x0 accordingly. + target_firm = target_firm_merged openocd_args = ["-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1)] openocd_args.extend( debug_tools.get(upload_protocol).get("server").get("arguments", [])) @@ -442,11 +486,14 @@ elif upload_protocol in debug_tools: % ( "$FS_START" if "uploadfs" in COMMAND_LINE_TARGETS - else "$ESP32_APP_OFFSET" + else board.get( + "upload.offset_address", + "0x0" if firmware_merge_required else "$ESP32_APP_OFFSET" + ) ), ] ) - if "uploadfs" not in COMMAND_LINE_TARGETS: + if "uploadfs" not in COMMAND_LINE_TARGETS and not firmware_merge_required: for image in env.get("FLASH_EXTRA_IMAGES", []): openocd_args.extend( [ diff --git a/platform.py b/platform.py index 1963baa..9a6801a 100644 --- a/platform.py +++ b/platform.py @@ -261,16 +261,23 @@ class Espressif32Platform(PlatformBase): if any(ignore_conds): return - load_cmds = [ - 'monitor program_esp "{{{path}}}" {offset} verify'.format( - path=to_unix_path(item["path"]), offset=item["offset"] - ) - for item in flash_images - ] + merged_firmware = build_extra_data.get("merged_firmware", False) + load_cmds = [] + if not merged_firmware: + load_cmds.extend([ + 'monitor program_esp "{{{path}}}" {offset} verify'.format( + path=to_unix_path(item["path"]), offset=item["offset"] + ) + for item in flash_images + ]) + load_cmds.append( 'monitor program_esp "{%s.bin}" %s verify' % ( - to_unix_path(debug_config.build_data["prog_path"][:-4]), + to_unix_path( + debug_config.build_data["prog_path"][:-4] + + ("_merged" if merged_firmware else "") + ), build_extra_data.get("application_offset", "0x10000"), ) ) From 0ed9a8524bef912e9159f6cfc2433bbe2770f64f Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Sat, 30 Jul 2022 22:50:59 +0300 Subject: [PATCH 13/14] Update default flash size value in merging procedure --- builder/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index fe25e80..7926766 100644 --- a/builder/main.py +++ b/builder/main.py @@ -167,7 +167,7 @@ def merge_binaries(source, target, env, for_signature): "--chip", mcu, "merge_bin", "-o", "$TARGET", "--flash_mode", "$BOARD_FLASH_MODE", - "--flash_size", board.get("upload.flash_size", "detect"), + "--flash_size", board.get("upload.flash_size", "4MB"), "$ESP32_APP_OFFSET", "$SOURCES" ] + ['"%s"' % itm for img in env.get("FLASH_EXTRA_IMAGES", []) for itm in img]) From b562f36df857eee97feebc72e227b78ea369413b Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Sun, 31 Jul 2022 22:15:56 +0300 Subject: [PATCH 14/14] Bump version to 5.1.0 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index 311c107..3c55e32 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/platformio/platform-espressif32.git" }, - "version": "5.0.0", + "version": "5.1.0", "frameworks": { "arduino": { "package": "framework-arduinoespressif32",