78 lines
2.3 KiB
CMake
78 lines
2.3 KiB
CMake
if(SB_CONFIG_NETCORE_HCI_IPC)
|
|
set(
|
|
hci_ipc_EXTRA_CONF_FILE
|
|
"${APP_DIR}/sysbuild/hci_ipc.conf"
|
|
CACHE INTERNAL
|
|
"Extra configuration for the nRF5340 net core HCI image"
|
|
)
|
|
endif()
|
|
|
|
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
|
|
list(APPEND mcuboot_EXTRA_CONF_FILE
|
|
"${APP_DIR}/sysbuild/mcuboot.conf"
|
|
)
|
|
list(REMOVE_DUPLICATES mcuboot_EXTRA_CONF_FILE)
|
|
set(
|
|
mcuboot_EXTRA_CONF_FILE
|
|
"${mcuboot_EXTRA_CONF_FILE}"
|
|
CACHE INTERNAL
|
|
"Extra configuration for the MCUboot image"
|
|
)
|
|
|
|
list(APPEND mcuboot_EXTRA_DTC_OVERLAY_FILE
|
|
"${APP_DIR}/sysbuild/mcuboot.overlay"
|
|
)
|
|
list(REMOVE_DUPLICATES mcuboot_EXTRA_DTC_OVERLAY_FILE)
|
|
set(
|
|
mcuboot_EXTRA_DTC_OVERLAY_FILE
|
|
"${mcuboot_EXTRA_DTC_OVERLAY_FILE}"
|
|
CACHE INTERNAL
|
|
"Extra devicetree overlay for the MCUboot image"
|
|
)
|
|
|
|
list(APPEND mcuboot_EXTRA_ZEPHYR_MODULES
|
|
"${APP_DIR}/sysbuild/mcuboot_power_hold_module"
|
|
)
|
|
list(REMOVE_DUPLICATES mcuboot_EXTRA_ZEPHYR_MODULES)
|
|
set(
|
|
mcuboot_EXTRA_ZEPHYR_MODULES
|
|
"${mcuboot_EXTRA_ZEPHYR_MODULES}"
|
|
CACHE INTERNAL
|
|
"Extra Zephyr modules for the MCUboot image"
|
|
)
|
|
endif()
|
|
|
|
# DFU ZIP 파일명에 MCUboot 서명 버전을 붙인 복사본 생성
|
|
set(APP_PRJ_CONF "${APP_DIR}/prj.conf")
|
|
if(EXISTS "${APP_PRJ_CONF}")
|
|
file(READ "${APP_PRJ_CONF}" APP_PRJ_CONF_TEXT)
|
|
|
|
if(APP_PRJ_CONF_TEXT MATCHES "CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION=\"([^\"]+)\"")
|
|
set(DFU_ZIP_VERSION "${CMAKE_MATCH_1}")
|
|
set(DFU_ZIP_SUFFIX "${DFU_ZIP_VERSION}")
|
|
|
|
# 0.0.1+3 형식은 사용자가 구분하기 쉽도록 1+3만 사용
|
|
if(DFU_ZIP_VERSION MATCHES "^0\\.0\\.([0-9]+\\+[^+]+)$")
|
|
set(DFU_ZIP_SUFFIX "${CMAKE_MATCH_1}")
|
|
endif()
|
|
|
|
# 파일명에 쓰기 어려운 문자는 밑줄로 치환
|
|
string(REGEX REPLACE "[^A-Za-z0-9_.+-]" "_" DFU_ZIP_SUFFIX "${DFU_ZIP_SUFFIX}")
|
|
|
|
set(DFU_ZIP_SOURCE "${CMAKE_BINARY_DIR}/dfu_application.zip")
|
|
set(DFU_ZIP_VERSIONED "${CMAKE_BINARY_DIR}/dfu_application_${DFU_ZIP_SUFFIX}.zip")
|
|
|
|
add_custom_command(
|
|
OUTPUT "${DFU_ZIP_VERSIONED}"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${DFU_ZIP_SOURCE}" "${DFU_ZIP_VERSIONED}"
|
|
DEPENDS "${DFU_ZIP_SOURCE}"
|
|
COMMENT "Generating versioned DFU ZIP ${DFU_ZIP_VERSIONED}"
|
|
VERBATIM
|
|
)
|
|
|
|
add_custom_target(dfu_application_versioned_zip ALL
|
|
DEPENDS "${DFU_ZIP_VERSIONED}"
|
|
)
|
|
endif()
|
|
endif()
|