From 23c55946a6caf67948071873b48c3f03c7ac1b6a Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 31 Jan 2022 10:53:59 +0800 Subject: [PATCH] kconfig: also parse target specific sdkconfig.rename.TARGET files Adds functionality for target specific sdkconfig.rename files which can be used when certain renames are only needed for a specific target. --- components/esp_hw_support/sdkconfig.rename | 1 - .../esp_hw_support/sdkconfig.rename.esp32c3 | 1 + components/esp_system/sdkconfig.rename | 18 ------------- components/esp_system/sdkconfig.rename.esp32 | 9 +++++++ .../esp_system/sdkconfig.rename.esp32c3 | 5 ++++ .../esp_system/sdkconfig.rename.esp32h2 | 5 ++++ .../esp_system/sdkconfig.rename.esp32s2 | 11 ++++++++ docs/en/api-reference/kconfig.rst | 2 +- tools/ci/test_build_system_cmake.sh | 26 +++++++++++++++++++ tools/cmake/kconfig.cmake | 3 +++ 10 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 components/esp_hw_support/sdkconfig.rename.esp32c3 create mode 100644 components/esp_system/sdkconfig.rename.esp32 create mode 100644 components/esp_system/sdkconfig.rename.esp32c3 create mode 100644 components/esp_system/sdkconfig.rename.esp32h2 create mode 100644 components/esp_system/sdkconfig.rename.esp32s2 diff --git a/components/esp_hw_support/sdkconfig.rename b/components/esp_hw_support/sdkconfig.rename index 2a76be137e..efc2e1f820 100644 --- a/components/esp_hw_support/sdkconfig.rename +++ b/components/esp_hw_support/sdkconfig.rename @@ -6,4 +6,3 @@ CONFIG_TWO_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_M CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR CONFIG_ESP_SYSTEM_PD_FLASH CONFIG_ESP_SLEEP_POWER_DOWN_FLASH -CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND diff --git a/components/esp_hw_support/sdkconfig.rename.esp32c3 b/components/esp_hw_support/sdkconfig.rename.esp32c3 new file mode 100644 index 0000000000..ae3dacc35e --- /dev/null +++ b/components/esp_hw_support/sdkconfig.rename.esp32c3 @@ -0,0 +1 @@ +CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND diff --git a/components/esp_system/sdkconfig.rename b/components/esp_system/sdkconfig.rename index 5dad89fa8f..4e3827fbb8 100644 --- a/components/esp_system/sdkconfig.rename +++ b/components/esp_system/sdkconfig.rename @@ -1,21 +1,5 @@ # sdkconfig replacement configurations for deprecated options formatted as # CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION -CONFIG_ESP32_PANIC CONFIG_ESP_SYSTEM_PANIC -CONFIG_ESP32_PANIC_PRINT_HALT CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT -CONFIG_ESP32_PANIC_PRINT_REBOOT CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT -CONFIG_ESP32_PANIC_SILENT_REBOOT CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT -CONFIG_ESP32_PANIC_GDBSTUB CONFIG_ESP_SYSTEM_PANIC_GDBSTUB -CONFIG_ESP32S2_PANIC CONFIG_ESP_SYSTEM_PANIC -CONFIG_ESP32S2_PANIC_PRINT_HALT CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT -CONFIG_ESP32S2_PANIC_PRINT_REBOOT CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT -CONFIG_ESP32S2_PANIC_SILENT_REBOOT CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT -CONFIG_ESP32S2_PANIC_GDBSTUB CONFIG_ESP_SYSTEM_PANIC_GDBSTUB -CONFIG_ESP32S2_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPROT_FEATURE -CONFIG_ESP32S2_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK -CONFIG_ESP32C3_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPROT_FEATURE -CONFIG_ESP32C3_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK -CONFIG_ESP32H2_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPROT_FEATURE -CONFIG_ESP32H2_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES CONFIG_ESP_SYSTEM_RTC_EXT_XTAL_BOOTSTRAP_CYCLES @@ -43,5 +27,3 @@ CONFIG_TASK_WDT_TIMEOUT_S CONFIG_ESP_TASK_WDT_TIME CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 CONFIG_ESP32_DEBUG_STUBS_ENABLE CONFIG_ESP_DEBUG_STUBS_ENABLE -CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP -CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP diff --git a/components/esp_system/sdkconfig.rename.esp32 b/components/esp_system/sdkconfig.rename.esp32 new file mode 100644 index 0000000000..c8b230b688 --- /dev/null +++ b/components/esp_system/sdkconfig.rename.esp32 @@ -0,0 +1,9 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_ESP32_PANIC CONFIG_ESP_SYSTEM_PANIC +CONFIG_ESP32_PANIC_PRINT_HALT CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT +CONFIG_ESP32_PANIC_PRINT_REBOOT CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT +CONFIG_ESP32_PANIC_SILENT_REBOOT CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT +CONFIG_ESP32_PANIC_GDBSTUB CONFIG_ESP_SYSTEM_PANIC_GDBSTUB +CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP diff --git a/components/esp_system/sdkconfig.rename.esp32c3 b/components/esp_system/sdkconfig.rename.esp32c3 new file mode 100644 index 0000000000..a724a1f41f --- /dev/null +++ b/components/esp_system/sdkconfig.rename.esp32c3 @@ -0,0 +1,5 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_ESP32C3_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPROT_FEATURE +CONFIG_ESP32C3_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK diff --git a/components/esp_system/sdkconfig.rename.esp32h2 b/components/esp_system/sdkconfig.rename.esp32h2 new file mode 100644 index 0000000000..bb411dbf12 --- /dev/null +++ b/components/esp_system/sdkconfig.rename.esp32h2 @@ -0,0 +1,5 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_ESP32H2_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPROT_FEATURE +CONFIG_ESP32H2_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK diff --git a/components/esp_system/sdkconfig.rename.esp32s2 b/components/esp_system/sdkconfig.rename.esp32s2 new file mode 100644 index 0000000000..ac3027174b --- /dev/null +++ b/components/esp_system/sdkconfig.rename.esp32s2 @@ -0,0 +1,11 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_ESP32S2_PANIC CONFIG_ESP_SYSTEM_PANIC +CONFIG_ESP32S2_PANIC_PRINT_HALT CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT +CONFIG_ESP32S2_PANIC_PRINT_REBOOT CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT +CONFIG_ESP32S2_PANIC_SILENT_REBOOT CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT +CONFIG_ESP32S2_PANIC_GDBSTUB CONFIG_ESP_SYSTEM_PANIC_GDBSTUB +CONFIG_ESP32S2_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPROT_FEATURE +CONFIG_ESP32S2_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK +CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP diff --git a/docs/en/api-reference/kconfig.rst b/docs/en/api-reference/kconfig.rst index 9d697fa62a..f9c9357931 100644 --- a/docs/en/api-reference/kconfig.rst +++ b/docs/en/api-reference/kconfig.rst @@ -67,7 +67,7 @@ Therefore, several features have been adopted to avoid this: 1. ``confgen.py`` is used by the tool chain to pre-process ``sdkconfig`` files before anything else, for example ``menuconfig``, would read them. As the consequence, the settings for old options will be kept and not ignored. 2. ``confgen.py`` recursively finds all ``sdkconfig.rename`` files in ESP-IDF directory which contain old and new - ``Kconfig`` option names. Old options are replaced by new ones in the ``sdkconfig`` file. + ``Kconfig`` option names. Old options are replaced by new ones in the ``sdkconfig`` file. Renames that should only appear for a single target can be placed in a target specific rename file: `sdkconfig.rename.TARGET`, where `TARGET` is the target name, e.g. `sdkconfig.rename.esp32s2`. 3. ``confgen.py`` post-processes ``sdkconfig`` files and generates all build outputs (``sdkconfig.h``, ``sdkconfig.cmake``, ``auto.conf``) by adding a list of compatibility statements, i.e. value of the old option is set the value of diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index 1f206c1899..1c34e6bacb 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -631,6 +631,32 @@ endmenu\n" >> ${IDF_PATH}/Kconfig git checkout -- sdkconfig.rename Kconfig popd + echo "Can have target specific deprecated Kconfig options" + idf.py clean + rm -f sdkconfig + echo "CONFIG_TEST_OLD_OPTION=y" > sdkconfig + echo "CONFIG_TEST_OLD_OPTION CONFIG_TEST_NEW_OPTION" >> ${IDF_PATH}/components/esp_system/sdkconfig.rename.esp32s2 + echo -e "\n\ + menu \"test\"\n\ + config TEST_NEW_OPTION\n\ + bool \"TEST_NEW_OPTION\"\n\ + default y\n\ + help\n\ + TEST_NEW_OPTION description\n\ + endmenu\n" >> ${IDF_PATH}/Kconfig + idf.py set-target esp32 > /dev/null + grep "CONFIG_TEST_OLD_OPTION=y" sdkconfig && failure "CONFIG_TEST_OLD_OPTION=y should NOT be in sdkconfig" + grep "CONFIG_TEST_NEW_OPTION=y" sdkconfig || failure "CONFIG_TEST_NEW_OPTION=y should be in sdkconfig" + rm -f sdkconfig + idf.py set-target esp32s2 > /dev/null + grep "CONFIG_TEST_OLD_OPTION=y" sdkconfig || failure "CONFIG_TEST_OLD_OPTION=y should be in esp32s2's sdkconfig for backward compatibility" + grep "CONFIG_TEST_NEW_OPTION=y" sdkconfig || failure "CONFIG_TEST_NEW_OPTION=y should be in sdkconfig" + rm -rf sdkconfig sdkconfig.defaults build + pushd ${IDF_PATH} + git checkout -- components/esp_system/sdkconfig.rename.esp32s2 Kconfig + popd + + print_status "Confserver can be invoked by idf.py" echo '{"version": 1}' | idf.py confserver || failure "Couldn't load confserver" diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index 53e88ddf33..c554fd7f49 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -22,6 +22,9 @@ function(__kconfig_component_init component_target) list(SORT kconfig) __component_set_property(${component_target} KCONFIG_PROJBUILD "${kconfig}") file(GLOB sdkconfig_rename "${component_dir}/sdkconfig.rename") + file(GLOB sdkconfig_rename_target "${component_dir}/sdkconfig.rename.${IDF_TARGET}") + + list(APPEND sdkconfig_rename ${sdkconfig_rename_target}) list(SORT sdkconfig_rename) __component_set_property(${component_target} SDKCONFIG_RENAME "${sdkconfig_rename}") endfunction()