Commit Graph

7388 Commits

Author SHA1 Message Date
Jiang Jiang Jian 94ace905b9 Merge branch 'feature/update_gdbstub_v6.0' into 'release/v6.0'
gdbstub: backport fixes (v6.0)

See merge request espressif/esp-idf!46200
2026-03-24 10:28:23 +08:00
Marius Vikhammer e741963f13 Merge branch 'ci/common-components-release-v6.0' into 'release/v6.0'
ci: update build-test-rules to use common_components (v6.0)

See merge request espressif/esp-idf!45547
2026-03-23 09:31:28 +08:00
Frantisek Hrbata fa14a9df47 Merge branch 'feat/cmakev2-backports-v6.0' into 'release/v6.0'
feat(cmakev2): sync pending v6.0 MRs for cmakev2

See merge request espressif/esp-idf!46778
2026-03-21 07:17:43 +01:00
igor.udot e2a8bbe639 ci: update build-test-rules to use common_components 2026-03-20 15:53:26 +08:00
igor.udot 6a0c25afec ci(sort_yaml): add mock common components 2026-03-20 15:53:26 +08:00
Frantisek Hrbata 8ed25711ac fix(cmakev2): remove stale test CMakeLists.txt missed by cherry-pick
The cherry-pick in the backport of \!46287 (test/buildv2_pytest_build_v6.0)
dropped the deletion of tools/cmakev2/test/CMakeLists.txt. The original MR
deleted all 15 files from the tools/cmakev2/test/ directory, but the
cherry-pick only captured 14 deletions. This commit removes the missed file.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:16:52 +01:00
Sudeep Mohanty ecdaae279f test(cmakev2): Remove old cmakev2/test directory, now replaced by buildv2 pytest suite
Made-with: Cursor
2026-03-20 08:16:52 +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
Frantisek Hrbata 53b684c00d fix(cmakev2/project): export build properties as variables for project_include.cmake
In cmake v1, __build_process_project_includes() exports all build
properties as CMake variables before including project_include.cmake
files. cmakev2 was missing this step, causing components like ULP that
reference build properties as CMake variables (e.g. ${SDKCONFIG_HEADER})
to receive empty values.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:16:52 +01:00
Frantisek Hrbata cdbc0244e0 fix(cmakev2/kconfig): add public aliases for sdkconfig output properties
The cmakev2 kconfig module sets sdkconfig output paths using internal
property names (__SDKCONFIG_HEADER, __SDKCONFIG_CMAKE, etc.), but
components like ULP read the public names (SDKCONFIG_HEADER,
SDKCONFIG_CMAKE). This results in empty values being passed to the ULP
sub-project, causing its CMake configure step to fail.

Add public aliases matching the cmake v1 property names for backward
compatibility.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:16:52 +01:00
Sudeep Mohanty 700c86d0c9 fix(cmakev2): Defer idf_component_optional_requires linking to library build time
This commit introduces a new build property, __OPTIONAL_REQUIRES_MODE,
and uses it to either defer or link immediately, optional requirements
to components that request such linkage via the
idf_component_optional_requires() function in build system v2. The
DEFERRED mode is intended for single-binary projects where in the linking
of optional components happens after the library target is created the
dependency graph is available to the build system, thereby allowing it to
behave like the v1 version of the function.
2026-03-20 08:13:27 +01:00
Sudeep Mohanty 88bd665422 test(cmakev2): add POST_ELF build event callback test 2026-03-20 08:13:27 +01:00
Sudeep Mohanty ded543e561 feat(cmakev2): Add build event callback framework for components
Introduce a callback mechanism that lets components register CMake
functions to be called at specific points in the build lifecycle.

Currently, this framework only supports registering callbacks to be
called after the executable target is created, i.e, the POST_ELF phase
of the build but before the binary target is created.
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
Sudeep Mohanty d782a2c4eb feat(cmakev2): add idf_build_get_compile_options and use in compat and component
Add idf_build_get_compile_options() to aggregate COMPILE_OPTIONS,
C_COMPILE_OPTIONS, CXX_COMPILE_OPTIONS, and ASM_COMPILE_OPTIONS build
properties with generator expressions. Replace internal
__get_compile_options(OUTPUT ...) usage in idf_component_register and
idf_component_include with the new public function.
2026-03-20 08:13:26 +01:00
Sudeep Mohanty c4fcce84cc fix(cmakev2): add --cref with MAPFILE_TARGET and remove global -Wl,--cref
When MAPFILE_TARGET is used in idf_build_executable, add the linker
--cref option so the cross-reference table is written to the map file
instead of stdout. Remove the global -Wl,--cref from default link
options in project.cmake so cref is only applied where a map file
is requested.
2026-03-20 08:13:26 +01:00
Frantisek Hrbata 22626469de fix(cmakev2/utilities): add a dependency target for the embedded file
Currently, embedded files can be added in two ways. First, by calling
the `target_add_binary_data` function directly within a component.
Second, by passing `EMBED_FILES` or `EMBED_TXTFILES` to
`idf_component_register`, or in cmakev2 by setting the `EMBED_FILES` or
`EMBED_TXTFILES` component properties.

