Skip to content

Correct size output for const variables #59

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

Merged
merged 1 commit into from
Oct 14, 2019

Conversation

SpenceKonde
Copy link
Contributor

avr-size reports const variables in .rodata (under megaavr, since there's a unified address space, you don't need to declare const variables as PROGMEM for them to not be copied to RAM, which is awesome.

recipe.size.regex did not check .rodata when totaling up flash usage. This would result in the reported size of the sketch not including variables that were declared const; it was thus possible to make a sketch that did not fit in the flash, but where this wasn't detected until it got to avrdude during the upload process, and avrdude dutifully reported that it was trying to write to addresses that were out of range.

See the big discussion over here when I encountered this in megaTinyCore (and @MCUdude discovered that this happened on the official megaavr boards too) SpenceKonde/megaTinyCore#95

avr-size reports const variables in .rodata. 
recipe.size.regex did not check .rodata when totaling up flash usage. This would result in the reported size of the sketch not including variables that were declared const; it was possible to make a sketch that did not fit in the flash, but where this wasn't detected until it got to avrdude during the upload process, and avrdude dutifully reported that it was trying to write to addresses that were out of range. 

See the big discussion over here when I encountered this in megaTinyCore (and @MCUdude discovered that this happened on the official megaavr boards too) SpenceKonde/megaTinyCore#95
@facchinm
Copy link
Member

Great catch, thank you!| Applying immediately

@facchinm facchinm merged commit d2d1a2a into arduino:master Oct 14, 2019
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.

2 participants