Merge branch 'bugfix/ldgen_make_escaping' into 'master'
make/ldgen: Fix generation of ldgen.section_infos file when shell is bash See merge request idf/esp-idf!3893
This commit is contained in:
commit
8c7a6be627
4 changed files with 21 additions and 22 deletions
|
@ -6,17 +6,14 @@ LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS)
|
|||
# Target to generate linker script generator from fragments presented by each of
|
||||
# the components
|
||||
define ldgen_process_template
|
||||
$(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES) $(IDF_PATH)/make/ldgen.mk
|
||||
printf "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
sed -E -i.bak 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
rm $(BUILD_DIR_BASE)/ldgen.section_infos.bak
|
||||
ifeq ($(OS), Windows_NT)
|
||||
$(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES)
|
||||
echo -ne "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
sed -i 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
mv $(BUILD_DIR_BASE)/ldgen.section_infos $(BUILD_DIR_BASE)/ldgen.section_infos.temp
|
||||
cygpath -w -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
rm -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp
|
||||
else
|
||||
$(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES)
|
||||
echo "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
sed -i 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
endif
|
||||
|
||||
$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
|
|
|
@ -254,8 +254,7 @@ function run_tests()
|
|||
rm -f ${TESTDIR}/template/version.txt
|
||||
|
||||
print_status "Build fails if partitions don't fit in flash"
|
||||
cp sdkconfig sdkconfig.bak
|
||||
sed -i "s/CONFIG_ESPTOOLPY_FLASHSIZE.\+//" sdkconfig # remove all flashsize config
|
||||
sed -i.bak "s/CONFIG_ESPTOOLPY_FLASHSIZE.\+//" sdkconfig # remove all flashsize config
|
||||
echo "CONFIG_ESPTOOLPY_FLASHSIZE_1MB=y" >> sdkconfig # introduce undersize flash
|
||||
make defconfig || failure "Failed to reconfigure with smaller flash"
|
||||
( make 2>&1 | grep "does not fit in configured flash size 1MB" ) || failure "Build didn't fail with expected flash size failure message"
|
||||
|
|
|
@ -180,7 +180,7 @@ function run_tests()
|
|||
idf.py build
|
||||
take_build_snapshot
|
||||
# need to actually change config, or cmake is too smart to rebuild
|
||||
sed -i s/^\#\ CONFIG_FREERTOS_UNICORE\ is\ not\ set/CONFIG_FREERTOS_UNICORE=y/ sdkconfig
|
||||
sed -i.bak s/^\#\ CONFIG_FREERTOS_UNICORE\ is\ not\ set/CONFIG_FREERTOS_UNICORE=y/ sdkconfig
|
||||
idf.py build
|
||||
# check the sdkconfig.h file was rebuilt
|
||||
assert_rebuilt config/sdkconfig.h
|
||||
|
@ -189,6 +189,7 @@ function run_tests()
|
|||
assert_rebuilt esp-idf/newlib/CMakeFiles/${IDF_COMPONENT_PREFIX}_newlib.dir/syscall_table.c.obj
|
||||
assert_rebuilt esp-idf/nvs_flash/CMakeFiles/${IDF_COMPONENT_PREFIX}_nvs_flash.dir/src/nvs_api.cpp.obj
|
||||
assert_rebuilt esp-idf/freertos/CMakeFiles/${IDF_COMPONENT_PREFIX}_freertos.dir/xtensa_vectors.S.obj
|
||||
mv sdkconfig.bak sdkconfig
|
||||
|
||||
print_status "Updating project CMakeLists.txt triggers full recompile"
|
||||
clean_build_dir
|
||||
|
@ -196,13 +197,14 @@ function run_tests()
|
|||
take_build_snapshot
|
||||
# Need to actually change the build config, or CMake won't do anything
|
||||
cp CMakeLists.txt CMakeLists.bak
|
||||
sed -i 's/^project(/add_compile_options("-DUSELESS_MACRO_DOES_NOTHING=1")\nproject\(/' CMakeLists.txt
|
||||
sed -i.bak 's/^project(/add_compile_options("-DUSELESS_MACRO_DOES_NOTHING=1")\nproject\(/' CMakeLists.txt
|
||||
idf.py build || failure "Build failed"
|
||||
mv CMakeLists.bak CMakeLists.txt
|
||||
# similar to previous test
|
||||
assert_rebuilt esp-idf/newlib/CMakeFiles/${IDF_COMPONENT_PREFIX}_newlib.dir/syscall_table.c.obj
|
||||
assert_rebuilt esp-idf/nvs_flash/CMakeFiles/${IDF_COMPONENT_PREFIX}_nvs_flash.dir/src/nvs_api.cpp.obj
|
||||
assert_rebuilt esp-idf/freertos/CMakeFiles/${IDF_COMPONENT_PREFIX}_freertos.dir/xtensa_vectors.S.obj
|
||||
mv sdkconfig.bak sdkconfig
|
||||
|
||||
print_status "Can build with Ninja (no idf.py)"
|
||||
clean_build_dir
|
||||
|
@ -217,23 +219,21 @@ function run_tests()
|
|||
|
||||
print_status "Can build with IDF_PATH set via cmake cache not environment"
|
||||
clean_build_dir
|
||||
cp CMakeLists.txt CMakeLists.bak
|
||||
sed -i 's/ENV{IDF_PATH}/{IDF_PATH}/' CMakeLists.txt
|
||||
sed -i.bak 's/ENV{IDF_PATH}/{IDF_PATH}/' CMakeLists.txt
|
||||
export IDF_PATH_BACKUP="$IDF_PATH"
|
||||
(unset IDF_PATH &&
|
||||
cd build &&
|
||||
cmake -G Ninja .. -DIDF_PATH=${IDF_PATH_BACKUP} &&
|
||||
ninja) || failure "Ninja build failed"
|
||||
mv CMakeLists.bak CMakeLists.txt
|
||||
mv CMakeLists.txt.bak CMakeLists.txt
|
||||
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
|
||||
|
||||
print_status "Can build with IDF_PATH unset and inferred by build system"
|
||||
clean_build_dir
|
||||
cp CMakeLists.txt CMakeLists.bak
|
||||
sed -i "s%\$ENV{IDF_PATH}%${IDF_PATH}%" CMakeLists.txt # expand to a hardcoded path
|
||||
sed -i.bak "s%\$ENV{IDF_PATH}%${IDF_PATH}%" CMakeLists.txt # expand to a hardcoded path
|
||||
(unset IDF_PATH && cd build &&
|
||||
cmake -G Ninja .. && ninja) || failure "Ninja build failed"
|
||||
mv CMakeLists.bak CMakeLists.txt
|
||||
mv CMakeLists.txt.bak CMakeLists.txt
|
||||
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
|
||||
|
||||
# Next two tests will use this fake 'esp31b' target
|
||||
|
@ -241,7 +241,7 @@ function run_tests()
|
|||
mkdir -p components/$fake_target
|
||||
touch components/$fake_target/CMakeLists.txt
|
||||
cp ${IDF_PATH}/tools/cmake/toolchain-esp32.cmake components/$fake_target/toolchain-$fake_target.cmake
|
||||
sed -i.old '/cmake_minimum_required/ a\
|
||||
sed -i.bak '/cmake_minimum_required/ a\
|
||||
set(COMPONENTS esptool_py)' CMakeLists.txt
|
||||
|
||||
print_status "Can override IDF_TARGET from environment"
|
||||
|
@ -261,7 +261,7 @@ function run_tests()
|
|||
grep "IDF_TARGET:STRING=${fake_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py -D"
|
||||
|
||||
# Clean up modifications for the fake target
|
||||
mv CMakeLists.txt.old CMakeLists.txt
|
||||
mv CMakeLists.txt.bak CMakeLists.txt
|
||||
rm -rf components
|
||||
|
||||
print_status "Can find toolchain file in component directory"
|
||||
|
|
|
@ -73,14 +73,17 @@ def main():
|
|||
fragment_files = [] if not args.fragments else args.fragments
|
||||
config_file = args.config
|
||||
output_path = args.output
|
||||
sections_info_files = [] if not args.sections else args.sections
|
||||
kconfig_file = args.kconfig
|
||||
sections = args.sections
|
||||
|
||||
try:
|
||||
sections_infos = SectionsInfo()
|
||||
|
||||
section_info_contents = [s.strip() for s in sections_info_files.read().split("\n")]
|
||||
section_info_contents = [s for s in section_info_contents if s]
|
||||
if sections:
|
||||
section_info_contents = [s.strip() for s in sections.read().split("\n")]
|
||||
section_info_contents = [s for s in section_info_contents if s]
|
||||
else:
|
||||
section_info_contents = []
|
||||
|
||||
for sections_info_file in section_info_contents:
|
||||
with open(sections_info_file) as sections_info_file_obj:
|
||||
|
|
Loading…
Reference in a new issue