esp-idf/tools
Frantisek Hrbata 1ca9e63e79 tools: add target consistency checks to cmake
Extend target checks in cmake, in case it's run directly and not via
idf.py or if idf.py misses something. This may happen
for example if cmake variables are set in project's CMakeLists.txt.

Some clean-ups are included along with the new checks and tests.

1. __target_check() function is removed. IIUC it should never fail,
   because the selected target is explicitly passed as environmental
   variable to kconfgen. Meaning the IDF_TARGET from environment variable may
   not be actually used in kconfgen if IDF_TARGET is already set it cmake cache.
   Note that the IDF_TARGET environment variable used for kconfgen is not
   based on the actual IDF_TARGET environment variable set for idf.py, but
   rather on the value set in __target_init() with

	set(IDF_TARGET ${env_idf_target} CACHE STRING "IDF Build Target")

   My understanding is that the original check was introduced to handle
   situation, where IDF_TARGET was already set in cmake's cache and
   the IDF_TARGET from environment variable was different. Since
   the kconfgen would use the original environment variable(not
   explicitly passed as it is now) the IDF_TARGET in cmake and in
   sdkconfig could differ. IOW I think the original check was introduced
   to cope with the following cmake behaviour

	set(VARIABLE "value1" CACHE STRING "test variable")
	set(VARIABLE "value2" CACHE STRING "test variable")
	message("Variable value: ${VARIABLE}")
	output: Variable value: value1

2. I scratched by head how it is possible that the following code
   in __target_check()

   	if(NOT ${IDF_TARGET} STREQUAL ${env_idf_target})

   could fail if IDF_TARGET is not set. For example in clean project

	IDF_TARGET=esp32 idf.py reconfigure

   Here env_idf_target==esp32 and IDF_TARGET is not set, so I would
   expect that cmake will fail with error message that the cache
   and env target do not match. The thing is that the variable
   evaluation is done before the if command, so it actually
   sees this

   	if(NOT  STREQUAL esp32)

   which is false and the error is not printed. It can be seen
   with 'cmake --trace-expand' command. I don't know if this
   was used on purpose or it worked just as a coincidence, but
   I find it very confusing, so I added explicit check if the
   IDF_TARGET is defined before the actual check. Same for
   CMAKE_TOOLCHAIN_FILE.

3. Error messages are not formated(line-wrapped) by cmake's markup
   so it's easier to check the output in tests.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-03-08 16:45:47 +01:00
