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

Add new target option to print/show the build size. #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

microbit-carlos
Copy link
Collaborator

@microbit-carlos microbit-carlos commented Sep 8, 2023

We should discuss if this is something we'd like to add, and if this is the right format to enable it (with an entry in the target.json file).

The size info is added by using the arm-none-eabi-size tool and the -Wl,--print-memory-usage linker flag.

With this change, and by setting the "show_size": true option in target.json, we get this additional info printed during builds:

$ python build.py

...

[ 99%] Linking CXX executable MICROBIT
Memory region         Used Size  Region Size  %age Used
             MBR:        2816 B         4 KB     68.75%
              SD:        105 KB       108 KB     97.22%
           FLASH:      127888 B       364 KB     34.31%
      BOOTLOADER:       25580 B        28 KB     89.22%
        SETTINGS:        4899 B         8 KB     59.80%
            UICR:           8 B          8 B    100.00%
          NOINIT:          16 B         16 B    100.00%
             RAM:      120768 B     122816 B     98.33%
Print total size info:
   text    data     bss     dec     hex filename
 239556  140823    8992  389371   5f0fb /Users/microbit-carlos/workspace/mbef/codal/microbit-v2-samples/build/MICROBIT
[ 99%] Built target MICROBIT
[100%] converting to bin file.
[100%] converting to hex file.
[100%] Built target MICROBIT_hex
[100%] Built target MICROBIT_bin

Using the arm-none-eabi-size tool and the `-Wl,--print-memory-usage`
linker flag.
@microbit-carlos
Copy link
Collaborator Author

This PR, by default, won't print the size info:

But, this temp branch has been created in the codal-microbit-v2 repo to test it with the option enabled:

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.

1 participant