Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework version handling #330

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
3 changes: 0 additions & 3 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
CONFIG_ZSWATCH_PCB_REV=1
CONFIG_BT_DIS_HW_REV_STR="1"

CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
3 changes: 0 additions & 3 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
CONFIG_ZSWATCH_PCB_REV=2
CONFIG_BT_DIS_HW_REV_STR="2"

CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
3 changes: 0 additions & 3 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONFIG_ZSWATCH_PCB_REV=3
CONFIG_BT_DIS_HW_REV_STR="3"

#---------------
# FLASH
#-----------------
Expand Down
3 changes: 0 additions & 3 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_4.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONFIG_ZSWATCH_PCB_REV=4
CONFIG_BT_DIS_HW_REV_STR="4"

#---------------
# FLASH
#-----------------
Expand Down
3 changes: 0 additions & 3 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf
Original file line number Diff line number Diff line change
@@ -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
Expand Down