Arduino core 3.0.4
This commit is contained in:
@@ -2,34 +2,55 @@
|
||||
# Fork of Platformio Espressif 32: development platform for [PlatformIO](https://platformio.org)
|
||||
|
||||
[](https://github.com/pioarduino/platform-espressif32/actions)
|
||||
[](https://discord.gg/Nutz9crnZr)
|
||||
[](https://github.com/pioarduino/platform-espressif32/releases/latest)
|
||||
|
||||
> [!NOTE]
|
||||
> This fork was created due to the lack of ongoing development for the Espressif 32 Arduino Core for PlatformIO.
|
||||
>
|
||||
> For additional information, please refer to these GitHub links:
|
||||
>
|
||||
> https://github.com/espressif/arduino-esp32/discussions/10039
|
||||
> https://github.com/platformio/platform-espressif32/issues/1225
|
||||
> https://github.com/espressif/arduino-esp32/pull/8606
|
||||
>
|
||||
> The discussions are self-explanatory, allowing you to draw your own conclusions.
|
||||
|
||||
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.
|
||||
|
||||
* [Home](https://registry.platformio.org/platforms/platformio/espressif32) (home page in the PlatformIO Registry)
|
||||
* [Documentation](https://docs.platformio.org/page/platforms/espressif32.html) (advanced usage, packages, boards, frameworks, etc.)
|
||||
|
||||
## IDE Preparation
|
||||
|
||||
- [Download and install official Microsoft Visual Studio Code](https://code.visualstudio.com/). PlatformIO IDE is built on top of it.
|
||||
- Open the extension manager.
|
||||
- Search for the official `platformio ide` extension.
|
||||
- Install PlatformIO IDE extension.
|
||||
|
||||

|
||||
|
||||
# Usage
|
||||
1. Setup new VSCode PlatformIO project.
|
||||
1. Configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
|
||||
|
||||
1. [Install PlatformIO](https://platformio.org)
|
||||
2. Create PlatformIO project and configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
|
||||
|
||||
## Stable version
|
||||
espressif Arduino 3.0.3 and IDF 5.1.4
|
||||
### Stable version
|
||||
espressif Arduino 3.0.4 and IDF 5.1.4
|
||||
|
||||
See `platform` [documentation](https://docs.platformio.org/en/latest/projectconf/sections/env/options/platform/platform.html#projectconf-env-platform) for details.
|
||||
|
||||
```ini
|
||||
[env:stable]
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
|
||||
board = ...
|
||||
...
|
||||
```
|
||||
|
||||
## Development version
|
||||
### Development version
|
||||
espressif Arduino repo branch master and latest compiled Arduino libs
|
||||
|
||||
```ini
|
||||
[env:development]
|
||||
platform = https://github.com/pioarduino/platform-espressif32.git#development
|
||||
platform = https://github.com/pioarduino/platform-espressif32.git#develop
|
||||
board = ...
|
||||
...
|
||||
```
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "partitions-4MB-tinyuf2.csv",
|
||||
"partitions": "tinyuf2-partitions-4MB.csv",
|
||||
"memory_type": "qio_qspi"
|
||||
},
|
||||
"core": "esp32",
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"ldscript": "esp32c3_out.ld"
|
||||
},
|
||||
"core": "esp32",
|
||||
"f_cpu": "160000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "dio",
|
||||
"extra_flags": [
|
||||
"-DARDUINO_AirM2M_CORE_ESP32C3",
|
||||
"-DARDUINO_USB_MODE=1"
|
||||
"-DARDUINO_USB_MODE=1",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1"
|
||||
],
|
||||
"mcu": "esp32c3",
|
||||
"variant": "AirM2M_CORE_ESP32C3"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"partitions": "default_16MB.csv"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": "-DARDUINO_M5STACK_Paper -DBOARD_HAS_PSRAM",
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"mcu": "esp32",
|
||||
"variant": "m5stack_paper"
|
||||
},
|
||||
"connectivity": [
|
||||
"wifi",
|
||||
"bluetooth",
|
||||
"ethernet",
|
||||
"can"
|
||||
],
|
||||
"frameworks": [
|
||||
"arduino",
|
||||
"espidf"
|
||||
],
|
||||
"name": "M5Stack Paper",
|
||||
"upload": {
|
||||
"flash_size": "16MB",
|
||||
"maximum_ram_size": 4521984,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"speed": 460800
|
||||
},
|
||||
"url": "http://www.m5stack.com",
|
||||
"vendor": "M5Stack"
|
||||
}
|
||||
+103
-35
@@ -58,7 +58,6 @@ board = env.BoardConfig()
|
||||
mcu = board.get("build.mcu", "esp32")
|
||||
idf_variant = mcu.lower()
|
||||
|
||||
# Required until Arduino switches to v5
|
||||
IDF5 = (
|
||||
platform.get_package_version("framework-espidf")
|
||||
.split(".")[1]
|
||||
@@ -248,13 +247,13 @@ def populate_idf_env_vars(idf_env):
|
||||
os.path.dirname(get_python_exe()),
|
||||
]
|
||||
|
||||
if mcu not in ("esp32c2", "esp32c3", "esp32c6","esp32h2"):
|
||||
if mcu not in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"):
|
||||
additional_packages.append(
|
||||
os.path.join(platform.get_package_dir("toolchain-esp32ulp"), "bin"),
|
||||
)
|
||||
|
||||
if IS_WINDOWS:
|
||||
additional_packages.append(platform.get_package_dir("tool-mconf"))
|
||||
# if IS_WINDOWS:
|
||||
# additional_packages.append(platform.get_package_dir("tool-mconf"))
|
||||
|
||||
idf_env["PATH"] = os.pathsep.join(additional_packages + [idf_env["PATH"]])
|
||||
|
||||
@@ -503,7 +502,7 @@ def extract_linker_script_fragments_backup(framework_components_dir, sdk_config)
|
||||
sys.stderr.write("Error: Failed to extract paths to linker script fragments\n")
|
||||
env.Exit(1)
|
||||
|
||||
if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"):
|
||||
if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"):
|
||||
result.append(os.path.join(framework_components_dir, "riscv", "linker.lf"))
|
||||
|
||||
# Add extra linker fragments
|
||||
@@ -644,16 +643,31 @@ def generate_project_ld_script(sdk_config, ignore_targets=None):
|
||||
'--objdump "{objdump}"'
|
||||
).format(**args)
|
||||
|
||||
initial_ld_script = os.path.join(
|
||||
FRAMEWORK_DIR,
|
||||
"components",
|
||||
"esp_system",
|
||||
"ld",
|
||||
idf_variant,
|
||||
"sections.ld.in",
|
||||
)
|
||||
|
||||
framework_version = [int(v) for v in get_framework_version().split(".")]
|
||||
if framework_version[:2] > [5, 2]:
|
||||
initial_ld_script = preprocess_linker_file(
|
||||
initial_ld_script,
|
||||
os.path.join(
|
||||
BUILD_DIR,
|
||||
"esp-idf",
|
||||
"esp_system",
|
||||
"ld",
|
||||
"sections.ld.in",
|
||||
)
|
||||
)
|
||||
|
||||
return env.Command(
|
||||
os.path.join("$BUILD_DIR", "sections.ld"),
|
||||
os.path.join(
|
||||
FRAMEWORK_DIR,
|
||||
"components",
|
||||
"esp_system",
|
||||
"ld",
|
||||
idf_variant,
|
||||
"sections.ld.in",
|
||||
),
|
||||
initial_ld_script,
|
||||
env.VerboseAction(cmd, "Generating project linker script $TARGET"),
|
||||
)
|
||||
|
||||
@@ -1103,6 +1117,46 @@ def get_app_partition_offset(pt_table, pt_offset):
|
||||
return app_params.get("offset", "0x10000")
|
||||
|
||||
|
||||
def preprocess_linker_file(src_ld_script, target_ld_script):
|
||||
return env.Command(
|
||||
target_ld_script,
|
||||
src_ld_script,
|
||||
env.VerboseAction(
|
||||
" ".join(
|
||||
[
|
||||
os.path.join(
|
||||
platform.get_package_dir("tool-cmake"),
|
||||
"bin",
|
||||
"cmake",
|
||||
),
|
||||
"-DCC=%s"
|
||||
% os.path.join(
|
||||
TOOLCHAIN_DIR,
|
||||
"bin",
|
||||
"$CC",
|
||||
),
|
||||
"-DSOURCE=$SOURCE",
|
||||
"-DTARGET=$TARGET",
|
||||
"-DCONFIG_DIR=%s" % os.path.join(BUILD_DIR, "config"),
|
||||
"-DLD_DIR=%s"
|
||||
% os.path.join(
|
||||
FRAMEWORK_DIR, "components", "esp_system", "ld"
|
||||
),
|
||||
"-P",
|
||||
os.path.join(
|
||||
"$BUILD_DIR",
|
||||
"esp-idf",
|
||||
"esp_system",
|
||||
"ld",
|
||||
"linker_script_generator.cmake",
|
||||
),
|
||||
]
|
||||
),
|
||||
"Generating LD script $TARGET",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def generate_mbedtls_bundle(sdk_config):
|
||||
bundle_path = os.path.join("$BUILD_DIR", "x509_crt_bundle")
|
||||
if os.path.isfile(env.subst(bundle_path)):
|
||||
@@ -1238,16 +1292,16 @@ def install_python_deps():
|
||||
)
|
||||
)
|
||||
|
||||
# A special "esp-windows-curses" python package is required on Windows
|
||||
# for Menuconfig on IDF <5
|
||||
if not IDF5 and "esp-windows-curses" not in installed_packages:
|
||||
env.Execute(
|
||||
env.VerboseAction(
|
||||
'"%s" -m pip install "file://%s/tools/kconfig_new/esp-windows-curses"'
|
||||
% (python_exe_path, FRAMEWORK_DIR),
|
||||
"Installing windows-curses package",
|
||||
)
|
||||
)
|
||||
# # A special "esp-windows-curses" python package is required on Windows
|
||||
# # for Menuconfig on IDF <5
|
||||
# if not IDF5 and "esp-windows-curses" not in installed_packages:
|
||||
# env.Execute(
|
||||
# env.VerboseAction(
|
||||
# '"%s" -m pip install "file://%s/tools/kconfig_new/esp-windows-curses"'
|
||||
# % (python_exe_path, FRAMEWORK_DIR),
|
||||
# "Installing windows-curses package",
|
||||
# )
|
||||
# )
|
||||
|
||||
|
||||
def get_idf_venv_dir():
|
||||
@@ -1349,19 +1403,31 @@ generate_default_component()
|
||||
#
|
||||
|
||||
if not board.get("build.ldscript", ""):
|
||||
linker_script = env.Command(
|
||||
os.path.join("$BUILD_DIR", "memory.ld"),
|
||||
board.get(
|
||||
"build.esp-idf.ldscript",
|
||||
initial_ld_script = board.get("build.esp-idf.ldscript", os.path.join(
|
||||
FRAMEWORK_DIR,
|
||||
"components",
|
||||
"esp_system",
|
||||
"ld",
|
||||
idf_variant,
|
||||
"memory.ld.in",
|
||||
))
|
||||
|
||||
framework_version = [int(v) for v in get_framework_version().split(".")]
|
||||
if framework_version[:2] > [5, 2]:
|
||||
initial_ld_script = preprocess_linker_file(
|
||||
initial_ld_script,
|
||||
os.path.join(
|
||||
FRAMEWORK_DIR,
|
||||
"components",
|
||||
BUILD_DIR,
|
||||
"esp-idf",
|
||||
"esp_system",
|
||||
"ld",
|
||||
idf_variant,
|
||||
"memory.ld.in",
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
linker_script = env.Command(
|
||||
os.path.join("$BUILD_DIR", "memory.ld"),
|
||||
initial_ld_script,
|
||||
env.VerboseAction(
|
||||
'$CC -I"$BUILD_DIR/config" -I"%s" -C -P -x c -E $SOURCE -o $TARGET'
|
||||
% os.path.join(FRAMEWORK_DIR, "components", "esp_system", "ld"),
|
||||
@@ -1523,7 +1589,9 @@ libs = find_lib_deps(
|
||||
|
||||
# Extra flags which need to be explicitly specified in LINKFLAGS section because SCons
|
||||
# cannot merge them correctly
|
||||
extra_flags = filter_args(link_args["LINKFLAGS"], ["-T", "-u"])
|
||||
extra_flags = filter_args(
|
||||
link_args["LINKFLAGS"], ["-T", "-u", "-Wl,--start-group", "-Wl,--end-group"]
|
||||
)
|
||||
link_args["LINKFLAGS"] = sorted(list(set(link_args["LINKFLAGS"]) - set(extra_flags)))
|
||||
|
||||
# remove the main linker script flags '-T memory.ld'
|
||||
@@ -1599,7 +1667,7 @@ env.Prepend(
|
||||
(
|
||||
board.get(
|
||||
"upload.bootloader_offset",
|
||||
"0x0" if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32s3", "esp32h2") else "0x1000",
|
||||
"0x0" if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32s3", "esp32h2") else ("0x2000" if mcu in ("esp32p4") else "0x1000"),
|
||||
),
|
||||
os.path.join("$BUILD_DIR", "bootloader.bin"),
|
||||
),
|
||||
@@ -1710,7 +1778,7 @@ env["BUILDERS"]["ElfToBin"].action = action
|
||||
#
|
||||
|
||||
ulp_dir = os.path.join(PROJECT_DIR, "ulp")
|
||||
if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"):
|
||||
if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"):
|
||||
env.SConscript("ulp.py", exports="env sdk_config project_config idf_variant")
|
||||
|
||||
#
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from platformio import fs
|
||||
from platformio.util import get_systype
|
||||
@@ -34,11 +35,12 @@ ULP_BUILD_DIR = os.path.join(
|
||||
def prepare_ulp_env_vars(env):
|
||||
ulp_env.PrependENVPath("IDF_PATH", FRAMEWORK_DIR)
|
||||
|
||||
toolchain_path = platform.get_package_dir(
|
||||
"toolchain-xtensa-%s" % idf_variant
|
||||
)
|
||||
|
||||
additional_packages = [
|
||||
os.path.join(
|
||||
platform.get_package_dir("toolchain-xtensa-%s" % idf_variant),
|
||||
"bin",
|
||||
),
|
||||
toolchain_path,
|
||||
os.path.join(
|
||||
platform.get_package_dir("toolchain-esp32ulp"),
|
||||
"bin",
|
||||
@@ -48,8 +50,8 @@ def prepare_ulp_env_vars(env):
|
||||
os.path.dirname(where_is_program("python")),
|
||||
]
|
||||
|
||||
if "windows" in get_systype():
|
||||
additional_packages.append(platform.get_package_dir("tool-mconf"))
|
||||
# if "windows" in get_systype():
|
||||
# additional_packages.append(platform.get_package_dir("tool-mconf"))
|
||||
|
||||
for package in additional_packages:
|
||||
ulp_env.PrependENVPath("PATH", package)
|
||||
@@ -57,7 +59,7 @@ def prepare_ulp_env_vars(env):
|
||||
|
||||
def collect_ulp_sources():
|
||||
return [
|
||||
fs.to_unix_path(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f))
|
||||
os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f)
|
||||
for f in os.listdir(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"))
|
||||
if f.endswith((".c", ".S", ".s"))
|
||||
]
|
||||
@@ -95,7 +97,7 @@ def generate_ulp_config(target_config):
|
||||
"-riscv" if riscv_ulp_enabled else "",
|
||||
),
|
||||
),
|
||||
"-DULP_S_SOURCES=%s" % ";".join([s.get_abspath() for s in source]),
|
||||
"-DULP_S_SOURCES=%s" % ";".join([fs.to_unix_path(s.get_abspath()) for s in source]),
|
||||
"-DULP_APP_NAME=ulp_main",
|
||||
"-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"),
|
||||
"-DCOMPONENT_INCLUDES=%s" % ";".join(get_component_includes(target_config)),
|
||||
@@ -110,7 +112,10 @@ def generate_ulp_config(target_config):
|
||||
os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake"),
|
||||
)
|
||||
|
||||
exec_command(cmd)
|
||||
result = exec_command(cmd)
|
||||
if result["returncode"] != 0:
|
||||
sys.stderr.write(result["err"] + "\n")
|
||||
env.Exit(1)
|
||||
|
||||
ulp_sources = collect_ulp_sources()
|
||||
ulp_sources.sort()
|
||||
|
||||
@@ -19,12 +19,11 @@ board_build.embed_txtfiles =
|
||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
|
||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt
|
||||
|
||||
; FixMe: Linker error only with S3 and arduino,espidf
|
||||
;[env:esp32-s3]
|
||||
;board = 4d_systems_esp32s3_gen4_r8n16
|
||||
;build_flags =
|
||||
; -DCONFIG_BLINK_GPIO=2
|
||||
; -DARDUINO_PARTITION_esp_sr_16
|
||||
[env:esp32-s3]
|
||||
board = 4d_systems_esp32s3_gen4_r8n16
|
||||
build_flags =
|
||||
-DCONFIG_BLINK_GPIO=2
|
||||
-DARDUINO_PARTITION_esp_sr_16
|
||||
|
||||
[env:esp32-c6-devkitm-1]
|
||||
board = esp32-c6-devkitm-1
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
+4
-14
@@ -18,7 +18,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/pioarduino/platform-espressif32.git"
|
||||
},
|
||||
"version": "51.03.03",
|
||||
"version": "51.03.03+develop",
|
||||
"frameworks": {
|
||||
"arduino": {
|
||||
"script": "builder/frameworks/arduino.py"
|
||||
@@ -33,19 +33,19 @@
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "espressif",
|
||||
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.3/esp32-3.0.3.zip"
|
||||
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.4/esp32-3.0.4.zip"
|
||||
},
|
||||
"framework-arduinoespressif32-libs": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "espressif",
|
||||
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.3/esp32-arduino-libs-3.0.3.zip"
|
||||
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.4/esp32-arduino-libs-3.0.4.zip"
|
||||
},
|
||||
"framework-espidf": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"version": "https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240712/esp-idf-v5.1.4.zip"
|
||||
"version": "https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240801/esp-idf-v5.1.4.zip"
|
||||
},
|
||||
"toolchain-xtensa-esp32": {
|
||||
"type": "toolchain",
|
||||
@@ -132,16 +132,6 @@
|
||||
"optional": true,
|
||||
"owner": "platformio",
|
||||
"version": "^1.7.0"
|
||||
},
|
||||
"tool-mconf": {
|
||||
"optional": true,
|
||||
"owner": "platformio",
|
||||
"version": "~1.4060000.0"
|
||||
},
|
||||
"tool-idf": {
|
||||
"optional": true,
|
||||
"owner": "platformio",
|
||||
"version": "~1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ class Espressif32Platform(PlatformBase):
|
||||
for p in self.packages:
|
||||
if p in ("tool-cmake", "tool-ninja"):
|
||||
self.packages[p]["optional"] = False
|
||||
elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS:
|
||||
self.packages[p]["optional"] = False
|
||||
# elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS:
|
||||
# self.packages[p]["optional"] = False
|
||||
|
||||
for available_mcu in ("esp32", "esp32s2", "esp32s3"):
|
||||
if available_mcu == mcu:
|
||||
|
||||
Reference in New Issue
Block a user