Commit Graph

194 Commits

Author SHA1 Message Date
Alexey Lapshin
77420a6f78 Merge branch 'feature/use_zcmp_by_default' into 'master'
feat(build): add ZCMP workaround post-build check

See merge request espressif/esp-idf!49764
2026-07-28 14:00:37 +04:00
Alexey Lapshin
631ad9033c 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-22 13:04:20 +07:00
Daniel Paul
ee93f899c2 chore: Remove old root managed components tests 2026-07-21 16:01:27 +02:00
Renz Christian Bagaporo
faca8f56a3 Merge branch 'feat/cmakev2_ulp_full_subproject' into 'master'
feat(ulp): initial support for building ULP projects as full subprojects under CMake v2

See merge request espressif/esp-idf!50134
2026-07-16 21:00:32 +08:00
Marek Fiala
8c08c75f48 feat(tools): adopt esp-pylib for idf.py logging and errors
Migrate idf.py and its actions to the shared esp-pylib library:
- add esp-pylib (and esp-pylib[ide]) to the core/ide requirements
- base FatalError on esp_pylib.errors.FatalError, keeping the idf.py ctx cleanup
- replace the local raw-ANSI helpers (red_print/yellow_print/print_warning/
  color_print) with esp_pylib.logger.log (warn/err/note/hint) across the
  idf.py actions
- install esp_pylib exception reporting at the idf.py entry point and silence
  the logger during shell completion
- update affected tests for the new prefixes/line wrapping
- add normalize_output() helper and unify terminal env in conftest to handle
  Rich line-wrapping in CI assertions

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 20:19:07 +08:00
Renz Bagaporo
7d75f85221 feat(ulp): build ULP full subprojects as CMake v2 children 2026-07-15 09:14:35 +09:00
Martin Vychodil
2573bf3988 Merge branch 'feat/bdl_ioctl_checker' into 'master'
feat(esp_blockdev): add build-time ioctl command reservation overlap checker

Closes IDF-15799

See merge request espressif/esp-idf!49670
2026-06-19 12:40:28 +08:00
Martin Vychodil
ddc9c5fc40 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>
2026-06-18 15:57:04 +02:00
Tomáš Rohlínek
a9f545bcea feat(esp_blockdev): add build-time ioctl command reservation overlap checker 2026-06-16 11:38:22 +02:00
Jan Beran
4b12e9a132 fix: update version of esp-idf-configdep in tools.json 2026-06-11 11:05:10 +02:00
Jakub Kocka
2e5d930e6b fix(tools): Windows builds when paths contain spaces (prefix_map, ldgen, CI)
- Harden prefix_map.cmake for paths with spaces on Windows

- ldgen: fragments-list-file, list normalization, CMake integration (tools/cmake + cmakev2)

- CI exclude list for check_tools; test_spaces bundle tweak

Made-with: Cursor
2026-06-04 14:45:05 +08:00
Roland Dobai
941bc94ec6 Merge branch 'feat/generate_per_component_headers' into 'master'
feat(kconfig): add support for per option based build optimization

Closes IDF-8957

See merge request espressif/esp-idf!41966
2026-06-02 19:46:09 +02:00
Jan Beran
3abb4c095b test: add esp-idf-configdep integration tests
Add build-level tests verifying configdep selective rebuild behavior:
- test_configdep.py: selective rebuild (only affected .obj rebuilt) and
  ELF string verification after Kconfig toggle
- test_rebuild_configdep.py: full rebuild graph tests with configdep enabled,
  including the two-build "settle" pattern for .cdep stub timestamps

Place the configdep test app in tools/test_build_system/configdep_test_app/
alongside the build system test infrastructure. Split configdep-specific
rebuild coverage from pure CMake/Ninja rebuild tests (test_rebuild.py runs
with configdep disabled via a module-local idf_py fixture).
2026-06-02 01:26:10 +08:00
Marek Fiala
f8799b8bba feat(tools): idf.py --help custom CMake targets rich-click style 2026-06-01 20:07:27 +08:00
Marek Fiala
4bc7d30fd4 feat(tools): Visibly grouped custom extension actions in idf.py --help 2026-06-01 20:07:27 +08:00
Tomas Rezucha
232035071e feat(tools): Add 'check' field to idf.py actions 2026-05-27 19:06:10 +02:00
Frantisek Hrbata
9b6aefc567 Merge branch 'fix/cmakev2_manager_seed_known_components' into 'master'
fix(cmakev2/manager): seed known_components for namespace rewrite

See merge request espressif/esp-idf!48453
2026-05-19 11:38:19 +02:00
Roland Dobai
9bea09a081 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 14:06:40 +08:00
Frantisek Hrbata
10c799105f 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-14 08:56:31 +02:00
Jakub Kocka
c040c3f840 ci(tools): Fixed git worktree copy 2026-05-13 14:55:21 +02:00
Marius Vikhammer
64b1eeda3b Merge branch 'ci/deprecate_template_app' into 'master'
ci(build): remove esp-idf-template dependency, use in-tree test apps

