Merge branch 'bugfix/regenerate_sdkconfig_fails' into 'master'
Fix issues with regenerating sdkconfig on modification Closes #58 See merge request idf/esp-idf!4115
This commit is contained in:
commit
58acac883d
|
@ -97,7 +97,6 @@ confgen_args = [sys.executable,
|
||||||
"../../tools/kconfig_new/confgen.py",
|
"../../tools/kconfig_new/confgen.py",
|
||||||
"--kconfig", "../../Kconfig",
|
"--kconfig", "../../Kconfig",
|
||||||
"--config", temp_sdkconfig_path,
|
"--config", temp_sdkconfig_path,
|
||||||
"--create-config-if-missing",
|
|
||||||
"--env", "COMPONENT_KCONFIGS={}".format(" ".join(kconfigs)),
|
"--env", "COMPONENT_KCONFIGS={}".format(" ".join(kconfigs)),
|
||||||
"--env", "COMPONENT_KCONFIGS_PROJBUILD={}".format(" ".join(kconfig_projbuilds)),
|
"--env", "COMPONENT_KCONFIGS_PROJBUILD={}".format(" ".join(kconfig_projbuilds)),
|
||||||
"--env", "IDF_PATH={}".format(idf_path),
|
"--env", "IDF_PATH={}".format(idf_path),
|
||||||
|
|
|
@ -260,6 +260,16 @@ function run_tests()
|
||||||
( make 2>&1 | grep "does not fit in configured flash size 1MB" ) || failure "Build didn't fail with expected flash size failure message"
|
( make 2>&1 | grep "does not fit in configured flash size 1MB" ) || failure "Build didn't fail with expected flash size failure message"
|
||||||
mv sdkconfig.bak sdkconfig
|
mv sdkconfig.bak sdkconfig
|
||||||
|
|
||||||
|
print_status "sdkconfig should have contents both files: sdkconfig and sdkconfig.defaults"
|
||||||
|
make clean > /dev/null;
|
||||||
|
rm -f sdkconfig.defaults;
|
||||||
|
rm -f sdkconfig;
|
||||||
|
echo "CONFIG_PARTITION_TABLE_OFFSET=0x10000" >> sdkconfig.defaults;
|
||||||
|
echo "CONFIG_PARTITION_TABLE_TWO_OTA=y" >> sdkconfig;
|
||||||
|
make defconfig > /dev/null;
|
||||||
|
grep "CONFIG_PARTITION_TABLE_OFFSET=0x10000" sdkconfig || failure "The define from sdkconfig.defaults should be into sdkconfig"
|
||||||
|
grep "CONFIG_PARTITION_TABLE_TWO_OTA=y" sdkconfig || failure "The define from sdkconfig should be into sdkconfig"
|
||||||
|
|
||||||
print_status "All tests completed"
|
print_status "All tests completed"
|
||||||
if [ -n "${FAILURES}" ]; then
|
if [ -n "${FAILURES}" ]; then
|
||||||
echo "Some failures were detected:"
|
echo "Some failures were detected:"
|
||||||
|
|
|
@ -306,6 +306,17 @@ function run_tests()
|
||||||
rm -rf main/main
|
rm -rf main/main
|
||||||
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
|
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
|
||||||
|
|
||||||
|
print_status "sdkconfig should have contents both files: sdkconfig and sdkconfig.defaults"
|
||||||
|
idf.py clean > /dev/null;
|
||||||
|
idf.py fullclean > /dev/null;
|
||||||
|
rm -f sdkconfig.defaults;
|
||||||
|
rm -f sdkconfig;
|
||||||
|
echo "CONFIG_PARTITION_TABLE_OFFSET=0x10000" >> sdkconfig.defaults;
|
||||||
|
echo "CONFIG_PARTITION_TABLE_TWO_OTA=y" >> sdkconfig;
|
||||||
|
idf.py reconfigure > /dev/null;
|
||||||
|
grep "CONFIG_PARTITION_TABLE_OFFSET=0x10000" sdkconfig || failure "The define from sdkconfig.defaults should be into sdkconfig"
|
||||||
|
grep "CONFIG_PARTITION_TABLE_TWO_OTA=y" sdkconfig || failure "The define from sdkconfig should be into sdkconfig"
|
||||||
|
|
||||||
print_status "All tests completed"
|
print_status "All tests completed"
|
||||||
if [ -n "${FAILURES}" ]; then
|
if [ -n "${FAILURES}" ]; then
|
||||||
echo "Some failures were detected:"
|
echo "Some failures were detected:"
|
||||||
|
|
|
@ -121,7 +121,6 @@ function(kconfig_process_config)
|
||||||
--kconfig ${ROOT_KCONFIG}
|
--kconfig ${ROOT_KCONFIG}
|
||||||
--config ${SDKCONFIG}
|
--config ${SDKCONFIG}
|
||||||
${defaults_arg}
|
${defaults_arg}
|
||||||
--create-config-if-missing
|
|
||||||
--env "COMPONENT_KCONFIGS=${kconfigs}"
|
--env "COMPONENT_KCONFIGS=${kconfigs}"
|
||||||
--env "COMPONENT_KCONFIGS_PROJBUILD=${kconfigs_projbuild}"
|
--env "COMPONENT_KCONFIGS_PROJBUILD=${kconfigs_projbuild}"
|
||||||
--env "IDF_CMAKE=y")
|
--env "IDF_CMAKE=y")
|
||||||
|
@ -154,12 +153,24 @@ function(kconfig_process_config)
|
||||||
# makes sdkconfig.h and skdconfig.cmake
|
# makes sdkconfig.h and skdconfig.cmake
|
||||||
#
|
#
|
||||||
# This happens during the cmake run not during the build
|
# This happens during the cmake run not during the build
|
||||||
execute_process(COMMAND ${confgen_basecommand}
|
if(NOT BOOTLOADER_BUILD)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${confgen_basecommand}
|
||||||
|
--output header ${SDKCONFIG_HEADER}
|
||||||
|
--output cmake ${SDKCONFIG_CMAKE}
|
||||||
|
--output json ${SDKCONFIG_JSON}
|
||||||
|
--output json_menus ${KCONFIG_JSON_MENUS}
|
||||||
|
--output config ${SDKCONFIG} # only generate config at the top-level project
|
||||||
|
RESULT_VARIABLE config_result)
|
||||||
|
else()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${confgen_basecommand}
|
||||||
--output header ${SDKCONFIG_HEADER}
|
--output header ${SDKCONFIG_HEADER}
|
||||||
--output cmake ${SDKCONFIG_CMAKE}
|
--output cmake ${SDKCONFIG_CMAKE}
|
||||||
--output json ${SDKCONFIG_JSON}
|
--output json ${SDKCONFIG_JSON}
|
||||||
--output json_menus ${KCONFIG_JSON_MENUS}
|
--output json_menus ${KCONFIG_JSON_MENUS}
|
||||||
RESULT_VARIABLE config_result)
|
RESULT_VARIABLE config_result)
|
||||||
|
endif()
|
||||||
if(config_result)
|
if(config_result)
|
||||||
message(FATAL_ERROR "Failed to run confgen.py (${confgen_basecommand}). Error ${config_result}")
|
message(FATAL_ERROR "Failed to run confgen.py (${confgen_basecommand}). Error ${config_result}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -52,10 +52,6 @@ def main():
|
||||||
default=[],
|
default=[],
|
||||||
action='append')
|
action='append')
|
||||||
|
|
||||||
parser.add_argument('--create-config-if-missing',
|
|
||||||
help='If set, a new config file will be saved if the old one is not found',
|
|
||||||
action='store_true')
|
|
||||||
|
|
||||||
parser.add_argument('--kconfig',
|
parser.add_argument('--kconfig',
|
||||||
help='KConfig file with config item definitions',
|
help='KConfig file with config item definitions',
|
||||||
required=True)
|
required=True)
|
||||||
|
@ -95,15 +91,11 @@ def main():
|
||||||
raise RuntimeError("Defaults file not found: %s" % name)
|
raise RuntimeError("Defaults file not found: %s" % name)
|
||||||
config.load_config(name, replace=False)
|
config.load_config(name, replace=False)
|
||||||
|
|
||||||
if args.config is not None:
|
# If config file previously exists, load it
|
||||||
if os.path.exists(args.config):
|
if args.config and os.path.exists(args.config):
|
||||||
config.load_config(args.config)
|
config.load_config(args.config, replace=False)
|
||||||
elif args.create_config_if_missing:
|
|
||||||
print("Creating config file %s..." % args.config)
|
|
||||||
config.write_config(args.config)
|
|
||||||
elif args.config is None:
|
|
||||||
raise RuntimeError("Config file not found: %s" % args.config)
|
|
||||||
|
|
||||||
|
# Output the files specified in the arguments
|
||||||
for output_type, filename in args.output:
|
for output_type, filename in args.output:
|
||||||
temp_file = tempfile.mktemp(prefix="confgen_tmp")
|
temp_file = tempfile.mktemp(prefix="confgen_tmp")
|
||||||
try:
|
try:
|
||||||
|
@ -275,6 +267,7 @@ def write_json_menus(config, filename):
|
||||||
def update_if_changed(source, destination):
|
def update_if_changed(source, destination):
|
||||||
with open(source, "r") as f:
|
with open(source, "r") as f:
|
||||||
source_contents = f.read()
|
source_contents = f.read()
|
||||||
|
|
||||||
if os.path.exists(destination):
|
if os.path.exists(destination):
|
||||||
with open(destination, "r") as f:
|
with open(destination, "r") as f:
|
||||||
dest_contents = f.read()
|
dest_contents = f.read()
|
||||||
|
|
Loading…
Reference in a new issue