Commit Graph

164 Commits

Author SHA1 Message Date
Fu Hanxi
fa4a2bfb83 ci(windows): fix fetch submodule path issue 2026-09-03 20:25:13 +02:00
Fu Hanxi
ddb9fd017c ci: apply idf-ci 1.x 2026-09-03 20:24:50 +02:00
Roland Dobai
186ce4d6b5 Merge branch 'fix/windows_tests_v6.0' into 'release/v6.0'
ci(tools): Fix Windows pytest_build_system idf_copy gitlinks and log_cli hang (v6.0)

See merge request espressif/esp-idf!52334
2026-09-03 16:00:30 +02:00
Roland Dobai
6fee1abe82 Merge branch 'fix/kconfig_test_format_v6.0' into 'release/v6.0'
fix: KConfig test output format (v6.0)

See merge request espressif/esp-idf!52367
2026-09-03 11:11:14 +02:00
Roland Dobai
d6ccd2a7df Merge branch 'feature/use_zcmp_by_default_v6.0' into 'release/v6.0'
feat(build): add ZCMP workaround post-build check (v6.0)

See merge request espressif/esp-idf!51326
2026-09-03 09:36:29 +02:00
Daniel Paul
700bd3dd8d fix: KConfig test output format 2026-09-03 09:14:19 +02:00
Jakub Kocka
3bde59c969 refactor(tools): Addressed pre-commit findings 2026-09-02 18:15:04 +02:00
Jakub Kocka
4450c2946b 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-02 15:17:46 +02:00
Martin Vychodil
a017026fc1 fix(test_build_system): require components in ioctl overlap checker tests
Wire esp_blockdev, comp_a, and comp_b into the test app dependency graph
so ioctl def files are registered and the POST_BUILD overlap checker runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit ddc9c5fc40)
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-08-05 16:00:45 +02:00
Alexey Lapshin
fbaf869fb9 feat(build): add RISC-V ZCMP post-link workaround check
Validate linked RISC-V executables when
CONFIG_COMPILER_ENABLE_RISCV_ZCMP is enabled on affected chips.
Disassemble each function and reject mstatus.MIE clears that lack an
earlier mintthresh write of 0xff.

Handle csrrci, csrrw, and register-mask csrrc patterns while ignoring
csrrs. Add build-only coverage for valid and invalid sequences with
CMake v1 and v2.

Stop the hardware stack guard before switching stacks during restart,
and keep ZCMP disabled for TEE test apps that still require the
workaround.
2026-07-30 12:14:54 +07:00
Tomáš Rohlínek
0188e1fe7b feat(esp_blockdev): add build-time ioctl command reservation overlap checker
(cherry picked from commit a9f545bcea)
2026-06-30 16:53:44 +02:00
Roland Dobai
31260fd35e Merge branch 'fix/cmakev2_manager_seed_known_components_v6.0' into 'release/v6.0'
fix(cmakev2/manager): seed known_components for namespace rewrite (v6.0)

See merge request espressif/esp-idf!48686
2026-06-29 07:42:02 +02:00
Marek Fiala
b6872d32a0 feat(tools): Visibly grouped custom extension actions in idf.py --help 2026-05-29 10:52:17 +02:00
Frantisek Hrbata
534674859a fix(cmakev2/manager): seed known_components for namespace rewrite
When a component's manifest declared a managed dep `<ns>/<name>` and the
project had a local `components/<name>` shadowing it, configure failed
with `IDF: Failed to resolve component '<ns>__<name>'`.

cmakev1 does a project-wide injection so the manager's _choose_component
sees every component name in known_components and rewrites the
namespaced dep to its locally-shadowing short name. cmakev2 invokes the
manager per component with a single-component requirements file, so
known_components has only one entry and the rewrite cannot fire --
`<ns>__<name>` is written verbatim into MANAGED_REQUIRES and the
force-include at component.cmake:995 aborts.

