Implement SHA256 update file checking

This commit is contained in:
2021-10-03 19:27:41 +02:00
parent c6fcd3154f
commit ae60c30919
3 changed files with 62 additions and 7 deletions

View File

@@ -136,8 +136,14 @@ add_custom_command(
)
set(HEX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${HEXFILE}")
add_custom_target(update-image ALL DEPENDS ${HEX_PATH})
add_custom_target(update-image ALL DEPENDS ${HEX_PATH} "${HEX_PATH}.sha")
add_custom_command(
DEPENDS ${ELFFILE}
OUTPUT ${HEX_PATH}
COMMAND ${CMAKE_OBJCOPY} -O ihex ${ELFFILE} ${HEX_PATH})
COMMAND ${CMAKE_OBJCOPY} -O ihex ${ELFFILE} ${HEX_PATH}
)
add_custom_command(
DEPENDS ${HEX_PATH}
OUTPUT "${HEX_PATH}.sha"
COMMAND sha256sum "${HEX_PATH}" | cut -d " " -f 1 > "${HEX_PATH}.sha"
)