From 5760e37dccf150c5efb5ec47dcb012731322aa8d Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Wed, 15 May 2019 11:40:57 +0800 Subject: [PATCH 1/2] cmake: fix custom bootloader issue 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/bootloader/project_include.cmake b/components/bootloader/project_include.cmake index cdb18a9fa..4b0137e94 100644 --- a/components/bootloader/project_include.cmake +++ b/components/bootloader/project_include.cmake @@ -15,9 +15,10 @@ set(bootloader_binary_files 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} + CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH} + -DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR} INSTALL_COMMAND "" BUILD_ALWAYS 1 # no easy way around this... BUILD_BYPRODUCTS ${bootloader_binary_files} From 2cd1cdcb7dbe2502142d7de4388be3f83b78de08 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Wed, 15 May 2019 14:49:51 +0800 Subject: [PATCH 2/2] ci: check that custom bootloader overrides original --- tools/ci/test_build_system_cmake.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index c679acc5c..5c434ab34 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -238,16 +238,13 @@ EOF export PATH="$OLDPATH" rm ./python - 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 "Custom bootloader overrides original" + clean_build_dir + (mkdir components && cd components && cp -r $IDF_PATH/components/bootloader .) + idf.py build + grep "$PWD/components/bootloader/subproject/main/bootloader_start.c" build/bootloader/compile_commands.json \ + || failure "Custom bootloader source files should be built instead of the original's" + rm -rf components print_status "All tests completed" if [ -n "${FAILURES}" ]; then