Merge branch 'bugfix/fix_ld_relinking_on_modification' into 'master'

build: fix linker scripts edition not triggering a rebuild

Closes IDF-1562

See merge request espressif/esp-idf!12561
This commit is contained in:
Angus Gratton 2021-03-12 11:16:58 +00:00
commit ac8d5fb552
5 changed files with 18 additions and 4 deletions

View File

@ -57,7 +57,8 @@ else()
add_custom_command(
OUTPUT esp32_out.ld
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32_out.ld -I ${config_dir} ${LD_DIR}/esp32.ld
MAIN_DEPENDENCY ${LD_DIR}/esp32.ld ${sdkconfig_header}
MAIN_DEPENDENCY ${LD_DIR}/esp32.ld
DEPENDS ${sdkconfig_header}
COMMENT "Generating linker script..."
VERBATIM)

View File

@ -58,7 +58,8 @@ else()
add_custom_command(
OUTPUT esp32c3_out.ld
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32c3_out.ld -I ${config_dir} ${LD_DIR}/esp32c3.ld
MAIN_DEPENDENCY ${LD_DIR}/esp32c3.ld ${sdkconfig_header}
MAIN_DEPENDENCY ${LD_DIR}/esp32c3.ld
DEPENDS ${sdkconfig_header}
COMMENT "Generating linker script..."
VERBATIM)

View File

@ -61,7 +61,8 @@ else()
add_custom_command(
OUTPUT esp32s2_out.ld
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32s2_out.ld -I ${config_dir} ${LD_DIR}/esp32s2.ld
MAIN_DEPENDENCY ${LD_DIR}/esp32s2.ld ${sdkconfig_header}
MAIN_DEPENDENCY ${LD_DIR}/esp32s2.ld
DEPENDS ${sdkconfig_header}
COMMENT "Generating linker script..."
VERBATIM)

View File

@ -58,7 +58,8 @@ else()
add_custom_command(
OUTPUT esp32s3_out.ld
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32s3_out.ld -I ${config_dir} ${LD_DIR}/esp32s3.ld
MAIN_DEPENDENCY ${LD_DIR}/esp32s3.ld ${sdkconfig_header}
MAIN_DEPENDENCY ${LD_DIR}/esp32s3.ld
DEPENDS ${sdkconfig_header}
COMMENT "Generating linker script..."
VERBATIM)

View File

@ -218,6 +218,16 @@ function run_tests()
assert_not_rebuilt ${BOOTLOADER_BINS}
mv esp32.project.ld.in ${IDF_PATH}/components/esp32/ld/
print_status "Updating ld file should only re-link app"
take_build_snapshot
cp ${IDF_PATH}/components/esp32/ld/esp32.ld .
sleep 1 # ninja may ignore if the timestamp delta is too low
echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.ld
idf.py build || failure "Failed to rebuild with modified linker script"
assert_rebuilt ${APP_BINS}
assert_not_rebuilt ${BOOTLOADER_BINS}
mv esp32.ld ${IDF_PATH}/components/esp32/ld/
print_status "Updating fragment file should only re-link app" # only app linker script is generated by tool for now
take_build_snapshot
cp ${IDF_PATH}/components/esp32/ld/esp32_fragments.lf .