Skip to content

Commit 95125e2

Browse files
committed
Update Arduino core to v2.0.11
- Added several new boards (including Nano ESP32) // Resolves platformio#1162 - Added DFU upload method via dfu-util for the new Arduino Nano ESP32 - Updated IDF version to v4.4.5 for mixed Arduino/IDF projects
1 parent 1d25419 commit 95125e2

File tree

8 files changed

+287
-3
lines changed

8 files changed

+287
-3
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32s3_out.ld",
5+
"partitions": "partitions-8MB-tinyuf2.csv"
6+
},
7+
"core": "esp32",
8+
"extra_flags": [
9+
"-DARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3",
10+
"-DARDUINO_USB_CDC_ON_BOOT=1",
11+
"-DARDUINO_RUNNING_CORE=1",
12+
"-DARDUINO_EVENT_RUNNING_CORE=1",
13+
"-DBOARD_HAS_PSRAM"
14+
],
15+
"f_cpu": "240000000L",
16+
"f_flash": "80000000L",
17+
"flash_mode": "qio",
18+
"hwids": [
19+
[
20+
"0x239A",
21+
"0x8125"
22+
],
23+
[
24+
"0x239A",
25+
"0x0125"
26+
],
27+
[
28+
"0x239A",
29+
"0x8126"
30+
]
31+
],
32+
"mcu": "esp32s3",
33+
"variant": "adafruit_matrixportal_esp32s3"
34+
},
35+
"connectivity": [
36+
"wifi"
37+
],
38+
"debug": {
39+
"openocd_target": "esp32s3.cfg"
40+
},
41+
"frameworks": [
42+
"arduino",
43+
"espidf"
44+
],
45+
"name": "Adafruit MatrixPortal ESP32-S3",
46+
"upload": {
47+
"arduino": {
48+
"flash_extra_images": [
49+
[
50+
"0x410000",
51+
"variants/adafruit_matrixportal_esp32s3/tinyuf2.bin"
52+
]
53+
]
54+
},
55+
"flash_size": "8MB",
56+
"maximum_ram_size": 327680,
57+
"maximum_size": 8388608,
58+
"use_1200bps_touch": true,
59+
"wait_for_upload_port": true,
60+
"require_upload_port": true,
61+
"speed": 460800
62+
},
63+
"url": "https://www.adafruit.com/product/5778",
64+
"vendor": "Adafruit"
65+
}

boards/arduino_nano_esp32.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32s3_out.ld",
5+
"partitions": "app3M_fat9M_fact512k_16MB.csv",
6+
"memory_type": "qio_opi"
7+
},
8+
"core": "esp32",
9+
"extra_flags": [
10+
"-DARDUINO_NANO_ESP32",
11+
"-DBOARD_HAS_PIN_REMAP",
12+
"-DBOARD_HAS_PSRAM",
13+
"-DUSB_MANUFACTURER=\\\"Arduino\\\"",
14+
"-DUSB_PRODUCT=\\\"NanoESP32\\\"",
15+
"-DARDUINO_USB_CDC_ON_BOOT=1",
16+
"-DARDUINO_USB_DFU_ON_BOOT=1",
17+
"-DARDUINO_RUNNING_CORE=1",
18+
"-DARDUINO_EVENT_RUNNING_CORE=1"
19+
],
20+
"f_cpu": "240000000L",
21+
"f_flash": "80000000L",
22+
"flash_mode": "qio",
23+
"hwids": [
24+
[
25+
"0x2341",
26+
"0x0070"
27+
]
28+
],
29+
"mcu": "esp32s3",
30+
"variant": "arduino_nano_nora"
31+
},
32+
"connectivity": [
33+
"wifi"
34+
],
35+
"debug": {
36+
"openocd_target": "esp32s3.cfg"
37+
},
38+
"frameworks": [
39+
"arduino",
40+
"espidf"
41+
],
42+
"name": "Arduino Nano ESP32",
43+
"upload": {
44+
"flash_size": "16MB",
45+
"maximum_ram_size": 327680,
46+
"maximum_size": 16777216,
47+
"require_upload_port": true,
48+
"speed": 460800,
49+
"protocol": "dfu"
50+
},
51+
"url": "https://docs.arduino.cc/hardware/nano-esp32",
52+
"vendor": "Arduino"
53+
}

