riscvarchive / riscv-qemu

QEMU with RISC-V (RV64G, RV32G) Emulation Support
384 stars 154 forks source link

FreeRTOS singlestep issue #173

Open arunthomas opened 5 years ago

arunthomas commented 5 years ago

I have been experimenting with SiFive's FreeRTOS demo application: https://github.com/sifive/freedom-e-sdk/tree/FreeRTOS

When I run the demo on QEMU without singlestep, the demo runs successfully:

qemu-system-riscv32 -machine sifive_e -nographic -kernel RISCV_HiFive1_GCC.elf

Sending to queue
Recieved: 100
Sending to queue
Recieved: 100
Sending to queue
Recieved: 100
Sending to queue
Recieved: 100
Giving Semaphore
RTOS Timer Callback
Semaphore taken
...

When I enable '-singlestep', the demo fails:

qemu-system-riscv32 -machine sifive_e -nographic -kernel RISCV_HiFive1_GCC.elf -singlestep

Giving Semaphore
Giving Semaphore
Giving Semaphore
Giving Semaphore
Giving Semaphore
...

I have reproduced the issue with QEMU built from the riscv-all branch. I built FreeRTOS with a recent 32-bit riscv-gnu-toolchain (--with-arch=rv32g --with-abi=ilp32) built from master.

I built FreeRTOS by cloning https://github.com/sifive/freedom-e-sdk/tree/FreeRTOS. I made the following modifications to software/FreeRTOSv9.0.0/Demo/RISCV_HiFive1_GCC/Makefile.inc:

I build FreeRTOS using:

make -C freedom-e-sdk/software/FreeRTOSv9.0.0/Demo/RISCV_HiFive1_GCC

The FreeRTOS demo code can be found here: https://github.com/sifive/freedom-e-sdk/blob/FreeRTOS/software/FreeRTOSv9.0.0/Demo/RISCV_HiFive1_GCC/main.c