Seed the per-component requirements file with one __COMPONENT_SOURCE
entry per discovered component so handle_project_requirements() builds
the same known_components list cmakev1 produces. The seeded entries are
inert on the cmake side -- the __component_set_property shim ignores
__COMPONENT_SOURCE -- they exist purely to feed the manager's rewrite.

Add a regression test in tools/test_build_system/buildv2/test_component.py.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-05-19 11:38:39 +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
Sudeep Mohanty
0b6d4ce6be test(cmakev2): verify IDF_TOOLCHAIN is propagated to sdkconfig
Add a buildv2 test that reconfigures the test app with both GCC and
clang toolchains and asserts that the selected IDF_TOOLCHAIN value
is propagated to sdkconfig. The clang case is skipped when a clang
compiler is not available in PATH.
2026-04-17 15:38:25 +02:00
Jiang Jiang Jian
c9dd3aca0b Merge branch 'fix/cmakev2_component_manager_disabled_v6.0' into 'release/v6.0'
fix(cmakev2): skip component manager flow when IDF_COMPONENT_MANAGER=0 (v6.0)

See merge request espressif/esp-idf!46954
2026-03-25 19:16:35 +08:00
Roland Dobai
7341f0564b feat(cmake): Create a merged hints database in the build directory 2026-03-24 19:23:22 +01:00
Frantisek Hrbata
4e767b9a26 test(cmakev2): add test for build with IDF_COMPONENT_MANAGER=0
Verify that setting IDF_COMPONENT_MANAGER=0 skips the component manager
flow entirely and produces a successful build. The test also asserts that
no "Component manager round" messages appear in the output, confirming
the manager loop is not entered.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-24 08:10:14 +01:00
Sudeep Mohanty
e945cf4542 test(cmakev2): Add pytest test for multi-binary build support
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
88bf72287d test(cmakev2): Add pytest tests for v1-to-v2 migration and utility APIs
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
cbdafbe8ed test(cmakev2): Assert ELF output in Linux target build test
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
03f8206021 test(cmakev2): Expand pytest tests for v2 Kconfig and sdkconfig behavior
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
93b9873b24 test(cmakev2): Add pytest tests for v2 component model
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
1fe8175099 test(cmakev2): Add pytest tests for build APIs
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
3ebada72a6 test(cmakev2): Add pytest tests for project APIs 2026-03-20 08:16:52 +01:00
Sudeep Mohanty
7b37db5276 test(cmakev2): Add placeholder hooks to buildv2_test_app
Made-with: Cursor
2026-03-20 08:16:52 +01:00
Sudeep Mohanty
88bd665422 test(cmakev2): add POST_ELF build event callback test 2026-03-20 08:13:27 +01:00
Sudeep Mohanty
2ebd9c19b7 test(buildv2): enable test_cmake.py for cmakev2
Add buildv2 path and option handling for idf_as_lib, import_lib, and
related tests. Use cmakev2 examples when running with buildv2.
2026-03-20 08:13:27 +01:00
Sudeep Mohanty
735a2b2f21 test(buildv2): skip test_post_elf_dependency for cmakev2
Post-ELF dependency API is not used in cmakev2; component callback method
replaces this. Skip the test when running buildv2.
2026-03-20 08:13:27 +01:00
Sudeep Mohanty
b9de1d70c0 test(buildv2): skip test_spaces bundles not yet ported to buildv2 2026-03-20 08:13:27 +01:00
Sudeep Mohanty
d6b030c71d refactor(test_spaces): ruff formatting to test_spaces.py 2026-03-20 08:13:27 +01:00
Frantisek Hrbata
9d19eba6e2 fix(test_build_system): add __init__.py to buildv2 test directory
Pytest's default import mode (prepend/rootdir) imports test modules as
top-level modules keyed by filename. When two directories contain test
files with the same basename (e.g. test_sdkconfig.py in both
test_build_system/ and test_build_system/buildv2/), pytest tries to
register both as the module name "test_sdkconfig". The second collection
fails with "import file mismatch" because the module object already
cached in sys.modules points to the first file.