boards/dfrobot_romeo_esp32s3.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "esp32s3_out.ld",
5+
"partitions": "app3M_fat9M_16MB.csv",
6+
"memory_type": "qio_opi"
7+
},
8+
"core": "esp32",
9+
"extra_flags": [
10+
"-DARDUINO_DFROBOT_ROMEO_ESP32S3",
11+
"-DARDUINO_USB_MODE=1",
12+
"-DARDUINO_RUNNING_CORE=1",
13+
"-DARDUINO_EVENT_RUNNING_CORE=1"
14+
],
15+
"f_cpu": "240000000L",
16+
"f_flash": "80000000L",
17+
"flash_mode": "qio",
18+
"hwids": [
19+
[
20+
"0x303A",
21+
"0x1001"
22+
]
23+
],
24+
"mcu": "esp32s3",
25+
"variant": "dfrobot_romeo_esp32s3"
26+
},
27+
"connectivity": [
28+
"wifi"
29+
],
30+
"debug": {
31+
"openocd_target": "esp32s3.cfg"
32+
},
33+
"frameworks": [
34+
"arduino",
35+
"espidf"
36+
],
37+
"name": "DFRobot Romeo ESP32-S3",
38+
"upload": {
39+
"flash_size": "16MB",
40+
"maximum_ram_size": 327680,
41+
"maximum_size": 16777216,
42+
"require_upload_port": true,
43+
"speed": 460800
44+
},
45+
"url": "https://wiki.dfrobot.com/",
46+
"vendor": "DFRobot"
47+
}

boards/m5stamp-pico.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32_out.ld"
5+
},
6+
"core": "esp32",
7+
"extra_flags": "-DARDUINO_M5Stamp_Pico",
8+
"f_cpu": "240000000L",
9+
"f_flash": "40000000L",
10+
"flash_mode": "dio",
11+
"mcu": "esp32",
12+
"variant": "m5stack_stamp_pico"
13+
},
14+
"connectivity": [
15+
"wifi",
16+
"bluetooth",
17+
"ethernet",
18+
"can"
19+
],
20+
"frameworks": [
21+
"arduino",
22+
"espidf"
23+
],
24+
"name": "M5Stamp-Pico",
25+
"upload": {
26+
"flash_size": "4MB",
27+
"maximum_ram_size": 327680,
28+
"maximum_size": 4194304,
29+
"require_upload_port": true,
30+
"speed": 1500000
31+
},
32+
"url": "https://shop.m5stack.com/products/m5stamp-pico-mate-with-pin-headers",
33+
"vendor": "M5Stack"
34+
}

boards/nebulas3.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "esp32s3_out.ld",
5+
"memory_type": "qio_opi"
6+
},
7+
"core": "esp32",
8+
"extra_flags": [
9+
"-DARDUINO_NEBULAS3",
10+
"-DARDUINO_USB_MODE=1",
11+
"-DARDUINO_RUNNING_CORE=1",
12+
"-DARDUINO_EVENT_RUNNING_CORE=1",
13+
"-DARDUINO_USB_CDC_ON_BOOT=1"
14+
],
15+
"f_cpu": "240000000L",
16+
"f_flash": "80000000L",
17+
"flash_mode": "qio",
18+
"hwids": [
19+
[
20+
"0x303A",
21+
"0x1001"
22+
]
23+
],
24+
"mcu": "esp32s3",
25+
"variant": "Nebula_S3"
26+
},
27+
"connectivity": [
28+
"wifi"
29+
],
30+
"debug": {
31+
"openocd_target": "esp32s3.cfg"
32+
},
33+
"frameworks": [
34+
"arduino",
35+
"espidf"
36+
],
37+
"name": "Kinetic Dynamics Nebula S3",
38+
"upload": {
39+
"flash_size": "4MB",
40+
"maximum_ram_size": 327680,
41+
"maximum_size": 4194304,
42+
"require_upload_port": true,
43+
"speed": 460800
44+
},
45+
"url": "https://kineticdynamics.in/product/nebula-s3/",
46+
"vendor": "Kinetic Dynamics"
47+
}

