Commit Graph

8003 Commits

Author SHA1 Message Date
Marek Fiala
d648b858bb feat(tools): adopt esp-pylib for mcp-server logging and ports
Migrate the MCP server extension to the shared esp-pylib library:
- replace raw stderr prints with esp_pylib.logger.log (note/err)
- route informational logs to stderr via set_info_stream so stdout
  stays reserved for the MCP JSON-RPC transport
- enumerate connected devices via esp_pylib.serial_ports.get_port_names
- stub the new imports in the mcp_ext unit tests

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:20:45 +02:00
Marek Fiala
3f005c8a4d feat(tools): mcp-server added monitor-device tool
Add a `monitor_device` MCP tool that lets an AI agent run a scripted,
non-interactive `esp-idf-monitor` session against a flashed device and
get back a short status plus a log file path, instead of raw serial
output inline.

Under the hood:

- The agent supplies a plain-text command body (expect/send/sleep/reset/
  exit/comments). `assemble_monitor_script_from_agent_commands()` frames
  it into a script the monitor's non-interactive command mode can
  consume via stdin: it appends `exit` if the agent didn't already end
  with one, and rewrites every bare `expect <regex>` into `expect
  --timeout <timeout_sec> <regex>` via `_monitor_normalize_expect_line()`
  (an already-bounded `expect --timeout ...` line is left untouched so
  the monitor itself reports a bad value). A leading `reset` is not
  prepended - the monitor already resets the chip when it opens the
  port - and any `reset` the agent wrote is left in place.
  `_monitor_parse_sleep_duration()` extracts each `sleep <n>` duration.
  The effective timeout is the sum of every bounded expect duration
  plus every sleep duration. Scripts whose sum exceeds
  `MONITOR_MAX_SCRIPT_SEC` are rejected. If the script has neither
  expect nor sleep (for example only `send`), `timeout_sec` is used so
  the process still has a kill bound.

- `monitor_device()` runs `python -m esp_idf_monitor` via
  `subprocess.run(..., input=script, timeout=2 * effective_timeout)`.
  `no_reset` is forwarded as `--no-reset` so the connection reset can be
  skipped; an explicit `-p` is forwarded when a port is given. Extra
  arguments match `idf.py monitor` where a build exists: baud (`baud`
  tool arg, else `monitor_baud` from `project_description.json`),
  toolchain prefix, `--target`/`--revision`, coredump/panic decode, and
  ELF files with the app ELF first. The 2x hard timeout is a safety net
  independent of the script's own `expect --timeout`/`exit` logic; on
  `TimeoutExpired` the process is killed but any output already captured
  is preserved and logged. `decode_stream()` normalizes that captured
  output, which can be `bytes` on the timeout path even though the
  process otherwise runs in text mode.

- The monitor's exit code drives the reported status via
  `_monitor_status()`, using `EXIT_EXPECT_TIMEOUT` and
  `EXIT_SCRIPT_ERROR` from `esp_idf_monitor.base.constants`: 0 is
  success, 110 means an `expect` pattern never showed up before its
  `--timeout` elapsed, 2 means the monitor rejected the script (bad
  syntax/timeout/regex), anything else is reported generically.

- Serial output and the monitor's own messages share one pipe
  (`stderr=STDOUT`) so decoded panic backtraces stay next to the lines
  that triggered them. `_save_monitor_output()` writes the full merge to
  `<tempdir>/esp_idf_mcp_log/action_monitor/monitor_<timestamp>.log` and
  reports a dedicated `Log file:` line. On non-zero exit or process
  kill, a short tail of that same merge is also returned inline so the
  agent has some failure context without a second file read. If the log
  file can't be written, it falls back to inlining a truncated tail.

Closes https://github.com/espressif/esp-idf/issues/18757
Closes https://github.com/espressif/esp-idf/pull/18385

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:20:45 +02:00
Roland Dobai
2e6d41c2e9 Merge branch 'task/buildv2_gdbinit_multi_exec' into 'master'
feat(cmakev2): parameterize gdbinit for multi-executable builds

Closes IDF-15860

