diff options
author | xengineering <me@xengineering.eu> | 2025-03-26 21:27:32 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2025-03-26 22:02:17 +0100 |
commit | c5f301aa879bc52add50d8d5f917ee551fe1673e (patch) | |
tree | 7441b2dae18e0234f5fb3535552bf3076a410911 /fw/CMakeLists.txt | |
parent | 2b7ecfb1f5b6c9f98d239c893d4b4130176a1beb (diff) | |
download | iot-contact-c5f301aa879bc52add50d8d5f917ee551fe1673e.tar iot-contact-c5f301aa879bc52add50d8d5f917ee551fe1673e.tar.zst iot-contact-c5f301aa879bc52add50d8d5f917ee551fe1673e.zip |
fw: app: Build as CMake External Project
This adopts this pattern from the bootloader build. It adds more
flexibility. It is assumed that in this way multiple builds for
different boards can easily be achieved.
Diffstat (limited to 'fw/CMakeLists.txt')
-rw-r--r-- | fw/CMakeLists.txt | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/fw/CMakeLists.txt b/fw/CMakeLists.txt index 5b1e42b..aa5af1c 100644 --- a/fw/CMakeLists.txt +++ b/fw/CMakeLists.txt @@ -4,28 +4,45 @@ cmake_minimum_required(VERSION 3.20.0) +include(ExternalProject) + set(KEY_DEFAULT "$ENV{HOME}/mcuboot/key.pem") set(KEY ${KEY_DEFAULT} CACHE STRING "Firmware signing key path") message(STATUS "Firmware signing key path: ${KEY}") -set(BOARD "native_sim/native/64") -add_subdirectory(rtos) +set(BOARD_DEFAULT "native_sim/native/64") +set(BOARD ${BOARD_DEFAULT} CACHE STRING "Zephyr board identifier") +message(STATUS "Selected board: ${BOARD}") +add_subdirectory(rtos) string(REPLACE ";" "," ZEPHYR_MODULES_COMMA "${ZEPHYR_MODULES}") -include(ExternalProject) + +if(BOARD STREQUAL "nucleo_f767zi") + ExternalProject_Add( + btl + PREFIX btl + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rtos/modules/mcuboot/boot/zephyr" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/btl" + INSTALL_COMMAND "" + LIST_SEPARATOR "," + CMAKE_ARGS + "-DBOARD=${BOARD}" + "-DZEPHYR_BASE=${ZEPHYR_BASE}" + "-DZEPHYR_MODULES=${ZEPHYR_MODULES_COMMA}" + "-DEXTRA_CONF_FILE=${CMAKE_CURRENT_SOURCE_DIR}/btl/bootloader.conf" + -DCONFIG_BOOT_SIGNATURE_KEY_FILE="${KEY}" + ) +endif() + ExternalProject_Add( - btl - PREFIX btl - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rtos/modules/mcuboot/boot/zephyr" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/btl" + app + PREFIX app + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/app" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/app" INSTALL_COMMAND "" LIST_SEPARATOR "," CMAKE_ARGS - "-DBOARD=nucleo_f767zi" + "-DBOARD=${BOARD}" "-DZEPHYR_BASE=${ZEPHYR_BASE}" "-DZEPHYR_MODULES=${ZEPHYR_MODULES_COMMA}" - "-DEXTRA_CONF_FILE=${CMAKE_CURRENT_SOURCE_DIR}/btl/bootloader.conf" - -DCONFIG_BOOT_SIGNATURE_KEY_FILE="${KEY}" ) - -add_subdirectory(app) |