See merge request espressif/esp-idf!47737
2026-05-07 16:48:10 +08:00
Frantisek Hrbata
11f73606cb test(cmakev2): skip idf.py --help CMake custom targets tests under buildv2
Two tests added in commit c21d05e612 (MR !46354 "Added cmake target
listing in help") fail under pytest_buildv2_system /
pytest_buildv2_system_win:

  * test_idf_py_help_after_configure_with_no_custom_targets_has_no_section
  * test_idf_py_help_lists_cmake_custom_targets_after_configure

The tests assert that internal phony build targets do not appear
under "CMake Custom Targets" in idf.py --help. Filtering is driven
by tools/idf_py_actions/help_custom_targets_skip.py, whose exact-name
allowlist and shape policy were calibrated against cmakev1 target
names. cmakev1 either hard-codes the names ("app_check_size") or
uses a prefix already covered by HELP_PHONY_NAME_PREFIXES
("gen_<project>_binary"), so v1 stays out of the section.

cmakev2 parameterizes the same logical targets by the project name
in tools/cmakev2/build.cmake and tools/cmakev2/project.cmake and
produces, for project "build_test_app":

  build_test_app_binary
  build_test_app_binary_check_size
  build_test_app_mapfile
  build_test_app.map
  ldgen_libraries.in_library_build_test_app

None of these match the v1-shaped allowlist or shape policy, so
both tests fail on every cmakev2 project rather than only on this
test app. Skip them under buildv2 with @pytest.mark.buildv2_skip
to unblock CI while a more robust filtering strategy is worked out.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-04-30 17:47:42 +02:00
Marius Vikhammer
c06bf7de44 ci(build): removed and replaced template with regular test-apps 2026-04-29 15:21:30 +08:00
Fu Hanxi
03af8a9f0e Merge branch 'ci/use-windows-vm' into 'master'
ci: windows tests with VM

See merge request espressif/esp-idf!47238
2026-04-28 12:46:47 +02:00
Jakub Kocka
d715ed0244 Merge branch 'feat/create-project_c++' into 'master'
feat(tools): Added create-project argument to allow cpp project creation

Closes IDFGH-15480

See merge request espressif/esp-idf!47373
2026-04-28 17:37:03 +08:00
Jakub Kocka
c21d05e612 feat(tools): Added listing of CMake custom targets in idf.py --help 2026-04-28 09:46:35 +02:00
Jakub Kocka
fb02854ad6 feat(tools): Added create-project argument to allow cpp project creation
Closes https://github.com/espressif/esp-idf/issues/16121
2026-04-28 09:24:20 +02:00
Marek Fiala
8a5cd0a285 test: fix setuptools auto-discovery failure on Windows vm 2026-04-27 12:41:53 +02:00
Sergei Silnov
52edbc934d Merge branch 'fix/test_project_components_overrides_extra_components' into 'master'
fix: test_managed_components_overrides_idf_components

Closes IDFCI-10153

See merge request espressif/esp-idf!47182
2026-04-20 14:44:33 +02:00
Frantisek Hrbata
4cd39bc28f Merge branch 'feat/ldgen_skip_generation' into 'master'
feat(ldgen): skip generation when section names unchanged

Closes IDFGH-17454

See merge request espressif/esp-idf!47278
2026-04-20 11:06:07 +02:00
Sudeep Mohanty
4b139455a8 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 13:56:42 +02:00
Frantisek Hrbata
e4fa15b50a feat(ldgen): cache parsed fragment files
Profiling shows that parsing the linker fragment (.lf) files with
pyparsing is the single largest cost in ldgen (~58% of total runtime).
parse_fragment_file() rebuilds its grammar from scratch on every call
because the conditional parser closure has to capture sdkconfig to
evaluate if/elif/else at parse time.

Add a cache that pickles the parsed FragmentFile object list to
<output>.lfcache. The cache is keyed on fragment file paths+mtimes
plus sdkconfig and kconfig mtimes — sdkconfig is included because
fragment if/elif/else blocks are evaluated against it at parse time.

This avoids the pyparsing cost on rebuilds where ldgen has to run
but the fragment files themselves are unchanged — for example when
a function is added or removed in a source file. Cache hits produce
the same sections.ld as a full parse, and any pickle load failure
falls through to a normal parse, so cache corruption or a Python
upgrade cannot produce a wrong build.

Print "Skipping linker fragment parsing, fragment files unchanged"
on the lf cache hit path so build logs show when the optimization
fired — this makes it easy to diagnose user reports of unexpected
ldgen behavior.

The LDGEN_NO_CACHE environment variable disables the lf cache. When
set, ldgen falls through to a normal parse without consulting or
writing the cache file.

Measured on wifi_station (205 libs, 67 .lf files), median of 10 runs:

                                          before   after
  rebuild, section change, .lf unchanged   5.82s   1.34s

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-04-08 11:51:20 +02:00
Frantisek Hrbata
e1f43e15b7 feat(ldgen): skip generation when section names unchanged
After running objdump on all libraries, extract section names from the
stored raw output using regex and compute a fingerprint (MD5 hash of
section names + mtimes of fragment files, sdkconfig, and kconfig).

If the fingerprint matches the cached value from the previous run,
skip the expensive pyparsing + generation step entirely and touch
the output file to update its timestamp. The fingerprint file is
stored next to the output (e.g. sections.ld.fingerprint) in the build
directory.

This avoids the pyparsing bottleneck for the common case of editing
function bodies without adding or removing symbols — section names
in the object files are unchanged, so the generated sections.ld
would be identical. When sections do change, the full generation
runs and the fingerprint is updated.

Print "Skipping linker script generation, section names unchanged"
on the fingerprint hit path so build logs show when the optimization
fired. This makes it easy to diagnose user reports of unexpected
ldgen behavior — the build log directly shows whether the cache was
used.

Add an LDGEN_NO_CACHE environment variable to disable the cache as a
workaround in case the optimization causes problems. When set, ldgen
prints "Linker script generation caches disabled by LDGEN_NO_CACHE"
and runs full generation as before, leaving any existing fingerprint
file untouched.

Measured on wifi_station (205 libs, 67 .lf files), median of 10 runs:

                                       before   after
  rebuild, section names unchanged      5.82s   0.82s

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

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-04-08 10:26:55 +02:00
Daniel Paul
166bdcee87 fix: test_project_components_overrides_extra_components 2026-04-01 17:22:17 +02:00
Frantisek Hrbata
76e7ea2ba5 fix(cmakev2): skip root component tests until cmakev2 support is added
The TestIdfRootDependency tests (test_basic_build,
test_build_only_when_required, test_cleanup_unused) were introduced in
MR 39704 to validate the idf_extra_components.yml root dependency
feature. This feature relies on component manager integration that is
not yet implemented in the cmakev2 build system, causing all three
tests to fail when run with --buildv2.

Skip these tests for cmakev2 using the buildv2_skip marker until root
components support is added (IDF-14259).

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-26 16:30:15 +01:00
Daniel Paul
914d32c101 Merge branch 'feat/move-cjson-to-root-dep' into 'master'
feat: support moving idf components to component registry

Closes PACMAN-1102

See merge request espressif/esp-idf!39704
2026-03-25 18:10:42 +08:00
Roland Dobai
0459417fed Merge branch 'feat/add_merged_hints_to_build' into 'master'
Build & Config: Create a merged hints database in the build directory

Closes IDF-15480

See merge request espressif/esp-idf!46861
2026-03-25 07:47:41 +01:00
Frantisek Hrbata
927fc8d03a 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-23 16:02:36 +01:00
Roland Dobai
f46452d3ab feat(cmake): Create a merged hints database in the build directory 2026-03-23 09:24:45 +01:00
Sudeep Mohanty
aa67c578fb test(cmakev2): Add pytest test for multi-binary build support
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
a1306a094c test(cmakev2): Add pytest tests for v1-to-v2 migration and utility APIs
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
d6b1fd56a4 test(cmakev2): Assert ELF output in Linux target build test
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
f00d5db927 test(cmakev2): Expand pytest tests for v2 Kconfig and sdkconfig behavior
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
3f477b9d80 test(cmakev2): Add pytest tests for v2 component model
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
c2cba58409 test(cmakev2): Add pytest tests for build APIs
Made-with: Cursor
2026-03-18 09:25:12 +01:00
Sudeep Mohanty
4d15351959 Merge branch 'test/buildv2_pytest_project' into 'master'
test(cmakev2): Add pytest tests for project APIs

See merge request espressif/esp-idf!46286
2026-03-18 07:50:54 +01:00
Marius Vikhammer
4e000a41d5 docs(test_build_system): add supported targets table to kconfig_test_app README
The check-all-apps-readmes pre-commit hook detected that
kconfig_test_app/README.md was missing the supported targets table.
Added the full table including esp32h21, esp32h4, and esp32s31.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-18 10:40:13 +08:00
Fu Hanxi
c360d8be98 feat: support moving idf components to component registry
and mark it as root dependency
2026-03-17 21:02:49 +08:00
Jakub Kocka
31b36e4428 fix(ci): Fixed Tools related CI tests 2026-03-16 12:55:57 +01:00
Sudeep Mohanty
e53d8e9a74 test(cmakev2): Add pytest tests for project APIs 2026-03-16 10:57:26 +01:00