Skip to content
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

Fix libraries and RAM size in PlatformIO build #440

Merged
merged 2 commits into from
Jan 27, 2022
Merged

Fix libraries and RAM size in PlatformIO build #440

merged 2 commits into from
Jan 27, 2022

Conversation

maxgerhardt
Copy link
Contributor

@maxgerhardt maxgerhardt commented Jan 26, 2022

This fixes two things:

  • the ram_size variable which is fixed at 256K. Previously PlatformIO's board definitions would have 264K there (+4K scratch x/y), which would generate a linker script with the content
MEMORY
{
    FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 1044480
    RAM(rwx) : ORIGIN =  0x20000000, LENGTH = 264k
    SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
    SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
}

i.e., the RAM section length would be off by 8K.

  • links only against lib/libpico.a, not lib/libstdc++.a by reworking the linkerflags (no -L flag to add to the search directory and -lpico -lstdc++, only link libpico.a by full path and source libstdc++.a from compiler). The libstdc++.a has weird errors which make the the system crash & burn when attempting to use even the smallest bits of the C++ standard library, such as creating a std::string or a std::map. I am not sure why this file exists here, the Arduino IDE build also does not link against it.

Related to maxgerhardt/pio-pico-core-earlephilhower-test#3 and #436.

@earlephilhower
Copy link
Owner

I'm very surprised the binaries didn't just crash immediately with a different stdc++.a interface/structures vs. the interface used in the headers used to compile the code. Good debug!

@earlephilhower earlephilhower merged commit 00c0bc1 into earlephilhower:master Jan 27, 2022
@earlephilhower
Copy link
Owner

Actually, @maxgerhardt if I get it correctly I really need to delete that libstdc++.a file. I was experimenting w/exceptions enabled/disabled at one point but never got into it deeply. Seems maybe I have some cruft in the repo left over from those experiments...

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.

None yet

2 participants