-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Better Info on flash & RAM requirements #9628
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea but have some issues with the implementation.
Some remarks before testing:
It would be better to add new targets for the output. The output of print-size
is I think parsed at least by murdock, and maybe used by others.
It would be safer to separate it first. It is easier to add new things that change existing ones. And making it the default, if it should, could be a dedicated PR.
For the script, python3
only, don't bother. It is already enforced by many of our scripts.
Regarding the new variables, there are already similar variables in cpu/cortexm_common/Makefile.include
and re-using the same name would be better for future work on OTA.
They would be ROM_LEN
, RAM_LEN
ROM_OFFSET
.
I will give feedback on the python inline.
@Josar: Thanks for the hint. Care to provide documentation/example on how to generate the output you mentioned in the PR? It is very unfortunate that in my PR the variable |
@cladmi: Thanks for the feedback. So is this correct?
Using a new target would also solve the problem of breaking with the PR of @Josar. Maybe make flash could still depend on the new target? The motivation of this PR is that I had trouble debugging a strange issue that turned out to be using more RAM/ROM than available. I really would like "make flash" to fail, if the application cannot work correctly because of more RAM/ROM used than available. (And warn if the estimated usage is close to the available RAM/ROM, as exact RAM/ROM usage is more complex than just summing up the sections - even without having dynamic memory management in mind). Btw: I'm really bad at giving names. Any suggestion for a name of the new target? |
@maribu i added a description how to use the |
@Josar: The -C flag for avr-size seems to be unoffical hack according to this German forum, that was applied to WinAVR. So there is value in having a way to get size information on vanilla binutils as well. I will wait for cladmi's feedback and than update the PR to still allow avr-size -C were available. Additionally, maybe other targets than AVR can profit, in case no overflow detection is available there, too. |
I also think all platform would benefit from such a solution. I know the -C flag is a specific avr-size feature. |
@maribu that is right for the variables For the output, KiB is not better than Bytes, as for some PRs number of bytes difference must be checked to know increased code size and also detect impact of build system change. I do not have the To be sure, do I understand correctly if I say that for
This would mean it could be only enabled for If the goal is to fix the lack on rom/ram size check during link, it could be done as a
I am also bad at names. |
7df9c23
to
025098f
Compare
@cladmi: I added now the new targets "print-sizebars" and "info-sizebars" instead of changing existing targets. (Just like print-buildsize and info-buildsize the print version rebuilds the elf file, the info version doesn't.) The script no longer creates the table, as print-buildsize and info-buildsize already do that. It just creates the horizontal stacked bars. Also, by using the ROM_LEN, RAM_LEN and ROM_OFFSET variables the tool seems to just work for all ARM targets I tested so far. Finally, I added print-sizebars for all boards using cpu/atmega_common as dependency for the flash target. Thus, in case ROM_LEN and RAM_LEN are set, an check for overflown RAM/ROM is performed for AVR boards. One thing of concern: The |
I will look more into it after the release. I reviewed the tests results for the release, and I think many arduino errors are actually issues with an overflow that is not detected during link. So exactly what your script is trying to solve. So I would still be in favor of also having also a It makes more sense for me to say that the compilation failed and not flashing or another target as the resulting firmware is invalid and should not be produced. It would also make it detected directly in murdock. |
@cladmi: I reverted the commit adding print-sizeinfo to the flash target on AVR platform and added the "--silent" flag to the script. With that flag, only RAM/ROM overflow checks are performed. I also added the "check-buildsize" that calls the script with "--silent". It now only needs to be added as post link check for platforms missing RAM/ROM overflow checks. Feel free to just push to this PR if you have any suggestion. |
Now that I had time to look, I think there is a solution for the linker check. I am currently on an arch linux computer with
So should now be possible to configure these with the newer versions. It looks included since I am building a bionic docker image to check. Even, with an old avr we may be able to just ship the new linker script to maintain compatibility for some time. This way, no need for any "post-link check" as it would be done at link time. This would remove the need for any error case handling in the print script as no elf should be generated if there is an overflow. I will try something with this. It would change the requirements for this PR if it works. |
@maribu reverting the |
3ae95c4
to
f8778e0
Compare
@cladmi: I reverted the last commit, rebased against current master and squashed. Now the PR only provides eye-candy :-) |
Almost forgot about this. I now rebased this PR on top of current master to solve the merge conflicts. This PR now uses |
The targets print-sizebars and info-sizebars display a horizontal stacked bar diagram of the RAM/ROM usage, in case the variables RAM_LEN and ROM_LEN are set.
Rebased to solve the merge conflict |
Changed python script to force using Python3, as Python2 now is officially legacy. This allowed cleaning up the script a bit. |
OK. I would like to cross this PR of the list. Either by getting it merged, or by closing it. To me, either is fine. |
@cladmi what's missing here? |
@cladmi ping. Seems like we converged here, no? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
This PR adds the
make
targetsprint-sizebars
andinfo-sizebars
. Both display a horizontal stacked bar diagram of the RAM/ROM usage, in case the variablesRAM_LEN
andROM_LEN
are set. IfBOOTLOADER_SIZE
is set, it will also be taken into account. Whilemake print-sizebars
will rebuild the app and show the diagram,make info-sizebars
will do so without a rebuild.Testing procedure
Go into your favorite RIOT application and run for a couple of boards
and
The diagrams should appear for all ATmega based and STM32 based boards.
Issues/PRs references
None
Update: Rewrote the description to match the current contribution of this PR, after #9781 implemented a check for overflow of RAM/ROM during link time.