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

print binary size #182

Merged
merged 4 commits into from
Jun 21, 2021
Merged

print binary size #182

merged 4 commits into from
Jun 21, 2021

Conversation

atsju
Copy link
Collaborator

@atsju atsju commented Jan 31, 2021

closes #166
The function is called stm32_print_size_of_target

I also added a small modification so that STM32_TOOLCHAIN_PATH could be set by CMAKE_C_COMPILER. As a VScode user, this is how the compiler is passed to cmake.

Comment on lines 13 to 23
if(NOT STM32_TOOLCHAIN_PATH AND NOT CMAKE_C_COMPILER)
set(STM32_TOOLCHAIN_PATH "/usr")
message(STATUS "No STM32_TOOLCHAIN_PATH specified, using default: " ${STM32_TOOLCHAIN_PATH})
else()
file(TO_CMAKE_PATH "${STM32_TOOLCHAIN_PATH}" STM32_TOOLCHAIN_PATH)
if(NOT STM32_TOOLCHAIN_PATH)
# keep only directory of compiler
get_filename_component(STM32_TOOLCHAIN_PATH ${CMAKE_C_COMPILER} DIRECTORY)
# remove the last /bin directory
get_filename_component(STM32_TOOLCHAIN_PATH ${STM32_TOOLCHAIN_PATH} DIRECTORY)
endif()
file(TO_CMAKE_PATH "${STM32_TOOLCHAIN_PATH}" STM32_TOOLCHAIN_PATH)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is confusing

if(not a && not b)
else() # if(a or b)
    if(not a)
    endif()
endif()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did my best. What do you propose ?

Copy link
Collaborator

@Hish15 Hish15 Jan 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about :

if(not a && not b)
elseif(not a) # the `&& b` not needed but good too
endif()
file(TO_CMAKE_PATH "${STM32_TOOLCHAIN_PATH}" STM32_TOOLCHAIN_PATH)

I think doing the conversion TO_CMAKE_PATH is good either way, so I took it out of the if blocks.
What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's good after 3 month is that I'm stranger to my code and can judge it better. Sorry for delay :)

This was referenced Jun 8, 2021
@atsju atsju merged commit 86e16af into ObKo:master Jun 21, 2021
@atsju atsju deleted the JST_binarySize branch June 21, 2021 17:28
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.

Have binary size as output of build
2 participants