Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to invoke bin2hex #7

Open
marker5a opened this issue Jan 20, 2022 · 3 comments
Open

How to invoke bin2hex #7

marker5a opened this issue Jan 20, 2022 · 3 comments

Comments

@marker5a
Copy link

I started playing w/ this as we would like to switch our builds to cmake eventually. Quick question, I see that there is "support" for calling bin2hex... what I'm unsure of is how to invoke it following a build? Is there a directive I need to add to the toplevel CMakeLists.txt file?

@rkalnins
Copy link

rkalnins commented Jan 25, 2022

Edit: MicrochipBin2Hex.cmake is already included in Modules/Platform/MicrochipMCU.cmake so we don't need to include() the module.

# CMakeLists.txt
add_executable(${PROJECT_NAME}.elf ...)

bin2hex(${PROJECT_NAME}.elf)

Was using a custom command before and this worked too:

add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
    COMMAND ${MICROCHIP_XC32_PATH}/bin/xc32-bin2hex $<TARGET_FILE:${PROJECT_NAME}.elf>)

@mbetten89
Copy link

Hey,

I get the error target was not created in this directory. In which CMakeLists.txt should I add this command? Actually it is in my top level CMakeLists.txt.

Best

@rkalnins
Copy link

rkalnins commented Feb 3, 2022

The target needs to be created before invoking bin2hex so bin2hex can be used in any directory as long as the target is created first. For example,

# CMakeLists.txt

# first
add_executable(${TARGET_NAME} ........)

# then
bin2hex(${TARGET_NAME})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants