From 44d2d683f9336611cdec2c20834d0c422afee9db Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 18 Dec 2019 19:43:58 +0000 Subject: [PATCH] Generate DFU file for OrgPal3 board (#1533) * Add GetTargetCapabilities for OrgPal3 * Add DFU package to CMakeLists for OrgPal3 board --- .../ChibiOS/ORGPAL_PALTHREE/CMakeLists.txt | 24 +++++++++++++++++++ .../ChibiOS/ORGPAL_PALTHREE/target_common.c | 6 +++++ 2 files changed, 30 insertions(+) diff --git a/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/CMakeLists.txt b/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/CMakeLists.txt index d35dcf2f50..26be19a009 100644 --- a/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/CMakeLists.txt +++ b/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/CMakeLists.txt @@ -271,3 +271,27 @@ set_property(TARGET ${NANOCLR_PROJECT_NAME}.elf APPEND_STRING PROPERTY LINK_FLAG # generate output files nf_generate_build_output_files(${NANOBOOTER_PROJECT_NAME}.elf) nf_generate_build_output_files(${NANOCLR_PROJECT_NAME}.elf) + +# if HEX2DFU tool is available pack the binaries into a DFU package +if(HEX2DFU_TOOL_AVAILABLE) + + #################################################################################################### + ## when changing the linker file make sure to update the new addresses for the image files below ## + ## DO NOT use the leading 0x notation, just the address in plain hexadecimal formating ## + #################################################################################################### + + if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + NF_GENERATE_DFU_PACKAGE( + ${PROJECT_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000 + ${PROJECT_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08010000 + ${PROJECT_SOURCE_DIR}/build/nanobooter-nanoclr.dfu + ) + else() + NF_GENERATE_DFU_PACKAGE( + ${PROJECT_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000 + ${PROJECT_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08010000 + ${PROJECT_SOURCE_DIR}/build/nanobooter-nanoclr.dfu + ) + endif() + +endif() diff --git a/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/target_common.c b/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/target_common.c index ee602ba034..581c4598f1 100644 --- a/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/target_common.c +++ b/targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/target_common.c @@ -22,3 +22,9 @@ HAL_SYSTEM_CONFIG HalSystemConfig = }; HAL_TARGET_CONFIGURATION g_TargetConfiguration; + +// this target use DFU for updates +uint32_t GetTargetCapabilities() +{ + return TargetCapabilities_DfuUpdate; +};