The source file for an embedded file is generated using
`add_custom_command`. When the embedded file is added directly in the
component's CMakeLists.txt file by using the `target_add_binary_data`
function, the `add_custom_command` command is evaluated in the same
directory context where the component target is created. As a result,
the generated embedded file can be used automatically as a file
dependency in component's sources.

However, when an embedded file is added via `idf_component_register` or
by setting the component property, the call to `add_custom_command`
inside `target_add_binary_data` occurs after the component has been
evaluated, specifically after the `add_subdirectory` call, within
`idf_component_include`. This means it is not created in the same
directory context as the component's target. In this case, the embedded
file dependency is not added to the component's target, and the embedded
file is not generated. This behavior is described in the
`add_custom_command` documentation [1].

   > A target created in the same directory (CMakeLists.txt file)
   > that specifies any output of the custom command as a source
   > file is given a rule to generate the file using the command at
   > build time.

To fix this issue, an explicit custom target for the generated embedded
file is created and added as a dependency of the component's target,
ensuring that the file is generated correctly.

[1] - https://cmake.org/cmake/help/latest/command/add_custom_command.html

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +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 ac3217a9e4 fix(cmakev2/compat): change idf_component_optional_requires behavior
The idf_component_optional_requires compatibility function in cmakev2
currently attempts to mimic the behavior of cmakev1 by adding a
dependency only if a component is already included in the build. In
cmakev1, this is handled by checking the BUILD_COMPONENTS list, which is
created during an early evaluation phase. Because cmakev2 removed this
early phase to allow for configuration-based component dependencies, the
build system does not inherently know which components will be part of
the build beforehand. To compensate, the current compatibility function
relies on the TARGET_EXISTS generator expression to determine if a
component should be linked.

This approach poses a problem because generator expressions are not
evaluated until the generation phase, but cmakev2 processes linker
scripts during the configuration phase by recursively scanning targets
linked to a library. Because the scanner does not recognize and cannot
evaluate generator expressions, any component linked optionally through
generator expression is skipped. If that component carries a linker
script, the script is never added to the library interface, resulting in
build failures. Since cmakev2 aims to support multiple libraries, a
component might also exist globally, causing TARGET_EXISTS to evaluate
to true, yet still be missed during a specific library's recursive scan,
leading to the same omission of necessary linker scripts.

To resolve this, the implementation of idf_component_optional_requires
is changed to check if a component is known to the build system in
COMPONENTS_DISCOVERED build property. If so, it is explicitly included
and linked directly via its interface target. While this may pull more
components into a build than the previous generator expression method,
potentially increasing build times, it ensures that dependency trees are
fully visible to the library target scanner. This serves as a practical
middle ground that maintains compatibility with existing components and
ensures build stability. This approach allows for the gradual fixing of
idf_component_optional_requires usage in components for cmakev2, with
the eventual goal of removing its usage in cmakev2 entirely.

This change also fixes cases where idf_component_optional_requires is
used to conditionally add requirements based on configuration options.
In cmakev2, the presence of a configuration option does not guarantee[1]
that a component has been included via add_subdirectory, unlike the
behavior in cmakev1. With this change even constructions like

```cmake
if(CONFIG_VFS_SUPPORT_IO)
    idf_component_optional_requires(PRIVATE vfs)
endif()
```

will now work in cmakev2, as the updated idf_component_optional_requires
explicitly includes the required component if it is available to the
build system.

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

[1] https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system-v2.html#id9

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
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
Frantisek Hrbata b56b3547f5 fix(cmakev2/build): extend idf_build_generate_metadata to also accept executable
Currently, idf_build_generate_metadata only accepts binary targets for
which it generates metadata (project_description.json). On Linux
targets, binary images are not generated, but we still need to generate
project_description.json. Extend the current function to accept both
executable and binary targets and ensure project_description.json is
generated when a Linux target is used.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata 60e46a1b3f fix(cmakev2/compat): display empty components as excluded into menuconfig
Some components simply return when included in a build for the Linux
target. This is silently ignored in the `idf_component_include`, and the
component interface target is linked as requirement in
`idf_component_register`. This has the side
effect of such components being reported as included, with their
configuration displayed in the menuconfig for included components,
rather than in the submenu for excluded components. For example, the
`bt` component, if added as a dependency in `idf_component_register`,
will be displayed in menuconfig as an included component for Linux
target. The `idf_component_include` function sets the component's
`COMPONENT_REAL_TARGET` property to `NOTFOUND` in such situations. Use
this information when config.env is generated put such components into
excluded submenu. Note that we cannot avoid linking empty component interface
into library, because there might be recursive dependencies and at the
time when the component is included we might not now if it has a real
target or not.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata 82a063957a fix(cmakev2/project): generate binaries only if esptool_py component is present
Currently, the CONFIG_APP_BUILD_GENERATE_BINARIES option is used to
determine whether binary images will be generated in
idf_project_default. At present, this option is enabled even for the
Linux target, where the esptool_py component is not included, preventing
the generation of binary images. To address this issue, verify if the
target for esptool_py is present.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata 5e9e17ef09 fix(cmakev2/idf): fix IDF_TOOLCHAIN build property for linux target
The IDF_TOOLCHAIN build property is currently incorrectly set to the
default `gcc` value for the linux target, whereas it should be empty.
This misconfiguration causes confusion for components like `soc`, which
adjust toolchain options based on the
IDF_TOOLCHAIN(CONFIG_IDF_TOOLCHAIN_GCC) build property's setting.

