Commit Graph

68 Commits

Author SHA1 Message Date
Vojtech Piroch
6e0fc71aed 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-07 14:48:25 +02:00
Fu Hanxi
ddb9fd017c ci: apply idf-ci 1.x 2026-09-03 20:24:50 +02:00
Marek Fiala
85a6c1d8c1 fix(tools): support mcp Python SDK 2.0 for mcp-server
FastMCP was renamed to MCPServer in mcp 2.0, which made idf.py mcp-server
report a false "MCP dependencies not available" error. Prefer MCPServer
and keep a FastMCP fallback for mcp 1.x.

Closes https://github.com/espressif/esp-idf/issues/18904

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 15:36:43 +02:00
Aditya Patwardhan
aa70f6de09 fix(esp-tls): update secure element build hint for PSA integration
(cherry picked from commit 5f1074045f)
2026-07-09 11:17:03 +05:30
Aditya Patwardhan
9c1dcca1af fix(esp-tls): address MR review comments for SE PSA driver
- esp_tls_mbedtls: require cert when PSA-backed server/client key is set
- esp_tls_mbedtls: drop redundant pk_init/x509_crt_init (calloc handles it)
- psa SE driver: copy callbacks/opaque_key by value (no lifetime coupling)
- psa SE driver: replace atomic CAS with simple null check on register
- psa SE driver: use sig_len from sign callback with bounds validation
- psa SE driver: validate pubkey_len returned by export_pubkey callback
- psa SE driver: check hash sub-alg in RSA PKCS1V15 branch of validate_request
- psa SE driver: align secure_element_register_callbacks doc with value-copy impl
- esp_https_server: initialize server_key in HTTPD_SSL_CONFIG_DEFAULT
- mbedtls: move SECURE_ELEMENT_DRIVER_ENABLED to esp_config.h for parity
  with ESP_ECDSA_DRIVER_ENABLED; drop target_compile_definitions
- docs: fix esp_tls_cfg_t -> esp_http_client_config_t cross-reference
- docs: check psa_import_key() status in ESP-TLS PSA example
- hints/error_output: point at CONFIG_MBEDTLS_SECURE_ELEMENT_DRIVER_ENABLED

(cherry picked from commit 08b567ef3b)
2026-07-09 11:17:02 +05:30
Roland Dobai
1c097b7acd Merge branch 'feat/replace_click_witch_rich_click_v6.0' into 'release/v6.0'
feat(tools): Replaced click with rich_click (v6.0)

See merge request espressif/esp-idf!49021
2026-06-29 07:37:36 +02:00
Marek Fiala
56fb3657a2 feat(tools): Improved verification of ESP-IDF project
Closes https://github.com/espressif/esp-idf/issues/18675
2026-06-25 09:14:01 +02:00
Marek Fiala
14d3b3cbc0 feat(tools): mcp-server added create-project tool 2026-06-25 09:14:01 +02:00
Marek Fiala
a2adc0ab1e feat(tools): mcp-server accepts project_dir from chat
At the same time, it's possible to start idf.py mcp-server
outside ESP-IDF project directory.

Added ESP-IDF mcp server tests
2026-06-25 09:14:01 +02:00
Marek Fiala
007e0139d7 feat(tools): Replaced click with rich_click 2026-05-29 10:52:09 +02:00
Roland Dobai
29dcff2cdc fix(tools): seed IDF_VERSION before idf.py parses dependencies.lock
Any idf.py invocation could hang indefinitely with no output while
spawning an unbounded chain of "idf.py --version" subprocesses,
eventually exhausting system memory.

During init_cli(), idf.py parses the project's dependencies.lock to
vet trusted component-provided idf_ext.py extensions. If the lock
contains a component whose manifest has an "if: idf_version" clause,
evaluating it calls idf-component-manager's _get_idf_version(). Outside
a CMake build the IDF_VERSION environment variable is not set, so that
function falls back to running "idf.py --version" as a subprocess,
which re-enters init_cli() and recurses without bound.