Adding __init__.py to the buildv2/ directory makes it a proper Python
package. Pytest then imports its test modules under the package
namespace (buildv2.test_sdkconfig), which is distinct from the
top-level test_sdkconfig, resolving the collision.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata
2aacc2ad0c fix(cmakev2/kconfig): preserve sdkconfig options from managed components
The sdkconfig file may contain configuration options defined in Kconfig
files of managed components. Since kconfgen runs before the component
manager fetches these components, the Kconfig definitions for managed
component options are not yet available. The kconfgen --output config
flag regenerates sdkconfig from kconfiglib's internal state, which only
knows about options with loaded Kconfig definitions. This causes unknown
options (i.e., those from managed components) to be silently dropped
from sdkconfig during intermediate regeneration rounds.

Note that kconfgen's --config flag (used for reading sdkconfig) only
performs deprecated option name replacement and does NOT drop unknown
options. The problem is exclusively in --output config, which writes a
fresh sdkconfig from the parsed Kconfig tree state.

Fix this by introducing a __SDKCONFIG_ORIG build property that provides
an indirection layer for the --config input path:

- Before the component manager runs: __SDKCONFIG_ORIG points to a copy
  of the original sdkconfig (build/sdkconfig.orig), created by the new
  __create_sdkconfig_orig_copy() function. This copy preserves all
  original options, including those from managed components.

- During intermediate kconfgen runs: --config reads from the preserved
  copy (so unknown options survive as input), while --output config
  writes to the real sdkconfig (unknown options may be dropped there,
  but this is harmless since kconfgen always reads from the copy).

- After the component manager completes: __SDKCONFIG_ORIG is reset to
  point to the real sdkconfig and __BASE_KCONFGEN_CMD is rebuilt, so
  that subsequent operations (menuconfig, save-defconfig, confserver)
  read and write the actual sdkconfig file directly.

The flow is:

  __create_sdkconfig_orig_copy()
    -> __SDKCONFIG_ORIG = build/sdkconfig.orig

  __generate_sdkconfig()
    -> --config build/sdkconfig.orig --output config project/sdkconfig

  __fetch_components_from_registry():
    loop:
      download_components()
      __generate_sdkconfig()
        -> --config build/sdkconfig.orig --output config project/sdkconfig
      if success: break
    endloop
    -> __SDKCONFIG_ORIG = project/sdkconfig
    -> rebuild __BASE_KCONFGEN_CMD

  idf_create_menuconfig() / save-defconfig / confserver
    -> uses --config project/sdkconfig (the real file)

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Sudeep Mohanty
5c141ea8c1 test(cmakev2): Enable test_build_loadable_elf for buildv2
Remove the buildv2_skip marker from test_build_loadable_elf.
2026-03-20 08:13:26 +01:00
Frantisek Hrbata
4f18ef68d4 feat(test_build_system): add buildv2 test for linux target build
Add a simple test to verify that the buildv2_test_app can be built for
the Linux target.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata
2abd858e61 feat(test_build_system): allow buildv2 specific tests
Currently, cmakev2 is being tested only in backward-compatible mode by
using the existing cmakev1 tests with the cmakev2 test application. We
also need to add tests specific to cmakev2, and it is convenient to
reuse the existing build system testing framework. Let's add a `buildv2`
subdirectory to the existing `tools/test_build_system` directory and use
the `pytest_collection_modifyitems` hook to ignore tests in this
directory unless the `--buildv2` option is used.

Without the `--buildv2` option, only the existing cmakev1 tests are
executed and tests in `buildv2` directory are skipped. With the
`--buildv2` option, the existing cmakev1 tests run with the cmakev2
testing application for backward compatibility testing, and all cmakev2
tests within the `buildv2` subdirectory are also executed.

