-
Notifications
You must be signed in to change notification settings - Fork 240
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
Missing memory section for .rodata in neorv32.ld #134
Comments
This is really interesting! Seems like a problem during relocation....
Could you share a minimal example of your software source code?
That's right. But right after reset, the CPU executes
I was not aware of that 👍
Looks very good! |
Thank you for your reply!
I just used the blinky_led example when I realized that the programm is running but the initial UART output ("Blinking LED demo program\n") is not printed although the bootloader menu showed correctly.
When i look at the main.c object file it seems to be in the section ".rodata.main.str1.4", which should match the wildcard ( .rodata.)
It seems to be correct in the object file, and the wildcard which is not mapped to a memory section causes it to be placed in the ram section. Therefore also the copy routine in the crt0.S can't copy the data from the rom to the ram as it isn't in the rom section in the first place (but they also don't need to be in the ram at all, they should stay in the rom as they are read only). |
So you did not change any of the default software files? What hardware setup do you use? Especially the memory configuration is interesting here. And by the way: what kind of UART hardware interface do you use on the FOMU? 😉
I have not testes that version, but I don't think that any section-mapping related thing have changed. Anyway, I will check that.
Right, the mapping looks fine. Please try running this: On my setup it shows the static string "Blinking LED demo program\n" placed at offset 0x24 in section
I have checked the programs'
|
No, I did not change anything in the default software source files.
I configured the core to use the internal bootloader (in EBR), internal memories for data and instructions (2* 64kBytes) in SPRAM. No cache or external memories are active.
I used the 4 Touch I/Os which are the only exposed I/Os on the back of the board and soldered wires onto them. And a FTDI TTL to USB converter to get an serial interface. 😉
It shows the same output on my setup, but the base address is still at 0x80000000.
Here I get different results, where the address points to the ram:
Update: |
Nice one! 👍
Good to hear! But I am still not sure why the linker thinks the string is located in the |
Ok, this really is (was) a bug in the linker script. The |
Hello,
I've been trying to run some software examples on a Fomu.im board. After some experimenting i realized that the neorv32_uart_print() outputs were missing. After some debugging i realized that the static strings where looked for in the DMEM section although they are read only. As only the IMEM gets filled through the bootloader these data were missing.
After some research i found that unmapped sections get mapped to the first defined memory region which has the correct attributes. Link here:
https://users.informatik.haw-hamburg.de/~krabat/FH-Labor/gnupro/5_GNUPro_Utilities/c_Using_LD/ldLinker_scripts.html#MEMORY_command
Because the linker file defines the ram section first which also has the r attribute the .rodata section (which includes the static strings) is suitable. Here is a snippet from the linker script:
By changing the order and defining "rom" first, the linker would place the .rodata section in the rom, which is correct in my opinion for static read-only data. But this approach would not remove the root of the problem (the unspecified memory section), but only work for this case.
So my solution would be to remove these unmapped sections:
An add the wildcards to the mapped section below:
In my tests this approach led to correct placements and the neorv32_uart_print() functions were working. Am I missing something here or is this a real bug?
The text was updated successfully, but these errors were encountered: