-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Consolidate .iram.text matcher in linker to wildcard matcher #4356
Consolidate .iram.text matcher in linker to wildcard matcher #4356
Conversation
REMOVED |
@ivankravets sorry, I don't follow. How is this PR related to library.json? It fixes a bug in the linker script that .iram.text sections from some files could be missed by the wildcard rules. It's not related to platformio (although it happens to reduce the number of platformio-specific rules). |
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.
Tested with this complex project. Works well!
Before PR
text data bss dec hex filename
390880 9104 32464 432448 69940 .pioenvs/nodemcuv2/firmware.elf
After PR
text data bss dec hex filename
392435 7544 32472 432451 69943 .pioenvs/nodemcuv2/firmware.elf
I'm not expert in LD scripting. Could we have the same improvements for https://github.com/kylefleming/Arduino/blob/17a96a93ad8bd904663cf8c23a56ae747e191021/tools/sdk/ld/eagle.app.v6.common.ld#L91:L104 ? |
@ivankravets It depends on what is being caught by the catch-all matcher in iram (found here). Converting the section you mention, which is in flash, to a catch-all matcher will change what the default section is for @igrr do you have a good sense of this? Since all user supplied |
The problem is with defining this whitelist. Consider a hypothetical object file which is part of an SDK library. This object file has a few functions without any attribute (which get placed into .text or .text.functionname sections), and a few functions with ICACHE_FLASH_ATTR (which get placed into .irom.text section). How do we a) write a rule to place only some of these functions into flash and others into IRAM, and b) make sure that when SDK libraries are updated (and some functions are moved between sections), the rules are updated as well?
I have suggested in the past to generate object files named xxx.c.o and yyy.cpp.o for xxx.c and yyy.cpp source files, when building with platformio. Then the behaviour would match that of arduino-builder, and this fragment of the linker script could be reduced to three lines. |
@bdbaddog do we have an API in SCons to declare a custom Some LD scripts depend on these files
Thanks! |
@kylefleming Could you try this temporary hook? Please navigate to 37 line https://github.com/esp8266/Arduino/blob/master/tools/platformio-build.py#L37 and add this env.Replace(OBJSUFFIX =".c.o") Now, you can try to remove/comment all PlatformIO-related lines in LD script. All should work, including #4355 Please confirm. P.S: I know that we will append |
@igrr all things related to PlatformIO were removed from LD script. So, you can merge this PR |
39749be
to
2ac3f35
Compare
Updated to integrate #4399 changes. |
Sorry about #4567, can you report your changes in the new .h file ? |
Use wildcard matcher for .iram.text symbols.
2ac3f35
to
bb3556d
Compare
Updated |
@kylefleming I updated this via the online editor and think we're OK now. |
Any symbol that is specified to be placed in the
iram.text
section (for example with theICACHE_RAM_ATTR
attribute) should generally be placed in that section regardless of where it came from, especially since this isn't something a non-Arduino/ESP8266 library would specify. As such, it seems like a wildcard matcher could be used here, in order to make sure no symbols fall through the cracks. This is how it's done withirom
andirom0
, so one could reasonably assumeiram
to be consistent. Does this seem reasonable?