DFU 완료 후 전원 래치 Low 방지, zip 파일명에 버전 정보 포함
This commit is contained in:
@@ -29,4 +29,49 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT)
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user