diff --git a/CMake/Modules/FindBuildUtils.cmake b/CMake/Modules/FindBuildUtils.cmake index 5ddfee071f..bc29809ffe 100644 --- a/CMake/Modules/FindBuildUtils.cmake +++ b/CMake/Modules/FindBuildUtils.cmake @@ -6,20 +6,23 @@ function(NF_GENERATE_DFU_PACKAGE FILE1 ADDRESS1 FILE2 ADDRESS2 OUTPUTFILENAME) add_custom_command( + TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD + COMMAND ${TOOL_HEX2DFU_PREFIX}/hex2dfu - + -b="${FILE1}" -a="${ADDRESS1}" -b="${FILE2}" -a="${ADDRESS2}" -o="${OUTPUTFILENAME}" - + WORKING_DIRECTORY ${TOOL_HEX2DFU_PREFIX} - - DEPENDS ${FILE1} ${FILE2} COMMENT "exporting bin files to DFU image" ) + # need to add a dependency of NANOCLR to NANOBOOTER because DFU util needs bin outputs of both targets + add_dependencies(${NANOCLR_PROJECT_NAME}.elf ${NANOBOOTER_PROJECT_NAME}.elf) + endfunction() function(NF_GENERATE_BUILD_OUTPUT_FILES TARGET) diff --git a/targets/CMSIS-OS/ChibiOS/CMakeLists.txt b/targets/CMSIS-OS/ChibiOS/CMakeLists.txt index 1182db95b5..1e56887551 100644 --- a/targets/CMSIS-OS/ChibiOS/CMakeLists.txt +++ b/targets/CMSIS-OS/ChibiOS/CMakeLists.txt @@ -7,19 +7,16 @@ include(STM32_CubePackage) ######################################################## # check availability of hex2dfu tool if specified -# only relevant if this is running on a Windows machine -if(WIN32) - if(NOT "${TOOL_HEX2DFU_PREFIX}" STREQUAL "") - if(NOT EXISTS ${TOOL_HEX2DFU_PREFIX}/hex2dfu.exe) - message(STATUS "") - message(STATUS "Couldn't find the hex2dfu tool at the specified path: ${TOOL_HEX2DFU_PREFIX}/hex2dfu.exe") - message(STATUS "Make sure that the CMake option TOOL_HEX2DFU_PREFIX has the correct path.") - message(STATUS "If you don't have this tool download it from https://github.com/nanoframework/nf-tools/releases") - message(STATUS "") - message(FATAL_ERROR "hex2dfu tool not found") - else() - set(HEX2DFU_TOOL_AVAILABLE TRUE CACHE INTERNAL "hex2dfu tool available") - endif() +if(NOT "${TOOL_HEX2DFU_PREFIX}" STREQUAL "") + if(NOT EXISTS ${TOOL_HEX2DFU_PREFIX}/hex2dfu.exe) + message(STATUS "") + message(STATUS "Couldn't find the hex2dfu tool at the specified path: ${TOOL_HEX2DFU_PREFIX}/hex2dfu.exe") + message(STATUS "Make sure that the CMake option TOOL_HEX2DFU_PREFIX has the correct path.") + message(STATUS "If you don't have this tool download it from https://github.com/nanoframework/nf-tools/releases") + message(STATUS "") + message(FATAL_ERROR "hex2dfu tool not found") + else() + set(HEX2DFU_TOOL_AVAILABLE TRUE CACHE INTERNAL "hex2dfu tool available") endif() endif() diff --git a/targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt b/targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt index 01d62d2687..904d02695f 100644 --- a/targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt +++ b/targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt @@ -235,7 +235,7 @@ if(HEX2DFU_TOOL_AVAILABLE) NF_GENERATE_DFU_PACKAGE( ${PROJECT_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000 ${PROJECT_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08004000 - ${PROJECT_SOURCE_DIR}/build/nanobooter-nanoclr.dfu + ${PROJECT_SOURCE_DIR}/build/nanobooter-nanoclr.dfu ) endif()