See merge request espressif/esp-idf!51239
2026-09-10 10:59:42 +02:00
Armando (Dou Yiwen)
496c0b6377 Merge branch 'refactor/flash_refactor' into 'master'
spi_flash: split driver and os driver into `spi_flash` and `esp_mspi` components

Closes IDF-15210

See merge request espressif/esp-idf!45409
2026-09-10 07:29:01 +00:00
Roland Dobai
e9362463b4 Merge branch 'feat/pylib_standalone_scripts' into 'master'
Adopted esp-pylib for various standalone scripts

See merge request espressif/esp-idf!49944
2026-09-09 15:24:05 +02:00
morris
da3e20988f Merge branch 'ci/reenable_h4_eco2_target_test' into 'master'
feat(esp32h4): remove the support of esp32h4 rev0

Closes IDF-16110

See merge request espressif/esp-idf!52538
2026-09-09 16:03:35 +08:00
Jakub Kocka
d6771a0608 change(tools): Unified outputs of various standalone scripts (esp-pylib) 2026-09-09 09:43:59 +02:00
Armando (Dou Yiwen)
5e181236b7 refactor(mspi): move esp_mspi_align and mspi_mem_barrier to esp_mspi 2026-09-09 14:17:00 +08:00
armando
6e3abd12a1 refactor(spi_flash): move os layer to esp_mspi and chip configs to spi_flash
Also fixes the implicit dependency on esp_partition.
2026-09-09 14:17:00 +08:00
Mahavir Jain
71c93b10b9 Merge branch 'test/s3_memprot_dram_exec_xfail' into 'master'
test(panic): apply the ESP32-S2 memprot expected failures to ESP32-S3

Closes IDFCI-13868

See merge request espressif/esp-idf!52444
2026-09-09 11:42:35 +05:30
Marius Vikhammer
25555683b9 Merge branch 'feature/g1_improvements_cmake_v2' into 'master'
feat(build): fixed esp_usb_cdc_rom_console always being included in build

See merge request espressif/esp-idf!51981
2026-09-08 10:36:40 +08:00
Chen Jichang
c950e7bae0 feat(esp32h4): remove the support of esp32h4 rev0 2026-09-08 10:30:20 +08:00
morris
77d0058435 Merge branch 'ci/disable_h4_target_test_for_updating_runners' into 'master'
ci(esp32h4): disable h4 target test for updating runners

See merge request espressif/esp-idf!52449
2026-09-07 17:19:53 +08:00
Marius Vikhammer
b38c8a0625 Merge branch 'feat/llvm-opt-integration' into 'master'
feat(compiler): add ESP-IDF LLVM optimization enablement framework

See merge request espressif/esp-idf!51154
2026-09-07 10:11:37 +08:00
Alexey Gerenkov
6d01a64027 Merge branch 'feature/update-openocd-to-v0.12.0-esp32-20260831' into 'master'
feat(tools): update openocd version to v0.12.0-esp32-20260831

See merge request espressif/esp-idf!52371
2026-09-04 19:37:02 +08:00
Chen Jichang
e9c56e2d78 ci(esp32h4): disable h4 target test for updating runners 2026-09-04 17:19:46 +08:00
harshal.patil
2068cd1aa0 test(panic): apply the ESP32-S2 memprot expected failures to ESP32-S3
The DRAM and RTC_FAST execute cases race the CPU exception against the PMS or
cache interrupt on ESP32-S3 too, so the panic reason is not deterministic.
2026-09-04 14:13:04 +05:30
Roland Dobai
aa03e678f5 Merge branch 'fix/serial_port_target_mismatch' into 'master'
fix(tools): Detect serial port matching the project target

Closes IDF-15356

See merge request espressif/esp-idf!51466
2026-09-04 07:01:30 +02:00
Sudeep Mohanty
4756c1ec75 test(cmakev2): add gdbinit single and multi-binary tests
Cover the default single-executable output directory and per-executable
gdbinit generation in a multi-binary build.
2026-09-04 13:00:09 +08:00
Sudeep Mohanty
0ca0b8da52 feat(cmakev2): parameterize gdbinit for multi-executable builds
__generate_gdbinit wrote into a single shared directory and derived the
application ELF from a global property, so a project building multiple
executables had their gdbinit files overwrite each other. Take the ELF
path and output directory as arguments, and derive them per executable in
idf_build_generate_metadata.
2026-09-04 13:00:09 +08:00
Roland Dobai
c63f12f2d0 Merge branch 'fix/kconfig_test_format' into 'master'
fix: KConfig test output format

