-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add support for multiple progmem sections #734
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
Comments
+1 Sent from my iPhone
|
Got the ucglib port running (short demo: https://youtu.be/fafYB9CCGQ4), and successfully remove unused global font data automatically. This appears to need support for multiple progmem sections, which also requires a simple edit to the linker scripts -- changing issue title to better reflect this. The current approach mirrors what olikraus did for the AVR arch. If you can think of a better way to accomplish the same, please do let me know. Anything else I tried to get those global font vars removed by linker failed, but I'm not an expert in this stuff (just get by as needed :). The patches are https://gist.github.com/spapadim/a4bc258df47f00831006 and the ucglib port that makes use of this feature is https://github.com/spapadim/ucglib -- note that one of the patches is in the gcc toolchain. |
I understand the need for |
I basically copied avr-gcc flags Arduino uses on this :) -- can try w/o -ffunction-sections. However, the essential bit seems to be support for explicit separate irom sections (and progmem sections on AVR), relevant defines are here: I can confirm that setting |
That's right, I think for the change above you only need |
Yes, you are right, the -f flags are redundant -- just verified. Gist updated. Now it makes sense btw, thanks -- unused code/data gc unit is always section, and if you want to remove unused data from progmem/irom (which necessarily have explicit section attribute), you need to play the tricks olikraus does (and I was wondering why he did it!). So this would also imply that |
Current setup does not remove unused code and constants. Fixing this is a simple change to
platforms.txt
; I changed two lines, forcompiler.c.flags
andcompiler.c.elf.flags
to:Let me know if you'd like a PR, but the changes are very simple: adding
-ffunction-sections -fdata-section
to the first and-Wl,--gc-sections
.I've tested this on a port of olikraus's excellent ucglib to the ESP; see https://github.com/spapadim/ucglib and olikraus/ucglib#61. The code compiles without issues with these simple changes (otherwise fails, since ucglib compiles all font data, several MB, putting each in a separate section, and relying on the linker to pick the ones actually used).
The text was updated successfully, but these errors were encountered: