From 3c4aa1a5a507be04dc8ace98f92d90c8c7a6bc01 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 19 Aug 2025 09:39:18 +0000 Subject: [PATCH 1/4] feat(tools): update qemu version to esp_develop_9.2.2_20250817 --- tools/tools.json | 64 ++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/tools/tools.json b/tools/tools.json index 05d00ccc98..e2cd21ed22 100644 --- a/tools/tools.json +++ b/tools/tools.json @@ -964,31 +964,31 @@ "versions": [ { "linux-amd64": { - "sha256": "071d117c44a6e9a1bc8664ab63b592d3e17ceb779119dcb46c59571a4a7a88c9", - "size": 13611248, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz" + "sha256": "588bfaccd0f929650655d10a580f020c6ba9c131712d8fa519280081b8d126eb", + "size": 15648448, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz" }, "linux-arm64": { - "sha256": "43552f32b303a6820d0d9551903e54fc221aca98ccbd04e5cbccbca881548008", - "size": 15247720, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-aarch64-linux-gnu.tar.xz" + "sha256": "317f6e0fd1dba0886d8110709823d909593ef29438822a14f81ebe19d72ce7cd", + "size": 15123084, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-aarch64-linux-gnu.tar.xz" }, "macos": { - "sha256": "0096734280ce04f558cd9bd72f35db39667f80d44309a35565f2f8c02d1f9cc3", - "size": 3707956, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-apple-darwin.tar.xz" + "sha256": "00b9dbc2124cf7633cb86f264fbc524226ad4001bce68bbdba43c9bdc4eb026e", + "size": 4092932, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-x86_64-apple-darwin.tar.xz" }, "macos-arm64": { - "sha256": "fb4ca6be7b1a4dbcf153879cf0582300f974371def0826c0c5b728f12812ad08", - "size": 3456764, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-aarch64-apple-darwin.tar.xz" + "sha256": "aa92e337461d482f5d9f31cd8efc0bd67b3de8fcfcfb567289cb43a59c184651", + "size": 3882404, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-aarch64-apple-darwin.tar.xz" }, - "name": "esp_develop_9.0.0_20240606", + "name": "esp_develop_9.2.2_20250817", "status": "recommended", "win64": { - "sha256": "281659f7a1d49761ac6f54d0aeb14366cb93c002f21948b847a0e15c0b8f5425", - "size": 33957256, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-w64-mingw32.tar.xz" + "sha256": "ef550b912726997f3c1ff4a4fb13c1569e2b692efdc5c9f9c3c926a8f7c540fa", + "size": 34664956, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-x86_64-w64-mingw32.tar.xz" } } ] @@ -1017,31 +1017,31 @@ "versions": [ { "linux-amd64": { - "sha256": "47120e826cfec7180db8cb611a7a4aed2e9b2191c2a739194f8ce085e63cdd8d", - "size": 14454468, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz" + "sha256": "373b37a68bae3ef441ead24a7bfc950fcbfc274cbdd2b628fc6915f179eb1d8e", + "size": 16850080, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz" }, "linux-arm64": { - "sha256": "3b6221a8b1881d2c9b9fa0b0bf8d7065c84153d2a54e429307bde9feae235c27", - "size": 16542756, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-aarch64-linux-gnu.tar.xz" + "sha256": "f907a54313058f8a9681d2f48257d518950ff98bcd5a319194b4bee7c10cf223", + "size": 16332832, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-aarch64-linux-gnu.tar.xz" }, "macos": { - "sha256": "3afa55d5abea52ccf18d0bc41fe819d568bd4ee1582989b1ee9b1ee4a609a31e", - "size": 3751096, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-x86_64-apple-darwin.tar.xz" + "sha256": "820028ee7cd2dd8fe8cd8ca5519ab6e792d15fea9367c4525cf63c0f707c0b1f", + "size": 4086872, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-x86_64-apple-darwin.tar.xz" }, "macos-arm64": { - "sha256": "69ba5154594fb2922d5490a49ea6b4925c024c6c37f875b42f9885f513e0bcdd", - "size": 3409264, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-aarch64-apple-darwin.tar.xz" + "sha256": "234690b6fa7c1d5dfe3dbb2bdd0c2810755e7c98999a9f21c389a6046b7eb76d", + "size": 3761104, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-aarch64-apple-darwin.tar.xz" }, - "name": "esp_develop_9.0.0_20240606", + "name": "esp_develop_9.2.2_20250817", "status": "recommended", "win64": { - "sha256": "f49bb5c8f4d6e2cfbf7eeec21eb8ef190a57307778705bc689536ac13bde511c", - "size": 36274632, - "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-x86_64-w64-mingw32.tar.xz" + "sha256": "9474015f24d27acb7516955ec932e5307226bd9d6652cdc870793ed36010ab73", + "size": 37189656, + "url": "https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-x86_64-w64-mingw32.tar.xz" } } ] From e8157d8fde32824fe3ac55ee4e1253eeebd7cc39 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 20 Aug 2025 17:09:55 +0200 Subject: [PATCH 2/4] feat(tools): enable PSRAM by default in "idf.py qemu" for ESP32-S3 --- tools/idf_py_actions/qemu_ext.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/idf_py_actions/qemu_ext.py b/tools/idf_py_actions/qemu_ext.py index 6b58763230..bdeb2a64af 100644 --- a/tools/idf_py_actions/qemu_ext.py +++ b/tools/idf_py_actions/qemu_ext.py @@ -111,7 +111,7 @@ QEMU_TARGETS: Dict[str, QemuTarget] = { 'esp32s3', 'qemu-system-xtensa', 'qemu-xtensa', - '-M esp32s3', + '-M esp32s3 -m 32M', # Chip revision 0.3 binascii.unhexlify( '00000000000000000000000000000000000000000000000000000000000000000000000000000c00' @@ -308,6 +308,10 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: f'driver=timer.{target}.timg,property=wdt_disable,value=true', ] + # Quad PSRAM should work by default; octal requires a flag + if get_sdkconfig_value(project_desc['config_file'], 'CONFIG_SPIRAM_MODE_OCT'): + qemu_args += ['-global', 'driver=ssi_psram,property=is_octal,value=true'] + if '-nic' not in qemu_extra_args: qemu_args += ['-nic', 'user,model=open_eth'] From cd1bfdd4634219be68081c07dfd27c37900f6d43 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 22 Aug 2025 11:18:06 +0200 Subject: [PATCH 3/4] fix(tools): pre-commit fixes for qemu_ext.py --- tools/idf_py_actions/qemu_ext.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/idf_py_actions/qemu_ext.py b/tools/idf_py_actions/qemu_ext.py index bdeb2a64af..102b9887f8 100644 --- a/tools/idf_py_actions/qemu_ext.py +++ b/tools/idf_py_actions/qemu_ext.py @@ -13,8 +13,6 @@ import sys import time from dataclasses import dataclass from typing import Any -from typing import Dict -from typing import List from click.core import Context @@ -54,7 +52,7 @@ class QemuTarget: # To generate the default eFuse values, follow the instructions in # https://github.com/espressif/esp-toolchain-docs/blob/main/qemu/esp32/README.md#using-esptoolpy-and-espefusepy-to-interact-with-qemu # and burn the eFuses which should be set by default. Then take the binary file, convert it to hex, and paste it here. -QEMU_TARGETS: Dict[str, QemuTarget] = { +QEMU_TARGETS: dict[str, QemuTarget] = { 'esp32': QemuTarget( 'esp32', 'qemu-system-xtensa', @@ -178,12 +176,12 @@ def wait_for_socket(port: int, timeout_sec: float = 10.0) -> None: raise SystemExit(1) -def action_extensions(base_actions: Dict, project_path: str) -> Dict: +def action_extensions(base_actions: dict, project_path: str) -> dict: # Shared state between "global_callback" and "qemu" action. # Stores options which depend on the presence of other tasks. options = QemuTaskRunOptions() - def global_callback(ctx: Context, global_args: Dict, tasks: List) -> None: + def global_callback(ctx: Context, global_args: dict, tasks: list) -> None: # This callback lets us customize QEMU launch arguments depending on the presence of other tasks. def have_task(name: str) -> bool: return any(fnmatch.fnmatch(task.name, name) for task in tasks) @@ -219,7 +217,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: desc_path = os.path.join(args.build_dir, 'project_description.json') if not os.path.exists(desc_path): ensure_build_directory(args, ctx.info_name) - with open(desc_path, 'r', encoding='utf-8') as f: + with open(desc_path, encoding='utf-8') as f: project_desc = json.load(f) return project_desc From 17fd3133d9b745ab028dc6ae403d6808ecbc7a1a Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 22 Aug 2025 11:20:15 +0200 Subject: [PATCH 4/4] fix(tools): use nvram.esp32s3.efuse device in qemu_ext.py Related to https://github.com/espressif/esp-idf/issues/17258 --- tools/idf_py_actions/qemu_ext.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/idf_py_actions/qemu_ext.py b/tools/idf_py_actions/qemu_ext.py index 102b9887f8..98c84d9538 100644 --- a/tools/idf_py_actions/qemu_ext.py +++ b/tools/idf_py_actions/qemu_ext.py @@ -46,7 +46,6 @@ class QemuTarget: qemu_args: str # chip-specific arguments to pass to QEMU default_efuse: bytes # default efuse values for the target boot_mode_arg: str = '' # additional arguments to pass to QEMU when booting in download mode - efuse_device: str = '' # efuse device name, if different from the target nvram.{target}.efuse # To generate the default eFuse values, follow the instructions in @@ -66,7 +65,6 @@ QEMU_TARGETS: dict[str, QemuTarget] = { '00000000' ), '-global driver=esp32.gpio,property=strap_mode,value=0x0f', - 'nvram.esp32.efuse', ), 'esp32c3': QemuTarget( 'esp32c3', @@ -103,7 +101,6 @@ QEMU_TARGETS: dict[str, QemuTarget] = { '000000000000000000000000000000000000000000000000' ), '-global driver=esp32c3.gpio,property=strap_mode,value=0x02', - 'nvram.esp32c3.efuse', ), 'esp32s3': QemuTarget( 'esp32s3', @@ -140,8 +137,7 @@ QEMU_TARGETS: dict[str, QemuTarget] = { '000000000000000000000000000000000000000000000000' ), '-global driver=esp32s3.gpio,property=strap_mode,value=0x07', - 'nvram.esp32c3.efuse', - ), # Not esp32s3, QEMU-201 + ), } @@ -301,7 +297,7 @@ def action_extensions(base_actions: dict, project_path: str) -> dict: '-drive', f'file={efuse_bin_path},if=none,format=raw,id=efuse', '-global', - f'driver={qemu_target_info.efuse_device},property=drive,value=efuse', + f'driver=nvram.{target}.efuse,property=drive,value=efuse', '-global', f'driver=timer.{target}.timg,property=wdt_disable,value=true', ]