cmake: Refactor bootloader_subproject into the bootloader component itself

This commit is contained in:
Angus Gratton 2018-01-19 16:00:41 +11:00 committed by Angus Gratton
parent 674d398c93
commit 3fac2b2ddc
3 changed files with 12 additions and 14 deletions

View File

@ -1,18 +1,22 @@
if(IS_BOOTLOADER_BUILD)
return() # don't keep recursing!
endif()
# Glue to build the bootloader subproject binary as an external # Glue to build the bootloader subproject binary as an external
# cmake project under this one # cmake project under this one
# #
# #
set(bootloader_subproject_build_dir "${CMAKE_BINARY_DIR}/bootloader_subproject") set(bootloader_build_dir "${CMAKE_BINARY_DIR}/bootloader")
set(bootloader_binary_files set(bootloader_binary_files
"${bootloader_subproject_build_dir}/bootloader.elf" "${bootloader_build_dir}/bootloader.elf"
"${bootloader_subproject_build_dir}/bootloader.bin" "${bootloader_build_dir}/bootloader.bin"
"${bootloader_subproject_build_dir}/bootloader.map" "${bootloader_build_dir}/bootloader.map"
) )
ExternalProject_Add(bootloader_subproject ExternalProject_Add(bootloader
# TODO: support overriding the bootloader in COMPONENT_PATHS # TODO: support overriding the bootloader in COMPONENT_PATHS
SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject" SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
BINARY_DIR "${bootloader_subproject_build_dir}" BINARY_DIR "${bootloader_build_dir}"
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH="${IDF_PATH}" CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH="${IDF_PATH}"
INSTALL_COMMAND "" INSTALL_COMMAND ""
BUILD_ALWAYS 1 # no easy way around this... BUILD_ALWAYS 1 # no easy way around this...

View File

@ -12,8 +12,7 @@ set(BOOTLOADER_BUILD 1)
set(IS_BOOTLOADER_BUILD 1) # deprecated, use BOOTLOADER_BUILD set(IS_BOOTLOADER_BUILD 1) # deprecated, use BOOTLOADER_BUILD
add_definitions(-DBOOTLOADER_BUILD=1) add_definitions(-DBOOTLOADER_BUILD=1)
set(MAIN_SRCS main/bootloader_start.c set(MAIN_SRCS main/bootloader_start.c)
main/flash_qio_mode.c)
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)

View File

@ -70,11 +70,6 @@ idf_add_executable()
# #
# Finish component registration (add cross-dependencies, make # Finish component registration (add cross-dependencies, make
# executable dependent on all components.) # executable dependent on all components)
# #
components_finish_registration() components_finish_registration()
# Define the external target to build the bootloader subproject
if(NOT BOOTLOADER_BUILD)
include(bootloader_subproject)
endif()