]> granicus.if.org Git - esp-idf/commitdiff
cmake: fix custom bootloader issue
authorRenz Christian Bagaporo <renz@espressif.com>
Wed, 15 May 2019 03:40:57 +0000 (11:40 +0800)
committerRenz Christian Bagaporo <renz@espressif.com>
Mon, 27 May 2019 09:00:23 +0000 (17:00 +0800)
Issue is that when users creates a custom bootloader from
$IDF_PATH/components/bootloader. Parent project build uses the copy but
bootloader subproject build uses the original still. The issue is solved
by passing the custom bootloader as extra component directory so
bootloader build knows to use the new copy (itself) in the build.

components/bootloader/project_include.cmake
components/bootloader/subproject/CMakeLists.txt

index e08c18f7dd390fe312383469c989952a5f7ee0c8..209957c97863257fcd710e2a9db3a45fd96173bc 100644 (file)
@@ -49,10 +49,11 @@ if((NOT CONFIG_SECURE_BOOT_ENABLED) OR
     CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH)
     externalproject_add(bootloader
         # TODO: support overriding the bootloader in COMPONENT_PATHS
-        SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
+        SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/subproject"
         BINARY_DIR "${bootloader_build_dir}"
         CMAKE_ARGS  -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
                     -DSECURE_BOOT_SIGNING_KEY=${secure_boot_signing_key}
+                    -DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR}
         INSTALL_COMMAND ""
         BUILD_ALWAYS 1  # no easy way around this...
         BUILD_BYPRODUCTS ${bootloader_binary_files}
index aad0ff99ebe2306ccc9bd796d7c6fbd2848bc980..9459c13420f7ec6ea3ff888857eefa3bbc78de22 100644 (file)
@@ -27,9 +27,9 @@ target_linker_script(bootloader.elf
 # as cmake won't attach linker args to a header-only library, attach
 # linker args directly to the bootloader.elf
 set(ESP32_BOOTLOADER_LINKER_SCRIPTS
-    "../../esp32/ld/esp32.rom.ld"
-    "../../esp32/ld/esp32.rom.spiram_incompatible_fns.ld"
-    "../../esp32/ld/esp32.peripherals.ld")
+    "${IDF_PATH}/components/esp32/ld/esp32.rom.ld"
+    "${IDF_PATH}/components/esp32/ld/esp32.rom.spiram_incompatible_fns.ld"
+    "${IDF_PATH}/components/esp32/ld/esp32.peripherals.ld")
 
 target_linker_script(bootloader.elf ${ESP32_BOOTLOADER_LINKER_SCRIPTS})