riscv-qemu
riscv-qemu copied to clipboard
How to skip reset_vec execution before user program?
I run a bare metal RISC-V assembler program on QEMU. I use the following command:
qemu-system-riscv64 -M spike_v1.10 -cpu any -d in_asm -nographic -singlestep -bios program.bin
The simulation starts with the following instructions:
IN:
0x0000000000001000: 00000297 auipc t0,0 # 0x1000
IN:
0x0000000000001004: 02028593 addi a1,t0,32
IN:
0x0000000000001008: f1402573 csrrs a0,mhartid,zero
IN:
0x000000000000100c: 0182b283 ld t0,24(t0)
IN:
0x0000000000001010: 00028067 jr t0
IN:
0x0000000080000000: 0000 mv s0,sp
As I understand, these instructions (preamble) are stored at 'reset_vec' array (/hw/riscv/spike.c) and they're executed at the very beginning.
Is it possible to avoid their emulation and run my program only? When I've used QEMU for Aarch64 programs simulation, it was possible to skip this preamble by using '-bios' option instead of '-kernel'.
We could implement the -bios
option so that you can specify the firmware that is loaded, rather than use -kernel
.
Otherwise you can make your own board for your own use. e.g. copy which ever board you are using and modify the reset vector i.e. add an option to load the firmware from a file. This is essentially similar to implementing the -bios
option.
We could implement the -bios option so that you can specify the firmware that is loaded, rather than use -kernel.
That would be great.