Skip to content

Commit 5680895

Browse files
authored
Arduino core 3.0.4
2 parents 2ce731a + e9a6098 commit 5680895

File tree

10 files changed

+195
-81
lines changed

10 files changed

+195
-81
lines changed

README.md

+30-9
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,55 @@
22
# Fork of Platformio Espressif 32: development platform for [PlatformIO](https://platformio.org)
33

44
[![Build Status](https://github.com/pioarduino/platform-espressif32/workflows/Examples/badge.svg)](https://github.com/pioarduino/platform-espressif32/actions)
5+
[![Discord](https://img.shields.io/discord/1263397951829708871.svg?logo=discord&logoColor=white&color=5865F2&label=Discord)](https://discord.gg/Nutz9crnZr)
6+
[![GitHub Releases](https://img.shields.io/github/downloads/pioarduino/platform-espressif32/total?label=downloads)](https://github.com/pioarduino/platform-espressif32/releases/latest)
7+
8+
> [!NOTE]
9+
> This fork was created due to the lack of ongoing development for the Espressif 32 Arduino Core for PlatformIO.
10+
>
11+
> For additional information, please refer to these GitHub links:
12+
>
13+
> https://github.com/espressif/arduino-esp32/discussions/10039
14+
> https://github.com/platformio/platform-espressif32/issues/1225
15+
> https://github.com/espressif/arduino-esp32/pull/8606
16+
>
17+
> The discussions are self-explanatory, allowing you to draw your own conclusions.
518
619
ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and Bluetooth. ESP32 integrates an antenna switch, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules.
720

8-
* [Home](https://registry.platformio.org/platforms/platformio/espressif32) (home page in the PlatformIO Registry)
921
* [Documentation](https://docs.platformio.org/page/platforms/espressif32.html) (advanced usage, packages, boards, frameworks, etc.)
1022

11-
# Usage
23+
## IDE Preparation
24+
25+
- [Download and install official Microsoft Visual Studio Code](https://code.visualstudio.com/). PlatformIO IDE is built on top of it.
26+
- Open the extension manager.
27+
- Search for the official `platformio ide` extension.
28+
- Install PlatformIO IDE extension.
1229

13-
1. [Install PlatformIO](https://platformio.org)
14-
2. Create PlatformIO project and configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
30+
![image](idesetup.png)
31+
32+
# Usage
33+
1. Setup new VSCode PlatformIO project.
34+
1. Configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
1535

16-
## Stable version
17-
espressif Arduino 3.0.3 and IDF 5.1.4
36+
### Stable version
37+
espressif Arduino 3.0.4 and IDF 5.1.4
1838

1939
See `platform` [documentation](https://docs.platformio.org/en/latest/projectconf/sections/env/options/platform/platform.html#projectconf-env-platform) for details.
2040

2141
```ini
2242
[env:stable]
23-
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
43+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
2444
board = ...
2545
...
2646
```
2747

28-
## Development version
48+
### Development version
49+
espressif Arduino repo branch master and latest compiled Arduino libs
2950

3051
```ini
3152
[env:development]
32-
platform = https://github.com/pioarduino/platform-espressif32.git#development
53+
platform = https://github.com/pioarduino/platform-espressif32.git#develop
3354
board = ...
3455
...
3556
```

boards/adafruit_feather_esp32s3_reversetft.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"build": {
33
"arduino": {
4-
"ldscript": "esp32s3_out.ld",
5-
"partitions": "partitions-4MB-tinyuf2.csv",
4+
"partitions": "tinyuf2-partitions-4MB.csv",
65
"memory_type": "qio_qspi"
76
},
87
"core": "esp32",

boards/airm2m_core_esp32c3.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
{
22
"build": {
3-
"arduino":{
4-
"ldscript": "esp32c3_out.ld"
5-
},
63
"core": "esp32",
74
"f_cpu": "160000000L",
85
"f_flash": "80000000L",
96
"flash_mode": "dio",
107
"extra_flags": [
118
"-DARDUINO_AirM2M_CORE_ESP32C3",
12-
"-DARDUINO_USB_MODE=1"
9+
"-DARDUINO_USB_MODE=1",
10+
"-DARDUINO_USB_CDC_ON_BOOT=1"
1311
],
1412
"mcu": "esp32c3",
1513
"variant": "AirM2M_CORE_ESP32C3"

boards/m5stack_paper.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"partitions": "default_16MB.csv"
5+
},
6+
"core": "esp32",
7+
"extra_flags": "-DARDUINO_M5STACK_Paper -DBOARD_HAS_PSRAM",
8+
"f_cpu": "240000000L",
9+
"f_flash": "80000000L",
10+
"flash_mode": "qio",
11+
"mcu": "esp32",
12+
"variant": "m5stack_paper"
13+
},
14+
"connectivity": [
15+
"wifi",
16+
"bluetooth",
17+
"ethernet",
18+
"can"
19+
],
20+
"frameworks": [
21+
"arduino",
22+
"espidf"
23+
],
24+
"name": "M5Stack Paper",
25+
"upload": {
26+
"flash_size": "16MB",
27+
"maximum_ram_size": 4521984,
28+
"maximum_size": 16777216,
29+
"require_upload_port": true,
30+
"speed": 460800
31+
},
32+
"url": "http://www.m5stack.com",
33+
"vendor": "M5Stack"
34+
}

builder/frameworks/espidf.py

+103-35
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
mcu = board.get("build.mcu", "esp32")
5959
idf_variant = mcu.lower()
6060

61-
# Required until Arduino switches to v5
6261
IDF5 = (
6362
platform.get_package_version("framework-espidf")
6463
.split(".")[1]
@@ -248,13 +247,13 @@ def populate_idf_env_vars(idf_env):
248247
os.path.dirname(get_python_exe()),
249248
]
250249

251-
if mcu not in ("esp32c2", "esp32c3", "esp32c6","esp32h2"):
250+
if mcu not in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"):
252251
additional_packages.append(
253252
os.path.join(platform.get_package_dir("toolchain-esp32ulp"), "bin"),
254253
)
255254

256-
if IS_WINDOWS:
257-
additional_packages.append(platform.get_package_dir("tool-mconf"))
255+
# if IS_WINDOWS:
256+
# additional_packages.append(platform.get_package_dir("tool-mconf"))
258257

259258
idf_env["PATH"] = os.pathsep.join(additional_packages + [idf_env["PATH"]])
260259

@@ -503,7 +502,7 @@ def extract_linker_script_fragments_backup(framework_components_dir, sdk_config)
503502
sys.stderr.write("Error: Failed to extract paths to linker script fragments\n")
504503
env.Exit(1)
505504

506-
if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"):
505+
if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"):
507506
result.append(os.path.join(framework_components_dir, "riscv", "linker.lf"))
508507

509508
# Add extra linker fragments
@@ -644,16 +643,31 @@ def generate_project_ld_script(sdk_config, ignore_targets=None):
644643
'--objdump "{objdump}"'
645644
).format(**args)
646645

646+
initial_ld_script = os.path.join(
647+
FRAMEWORK_DIR,
648+
"components",
649+
"esp_system",
650+
"ld",
651+
idf_variant,
652+
"sections.ld.in",
653+
)
654+
655+
framework_version = [int(v) for v in get_framework_version().split(".")]
656+
if framework_version[:2] > [5, 2]:
657+
initial_ld_script = preprocess_linker_file(
658+
initial_ld_script,
659+
os.path.join(
660+
BUILD_DIR,
661+
"esp-idf",
662+
"esp_system",
663+
"ld",
664+
"sections.ld.in",
665+
)
666+
)
667+
647668
return env.Command(
648669
os.path.join("$BUILD_DIR", "sections.ld"),
649-
os.path.join(
650-
FRAMEWORK_DIR,
651-
"components",
652-
"esp_system",
653-
"ld",
654-
idf_variant,
655-
"sections.ld.in",
656-
),
670+
initial_ld_script,
657671
env.VerboseAction(cmd, "Generating project linker script $TARGET"),
658672
)
659673

@@ -1103,6 +1117,46 @@ def get_app_partition_offset(pt_table, pt_offset):
11031117
return app_params.get("offset", "0x10000")
11041118

11051119

1120+
def preprocess_linker_file(src_ld_script, target_ld_script):
1121+
return env.Command(
1122+
target_ld_script,
1123+
src_ld_script,
1124+
env.VerboseAction(
1125+
" ".join(
1126+
[
1127+
os.path.join(
1128+
platform.get_package_dir("tool-cmake"),
1129+
"bin",
1130+
"cmake",
1131+
),
1132+
"-DCC=%s"
1133+
% os.path.join(
1134+
TOOLCHAIN_DIR,
1135+
"bin",
1136+
"$CC",
1137+
),
1138+
"-DSOURCE=$SOURCE",
1139+
"-DTARGET=$TARGET",
1140+
"-DCONFIG_DIR=%s" % os.path.join(BUILD_DIR, "config"),
1141+
"-DLD_DIR=%s"
1142+
% os.path.join(
1143+
FRAMEWORK_DIR, "components", "esp_system", "ld"
1144+
),
1145+
"-P",
1146+
os.path.join(
1147+
"$BUILD_DIR",
1148+
"esp-idf",
1149+
"esp_system",
1150+
"ld",
1151+
"linker_script_generator.cmake",
1152+
),
1153+
]
1154+
),
1155+
"Generating LD script $TARGET",
1156+
),
1157+
)
1158+
1159+
11061160
def generate_mbedtls_bundle(sdk_config):
11071161
bundle_path = os.path.join("$BUILD_DIR", "x509_crt_bundle")
11081162
if os.path.isfile(env.subst(bundle_path)):
@@ -1238,16 +1292,16 @@ def _get_installed_pip_packages(python_exe_path):
12381292
)
12391293
)
12401294

1241-
# A special "esp-windows-curses" python package is required on Windows
1242-
# for Menuconfig on IDF <5
1243-
if not IDF5 and "esp-windows-curses" not in installed_packages:
1244-
env.Execute(
1245-
env.VerboseAction(
1246-
'"%s" -m pip install "file://%s/tools/kconfig_new/esp-windows-curses"'
1247-
% (python_exe_path, FRAMEWORK_DIR),
1248-
"Installing windows-curses package",
1249-
)
1250-
)
1295+
# # A special "esp-windows-curses" python package is required on Windows
1296+
# # for Menuconfig on IDF <5
1297+
# if not IDF5 and "esp-windows-curses" not in installed_packages:
1298+
# env.Execute(
1299+
# env.VerboseAction(
1300+
# '"%s" -m pip install "file://%s/tools/kconfig_new/esp-windows-curses"'
1301+
# % (python_exe_path, FRAMEWORK_DIR),
1302+
# "Installing windows-curses package",
1303+
# )
1304+
# )
12511305

12521306

12531307
def get_idf_venv_dir():
@@ -1349,19 +1403,31 @@ def get_python_exe():
13491403
#
13501404

13511405
if not board.get("build.ldscript", ""):
1352-
linker_script = env.Command(
1353-
os.path.join("$BUILD_DIR", "memory.ld"),
1354-
board.get(
1355-
"build.esp-idf.ldscript",
1406+
initial_ld_script = board.get("build.esp-idf.ldscript", os.path.join(
1407+
FRAMEWORK_DIR,
1408+
"components",
1409+
"esp_system",
1410+
"ld",
1411+
idf_variant,
1412+
"memory.ld.in",
1413+
))
1414+
1415+
framework_version = [int(v) for v in get_framework_version().split(".")]
1416+
if framework_version[:2] > [5, 2]:
1417+
initial_ld_script = preprocess_linker_file(
1418+
initial_ld_script,
13561419
os.path.join(
1357-
FRAMEWORK_DIR,
1358-
"components",
1420+
BUILD_DIR,
1421+
"esp-idf",
13591422
"esp_system",
13601423
"ld",
1361-
idf_variant,
13621424
"memory.ld.in",
1363-
),
1364-
),
1425+
)
1426+
)
1427+
1428+
linker_script = env.Command(
1429+
os.path.join("$BUILD_DIR", "memory.ld"),
1430+
initial_ld_script,
13651431
env.VerboseAction(
13661432
'$CC -I"$BUILD_DIR/config" -I"%s" -C -P -x c -E $SOURCE -o $TARGET'
13671433
% os.path.join(FRAMEWORK_DIR, "components", "esp_system", "ld"),
@@ -1523,7 +1589,9 @@ def get_python_exe():
15231589

15241590
# Extra flags which need to be explicitly specified in LINKFLAGS section because SCons
15251591
# cannot merge them correctly
1526-
extra_flags = filter_args(link_args["LINKFLAGS"], ["-T", "-u"])
1592+
extra_flags = filter_args(
1593+
link_args["LINKFLAGS"], ["-T", "-u", "-Wl,--start-group", "-Wl,--end-group"]
1594+
)
15271595
link_args["LINKFLAGS"] = sorted(list(set(link_args["LINKFLAGS"]) - set(extra_flags)))
15281596

15291597
# remove the main linker script flags '-T memory.ld'
@@ -1599,7 +1667,7 @@ def _skip_prj_source_files(node):
15991667
(
16001668
board.get(
16011669
"upload.bootloader_offset",
1602-
"0x0" if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32s3", "esp32h2") else "0x1000",
1670+
"0x0" if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32s3", "esp32h2") else ("0x2000" if mcu in ("esp32p4") else "0x1000"),
16031671
),
16041672
os.path.join("$BUILD_DIR", "bootloader.bin"),
16051673
),
@@ -1710,7 +1778,7 @@ def _skip_prj_source_files(node):
17101778
#
17111779

17121780
ulp_dir = os.path.join(PROJECT_DIR, "ulp")
1713-
if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"):
1781+
if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"):
17141782
env.SConscript("ulp.py", exports="env sdk_config project_config idf_variant")
17151783

17161784
#

0 commit comments

Comments
 (0)