mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/confgen_rename_many_to_one' into 'master'
kconfig: update confgen to handle sdkconfig.rename with target specific markup Closes IDF-4544 See merge request espressif/esp-idf!16949
This commit is contained in:
commit
0ffeaf9350
@ -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_FOUR_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR
|
||||||
|
|
||||||
CONFIG_ESP_SYSTEM_PD_FLASH CONFIG_ESP_SLEEP_POWER_DOWN_FLASH
|
CONFIG_ESP_SYSTEM_PD_FLASH CONFIG_ESP_SLEEP_POWER_DOWN_FLASH
|
||||||
CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND
|
|
||||||
|
1
components/esp_hw_support/sdkconfig.rename.esp32c3
Normal file
1
components/esp_hw_support/sdkconfig.rename.esp32c3
Normal file
@ -0,0 +1 @@
|
|||||||
|
CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND
|
@ -1,21 +1,5 @@
|
|||||||
# sdkconfig replacement configurations for deprecated options formatted as
|
# sdkconfig replacement configurations for deprecated options formatted as
|
||||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
# 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
|
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_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_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_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
|
|
||||||
|
9
components/esp_system/sdkconfig.rename.esp32
Normal file
9
components/esp_system/sdkconfig.rename.esp32
Normal file
@ -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
|
5
components/esp_system/sdkconfig.rename.esp32c3
Normal file
5
components/esp_system/sdkconfig.rename.esp32c3
Normal file
@ -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
|
5
components/esp_system/sdkconfig.rename.esp32h2
Normal file
5
components/esp_system/sdkconfig.rename.esp32h2
Normal file
@ -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
|
11
components/esp_system/sdkconfig.rename.esp32s2
Normal file
11
components/esp_system/sdkconfig.rename.esp32s2
Normal file
@ -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
|
@ -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
|
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.
|
``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
|
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
|
3. ``confgen.py`` post-processes ``sdkconfig`` files and generates all build
|
||||||
outputs (``sdkconfig.h``, ``sdkconfig.cmake``, ``auto.conf``) by adding a list
|
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
|
of compatibility statements, i.e. value of the old option is set the value of
|
||||||
|
@ -631,6 +631,61 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
|
|||||||
git checkout -- sdkconfig.rename Kconfig
|
git checkout -- sdkconfig.rename Kconfig
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
echo "Can have multiple deprecated Kconfig options map to a single new option"
|
||||||
|
idf.py clean > /dev/null
|
||||||
|
rm -f sdkconfig.defaults
|
||||||
|
rm -f sdkconfig
|
||||||
|
echo "" > ${IDF_PATH}/sdkconfig.rename
|
||||||
|
idf.py reconfigure > /dev/null
|
||||||
|
echo "CONFIG_TEST_NEW_OPTION=y" >> sdkconfig
|
||||||
|
echo "CONFIG_TEST_OLD_OPTION_1 CONFIG_TEST_NEW_OPTION" >> ${IDF_PATH}/sdkconfig.rename
|
||||||
|
echo "CONFIG_TEST_OLD_OPTION_2 CONFIG_TEST_NEW_OPTION" >> ${IDF_PATH}/sdkconfig.rename
|
||||||
|
echo -e "\n\
|
||||||
|
menu \"test\"\n\
|
||||||
|
config TEST_NEW_OPTION\n\
|
||||||
|
bool \"test\"\n\
|
||||||
|
default \"n\"\n\
|
||||||
|
help\n\
|
||||||
|
TEST_NEW_OPTION description\n\
|
||||||
|
endmenu\n" >> ${IDF_PATH}/Kconfig
|
||||||
|
idf.py reconfigure > /dev/null
|
||||||
|
grep "CONFIG_TEST_OLD_OPTION_1=y" sdkconfig || failure "CONFIG_TEST_OLD_OPTION_1 should be in sdkconfig for backward compatibility"
|
||||||
|
grep "CONFIG_TEST_OLD_OPTION_2=y" sdkconfig || failure "CONFIG_TEST_OLD_OPTION_2 should be in sdkconfig for backward compatibility"
|
||||||
|
grep "#define CONFIG_TEST_OLD_OPTION_1 CONFIG_TEST_NEW_OPTION" build/config/sdkconfig.h || failure "sdkconfig.h should contain the compatibility macro"
|
||||||
|
grep "#define CONFIG_TEST_OLD_OPTION_2 CONFIG_TEST_NEW_OPTION" build/config/sdkconfig.h || failure "sdkconfig.h should contain the compatibility macro"
|
||||||
|
grep "set(CONFIG_TEST_OLD_OPTION_1 \"y\")" build/config/sdkconfig.cmake || failure "CONFIG_TEST_OLD_OPTION_1 should be in auto.conf for backward compatibility"
|
||||||
|
grep "set(CONFIG_TEST_OLD_OPTION_2 \"y\")" build/config/sdkconfig.cmake || failure "CONFIG_TEST_OLD_OPTION_2 should be in auto.conf for backward compatibility"
|
||||||
|
rm -rf sdkconfig sdkconfig.defaults build
|
||||||
|
pushd ${IDF_PATH}
|
||||||
|
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"
|
print_status "Confserver can be invoked by idf.py"
|
||||||
echo '{"version": 1}' | idf.py confserver || failure "Couldn't load confserver"
|
echo '{"version": 1}' | idf.py confserver || failure "Couldn't load confserver"
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@ function(__kconfig_component_init component_target)
|
|||||||
list(SORT kconfig)
|
list(SORT kconfig)
|
||||||
__component_set_property(${component_target} KCONFIG_PROJBUILD "${kconfig}")
|
__component_set_property(${component_target} KCONFIG_PROJBUILD "${kconfig}")
|
||||||
file(GLOB sdkconfig_rename "${component_dir}/sdkconfig.rename")
|
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)
|
list(SORT sdkconfig_rename)
|
||||||
__component_set_property(${component_target} SDKCONFIG_RENAME "${sdkconfig_rename}")
|
__component_set_property(${component_target} SDKCONFIG_RENAME "${sdkconfig_rename}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -18,6 +18,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
import gen_kconfig_doc
|
import gen_kconfig_doc
|
||||||
import kconfiglib
|
import kconfiglib
|
||||||
@ -43,7 +44,7 @@ class DeprecatedOptions(object):
|
|||||||
|
|
||||||
def _parse_replacements(self, repl_paths):
|
def _parse_replacements(self, repl_paths):
|
||||||
rep_dic = {}
|
rep_dic = {}
|
||||||
rev_rep_dic = {}
|
rev_rep_dic = defaultdict(list)
|
||||||
|
|
||||||
def remove_config_prefix(string):
|
def remove_config_prefix(string):
|
||||||
if string.startswith(self.config_prefix):
|
if string.startswith(self.config_prefix):
|
||||||
@ -68,11 +69,11 @@ class DeprecatedOptions(object):
|
|||||||
|
|
||||||
(dep_opt, new_opt) = (remove_config_prefix(x) for x in sp_line)
|
(dep_opt, new_opt) = (remove_config_prefix(x) for x in sp_line)
|
||||||
rep_dic[dep_opt] = new_opt
|
rep_dic[dep_opt] = new_opt
|
||||||
rev_rep_dic[new_opt] = dep_opt
|
rev_rep_dic[new_opt].append(dep_opt)
|
||||||
return rep_dic, rev_rep_dic
|
return rep_dic, rev_rep_dic
|
||||||
|
|
||||||
def get_deprecated_option(self, new_option):
|
def get_deprecated_option(self, new_option):
|
||||||
return self.rev_r_dic.get(new_option, None)
|
return self.rev_r_dic.get(new_option, [])
|
||||||
|
|
||||||
def get_new_option(self, deprecated_option):
|
def get_new_option(self, deprecated_option):
|
||||||
return self.r_dic.get(deprecated_option, None)
|
return self.r_dic.get(deprecated_option, None)
|
||||||
@ -128,10 +129,10 @@ class DeprecatedOptions(object):
|
|||||||
for sym in syms:
|
for sym in syms:
|
||||||
if sym.name in self.rev_r_dic:
|
if sym.name in self.rev_r_dic:
|
||||||
# only if the symbol has been renamed
|
# only if the symbol has been renamed
|
||||||
dep_name = self.rev_r_dic[sym.name]
|
dep_names = self.rev_r_dic[sym.name]
|
||||||
|
dep_names = [config.config_prefix + name for name in dep_names]
|
||||||
# config options doesn't have references
|
# config options doesn't have references
|
||||||
f_o.write(' - {}{}\n'.format(config.config_prefix, dep_name))
|
f_o.write(' - {}\n'.format(', '.join(dep_names)))
|
||||||
|
|
||||||
def append_config(self, config, path_output):
|
def append_config(self, config, path_output):
|
||||||
tmp_list = []
|
tmp_list = []
|
||||||
@ -142,8 +143,9 @@ class DeprecatedOptions(object):
|
|||||||
if item.name in self.rev_r_dic:
|
if item.name in self.rev_r_dic:
|
||||||
c_string = item.config_string
|
c_string = item.config_string
|
||||||
if c_string:
|
if c_string:
|
||||||
tmp_list.append(c_string.replace(self.config_prefix + item.name,
|
for dep_name in self.rev_r_dic[item.name]:
|
||||||
self.config_prefix + self.rev_r_dic[item.name]))
|
tmp_list.append(c_string.replace(self.config_prefix + item.name,
|
||||||
|
self.config_prefix + dep_name))
|
||||||
|
|
||||||
for n in config.node_iter():
|
for n in config.node_iter():
|
||||||
append_config_node_process(n)
|
append_config_node_process(n)
|
||||||
@ -392,10 +394,10 @@ def write_cmake(deprecated_options, config, filename):
|
|||||||
write('set({}{} "{}")\n'.format(prefix, sym.name, val))
|
write('set({}{} "{}")\n'.format(prefix, sym.name, val))
|
||||||
|
|
||||||
configs_list.append(prefix + sym.name)
|
configs_list.append(prefix + sym.name)
|
||||||
dep_opt = deprecated_options.get_deprecated_option(sym.name)
|
dep_opts = deprecated_options.get_deprecated_option(sym.name)
|
||||||
if dep_opt:
|
for opt in dep_opts:
|
||||||
tmp_dep_list.append('set({}{} "{}")\n'.format(prefix, dep_opt, val))
|
tmp_dep_list.append('set({}{} "{}")\n'.format(prefix, opt, val))
|
||||||
configs_list.append(prefix + dep_opt)
|
configs_list.append(prefix + opt)
|
||||||
|
|
||||||
for n in config.node_iter():
|
for n in config.node_iter():
|
||||||
write_node(n)
|
write_node(n)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user