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

[WIP] Support Qemu RISC-V virt tagret #703

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

oddcoder
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Aug 14, 2023

Codecov Report

Merging #703 (4ca8db3) into main (fcfd19b) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@           Coverage Diff            @@
##            main    #703      +/-   ##
========================================
- Coverage   1.57%   1.56%   -0.01%     
========================================
  Files         22      23       +1     
  Lines        954     959       +5     
========================================
  Hits          15      15              
- Misses       939     944       +5     
Files Changed Coverage Δ
src/mainboard/emulation/qemu-riscv/src/serial.rs 0.00% <0.00%> (ø)

/src/mainboard/emulation/qemu-riscv/src/{init.S, bootblock.S} are never
used anywhere. The fix was to use them in main.rs using global_asm!.

bootblock.S contains entry point code for the whole rom, while init.S
contains some symbols used by bootblock.S

Signed-off-by: Ahmed <ahmedsoliman@oddcoder.com>
The correct address according to qemu + gdb is 0x80000000

Tested using Qemu version 8.0.3

Steps to reproduce the address
in one tab run:
qemu-system-riscv64 -m 4g -machine virt -nographic -bios /home/oddcoder/projects/VisionFive2/oreboot/target/riscv64imac-unknown-none-elf/release/emulation-qemu-riscv-bootblob.bin -s -S

in another tab attach gdb

PC will be initialized at 0x1000 but that code is not our bios code,
perhaps qemu's first stage bootloader?

but it looks like this:

   0x1000:      auipc   t0,0x0
   0x1004:      add     a2,t0,40
   0x1008:      csrr    a0,mhartid
   0x100c:      ld      a1,32(t0)
   0x1010:      ld      t0,24(t0)
   0x1014:      jr      t0
at the end of this code, t0 is initialized to 0x80000000 and we jump
into it, and that is our bootrom
Signed-off-by: Ahmed <ahmedsoliman@oddcoder.com>
This Ld script fails to work once the code starts improting symbols.
problems is we selectively keep some symbols and selectively get rid of
others and it feels arbitrary. I just replaced the whole meat of the
while with structure equivalent to that of link-nezha-bt0.ld.

The errors are generated arbitrarily and it is very hard to give a
solidc case where errors can be reproduced.

Signed-off-by: Ahmed <ahmedsoliman@oddcoder.com>
Signed-off-by: Ahmed <ahmedsoliman@oddcoder.com>
Signed-off-by: Ahmed <ahmedsoliman@oddcoder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant