FreeRTOS-Kernel/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC
johnrhen 43defa566c
Apply release changes to main branch (#759)
* Update History.txt and README.md for December release (#744)

* Update History.txt and README.md for release

* Bump mbedtls submodule to v2.28.0 (#745)

* Patch project files for mbedtls (#751)

* Apply group 1 patches

* Apply patches for group 2

* Update project files for mbedTLS new version

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Fix warnings in projects

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Fix warnings in HTTP_S3_Download demo

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>

* Update changelog and history for corePKCS11 update (#752)

* Update submodule pointer and manifest.yml for corePKCS11 (#754)

* Update readme and history.txt to show that Sigv4 is a newly added library (#756)

* Revert update to v143 of VS toolset (#757)

* [AUTO][RELEASE]: Bump file header version to "202112.00"

* Update file headers to satisfy core checks

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: johnrhen <johnrhen@users.noreply.github.com>
2021-12-23 10:16:27 -08:00
..
fake_rom.lds Add Makefile project for RISC-V QEMU virtpc (#266) 2020-11-11 15:35:21 -08:00
FreeRTOSConfig.h Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
main.c Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
main_blinky.c Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
Makefile Add Makefile project for RISC-V QEMU virtpc (#266) 2020-11-11 15:35:21 -08:00
ns16550.c Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
ns16550.h Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
Readme.md Add Makefile project for RISC-V QEMU virtpc (#266) 2020-11-11 15:35:21 -08:00
riscv-reg.h Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
riscv-virt.c Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
riscv-virt.h Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00
start.S Apply release changes to main branch (#759) 2021-12-23 10:16:27 -08:00

Emulating generic RISC-V 32bit machine on QEMU

Requirements

  1. GNU RISC-V toolchains (tested on Crosstool-NG)
  2. qemu-riscv32-system (tested on Debian 10 package)
  3. Linux OS (tested on Debian 10)

How to build toolchain

Clone the Crosstool-NG and build.

$ git clone https://github.com/crosstool-ng/crosstool-ng
$ ./configure --enable-local
$ make

$ ./ct-ng menuconfig

Change the following configs:

CT_EXPERIMENTAL=y
CT_ARCH_RISCV=y
CT_ARCH_64=y
CT_ARCH_ARCH=rv32ima
CT_ARCH_ABI=ilp32
CT_MULTILIB=y
CT_DEBUG_GDB=y

Build the GNU toolchain for RISC-V.

$ ./ct-ng build

A toolchain is installed at ~/x-tools/riscv64-unknown-elf directory.

How to build

Add path of toolchain that is described above section.

$ export PATH=~/x-tools/riscv64-unknown-elf:$PATH

For release build:

$ make

For debug build:

$ make DEBUG=1

If success to build, executable file RTOSDemo.axf in ./build directory.

How to run

$ 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 -kernel ./build/RTOSDemo.axf

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)

This is just recommend to use 'debug build' for more efficient debugging. Run these commands after starting the QEMU with above options:

$ riscv64-unknown-elf-gdb build/RTOSDemo.axf

(gdb) target remote localhost:1234
(gdb) break main
Breakpoint 1 at 0x80000110

(gdb) c
Continuing.

Breakpoint 1, 0x80000110 in main ()

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.