mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
029c4135ee
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>