Skip to content

Commit

Permalink
Fix DFU check (#1338)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored May 29, 2019
1 parent b5b8a6a commit 1d59583
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
11 changes: 7 additions & 4 deletions CMake/Modules/FindBuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 10 additions & 13 deletions targets/CMSIS-OS/ChibiOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 1d59583

Please sign in to comment.