[riot-notifications] [RIOT-OS/RIOT] riscv: Simplify reset trampoline (#16876)

Joakim Nohlgård notifications at github.com
Wed Sep 22 10:45:47 CEST 2021


This PR simplifies the code in the reset trampoline that is used to jump to the right flash base address for the real startup code. By loading the absolute address of `_start_real` we can unconditionally jump to it regardless if the PC is somewhere at `0x0` or at `ROM_START_ADDR`.

Background:

The whole logic in this function both before and after this PR is there because on GD32V, the PC jumps to `0x0` on system reset, which is an alias address for the flash, but our code in the ELF file is linked at `0x08000000` which makes GDB not understand any symbol addresses until we jump to the real flash base address. Without jumping to the correct base we also get the wrong address for `__global_pointer$` a few lines below this change.

This change was spawned from a discussion in the Matrix room this morning.
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16876

-- Commit Summary --

  * <a href="https://github.com/RIOT-OS/RIOT/pull/16876/commits/b70a4b7694d220181afa9d784638aae3bb296b20">riscv: Simplify reset trampoline</a>

-- File Changes --

    M cpu/riscv_common/start.S (7)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16876.patch
https://github.com/RIOT-OS/RIOT/pull/16876.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16876
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210922/ad26c232/attachment.htm>


More information about the notifications mailing list