See merge request espressif/esp-idf!52329
2026-09-03 12:52:44 +02:00
Samuel Obuch
0a1d19eba1 feat(tools): update openocd version to v0.12.0-esp32-20260831 2026-09-03 07:46:42 +00:00
Marius Vikhammer
157d6b1669 feat(build): fixed esp_usb_cdc_rom_console always being included in build 2026-09-03 15:09:38 +08:00
chenqian
25046e7959 feat(compiler): add ESP-IDF LLVM optimization enablement framework
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-03 13:02:58 +08:00
morris
0f42b6c4f3 Merge branch 'refactor/dac_examples' into 'master'
refactor(dac): remove adc read back in dac example, prepare for s31

See merge request espressif/esp-idf!52030
2026-09-02 20:04:22 +08:00
Daniel Paul
1c70539375 fix: KConfig test output format 2026-09-02 13:19:40 +02:00
Marius Vikhammer
ff6371a140 Merge branch 'task/remove_build_components_var_in_buildv2' into 'master'
change(build): drop BUILD_COMPONENTS support and migrate test_apps to not use it for buildv2

Closes IDF-15859

See merge request espressif/esp-idf!51695
2026-09-02 19:19:08 +08:00
Vojtech Piroch
19676ffa46 fix(tools): Detect serial port matching the project target
Auto-detect used to pick the first Espressif device, even when it did
not match IDF_TARGET. With several boards attached, flash/monitor could
talk to the wrong chip.

Pass the project target into esptool so unmatched ports are skipped.
Resolve the port after ensure_build_directory() so the target is known.
For monitor on an unconfigured project, probe the connected chip and
pass it directly to idf_monitor without configuring the project.
2026-09-02 17:18:57 +08:00
Mahavir Jain
a1f17cebdc Merge branch 'fix/s3_memprot_panic_report' into 'master'
Report ESP32-S3 PMS violations as memory protection faults

See merge request espressif/esp-idf!52109
2026-09-02 13:41:24 +05:30
Marius Vikhammer
58ab269d3a Merge branch 'feat/app-rollback-auto-confirmation' into 'master'
feat(app_update): Add auto-confirmation of OTA updates

Closes IDF-15981

See merge request espressif/esp-idf!50531
2026-09-02 15:54:30 +08:00
Konstantin Kondrashov
de1e5035b5 feat(app_update): Add auto-confirmation of OTA updates
Enable rollback auto-confirmation by default
2026-09-01 12:53:21 +03:00
Jakub Kocka
2a07ad46e7 ci(tools): Clip idf.py failure logs so Windows log_cli cannot stall
pytest.ini enables log_cli, so logging the full ninja stdout after a
failed first-time build is one multi-MB ERROR. That hung shard 3/6 for
hours after the hints test. Log the last 80 lines; keep the full output
on the exception and at DEBUG.
2026-09-01 09:18:32 +02:00
Jakub Kocka
02a689149c ci(tools): Don't abort idf_copy when a worktree submodule is a gitlink
git worktree add materializes submodules as gitlink files. rmtree() cannot
remove those, and exists()+iterdir() on a source gitlink raises and falls
back to shutil.copytree, which leaves mbedtls/include as a file. Unlink
dest gitlinks and only copy populated source directories.
2026-09-01 09:18:31 +02:00
harshal.patil
8daab867b7 test(panic): enable the memprot panic tests for ESP32-S3
sdkconfig.ci.memprot_esp32s3 was built but listed in no CONFIGS_MEMPROT_*, so
the S3 PMS panic path was never exercised.

expect_gme() takes an optional core, for panics with no attributable core.
2026-09-01 12:33:46 +05:30
Mahavir Jain
a3192567d5 Merge branch 'feat/cpu_region_protection_h4' into 'master'
Memory region protection for ESP32-H4

Closes IDF-12588

See merge request espressif/esp-idf!47070
2026-08-31 17:41:52 +05:30
Martin Vychodil
4cce27e1cc Merge branch 'fix/sdmmc_dma_aligned_buffer_leak' into 'master'
fix(sdmmc): release aligned buffer on card deinit

