diff --git a/boards/esp32-h2-devkitm-1.json b/boards/esp32-h2-devkitm-1.json new file mode 100644 index 000000000..1a7c8ac67 --- /dev/null +++ b/boards/esp32-h2-devkitm-1.json @@ -0,0 +1,30 @@ +{ + "build": { + "core": "esp32", + "f_cpu": "96000000L", + "f_flash": "64000000L", + "f_image": "48000000L", + "flash_mode": "qio", + "mcu": "esp32h2", + "variant": "esp32h2" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32h2.cfg" + }, + "frameworks": [ + "espidf" + ], + "name": "Espressif ESP32-H2-DevKitM-1", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32h2/esp32-h2-devkitm-1/index.html", + "vendor": "Espressif" +} diff --git a/builder/frameworks/_embed_files.py b/builder/frameworks/_embed_files.py index c89dc4338..b407eb0b5 100644 --- a/builder/frameworks/_embed_files.py +++ b/builder/frameworks/_embed_files.py @@ -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", "esp32c6", "esp32h2") 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","esp32c6","esp32h2") else "elf32-xtensa-le", "--binary-architecture", - "riscv" if mcu in ("esp32c3","esp32c6") else "xtensa", + "riscv" if mcu in ("esp32c3","esp32c6","esp32h2") else "xtensa", "--rename-section", ".data=.rodata.embedded", "$SOURCE", diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 3b9850039..a18c25db1 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -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", "esp32c6", "esp32h2") else ( ( "toolchain-xtensa-esp-elf" @@ -256,7 +256,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", "esp32c6", "esp32h2"): additional_packages.append( os.path.join(platform.get_package_dir("toolchain-esp32ulp"), "bin"), ) @@ -511,7 +511,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", "esp32c6", "esp32h2"): result.append(os.path.join(framework_components_dir, "riscv", "linker.lf")) # Add extra linker fragments @@ -1606,7 +1606,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", "esp32c6", "esp32h2", "esp32s3") else "0x1000", ), os.path.join("$BUILD_DIR", "bootloader.bin"), ), @@ -1717,7 +1717,7 @@ def _skip_prj_source_files(node): # ulp_dir = os.path.join(PROJECT_DIR, "ulp") -if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c3", "esp32c6"): +if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c3", "esp32c6", "esp32h2"): env.SConscript("ulp.py", exports="env sdk_config project_config idf_variant") # diff --git a/builder/main.py b/builder/main.py index 98ae15526..d8b454556 100644 --- a/builder/main.py +++ b/builder/main.py @@ -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", "esp32c6", "esp32h2"): toolchain_arch = "riscv32-esp" if "INTEGRATION_EXTRA_DATA" not in env: @@ -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", "esp32c6", "esp32h2") else "tool-xtensa-esp-elf-gdb" ) or "", diff --git a/examples/espidf-hello-world/platformio.ini b/examples/espidf-hello-world/platformio.ini index 44102cc88..925905e7d 100644 --- a/examples/espidf-hello-world/platformio.ini +++ b/examples/espidf-hello-world/platformio.ini @@ -25,3 +25,8 @@ board = esp32-c3-devkitm-1 board = esp32-c6-devkitc-1 board_build.cmake_extra_args = -DSDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32c6" + +[env:esp32-h2-devkitm-1] +board = esp32-h2-devkitm-1 +board_build.cmake_extra_args = + -DSDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32h2" diff --git a/examples/espidf-hello-world/sdkconfig.defaults.esp32h2 b/examples/espidf-hello-world/sdkconfig.defaults.esp32h2 new file mode 100644 index 000000000..084d1c240 --- /dev/null +++ b/examples/espidf-hello-world/sdkconfig.defaults.esp32h2 @@ -0,0 +1,2 @@ +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" diff --git a/platform.py b/platform.py index e0537875e..fca6e8745 100644 --- a/platform.py +++ b/platform.py @@ -126,7 +126,7 @@ def configure_default_packages(self, variables, targets): ): self.packages.pop("toolchain-%s" % target, None) - if mcu in ("esp32c3", "esp32c6"): + if mcu in ("esp32c3", "esp32c6", "esp32h2"): self.packages.pop("toolchain-xtensa-esp-elf", None) else: self.packages["toolchain-xtensa-esp-elf"][ @@ -150,8 +150,8 @@ def configure_default_packages(self, variables, targets): else: self.packages.pop("toolchain-xtensa-%s" % available_mcu, None) - if mcu in ("esp32s2", "esp32s3", "esp32c3", "esp32c6"): - # RISC-V based toolchain for ESP32C3, ESP32C6 ESP32S2, ESP32S3 ULP + if mcu in ("esp32s2", "esp32s3", "esp32c3", "esp32c6", "esp32h2"): + # RISC-V based toolchain for ESP32C3, ESP32C6, ESP32H2, ESP32S2, ESP32S3 ULP self.packages["toolchain-riscv32-esp"]["optional"] = False return super().configure_default_packages(variables, targets) @@ -195,7 +195,7 @@ def _add_dynamic_options(self, board): if board.id == "esp32-s2-kaluga-1": supported_debug_tools.append("ftdi") - if board.get("build.mcu", "") in ("esp32c3", "esp32c6", "esp32s3"): + if board.get("build.mcu", "") in ("esp32c3", "esp32c6", "esp32h2", "esp32s3"): supported_debug_tools.append("esp-builtin") upload_protocol = board.manifest.get("upload", {}).get("protocol")