During a normal CMake build the component manager runs as a subprocess
that already has IDF_VERSION in its environment (see build/config.env),
so the fallback is never reached. The recursion happens only because
idf.py runs component-manager code in-process during its own CLI
startup, outside that context.

Seed IDF_VERSION into os.environ early in init_cli(), before any
dependencies.lock parsing, using the subprocess-free
idf_version_from_cmake() helper. This gives in-process component-manager
code the same IDF_VERSION a CMake build would provide.
2026-05-15 16:30:46 +02:00
Roland Dobai
77c5324b09 Merge branch 'fix/env_locale_check_v6.0' into 'release/v6.0'
Locale encoding check (v6.0)

See merge request espressif/esp-idf!44133
2025-12-11 15:02:59 +01:00
Jakub Kocka
73cfe97054 fix: Improved encoding requirement check
Closes https://github.com/espressif/esp-idf/issues/17542
2025-12-11 08:48:57 +01:00
Peter Dragun
0aa6daf04d fix(tools/idf.py): Add implicit dependencies to flash targets 2025-12-08 21:40:14 +08:00
Marek Fiala
a46f5a1022 Revert "fix: Updated locale handling to prevent issues with build tools"
This reverts commit 7e09b471ab.
2025-11-03 18:09:17 +01:00
Jakub Kocka
7e09b471ab fix: Updated locale handling to prevent issues with build tools
Closes https://github.com/espressif/esp-idf/issues/17542
2025-10-17 09:58:44 +02:00
Marek Fiala
854f6b0a3e fix(test_idf_py): Added extension API version into test extensions files 2025-10-02 15:37:29 +02:00
Marek Fiala
248c3a996e change(test_idf_py): ruff formatting idf_ext.py & some_ext.py 2025-10-02 15:34:31 +02:00
Peter Dragun
9eb07f92ba docs: Update unify and update espefuse command outputs 2025-09-30 15:28:55 +02:00
Peter Dragun
e3198fff3c feat: Update esptool to v5 2025-09-30 15:28:55 +02:00
Roland Dobai
5dad2a4884 ci(test): Improve test failures on Windows
Tests are made cancellable and to print STDOUT and STDERR upon failures.
2025-09-24 13:43:23 +02:00
Roland Dobai
ef878f4d25 ci(test): Test requiring pexpect.spawn cannot be run on Windows 2025-09-24 13:43:23 +02:00
Roland Dobai
9e8962c6cc change(tools): Fix pre-commit checks for test_idf_qemu.py 2025-09-24 13:43:23 +02:00
Roland Dobai
26ae9e8589 ci(gitlab): Split up Windows tests into (more) parallel jobs 2025-09-24 13:43:23 +02:00
Jakub Kocka
2affbb9509 refactor(tools): Updated tests to corespond with massage changes 2025-08-26 13:50:45 +02:00
Peter Dragun
eba6b814ba feat: Add support for esptool v5 and keep v4 for now 2025-08-21 15:53:39 +02:00
Marek Fiala
9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
Marek Fiala
d7faae9ae4 change(tools): ruff formating test_hints.py 2025-08-19 14:44:31 +02:00
Fu Hanxi
87a5aedb85 ci: disable idf-ci plugin
this plugin will be re-enabled with compatible code in !38755
2025-06-03 08:37:56 +02:00
Ashish Sharma
4c23ba3c1f feat(security): update idf.py extensions to support security feature application 2025-03-17 18:23:14 +08:00
Alexey Lapshin
48a49c8154 feat(debugging): move gdbinit generation to CMake
This feature is useful for 3rd-party software to run GDB with predefined
options that described in project_description.json file

allow to pass custom options to "idf.py gdb":

  --gdb-commands: command line arguments for gdb. (without changes)
  -ex: pass command to gdb.
  -x: pass gdbinit file to gdb. Alias for old --gdbinit command