..
ble feat: add requirements.ttfw.txt 2022-08-01 15:52:21 +08:00
catch Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
ci esp_rom: put rom cache related functions to cache.h 2023-03-07 14:51:24 +08:00
cmake tools: add target consistency checks to cmake 2023-03-08 16:45:47 +01:00
docker tools: Docker: add build-essentials needed for linux targets 2023-02-28 11:27:25 +01:00
esp_app_trace sys_view: upgrade to version 3.32 2023-01-24 00:26:58 +07:00
esp_prov docs: added documentation for wifi_ctrl endpoint and updated esp_prov readme 2022-11-01 14:19:01 +05:30
gen_soc_caps_kconfig build-system: include soc_caps defines into kconfig 2021-12-06 12:37:07 +08:00
idf_py_actions tools: add target consistency checks for target specified with -D option 2023-03-08 16:43:42 +01:00
idf_size_yaml tools: Fix esp32c2_data_info.yaml memory values to match documentation 2023-01-06 09:30:36 +00:00
kconfig_new tools: Move out kconfig_new in favour of using the esp-idf-kconfig package 2022-11-15 21:19:51 +01:00
ldgen TWDT: Use the new TWDT Kconfig options in the examples and tests 2023-02-17 11:22:25 +08:00
mass_mfg tools: remove the dependency on the future package 2022-08-09 16:46:58 +02:00
mocks linux-target: fixed driver mock being broken due to changes in driver folder structure 2023-02-15 11:16:51 +08:00
requirements feat(idf_monitor): move idf_monitor to separate repo 2023-02-03 11:20:15 +01:00
templates/sample_component add new command to idf 2020-09-21 23:38:52 +02:00
test_apps g0: resolve MMU_PAGE_SIZE not defined in g0 build issue 2023-02-22 12:37:40 +08:00
test_build_system tools: add target consistency checks to cmake 2023-03-08 16:45:47 +01:00
test_idf_py hints: add a more complete description for component not found errors 2022-12-06 10:54:44 +08:00
test_idf_size cxx: removed cxx experimental components 2023-01-25 12:34:58 +01:00
test_idf_tools Tools: Allow custom Python installation path with IDF_PYTHON_ENV_PATH 2023-02-14 17:26:04 +01:00
test_mkdfu mkdfu.py: Support setting flash parameters 2022-05-27 15:44:56 +02:00
test_mkuf2 idf.py: Change copyright in tools dir 2022-05-24 14:01:50 +02:00
unit-test-app esp-system: migrate test app cases to pytest 2023-03-01 03:21:39 +00:00
check_python_dependencies.py Tools: Improve the message for missing setuptools in the Python checker 2022-07-18 11:56:32 +02:00
check_term.py check_term: allow alacritty term 2022-05-19 11:10:59 +08:00
detect_python.fish Tools: Use default value in the Python detections scripts 2022-03-11 11:00:31 +01:00
detect_python.sh Tools: Use default value in the Python detections scripts 2022-03-11 11:00:31 +01:00
eclipse-code-style.xml tools: add code formatter rules for Eclipse 2016-11-03 18:41:00 +08:00
format-minimal.sh global: use '/usr/bin/env bash' instead of '/usr/bin/bash' in shebangs 2020-04-03 01:10:02 +02:00
format.sh global: use '/usr/bin/env bash' instead of '/usr/bin/bash' in shebangs 2020-04-03 01:10:02 +02:00
gdb_panic_server.py tools: gdb_panic_server: add esp32h2 2023-01-04 17:00:16 +01:00
gen_esp_err_to_name.py tool: skip test folder when generating esp_err_t table 2022-11-10 10:37:59 +08:00
generate_debug_prefix_map.py build: create BUILD_DIR/prefix_map_gdbinit when enable reproducible build 2021-10-26 10:55:00 +08:00
idf_monitor.py feat(idf_monitor): move idf_monitor to separate repo 2023-02-03 11:20:15 +01:00
idf_size.py Fix idf_size.py archives diff display when using the CSV output mode 2023-01-13 23:04:40 +01:00
idf_tools.py tools: add triplet i686-linux-gnu for distributions 2023-02-22 05:33:03 +00:00
idf.py Merge branch 'bugfix/ctrlc_port_detection' into 'master' 2023-01-27 16:51:26 +08:00
install_util.py Tools: --disable-* argument for removing features 2022-06-30 12:31:59 +02:00
mkdfu.py tools: remove the dependency on the future package 2022-08-09 16:46:58 +02:00
mkuf2.py Merge branch 'fix/flake8_v5_warnings' into 'master' 2022-08-12 23:27:14 +08:00
python_version_checker.py Tools: Fix silent failure about the incompatible Python 2022-02-16 18:44:13 +01:00
requirements_schema.json Tools: Make easier the detection of the list of Python features 2022-02-03 19:02:14 +01:00
requirements.json feat: add requirements.ttfw.txt 2022-08-01 15:52:21 +08:00
set-submodules-to-github.sh global: use '/usr/bin/env bash' instead of '/usr/bin/bash' in shebangs 2020-04-03 01:10:02 +02:00
split_paths_by_spaces.py tools: fixup version references related to paths with spaces 2022-05-02 19:05:47 +02:00
tools_schema.json tools: add esp-rom-elfs version '20220823' 2022-09-21 22:39:03 +04:00
tools.json tools: update toolchain version to 'esp-12.2.0_20230208' 2023-02-22 05:33:03 +00:00