Closes IDF-16031 and DOC-15562

See merge request espressif/esp-idf!51530
2026-08-28 13:57:05 +08:00
Roland Dobai
1ba374b7e6 Merge branch 'fix/lto_function_data_sections' into 'master'
fix(build): keep per-function sections when generating code at LTO link time

See merge request espressif/esp-idf!51629
2026-08-27 13:55:43 +02:00
Adam Múdry
e0c094da69 fix(sdmmc): release aligned DMA buffer on card deinit 2026-08-27 12:00:24 +02:00
Hu Rui
7bb7fed5ec refactor(dac): remove adc read back in dac example, prepare for s31 2026-08-27 16:06:40 +08:00
Sudeep Mohanty
dfe99a4a41 feat(idf_py): hint at the BUILD_COMPONENTS migration path
Reading the BUILD_COMPONENTS build property aborts the build with a bare
message stating that the property is unsupported, without naming a
replacement. Add a hint that points at the $<TARGET_EXISTS:idf::component>
generator expression and at the documentation section describing the
migration, so the guidance lives with the other build hints instead of
being spelled out in the build system sources.
2026-08-26 15:28:18 +02:00
Sudeep Mohanty
b91f894234 change(build): reject BUILD_COMPONENTS in all cmakev2 builds
The compatibility shim populated BUILD_COMPONENTS from the library
interface's linked-components list so that consumers reading it kept
working. Those consumers now query the library interface directly, so
drop the shim population and reject reads of the property
unconditionally.
2026-08-26 15:28:18 +02:00
Sudeep Mohanty
052f444f32 change(test_apps): decouple netif_components from BUILD_COMPONENTS property
The BUILD_COMPONENTS build property only exists when building through the
Build system v1 compatibility shim. Query the executable library
interface's linked-components list instead, so the app does not depend on
compatibility-only properties.
2026-08-26 15:28:18 +02:00
Sudeep Mohanty
d519de14d1 change(test_apps): decouple g1_components from BUILD_COMPONENTS property
The BUILD_COMPONENTS build property only exists when building through the
Build system v1 compatibility shim. Query the executable library
interface's linked-components list instead, so the app does not depend on
compatibility-only properties.
2026-08-26 15:28:18 +02:00
Sudeep Mohanty
78d3f61757 change(test_apps): decouple g0_components from BUILD_COMPONENTS property
The BUILD_COMPONENTS build property only exists when building through the
Build system v1 compatibility shim. Query the executable library
interface's linked-components list instead, so the app does not depend on
compatibility-only properties.
2026-08-26 15:28:18 +02:00
Sudeep Mohanty
73bbe343ec fix(test_apps): drop obsolete esp_common dependency violations 2026-08-26 15:28:18 +02:00
harshal.patil
53c9439161 change(esp_hw_support): rework ESP32-H4 region protection to the application-owned layout
The bootloader programs only unlocked PMA entries (no PMP), so the layout is
not a bootloader<->application ABI; the application resets all entries, programs
them in ascending order from IRAM, and locks everything. Verified on ESP32-H4 v0.1.
2026-08-25 10:40:28 +05:30
harshal.patil
07debe6edc feat(esp_hw_support): Memory region protection for ESP32-H4 2026-08-25 10:40:28 +05:30
Roland Dobai
e37a7ae137 Merge branch 'feat/cmakev2-configdep' into 'master'
feat: Adopt rebuild optimization tool (configdep) in cmakev2

Closes IDF-15301

See merge request espressif/esp-idf!51263
2026-08-24 13:53:47 +02:00
Roland Dobai
502c3c305b Merge branch 'fix/mcp_subprocess_stdin' into 'master'
fix(tools): detach MCP tool subprocess stdin from JSON-RPC pipe

Closes IDFGH-18123

See merge request espressif/esp-idf!51872
2026-08-24 13:43:23 +02:00
Marius Vikhammer
b95b1bbf1f Merge branch 'bugfix/cmakev2-coredump-default-component' into 'master'
fix(cmakev2): include config-selected default components

See merge request espressif/esp-idf!49614
2026-08-21 10:16:27 +08:00