-
Notifications
You must be signed in to change notification settings - Fork 164
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
riscv-rt
: Linker relocation issue (QEMU / OpenSBI)
#153
Comments
Having worked with this crate & OpenSBI a little bit myself, I can't say for 100 % certain, but I think that the relatively large memory size reserved for RAM here (0x8000000 == 128 Mebibytes) causes the program to become "too large" for the link strategy used by this crate as defined in link.x. One way to properly solve this would be to try to use a link script from OpenSBI/QEMU side and try to adapt your runtime into it. A more hacky solution which would work for either verification of the issue or initial testing, could be to reduce the size you reserve for RAM and see if the program would be able to link in that case. I would maybe think of |
I have the same issue, but reducing the size of RAM does not solve the issue. @hegza Any other ideas? I have a custom |
When using this crate via
in the linker script addition, it seems to be working.. |
riscv-rt
: Linker relocation issue (QEMU / OpenSBI)
We ran into this or a similar issue with @hegza and were able to solve it by setting
|
Why use OpenSBI though? Are you trying to write S-mode software? |
In our case it wasn't OpenSBI but an application thay needed access to a memory located in the high bits. |
I am experimenting with the RISC-V ISA via QEMU emulation, and I am having trouble figuring out how to link in the _heap_size symbol appropriately, so that I can follow through with heap allocation. I followed the riscv-rt documentation closely. I am attempting to use QEMU with OpenSBI, but I am not experienced with linker configuration. Here is my memory layout specification:
I understand that to mean that there is 16M of reserved flash memory at the beginning of the address space (OpenSBI), followed by RAM address space. I would expect all of the memory regions to fit within RAM since the FLASH space is reserved by QEMU OpenSBI firmware.
I have the following example program:
The problem is that the linker cannot relocate _heap_size provided by riscv-rt and I do not understand why. I tried changing the code model to medium:
The text was updated successfully, but these errors were encountered: