Hi,
On 6/25/23 17:44, Tommy Murphy wrote:
Hi there
I've tried searching to find an answer to this question but with no success so
far unfortunately.
The issue is discussed here:
https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1278#issuecomment-1606108826
<https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1278#issuecomment-1606108826>
But the gist is that I can configure, build and use `qemu-riscv32` to run a simple bare
metal "hello world" program fine.
But if I add a CSR read instruction to it (e.g. `asm("csrr t0, misa");`) then I
get Illegal Instruction.
This is the case even if I use `qemu-riscv32 -cpu rv32,Zicsr=on hello.exe`.
How can I configure/invoke `qemu-riscv32` so that I can emulate CSR
instructions?
rv32 already has Zicsr support enabled by default. There might a bug
somewhere.
Please file a gitlab bug (https://gitlab.com/qemu-project/qemu/-/issues) and
we'll take a look. Don't forget to mention that you managed to reproduce the
SIGILL using upstream QEMU as you mentioned in the toolchain bug. Thanks,
Daniel
Thanks a lot
Regards
Tommy