Skip to content

Commit

Permalink
Auto generate hpm files if bin2hpm is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosr8 committed Jul 3, 2023
1 parent a316254 commit 89f524e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,18 @@ add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMENT "Converting the AXF output to a binary file"
)

##Generate hpm files if bin2hpm is installed

find_program(BIN2HPM NAMES "bin2hpm")
if(BIN2HPM)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND bin2hpm -c 1 -n -m 0x315A -p 0x00 ${CMAKE_PROJECT_NAME}.bin -o ${CMAKE_PROJECT_NAME}.hpm
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Creating HPM file from binary"
)
message(STATUS "bin2hpm found in the $PATH, .hpm files will be generated automatically.")
else()
message(NOTICE "bin2hpm not found in the $PATH, .hpm files will not be generated.")
endif()

include( ${CMAKE_SOURCE_DIR}/probe/openocd.cmake )
11 changes: 11 additions & 0 deletions port/ucontroller/nxp/lpc17xx/bootloader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,14 @@ add_custom_command(TARGET newboot POST_BUILD
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Generate a raw binary image of the bootloader"
)

##Generate hpm files if bin2hpm is installed

find_program(BIN2HPM NAMES "bin2hpm")
if(BIN2HPM)
add_custom_command(TARGET newboot POST_BUILD
COMMAND bin2hpm -c 0 -n -m 0x315A -p 0x00 newboot.bin -o newboot.hpm
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Creating HPM file from binary"
)
endif()

0 comments on commit 89f524e

Please sign in to comment.