-
Notifications
You must be signed in to change notification settings - Fork 585
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
Linking in libliteeth causes binary to fail to execute #2157
Comments
JTAG on
Resulted
With mainline OpenOCD. I think JTAG for OpenC906 and naxriscv are working, you can try those cores. |
I was able to get OpenOCD to attach to a litex_sim session:
OpenOCD invocation:
jtag_remote.cfg contents
riscv_jtag_tunneled.tcl contents:
The experience was not good though - single stepping took ~45 seconds per step, and I couldn't set breakpoints. Since I couldn't halt the CPU very effectively, I couldn't make very concrete determinations about what was wrong. Execution seems to be caught in I am very open to ideas about what could be happening here. |
After much more debugging I have tracked down the issue to an unaligned load. It appears that the libliteeth archive causes the load address of the This caused the word-alignment requirement of I fixed the issue for my application by simply swapping from I am unable to find a way to force the linker to align the LOADADDR, which would be the more universal way to solving this issue - I am open for suggestions for how to patch this! |
Thanks for tracking it down, can you try this?
|
The BIOS links in some other symbols which cause it to not experience this misalignment issue - could you provide your fixes against this linker script? https://github.com/kscz/wyrm/blob/debug_misalignment/software/linker.ld I actually had the same thought as you for what might fix the issue, and added alignment in the I'm actually willing to believe this may be some gnuld issue, but let me know if you have other thoughts for how to fix this. |
I have the following code base: https://github.com/kscz/wyrm/tree/debug_bridge
Generating the SoC and then loading the software works, so long as I do not call any method in libliteeth (see the instructions in the readme). The moment that I link in any function in libliteeth, the binary no longer appears to run at all.
I have the same issue regardless of what code I use - if I generate the SoC by invoking (note this expects this PR):
And then loading the code from demo works as expected. If I add a call to
eth_init()
inhelloc.c
, then the whole program has no output at all.I am unclear what's happening - the linker script feels like it must be related to the issue, but using the linker script from the bios modified to place code in
main_ram
seems to have the same issues.Edit: some extra context! This issue reproduces in the simulator and with both vexiiriscv as well as vexriscv. It reproduces both if the executable is in ROM or loaded by the BIOS into RAM. I have been unable to find a configuration where I can attach a debugger and see where the code is getting stuck. I followed the directions on the wiki and tried to get a simulator session of a vexiiriscv CPU with jtag, but I could not get openocd to connect.
The text was updated successfully, but these errors were encountered: