-
Notifications
You must be signed in to change notification settings - Fork 624
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
Enable libstdc++ v2 #146
base: master
Are you sure you want to change the base?
Enable libstdc++ v2 #146
Conversation
… retargetted to GCC 4.8.5
…ded romized versions of linker scripts
Seems the patches aren't sufficient to get esp_stdcpp_port/ and esp_newlib_port/ populated by git submodule {sync|update}...
|
Not sure what exactly you're trying to do. Cloning with recursive submodule checkout seems to work fine: |
For YOUR repo - yes.
Result: as shown in my last message - your submodules aren't pulled in, so the build will fail badly:
|
Shouldn't have you used "git submodule update --init" since these two are new to your .git/config? |
Thanks! |
I've started trying to play with this. So far I have run into a few issues
|
Thanks for the feedback. I started looking at the issue 1 and end up by reworking stdcpp_port throwing away garbage no more needed there. This fixed first two issues from your comment. Please pull in updates. As for the third one, you're right. libstdc++ is built sectionized and objcopy doesn't move content of those sections to .irom.text. I didn't find a way to make objcopy do such thing because it doesn't accept wildcards in section name specifier. Doing this section-by-section looks overexpensive. This is the reason why i created romized versions of linker scripts which make .text.* and .literal.* sections go to irom during link phase. If you have a better option please let me know. |
I played with this a little and had some success by modifying the linker script as follows to just put text and literal sections from --- xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/lib/eagle.app.v6.ld 2016-04-06 10:29:05.166730000 -0700
+++ xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/lib/eagle.app.v6.test.ld 2016-04-06 22:57:08.686971600 -0700
@@ -102,11 +102,14 @@
*(.gnu.linkonce.e.*)
*(.gnu.version_r)
*(.eh_frame)
+ . = (. + 3) & ~ 3;
/* C++ constructor and destructor tables, properly ordered: */
+ __init_array_start = ABSOLUTE(.);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
+ __init_array_end = ABSOLUTE(.);
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
@@ -151,6 +154,14 @@
} >dram0_0_seg :dram0_0_bss_phdr
/* __stack = 0x3ffc8000; */
+ .irom0.text : ALIGN(4)
+ {
+ _irom0_text_start = ABSOLUTE(.);
+ *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
+ *libstdc++irom.a:(.literal .text .literal.* .text.*)
+ _irom0_text_end = ABSOLUTE(.);
+ } >irom0_0_seg :irom0_0_phdr
+
.text : ALIGN(4)
{
_stext = .;
@@ -198,13 +209,6 @@
*(.gnu.linkonce.lit4.*)
_lit4_end = ABSOLUTE(.);
} >iram1_0_seg :iram1_0_phdr
-
- .irom0.text : ALIGN(4)
- {
- _irom0_text_start = ABSOLUTE(.);
- *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
- _irom0_text_end = ABSOLUTE(.);
- } >irom0_0_seg :irom0_0_phdr
}
/* get ROM code address */ |
Perhaps it would even make sense to put |
Yeah, this would work. At the same time i'm really in doubt even introducing the original changes into the linker scripts. Generally, doing so we bury a requirement to how the user application shall be built into a linker script, this smells bad. On the other hand, we seem to have no way out. Either we do this way or we don't do at all. |
Now i have a particular case of using this buried knowledge. I tried to build SGI STL sample and fail to link because implementations generated from templates are quite big and wouldn't fit into iram. The fix was quite easy: i preliminarily packed the compiler objects into sgitestsirom.a so that it applies to the linker script rule. But i can admit than this is definitely better than making .text.* go to irom I initially introduced in the linker scripts. So, thanks for the feedback, i'll incorporate your suggestion into the linker script patch. |
I agree on not being overly fond of making a magic name trigger this behavior. |
Yes, exactly. This gives at least a good hint where to go when you face such an issue. |
Just for information. I did a build test for Micropython project with the new environment. The built binary is different from what is built with the current esp-open-sdk head revision (mainly because gcc changed from 4.8.2 to 4.8.5 I suppose). The binary is loaded into esp8266. It seems to work as expected. At least print("Hello, World"); does what it has to. |
@Sermus: Great, thanks! I don't have time to look in more detail at your patches currently, but my comments would be exactly along the way of "how many projects with good testsuite coverage were tested with these patches?" |
Can you recommend more or less representative project set you usually use for such purposes? I'll do my best to check if they are ok with my changes. |
|
||
$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/lib/libstdc++irom.a: $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/lib/libstdc++.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc | ||
@echo "Creating irom version of libstdc++..." | ||
$(TOOLCHAIN)/bin/xtensa-lx106-elf-objcopy --rename-section .text=.irom0.text \ |
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.
Since it has pretty much been established that this objcopy
doesn't do anything useful, might it not be more efficient to just use cp
instead?
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 tend to agree, but there is one argument against this approach. I tried to keep backward compatibility meaning the patch mustn't break solutions which worked before. If we change libstdc++irom just to a copy we either keep inconsistency between the way how libcirom is built and the way how libstdc++irom is built or we may break those solutions which used libcirom assuming that the functions inside are packed into .irom0.text.
So i'd rather keep it the way it's done now to keep backward compatibility and unified way of building *irom libs.
Hello Paul, For me the test suite reports: |
Thanks for testing that, your contribution and your patience! We should get initial release of MicroPython esp8266 next week, and that should unfreeze changes to esp-open-sdk. It may still take some time (and there're other things in queue first like upgrade to SDK 1.5.3), but we're getting there. |
Need additional tool to be installed before running the make.
Update README.md
Hi Paul, |
What do you mean by upmerge? Definitely please rebase your branch against master when you have a chance (github shows there're conflicts). Unfortunately, I'm still backlogged on looking into this. Well, your patch being merged into any open-source project means that a maintainer is ready to maintain your code, or that you yourself will be around to answer any issues. Both take time, and thanks for doing the 2nd part ;-). I hope to have some progress on the weekend (at least create a separate branch and merge something there). |
Yes, i meant to say pulling recent changes from master in and resolving conflicts. The reason for the question was my natural laziness. I wouldn't like to do the same twice meaning if i rebase now and the request won't be merged anytime soon after most likely i'll be forced to rebase once again. That's why i wonder when you're ready to pull in the changes. Then i'll rebase and do final clearence. |
Feel free to put it off for now. |
Sorry for making noise around this, but how do i know when this should be done? The only way i see is polling you from time to time. Last time you gave clear evidence when the next poll shall be performed. |
I'll write something here. |
Ok, let's start like this: https://github.com/pfalcon/esp-open-sdk/commits/gcc-4.8.5 . Feel free to rebase against that branch at your convenience. No hurry - I'll need to test switch to gcc 4.8.5 well first, then proceed with the rest. Thanks. |
I'll wait until you backmerge this branch to master. Using built-in specs. |
Sure, and https://github.com/pfalcon/esp-open-sdk/commits/gcc-4.8.5 merges 1st patch from your series (that's why I mentioned need to tweak commit message to follow standard git commit message conventions (1st line fits in below than 80 chars, etc.))
As I mentioned above, there can't be too much testing, only too little. For example, you probably didn't test that functions in bootrom 100% match interface and semantics of those in gcc 4.8.5's libgcc. And MicroPython started in gradual fashion to do what nobody else seems to do - leverage these high-performance functions while saving iRAM, and I don't want to block further progress. Well, maybe @jcmvbkbc can help here too: what probability of breaking changes in libgcc between gcc micro-versions? (I understand it's low, but I'd like a second opinion anyway). Then for future cases, what's this probability for minor gcc version upgrades? And for major? Maybe this interface is set in stone (due to its utter simplicity) and breaking changes is a truly exceptional once-in-a-life case? |
I only see operation helpers exported from the ROM, AFAIU their interface is set in stone. |
@jcmvbkbc : Thanks for confirming! |
Ok, the first patch of the series (switch to gcc 4.8.5) was merged. @Sermus, thanks for driving this. Please see update commit message and please follow them for future patches (well, at least for next patch to merge, as we'll keep processing them one by one). In the meantime, please rebase. @dpgeorge: FYI |
One good way to upgrade to this patch is to "make clean" before pulling it, otherwise neither "make clean" won't work and will need fixing manually. This is also a good chance for a clean clone of esp-pen-sdk (all toolchain components will be redownloaded and rebuilt anyway). |
Actually, it requires git clean -d is crosstool-NG subdir. |
Conflicts: .gitmodules
I merged the changes form upstream so that the pull request is no more in conflicted state with upstream. |
I still see that the next patch to merge in this patchset is "crosstool-NG was switched to xtensa-1.22.x. 1000-mforce-l32.patch was… … |
I'll be off next two weeks, so there won't be progress on this, sorry. |
Is there any update on this? It would be really nice to have Edit: What are the actual actions left to get this merged? I would like to help if they are something I'm able to do. |
@Sermus Very interested in this too. Is there any progress? |
Sorry, Gents, I'm really busy with my current assignments. This lib is usable (you can check out in my fork of the esp-open-sdk). I'd appreciate if somebody could do a backmerge request to pfalcon's repo. |
This is a reworked pull requiest for #144 after comments made by @pfalcon and @jcmvbkbc.
The commits are better structured.
The STL SGI tests are not included in this request because there is no way to build 1MB+ images in current version of esp-open-sdk.