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

added binary and hex generation functions #221

Merged
merged 3 commits into from
Jul 1, 2021

Conversation

robamu
Copy link
Contributor

@robamu robamu commented Jun 27, 2021

Functions to generate binary file and hex file

@robamu robamu changed the title added functions added binary and hex generation functions Jun 27, 2021
@gudnimg
Copy link
Contributor

gudnimg commented Jun 27, 2021

I think it would be beneficial to add BYPRODUCTS ${TARGET}.hex after COMMAND.

They mention this in the docs:

The Makefile Generators will remove BYPRODUCTS and other GENERATED files during make clean.

I believe the same applies to ninja clean.

Edit:

Is ${CMAKE_EXECUTABLE_SUFFIX_C} needed? I'm wondering what happens if its C++

@atsju
Copy link
Collaborator

atsju commented Jun 28, 2021

Please update the readme file also.

@atsju atsju requested a review from Hish15 June 28, 2021 08:04
@robamu
Copy link
Contributor Author

robamu commented Jun 28, 2021

The ${CMAKE_EXECUTABLE_SUFFIX_C} is needed because the file might or might not have a suffix and the arm-none-eabi-size command needs the exact executable name. If the suffix is empty, it's not an issue because the resulting expansion will be empty too.

@gudnimg
Copy link
Contributor

gudnimg commented Jun 29, 2021

The ${CMAKE_EXECUTABLE_SUFFIX_C} is needed because the file might or might not have a suffix and the arm-none-eabi-size command needs the exact executable name. If the suffix is empty, it's not an issue because the resulting expansion will be empty too.

I was not aware of such a limitation. This has worked for me before:

# Print size information after build
add_custom_command(TARGET ${target} POST_BUILD
    COMMAND ${CMAKE_SIZE} "${target}"
)

CMAKE_OBJCOPY is arm-none-eabi-objcopy. I know it doesn't need an extension because it worked for me in another project. My executable had no extension such as .exe, .elf.

I don't quite see yet why ${CMAKE_EXECUTABLE_SUFFIX_C} is needed with arm-none-eabi-objcopy or how that relates to arm-none-eabi-size

@atsju
Copy link
Collaborator

atsju commented Jun 30, 2021

@gudnimg You are right, it's related to #174.
Because every file is formated in some way and I find it good to have the corresponding extension

@Hish15 Hish15 merged commit f2e4847 into ObKo:master Jul 1, 2021
@robamu robamu deleted the mueller/gen-bin-gen-hex-functions branch July 12, 2021 17:54
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

Successfully merging this pull request may close these issues.

4 participants