FreeRTOS-Kernel/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC
Jonathan Cubides 881305dcb8
Update RV32 qemu Demo to support RVA23 (#1329)
* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Increase the memory for RVA23 compilation

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Update the regtest to include fpu registers

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Fix small issues for 64-bit configs

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Enable FPU unit

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Enable compilation for RVA23 platforms

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Fix copyright related CI issues

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Update submodule manifest

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Update a few typos and left overs

* Demo: RISC-V_RV32_QEMU_VIRT_GCC: Apply @aggarg's sugestions

* Update pointer to Freertos-Kernel
2025-03-10 17:06:13 +05:30
..
build/gcc Update RV32 qemu Demo to support RVA23 (#1329) 2025-03-10 17:06:13 +05:30
FreeRTOSConfig.h Update RV32 qemu Demo to support RVA23 (#1329) 2025-03-10 17:06:13 +05:30
main.c Update RV32 qemu Demo to support RVA23 (#1329) 2025-03-10 17:06:13 +05:30
main_blinky.c Fix formatting in kernel demo application files (#1148) 2024-01-02 11:05:59 +05:30
main_full.c Update RV32 qemu Demo to support RVA23 (#1329) 2025-03-10 17:06:13 +05:30
ns16550.c Fix C source and header file license spacing (#1155) 2024-01-12 16:43:31 -08:00
ns16550.h Fix C source and header file license spacing (#1155) 2024-01-12 16:43:31 -08:00
Readme.md Update RV32 qemu Demo to support RVA23 (#1329) 2025-03-10 17:06:13 +05:30
riscv-reg.h Fix C source and header file license spacing (#1155) 2024-01-12 16:43:31 -08:00
riscv-virt.c Riscv re-factoring (#1145) 2023-12-21 11:42:46 +05:30
riscv-virt.h Fix C source and header file license spacing (#1155) 2024-01-12 16:43:31 -08:00
vector.S [AUTO][RELEASE]: Bump file header version to "202212.00" 2022-12-10 01:17:30 +00:00

Emulating generic RISC-V 32bit machine on QEMU

Requirements

  1. GNU RISC-V toolchains Tested on:
  1. qemu-riscv64-system. Tested on:
  1. Linux OS. Tested on:
  • Ubuntu 24.04 LTS

How to build

Add path of toolchain that is described above section, such as:

$ export PATH="/YOUR_PATH/riscv64-unknown-elf/bin:${PATH}"

For release build:

$ make -C build/gcc/

For debug build:

$ make -C build/gcc/ DEBUG=1

To clean build artifacts:

$ make -C build/gcc/ clean

For any of the previous configurations, if you want to use the port on a RVA23 system instead of a RV32, you may append append RVA23=1

$ make -C build/gcc/ RVA23=1

If the build was successful, the RTOSDemo.elf executable will be located in the build/gcc/output directory.

How to run

For the RV32 build:

$ qemu-system-riscv32 -nographic -machine virt -net none -chardev stdio,id=con,mux=on \
    -serial chardev:con -mon chardev=con,mode=readline -bios none -smp 4 \
    -s --kernel build/gcc/output/RTOSDemo.elf

For the RVA23 build:

$ qemu-system-riscv64 -nographic -machine virt -net none -chardev stdio,id=con,mux=on \
    -serial chardev:con -mon chardev=con,mode=readline -bios none -smp 4 \
    -s --kernel build/gcc/output/RTOSDemo.elf

How to debug with gdb

Append -s and -S options to the previous qemu command.

  • -s: enable to attach gdb to QEMU at port 1234
  • -S: start and halted CPU (wait for attach from gdb)

It is recommended to use the 'debug build' so that gdb can automatically map symbols. Run these commands after starting the QEMU with above options:

$ riscv64-unknown-elf-gdb -x build/gcc/gdbinit

Description

This demo just prints Tx/Rx message of queue to serial port, use no other hardware and use only primary core (currently hart 0). Other cores are simply going to wfi state and execute nothing else.