Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

How to skip reset_vec execution before user program? #131

Open
sergeysmolov opened this issue Apr 12, 2018 · 2 comments
Open

How to skip reset_vec execution before user program? #131

sergeysmolov opened this issue Apr 12, 2018 · 2 comments

Comments

@sergeysmolov
Copy link

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'.

@sergeysmolov sergeysmolov changed the title How to skip reset_vec execution befor user program How to skip reset_vec execution befor user program? Apr 12, 2018
@sergeysmolov sergeysmolov changed the title How to skip reset_vec execution befor user program? How to skip reset_vec execution before user program? Apr 12, 2018
@michaeljclark
Copy link
Collaborator

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.

@sergeysmolov
Copy link
Author

We could implement the -bios option so that you can specify the firmware that is loaded, rather than use -kernel.

That would be great.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants