Skip to content

support esp32c5 #1597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions boards/esp32-c5-devkitc-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"build": {
"arduino":{
},
"core": "esp32",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_ESP32C3_DEV"
],
"mcu": "esp32c5",
"variant": "esp32c5"
},
"connectivity": [
"wifi",
"bluetooth"
],
"debug": {
"openocd_target": "esp32c5.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Espressif ESP32-C3-DevKitC-1 v1.2 (ESP32-C5-WROOM-1-N8R4)",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 393216,
"maximum_size": 8388608,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/user_guide.html",
"vendor": "Espressif"
}
6 changes: 3 additions & 3 deletions builder/frameworks/_embed_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ def transform_to_asm(target, source, env):
" ".join(
[
"riscv32-esp-elf-objcopy"
if mcu in ("esp32c3", "esp32c6")
if mcu in ("esp32c3", "esp32c5", "esp32c6")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this (and the following) repeated lists of mcu feels like it could be refactored into each board json, or at least centralized into a function that said whether the mcu is riscv32 or not.

else "xtensa-%s-elf-objcopy" % mcu,
"--input-target",
"binary",
"--output-target",
"elf32-littleriscv" if mcu in ("esp32c3","esp32c6") else "elf32-xtensa-le",
"elf32-littleriscv" if mcu in ("esp32c3", "esp32c5", "esp32c6") else "elf32-xtensa-le",
"--binary-architecture",
"riscv" if mcu in ("esp32c3","esp32c6") else "xtensa",
"riscv" if mcu in ("esp32c3","esp32c5","esp32c6") else "xtensa",
"--rename-section",
".data=.rodata.embedded",
"$SOURCE",
Expand Down
8 changes: 4 additions & 4 deletions builder/frameworks/espidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
FRAMEWORK_DIR = platform.get_package_dir("framework-espidf")
TOOLCHAIN_DIR = platform.get_package_dir(
"toolchain-riscv32-esp"
if mcu in ("esp32c3", "esp32c6")
if mcu in ("esp32c3", "esp32c5", "esp32c6")
else (
(
"toolchain-xtensa-esp-elf"
Expand Down Expand Up @@ -262,7 +262,7 @@ def populate_idf_env_vars(idf_env):
os.path.dirname(get_python_exe()),
]

if mcu not in ("esp32c3", "esp32c6"):
if mcu not in ("esp32c3", "esp32c5", "esp32c6"):
additional_packages.append(
os.path.join(platform.get_package_dir("toolchain-esp32ulp"), "bin"),
)
Expand Down Expand Up @@ -530,7 +530,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 ("esp32c3", "esp32c6"):
if mcu in ("esp32c3", "esp32c5", "esp32c6"):
result.append(os.path.join(framework_components_dir, "riscv", "linker.lf"))

# Add extra linker fragments
Expand Down Expand Up @@ -1736,7 +1736,7 @@ def _skip_prj_source_files(node):
(
board.get(
"upload.bootloader_offset",
"0x0" if mcu in ("esp32c3", "esp32c6", "esp32s3") else "0x1000",
"0x0" if mcu in ("esp32c3", "esp32c5", "esp32c6", "esp32s3") else "0x1000",
),
os.path.join("$BUILD_DIR", "bootloader.bin"),
),
Expand Down
4 changes: 2 additions & 2 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def __fetch_fs_size(target, source, env):
mcu = board.get("build.mcu", "esp32")
toolchain_arch = "xtensa-%s" % mcu
filesystem = board.get("build.filesystem", "spiffs")
if mcu in ("esp32c3", "esp32c6"):
if mcu in ("esp32c3", "esp32c5", "esp32c6"):
toolchain_arch = "riscv32-esp"

if "INTEGRATION_EXTRA_DATA" not in env:
Expand All @@ -257,7 +257,7 @@ def __fetch_fs_size(target, source, env):
GDB=join(
platform.get_package_dir(
"tool-riscv32-esp-elf-gdb"
if mcu in ("esp32c3", "esp32c6")
if mcu in ("esp32c3", "esp32c5", "esp32c6")
else "tool-xtensa-esp-elf-gdb"
)
or "",
Expand Down
2 changes: 1 addition & 1 deletion platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def configure_default_packages(self, variables, targets):
else:
self.packages.pop("toolchain-xtensa-%s" % available_mcu, None)

if mcu in ("esp32s2", "esp32s3", "esp32c3", "esp32c6"):
if mcu in ("esp32s2", "esp32s3", "esp32c3", "esp32c5", "esp32c6"):
# RISC-V based toolchain for ESP32C3, ESP32C6 ESP32S2, ESP32S3 ULP
self.packages["toolchain-riscv32-esp"]["optional"] = False

Expand Down