builder/main.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,28 @@ def __fetch_fs_size(target, source, env):
460460
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")
461461
]
462462

463+
elif upload_protocol == "dfu":
464+
# C:\Users\ROOT\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.11.0-arduino5/dfu-util --device 0x2341:0x0070 -D C:\Users\ROOT\AppData\Local\Temp\arduino_build_789426/sketch_jul31a.ino.bin -Q
465+
466+
hwids = board.get("build.hwids", [["0x2341", "0x0070"]])
467+
vid = hwids[0][0]
468+
pid = hwids[0][1]
469+
470+
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]
471+
472+
env.Replace(
473+
UPLOADER=join(
474+
platform.get_package_dir("tool-dfuutil-arduino") or "", "dfu-util"
475+
),
476+
UPLOADERFLAGS=[
477+
"-d",
478+
",".join(["%s:%s" % (hwid[0], hwid[1]) for hwid in hwids]),
479+
"-Q",
480+
"-D"
481+
],
482+
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS "$SOURCE"',
483+
)
484+
463485

464486
elif upload_protocol in debug_tools:
465487
openocd_args = ["-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1)]

platform.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"type": "framework",
6868
"optional": true,
6969
"owner": "platformio",
70-
"version": "~3.20009.0"
70+
"version": "~3.20011.0"
7171
},
7272
"framework-arduino-mbcwb": {
7373
"type": "framework",
@@ -80,7 +80,7 @@
8080
"optional": true,
8181
"owner": "platformio",
8282
"version": "~3.50002.0",
83-
"optionalVersions": ["~3.40404.0"]
83+
"optionalVersions": ["~3.40405.0"]
8484
},
8585
"tool-esptoolpy": {
8686
"type": "uploader",
@@ -92,6 +92,12 @@
9292
"owner": "meteca",
9393
"version": ">=2.0.0"
9494
},
95+
"tool-dfuutil-arduino": {
96+
"type": "uploader",
97+
"optional": true,
98+
"owner": "platformio",
99+
"version": "~1.11.0"
100+
},
95101
"tool-openocd-esp32": {
96102
"type": "debugger",
97103
"optional": true,

platform.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def configure_default_packages(self, variables, targets):
4646
if os.path.isdir("ulp"):
4747
self.packages["toolchain-esp32ulp"]["optional"] = False
4848

49+
# Currently only Arduino Nano ESP32 uses the dfuutil tool as uploader
50+
if variables.get("board") == "arduino_nano_esp32":
51+
self.packages["tool-dfuutil-arduino"]["optional"] = False
52+
else:
53+
del self.packages["tool-dfuutil-arduino"]
54+
4955
build_core = variables.get(
5056
"board_build.core", board_config.get("build.core", "arduino")
5157
).lower()
@@ -96,7 +102,7 @@ def configure_default_packages(self, variables, targets):
96102

97103
if "arduino" in frameworks:
98104
# Downgrade the IDF version for mixed Arduino+IDF projects
99-
self.packages["framework-espidf"]["version"] = "~3.40404.0"
105+
self.packages["framework-espidf"]["version"] = "~3.40405.0"
100106
else:
101107
# Use the latest toolchains available for IDF v5.0
102108
for target in (
@@ -247,6 +253,10 @@ def _add_dynamic_options(self, board):
247253
"default": link == debug.get("default_tool"),
248254
}
249255

256+
# Avoid erasing Arduino Nano bootloader by preloading app binary
257+
if board.id == "arduino_nano_esp32":
258+
debug["tools"][link]["load_cmds"] = "preload"
259+
250260
board.manifest["debug"] = debug
251261
return board
252262

0 commit comments

Comments
 (0)