Open nolash opened 3 years ago
I had a chat with pm215
on #qemu@oftc
irc, and he identified the problem to be bios that gets automatically loaded at memory start. Also -kernel
adds some magic, making the PC start in a different place (0x1000
on mine).
Adding -bios none
and using -device loader,file=<elf-file>,cpu-num=0
instead of using -kernel <elf-file>
solves it.
this is the culprit:
https://www.qemu.org/docs/master/system/deprecated.html#risc-v-bios-since-5-1
Hey, thanks for a brilliantly written tutorial. Impressive clarity!
I am trying to make it work with qemu-riscv64 and riscv64-elf-* tools from archlinux. It compiles fine, but when I run, I get the following error:
I've reduced the main code to just
int main { return 0; }
, which disassembles to:0x80000052
is the end ofmain
, but stops two bytes before the next section.eh_frame
. My guess is that it's some sort of alignment problem, but I'm not sure how to read most of this stuff, so any pointers would be welcome!I've attached my
.ld
script and.dts
output with this post:riscv64-virt.dts.txt riscv64-virt.ld.txt