When sdkconfig is generated, the IDF_TOOLCHAIN build property is passed
as an environmental variable to kconfgen, and the CONFIG_IDF_TOOLCHAIN
configuration option is set based on this variable. Additionally, the
CONFIG_IDF_TOOLCHAIN_GCC and CONFIG_IDF_TOOLCHAIN_CLANG configuration
options are set accordingly. Subsequently, CONFIG_IDF_TOOLCHAIN_GCC is
used in several places, such as `components/soc/project_include.cmake`,
to configure the toolchain (compiler flags) by invoking functions from
`tools/cmake/toolchain_flags.cmake`, which is included only for
non-linux targets. As a result the configuration fails, because
functions from `tools/cmake/toolchain_flags.cmake` are not available on
linux target.

Since the IDF_TOOLCHAIN cmake cache variable is actually set in the
`tools/cmake/toolchain.cmake` file, the IDF_TOOLCHAIN build property
should be set after the toolchain is initialized in cmakev2's project
initialization. Note that each toolchain file, except for linux,
includes `toolchain.cmake`, which in turn includes
`toolchain_flags.cmake`. This means the IDF_TOOLCHAIN cmake cache
variable is set for every target except linux, because the toolchain
file for linux is empty. As a result CONFIG_IDF_TOOLCHAIN is empty and
CONFIG_IDF_TOOLCHAIN_GCC not set as for cmakev1.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Frantisek Hrbata 50876225a3 fix(cmakev2/component): use component interface in dependency chain
The dependency chain currently tracks component names that are included
recursively with `idf_component_include`. However, these component names
can be ambiguous because a component may be referenced by different
names, such as with a namespace. Additionally, `idf_component_include`
can accept anything that `__get_component_interface` accepts, meaning
even the component interface target can be used to include the component
in the build. To uniquely identify each component, use component
interface targets instead of names in the dependency chain.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
Chen Yudong 374063a60e fix: use iperf-cmd for example esp_ble_mesh/wifi_coexist 2026-03-20 15:05:14 +08:00
Chen Yudong 56065ee399 feat(example): update iperf examples 2026-03-20 15:05:14 +08:00
Jiang Jiang Jian 7a9362c9c8 Merge branch 'fix/cmake_flags_passing_to_external_project_v6.0' into 'release/v6.0'
fix(build): fix passing CMAKE_<LANG>_FLAGS from ExternalProject_Add (v6.0)

See merge request espressif/esp-idf!46651
2026-03-20 10:47:26 +08:00
Jiang Jiang Jian d6000ccecd Merge branch 'feat/use_common_config_to_sel_crypt_lib_v6.0' into 'release/v6.0'
Feat/use common config to sel crypt lib (v6.0)

See merge request espressif/esp-idf!46408
2026-03-20 10:39:59 +08:00
Jiang Jiang Jian c2dec1e7e2 Merge branch 'feature/update-openocd-to-v0.12.0-esp32-20260304_v6.0' into 'release/v6.0'
feat(tools): update openocd version to v0.12.0-esp32-20260304 (v6.0)

See merge request espressif/esp-idf!46363
2026-03-20 10:39:33 +08:00
Jiang Jiang Jian d8c022123d Merge branch 'fix/ai_idf_ver_fallback_when_no_git_v6.0' into 'release/v6.0'
fix(cmake): Fall back to version from components when git describe fails (v6.0)

See merge request espressif/esp-idf!46027
2026-03-20 10:34:25 +08: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
Jiang Jiang Jian 6c1ab48431 Merge branch 'fix/coredump_test_tcb_corrupted_v6.0' into 'release/v6.0'
test(espcoredump): fix test for corrupted TCB handling in coredump (v6.0)

See merge request espressif/esp-idf!44834
2026-03-20 10:21:26 +08:00
Marius Vikhammer 613f8eaaed Merge branch 'feat/esp_hal_sdmmc_v6.0' into 'release/v6.0'
sd: esp_hal_sd component (v6.0)

See merge request espressif/esp-idf!45623
2026-03-20 10:04:21 +08:00
Fu Hanxi beaaa115f3 Merge branch 'ci/missing_config_pre_commit_hook_v6.0' into 'release/v6.0'
ci: add pre-commit hook to detect missing configs (v6.0)

See merge request espressif/esp-idf!46205
2026-03-20 01:10:09 +01:00
Roland Dobai 96ad888b93 Merge branch 'feat/add_ar_binaries_v6.0' into 'release/v6.0'
feat(tools): Added cmake and ninja arm binaries (v6.0)

See merge request espressif/esp-idf!46559
2026-03-19 14:59:41 +01:00