Commit Graph

220 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Jan Beran
8b213b517d feat: Adopt rebuild optimization tool (configdep) in cmakev2 2026-08-20 15:57:10 +08:00
Marius Vikhammer
5c0facdaba fix(cmakev2): include config-selected default components 2026-08-20 11:09:58 +08:00
Marius Vikhammer
71ec4f2699 Merge branch 'fix/buildv2_ldgen_template_rebuild_test' into 'master'
fix(test_build_system): fix ldgen template rebuild test for build system v2

See merge request espressif/esp-idf!51732
2026-08-20 11:08:46 +08:00
Daniel Paul
7e6fc433cc chore: Pin the testing versions of components 2026-08-18 20:51:54 +08:00
Daniel Paul
39de6e1429 fix: Kconfig test - Make assertion whitespace-insensitive 2026-08-18 20:51:54 +08:00
Daniel Paul
b764f073ac feat: Consume root-managed components from IDF Component Manager 2026-08-18 20:51:54 +08:00
Jakub Kocka
5889cba730 ci(tools): Fix worktree submodule copy of gitlink files 2026-08-17 11:53:09 +02:00
Sudeep Mohanty
5f546d080a fix(test_build_system): fix ldgen template rebuild test for build system v2
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 07:59:40 +02:00
Frantisek Hrbata
a9de9dc172 Merge branch 'fix/ldgen_template_fingerprint' into 'master'
fix(ldgen): add the linker template to the generation fingerprint

See merge request espressif/esp-idf!51620
2026-08-10 08:31:03 +02:00
Frantisek Hrbata
5d4e96aeb8 fix(ldgen): add the linker template to the generation fingerprint
ldgen skips regeneration when a fingerprint over the section names, the
linker fragment files, sdkconfig and Kconfig is unchanged. The linker
script template was not part of that fingerprint, even though everything
outside its mapping placeholders is copied into the generated script
verbatim.

The build system regenerates the preprocessed template whenever any of
its inputs changes, not only when a linker fragment changes. When such a
change reaches ldgen but leaves the section names alone, the fingerprint
still matches, generation is skipped, and the image is linked against the
previously generated script. The skip path updates the mtime of the
output, so nothing in the build output shows that the change was dropped.

Add the template to the fingerprint so that regenerating it always
regenerates the linker script.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-08-07 10:39:10 +02:00
Renz Bagaporo
dfc3f54445 test(cmake): verify included linker scripts trigger preprocessing 2026-08-06 09:18:13 +09:00
Alexey Gerenkov
72732994ef Merge branch 'feature/enable_atomic_lock_policy_on_riscv' into 'master'
feat(build): add CONFIG_COMPILER_CXX_ATOMIC_LOCK_POLICY option

See merge request espressif/esp-idf!49913
2026-08-04 20:05:40 +08:00
Renz Bagaporo
1f5cba3070 fix(ulp): clarify buildv2 child marker
Rename the internal ULP child-build marker to __ULP_BUILDV2 so component CMake files make the build-system scope explicit.

Document that the marker is currently set only by the IDF_BUILD_V2 ULP child path.
2026-07-29 13:08:23 +09:00
Renz Bagaporo
83cdcc1da3 fix(ulp): use builtin v2 project for legacy embed
Route ulp_embed_binary() through a built-in CMake v2 default ULP project instead of generating a compatibility project with a synthetic main component.

Attach legacy ULP sources directly to the ULP executable, pass the parent component include view through the existing ULP_S_SOURCES/COMPONENT_* channel, and remove the generated legacy project templates plus the component path ownership validation bypass they required.

Update the build-system coverage to assert that the builtin child project builds and rebuilds when parent-owned ULP sources change.
2026-07-29 13:08:23 +09:00
Renz Bagaporo
dc813d91ea test(build_system): fix buildv2 pytest coverage
Allow the reconfigure test to assert the buildv2 activation message when pytest runs with --buildv2.

Make the ULP API probe use CMake-friendly forward-slash paths and an explicit ULP toolchain/custom-toolchain setting so the direct cmake configure works on Windows as well as Linux.
2026-07-29 13:08:23 +09:00
Renz Bagaporo
48374cb8fa test(build_system): add CMake v2 ULP legacy shim coverage 2026-07-29 13:08:22 +09:00
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
b3ae652f21 feat(build): add CONFIG_COMPILER_CXX_ATOMIC_LOCK_POLICY option
libstdc++ selects between a lock-free and a mutex-based policy for
std::shared_ptr reference counting based on this macro. Enabling this
option forces the lock-free policy, which avoids pulling in the
mutex-based implementation and can reduce code size.

Note: the lock-free policy avoids embedding a mutex in each control
block, saving about 88 bytes per shared_ptr, and improves performance
by using atomic operations instead of mutex locking.

Note: this option changes the ABI of libstdc++ atomic/shared_ptr
helpers. It can be incompatible when linking against prebuilt
libraries that were compiled without it, leading to link errors or
undefined runtime behavior. Only enable it if all C++ objects and
libraries in the build use the same setting.
2026-07-23 18:20:25 +07: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