2024-11-19 16:41:38 +07:00
Jan Beran
d77d1f5a95 fix(uf2): Ignore ESPBAUD, ESPPORT when calling idf.py uf2[-app] 2024-09-23 15:48:59 +02:00
harshal.patil
e5f22521da docs(secure_boot_v2): Mention idf.py and openssl commands to generate and verify signatures
- Adds support for verify_signature command in idf.py

Closes https://github.com/espressif/esptool/issues/942
2024-08-27 15:44:05 +05:30
Radim Karniš
4ccdc51b07 ci(espefuse_test): Comply with esptool v4.8 2024-08-22 16:12:16 +02:00
Ivan Grokhotkov
0773caf283 Merge branch 'feature/idf_py_efuse_qemu' into 'master'
feat(idf.py): support efuse-related commands in QEMU

Closes QEMU-193

See merge request espressif/esp-idf!29809
2024-08-21 16:13:54 +08:00
Ivan Grokhotkov
7b228ce8ab feat(idf.py): allow running idf.py efuse-* commands with QEMU 2024-08-15 16:57:08 +02:00
Ivan Grokhotkov
c521fcb6fd fix(cmake): report correct error on unknown component name
Previously the error message was

CMake Error at /home/user/esp-idf/tools/cmake/build.cmake:296 (__component_get_property):
  __component_get_property Function invoked with incorrect arguments for
  function named: __component_get_property
Call Stack (most recent call first):
  /home/user/esp-idf/tools/cmake/build.cmake:341 (__build_resolve_and_add_req)
  /home/user/esp-idf/tools/cmake/build.cmake:638 (__build_expand_requirements)
  /home/user/esp-idf/tools/cmake/project.cmake:710 (idf_build_process)
  CMakeLists.txt:6 (project)

Now it will be:

CMake Error at /home/user/esp-idf/tools/cmake/build.cmake:298 (message):
  Failed to resolve component 'whatever' required by component 'main'.
Call Stack (most recent call first):
  /home/user/esp-idf/tools/cmake/build.cmake:345 (__build_resolve_and_add_req)
  /home/user/esp-idf/tools/cmake/build.cmake:642 (__build_expand_requirements)
  /home/user/esp-idf/tools/cmake/project.cmake:710 (idf_build_process)
  CMakeLists.txt:6 (project)

Also improved the hint to show the component name in quotes.
2024-08-12 17:54:44 +02:00
Jan Beran
832c3f265a fix: Generate secure keys in project dir instead of build dir 2024-06-28 12:36:49 +02:00
Jan Beran
b286105d5f feat: Add unit tests for new wrapper commands 2024-06-24 10:56:10 +02:00
Frantisek Hrbata
fbe8bf89ee fix: properly resolve component dependencies
There is currently a bug in the __build_resolve_and_add_req function in
tools/cmake/build.cmake where the check for registered component
requirements is incorrectly applied to the component itself rather than
its dependencies. This issue likely originated from a typo, using
component_target instead of _component_target. To prevent further
confusion, _component_target has been renamed to _req_target.

Fixing this revealed multiple incorrect dependencies for the Linux
target, which have now been resolved by explicitly specifying the
dependencies for the Linux target.

Closes https://github.com/espressif/esp-idf/issues/13447

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2024-05-30 22:01:55 +08:00
Marek Fiala
a97e355e74 feat(tools): Run Tools related host tests on Win 2024-02-02 14:58:04 +01:00
Frantisek Hrbata
a773072734 fix: harden input parsing in component_requirements hint module
Currently we silently ignore when the original component is not found
in a hope we can provide at least some meaningful hint. As it turned
out it's not true. Instead of providing misleading hint, just return
error. This adds several checks for situations, which should not happen,
but when they do it should be easier to identify the root cause of the
problem.

