-
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
Add flash for vtable destination, make it default, and add build menu to control options #4582
Conversation
Add an option for placing vtables in flash to complement the existing iram and heap options. "make flash" Now that there is a way to change it, move to vtables in flash as default as only users with interrupts which use vtables require the vtable to be in RAM. For those users, if the tables are small enough they can put them in IRAM and save heap space for their app. If not, then the vtables can be placed in HEAP which supports much larger tables.
18ef818
to
cc58871
Compare
@earlephilhower I am not nitpicking on you or this PR. :) In my recent exploration solving "__c causes a section type conflict with __c" (#3369) I found it is possible to define multiple sections for string literals, so that data with different tags can coexist. Then I just wonder, whether it is possible to do similar things with vtable data? That is:
Just a crazy idea... not sure whether it is doable without hacking into the compiler. |
Unfortunately the compiler doesn't know which are interrupt called functions. I'm not sure you could tell that with static graph analysis, in fact. Turing strikes again! |
But could human annotation help? Just like I know I am writing a template class, so instead of PSTR("Blah"), I use PSTR_T("Blah") to put my string literal to a different section to avoid conflict. I know I am writing a class for ISR, then I add some annotation to the class so compiler can place the vtable of this class to the If that is possible I am happy enough... |
I don't think there's a way to annotate other than by class names. You can individually specify in the .ld file to include, say, If you find a way, we can figure out how to mangle it in, for sure! I think in practice, though, class functions in IRQs are pretty rare, and virtual tables in those are even less prevalent. |
Is there a way to be able to select this from the IDE menu? I'm thinking of the windows users. |
I think this can be in the menus if we change platform.txt and boards.py to build the app.ld file before every compile, like got GIT version. In boards.txt there'll be (yet another) popup menu, identical for all devices, that adds a -D switch. In platform.txt, add a recipe.hooks.prebuild.x to run the command the makefile does now. I can give it a whirl, but it'll take a few days. @d-a-v Does this make sense? You've been hacking the build.py and platform.txt much more than I have... |
Yes this could work this way and in fact would be much better because it'd work under windows without having to install make. |
@d-a-v that's exactly what I was getting at :) |
e9d7984
to
39daf03
Compare
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.
works for me, thanks @earlephilhower and for the idea @devyte
@d-a-v I'm stuck on how to make build.py get the default vtable flag that was added. Interactive builds seem to just work and take the first item by default, but the build.py script is barfing about it being undefined:
|
Setting the default value in platform.txt seems to solve it:
It is overridden by the IDE. |
Convert from manual "make" operated app.ld creation to runtime creation whose options are selected from the build menu. Use a prelink recipe to create the output app.ld file each run, without need for any special tools. Update the boards.txt.py script to generate this new config.
39daf03
to
e6184b1
Compare
Thanks, @d-a-v . Looks to be building now! |
@@ -76,6 +78,9 @@ recipe.hooks.core.prebuild.2.pattern=bash -c "mkdir -p {build.path}/core && echo | |||
recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c mkdir {build.path}\core & (echo #define ARDUINO_ESP8266_GIT_VER 0x00000000 & echo #define ARDUINO_ESP8266_GIT_DESC win-{version} ) > {build.path}\core\core_version.h | |||
recipe.hooks.core.prebuild.2.pattern.windows= | |||
|
|||
## Build the app.ld linker file | |||
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld" |
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.
eagle.app.v6.common.ld
is now auto-generated, why is it still tracked in Git? I think it should be removed from the repo and added to .gitignore.
… to control options (esp8266#4582) * Add flash for vtable destination, make it default Add an option for placing vtables in flash to complement the existing iram and heap options. "make flash" Now that there is a way to change it, move to vtables in flash as default as only users with interrupts which use vtables require the vtable to be in RAM. For those users, if the tables are small enough they can put them in IRAM and save heap space for their app. If not, then the vtables can be placed in HEAP which supports much larger tables. * Add VTable menu, FLASH as default, remove Makefile Convert from manual "make" operated app.ld creation to runtime creation whose options are selected from the build menu. Use a prelink recipe to create the output app.ld file each run, without need for any special tools. Update the boards.txt.py script to generate this new config.
I have just pulled in the most recent commit (e3c97021) yesterday and now I am getting However, It seems I am using Eclipse with Sloeber plugin. This is an ESP-12F module with the attached properties. Frankly I am not sure which value the new VTables option should take; I just assigned the default. |
The command line is in
|
Add an option for placing vtables in flash to complement the existing iram and heap options, and allow selection using a build menu. No makefile needed any more,.
Extension of #4551 issue and PR #4567