Note: we cannot use the `pytest_ignore_collect` hook, because the
`--buildv2` option is not known to the pytest, so the
`config.getoption('--buildv2', False)` returns always False. We would
likely need to add the `--buildv2` option in the conftest.py in the
esp-idf root directory.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>

fix: lsadjf las jflasjfl aslfsald asl fsadlf sladsal jfsadfas

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata
4c0566361e feat(test_build_system): add pytest header whether buildv1 or buildv2 is running
This adds a clear header to the pytest output, indicating which build
system version is currently being tested.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Jiang Jiang Jian
ea413ed78b Merge branch 'fix/minimal_build_no_main_v6.0' into 'release/v6.0'
fix(build): ensure the main component exists when MINIMAL_BUILD is enabled (v6.0)

See merge request espressif/esp-idf!45915
2026-03-20 10:32:22 +08:00
Sudeep Mohanty
ef533fb495 fix(cmakev2): Fixed test_hint_components_loading for buildv2
The test_hint_components_loading fails for buildv2 because the build
system only links the main component but not the components with the
hints.yml. Updated the test to explicitly include the new components in
the build.
2026-02-18 13:56:01 +01:00
Marek Fiala
16c766097c test(tools): Added test for coponent hints loading 2026-02-18 13:54:58 +01:00
Frantisek Hrbata
1e5d8fbf82 fix(build): ensure the main component exists when MINIMAL_BUILD is enabled
The minimal build property is simply a shorthand for `set(COMPONENTS
main)`. The issue is that there is currently no check to verify whether
the `main` component actually exists or is known to the build system.
If the `main` component is not present, print an error message along
with suggestions on how to fix this inconsistency.

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

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-02-17 06:59:55 +01:00
Sudeep Mohanty
5a91508507 test(cmakev2): Enabled component validation tests for cmakev2 2025-12-19 15:33:19 +01:00
Alexey Gerenkov
d8e47c5e43 Merge branch 'feature/dynamic_flags_in_toolchain_cmake_v6.0' into 'release/v6.0'
feat(build): propagate compiler flags from files to toolchain.cmake (v6.0)

See merge request espressif/esp-idf!43499
2025-11-21 16:19:34 +08:00
Sudeep Mohanty
c3658a495e test(cmakev2): Enable test_build_uf2 for buildv2 CI tests 2025-11-19 14:45:55 +05:30
Sudeep Mohanty
e28a2262f3 test(cmakev2): Enable test_build_dfu for buildv2 CI tests 2025-11-19 14:45:55 +05:30
Sudeep Mohanty
55de37fbf1 test(cmakev2): Enable test_rebuild.py for buildv2 CI tests
The test_rebuild_no_changes test verifies that running idf.py build
successively without any file changes results in identical build
artifacts on the second run (i.e., nothing gets rebuilt).

This test was failing in buildv2 because it expected kconfig_menus.json
to be present in build/config/ after a normal build. However, in
cmakev2, kconfig_menus.json is not generated during regular builds.

In cmakev1, kconfig_menus.json was generated globally during every
build alongside other config files (sdkconfig.h, sdkconfig.cmake, etc).

In cmakev2, kconfig_menus.json generation does not happend for
normal builds because it depends on the Kconfig menu hierarchy
and cannot be generated globally. It must be generated per-executable.

Hence, this commit updates the artefacts list for cmakev2 to not expect
the kconfig_menus.json file during a build/re-build action.
2025-11-19 14:45:55 +05:30
Alexey Lapshin
cbe44f2e33 fix(test): fix tests according to the new toolchain flags 2025-11-19 01:12:40 +07:00
hebinglin
b113517e70 feat(esp_hw_support): support lp uart wakeup during sleep v6.0 2025-11-06 19:25:20 +08:00
Roland Dobai
36d7618208 Merge branch 'feat/cmakev2_v6.0' into 'release/v6.0'
feat(cmakev2): introduce cmake-based build system v2 (v6.0)

See merge request espressif/esp-idf!43078
2025-11-04 18:02:10 +01:00