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

ESP32 DRAM linker fix #454

Merged
merged 2 commits into from
Mar 24, 2023
Merged

ESP32 DRAM linker fix #454

merged 2 commits into from
Mar 24, 2023

Conversation

MabezDev
Copy link
Member

The ROM code data section is loaded into the middle of the DRAM address space, unlike the other chips where it is loaded at the end. Therefore subtracting the previously "reserved" section from heap end could actually corrupt the ROM data section.

For the ESP32, the DRAM block has been split into two individual segments, with some reserved segments in the middle (addresses taken from esp-idf). At the moment we don't use the second segment at all in esp-hal, but we could utilize it in esp-wifi for placing the internal allocator for example.

Partially fixes #451 (The first issue)

The ROM code _data_ section is loaded into the middle of the DRAM
address space, unlike the other chips where it is loaded at the end.
Therefore subtracting the previously "reserved" section from heap end
could actually corrupt the ROM data section.

For the ESP32, the DRAM block has been split into two individual
segments, with some reserved segments in the middle (addresses taken
from esp-idf). At the moment we don't use the second segment at all in
esp-hal, but we could utilize it in esp-wifi for placing the internal
allocator for example.
@bjoernQ
Copy link
Contributor

bjoernQ commented Mar 24, 2023

Works fine for me - great idea to use that second segment for esp-wifi 👍
I think we also need a fix for S2 since it shows the same problems with esp-wifi now - but this already fixes the ESP32 👍

@MabezDev
Copy link
Member Author

Lets hold off on this, I'll take a look at the S2 as well.

@MabezDev
Copy link
Member Author

So I checked with the linker scripts produced by esp-idf, the DRAM sections for the esp32s2 & esp32s3 already have their length shortened to account for the ROM data section at the end of memory, so reducing it again is not required.

If you could double check the S2 & S3 work, I think this is ready to go after that.

@bjoernQ
Copy link
Contributor

bjoernQ commented Mar 24, 2023

Checked S2 and S3 - they work fine! Thanks for taking care of this ... going to merge

@bjoernQ bjoernQ merged commit 91ded64 into esp-rs:main Mar 24, 2023
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.

Some changes broke esp-wifi for some targets
2 participants