For example when hint module received malformed output with extra new
lines, e.g. caused by a bug in RunTool, it wrongly reported the original
component as source component.

This should also fix the tests on Windows.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2024-01-23 18:22:08 +01:00
Ivan Grokhotkov
71153c7dbb feat(tools): add 'idf.py qemu' extension
This extension allows running programs in QEMU similar to running
them on a real chip:

- 'idf.py qemu' — builds and runs the program in QEMU. User gets
  a QEMU instance launched, and can work with it as a normal QEMU
  instance.
- 'idf.py qemu monitor' — same, but QEMU is launched in the
  background, and idf_monitor runs in the foreground, showing QEMU
  output. Compared to only running 'idf.py qemu' this enables, for
  example, automatic backtrace decoding.
- 'idf.py qemu gdb' — launches QEMU in the background and opens an
  interactive GDB prompt, connecting it to QEMU.
- 'idf.py qemu --gdb monitor' and 'idf.py gdb' in another shell:
  launches QEMU in the background, keeps it suspended until GDB is
  connected, and opens idf_monitor. GDB can be used in another shell
  to debug the application.
2023-12-03 07:45:19 +01:00
Roland Dobai
bc1d74bb88 fix(ci): Remove unittest-xml-reporting dependency from host tests 2023-11-30 14:03:41 +01:00
Roland Dobai
51b104deac Merge branch 'feat/all_components' into 'master'
feat(tools): display hints for projects with trimmed down list of components

Closes IDF-8005 and IDF-8316

See merge request espressif/esp-idf!26297
2023-10-16 17:40:12 +08:00
Darian Leung
2b357071f1 refactor(freertos/task_snapshot): Deprecate task_snapshot.h
This commit deprecates the `#include "freertos/task_snapshot.h" include path:

- Adds compatibility header with compile time warning
- Removes hints related to `task_snapshot.h`
- Adds entry to migration guide
2023-10-07 18:55:47 +08:00
Frantisek Hrbata
64d82b54bc feat(hints): use all_component_info from project_description.json
Currently the component_requirements hint module does not work
as expected if the component list for a project is trimmed down.
With the new "all_component_info" dictionary info in project_description.json,
the module can produce hints even if cmake's COMPONENTS variable is
set.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-10-02 16:24:41 +02:00
Frantisek Hrbata
00d77e7a75 fix(hints): properly identify source component
If there is a component(child) within a component(parent), like for test_apps, the parent
component may be wrongly identified as source component for the failed include. This may
lead to a false bug report if the parent component has component, which provides the missing
header, in requirements.

Fix this by looking for the longest matching source component directory.

Suggested-by: Ivan Grokhotkov <ivan@espressif.com>
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-09-27 12:50:25 +02:00
Frantisek Hrbata
c5503b3537 ci(tools): fix test_hints.py to run on windows
1. The original test, before hint modules support was added, used
tempfile.NamedTemporaryFile in a way which is not supported on windows.
It was having the file open, which the hints tried to read it, leading
the EPERM exception. The docs[1] says this is not supported.
<quote>
Whether the name can be used to open the file a second time, while the
named temporary file is still open, varies across platforms (it can be
so used on Unix; it cannot on Windows)
</quote>

2. The hint module component_requirements test used the idf.py directly,
which is idf.py.exe on windows.Now it's starting idf.py through python.
We could probably used shell=True, but this approach is used in other
tests too.

Anyway the test are now passing on windows.

[1] https://docs.python.org/3/library/tempfile.html

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-08-05 20:13:28 +02:00
Frantisek Hrbata
801bf0053d ci(tools): add tests for component_requirements.py hints module
Following tests were added.

1. Test for missing header directory in component's INCLUDE_DIRS
2. Test for missing dependency in component's PRIV_REQUIRES
3. Test for missing dependency in component's REQUIRES
4. Test for dependency in PRIV_REQUIRES which should be in REQUIRES

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-08-05 20:13:28 +02:00