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-C3] Direct boot linker bug #144

Closed
MabezDev opened this issue Aug 9, 2022 · 5 comments · Fixed by #145
Closed

[ESP32-C3] Direct boot linker bug #144

MabezDev opened this issue Aug 9, 2022 · 5 comments · Fixed by #145
Labels
bug Something isn't working

Comments

@MabezDev
Copy link
Member

MabezDev commented Aug 9, 2022

I can't seem to pin it to a specific example, as on two different machines I encounter the error on a different example (timer_interrupts & serial_interrupts). To get this output I ran the following:

cargo build --features direct-boot --examples --release
= note: rust-lld: warning: address (0x42000008) of section .text is not a multiple of alignment (256)
          rust-lld: error: section .bss load address range overlaps with .rwtext
          >>> .bss range is [0x42C0, 0x42CF]
          >>> .rwtext range is [0x42C8, 0x498F]

@bjoernQ I believe you worked on the DB feature/linker script, any ideas?

@MabezDev MabezDev added the bug Something isn't working label Aug 9, 2022
@bjoernQ
Copy link
Contributor

bjoernQ commented Aug 9, 2022

Oh ... will try to reproduce this myself
Don't have any idea right now.

Just a shot in the dark:
Something like changing .rwtext ORIGIN(REGION_RWTEXT) + _data_size : AT(_text_size + _rodata_size + _data_size){ to .rwtext ORIGIN(REGION_RWTEXT) + _data_size : AT(_text_size + _rodata_size + _data_size + SIZEOF(.bss)){

But really just guessing

@MabezDev
Copy link
Member Author

MabezDev commented Aug 9, 2022

That seems to fix it for me!

@MabezDev
Copy link
Member Author

MabezDev commented Aug 9, 2022

Thinking on it though, this isn't really right because bss isn't loaded. Maybe we need to move bss section to after .rwtext?

@bjoernQ
Copy link
Contributor

bjoernQ commented Aug 9, 2022

Would probably be the better option 🤔worth a try

@gustavonihei
Copy link
Contributor

gustavonihei commented Aug 9, 2022

Oh ... will try to reproduce this myself Don't have any idea right now.

Just a shot in the dark: Something like changing .rwtext ORIGIN(REGION_RWTEXT) + _data_size : AT(_text_size + _rodata_size + _data_size){ to .rwtext ORIGIN(REGION_RWTEXT) + _data_size : AT(_text_size + _rodata_size + _data_size + SIZEOF(.bss)){

But really just guessing

I believe this is the actual solution, because both BSS and the RWTEXT refer to the same area on the address space, although they are accessible from different buses.

The #49 PR required a similar solution, since both Direct Boot and MCUboot images follow a different image format than the one expected by IDF Bootloader.
https://github.com/gustavonihei/esp-hal/blob/baba78e8385e05eee3e1a62ad8044a5bb1cbdc5c/esp32c3-hal/ld/mb-riscv-link.x#L76-L83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants