[QEMU] Running RT-Thread Without a Development Board — RISC-V Architecture Guide
Overview
RT-Thread, known for its tiny, efficiency, and flexibility, is becoming increasingly popular among IoT and embedded systems developers. However, acquiring and using a development board might seem daunting for those new to RT-Thread. This article provides a detailed guide on running RT-Thread on the QEMU platform, enabling developers to easily explore and learn the powerful features of RT-Thread without needing physical hardware.
I. Preparations:
- Download Source Code: Access the RT-Thread repository at https://github.com/RT-Thread/rt-thread and use the master branch.
- Download and Set Up ENV: Visit https://github.com/RT-Thread/env and follow the README for installation instructions on setting up a Linux environment.
- Prepare Toolchain: Refer to the BSP instructions for the recommended toolchain, though it can be substituted with other toolchains as needed.
- Prepare QEMU: Follow the BSP instructions for setting up QEMU, or replace it with another QEMU version if necessary.
II. Compilation:
To simplify the process, modify the line EXEC_PATH = 'toolchain path'
by replacing it with the path to your own toolchain.
Example:
Run the following command to compile in the relative path bsp/qemu-virt64-riscv
:
Example:
Result:
Generate the rtthread.elf at the current path.
III. Running
Execute ./qemu-nographic.sh to start
IV. Debugging
In VS Code, click on the debug option and select “Create launch.json file example.”
Replace the file contents with the following text:
Run the following in the terminal: qemu-dbg.sh
, press F5 to start debugging.
Enjoy your learning journey!