From 8384fc944660758c1c800ef8b4387c44f0cb7671 Mon Sep 17 00:00:00 2001 From: Daniel Kampert Date: Thu, 25 Jul 2024 12:24:18 +0200 Subject: [PATCH] Take version from board overlay --- app/CMakeLists.txt | 25 ++++++++++++------- .../zswatch_nrf5340_cpuapp_1.conf | 3 --- .../zswatch_nrf5340_cpuapp_2.conf | 3 --- .../zswatch_nrf5340_cpuapp_3.conf | 3 --- .../zswatch_nrf5340_cpuapp_4.conf | 3 --- .../zswatch_nrf5340_cpuapp_5.conf | 3 --- 6 files changed, 16 insertions(+), 24 deletions(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index eb9469c1..625067bb 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -7,23 +7,30 @@ foreach(file ${files}) patch -p1 -d $ENV{ZEPHYR_BASE} -i ${CMAKE_CURRENT_SOURCE_DIR}/${file} -r - --no-backup-if-mismatch) endforeach() +# Get the target hardware string(REGEX MATCH "zswatch_nrf5340_cpuapp(_ns)?@([0-9]+)$" ZSWATCH_BOARD "${BOARD}") if(ZSWATCH_BOARD) - set(ZSWATCH_REV ${CMAKE_MATCH_2}) - if(${ZSWATCH_REV} EQUAL 2) - set(DFU_BUILD true) - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_mcuboot.yml) - set(OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/boards/dfu.conf) - set(mcuboot_DTC_OVERLAY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/overlays/mcuboot.overlay) - elseif(${ZSWATCH_REV} GREATER_EQUAL 3) + string(CONCAT VERSION_STRING "\"" ${CMAKE_MATCH_2} "\"") + set(CONFIG_ZSWATCH_PCB_REV ${CMAKE_MATCH_2} CACHE INTERNAL "") + set(CONFIG_BT_DIS_HW_REV_STR ${VERSION_STRING} CACHE INTERNAL "") + + message("PCB revision: " ${CONFIG_ZSWATCH_PCB_REV}) + + if(CONFIG_ZSWATCH_PCB_REV GREATER_EQUAL 3) set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_external.yml) else() set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_internal.yml) endif() +elseif("nrf5340dk_nrf5340_cpuapp" STREQUAL "${BOARD}") + set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_external.yml) endif() -if("nrf5340dk_nrf5340_cpuapp" STREQUAL "${BOARD}") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_external.yml) +if(CONFIG_BOOTLOADER_MCUBOOT) + # TODO: Needed for MCUBoot + #set(DFU_BUILD true) + #set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_mcuboot.yml) + #set(OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/boards/dfu.conf) + #set(mcuboot_DTC_OVERLAY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/overlays/mcuboot.overlay) endif() set(BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf index ef6ee5ca..9760a94b 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf @@ -1,4 +1 @@ -CONFIG_ZSWATCH_PCB_REV=1 -CONFIG_BT_DIS_HW_REV_STR="1" - CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y \ No newline at end of file diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf index ab3b5deb..9760a94b 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf @@ -1,4 +1 @@ -CONFIG_ZSWATCH_PCB_REV=2 -CONFIG_BT_DIS_HW_REV_STR="2" - CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y \ No newline at end of file diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf index 493f87ec..ed3a9edf 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf @@ -1,6 +1,3 @@ -CONFIG_ZSWATCH_PCB_REV=3 -CONFIG_BT_DIS_HW_REV_STR="3" - #--------------- # FLASH #----------------- diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_4.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_4.conf index 9167a5aa..340d1ba4 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_4.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_4.conf @@ -1,6 +1,3 @@ -CONFIG_ZSWATCH_PCB_REV=4 -CONFIG_BT_DIS_HW_REV_STR="4" - #--------------- # FLASH #----------------- diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf index 11f9e328..50d00823 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf @@ -1,6 +1,3 @@ -CONFIG_ZSWATCH_PCB_REV=5 -CONFIG_BT_DIS_HW_REV_STR="5" - # FLASH CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y