RT-Thread IoT OS
4 min readAug 14, 2024

[QEMU] Running RT-Thread Without a Development Board — ARM 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 QEMU’s Vexpress-A9 platform, enabling developers to easily explore and learn the powerful features of RT-Thread without needing physical hardware.

Setting Up the Development Environment

  • Required Tools: RT-Thread source code, env-windows 2.0 tools, and VS Code.
  • Resource Download: You can develop RT-Thread using VS Code in a Windows environment.
  • Env-Windows Tutorials: For guidance on using env-windows, check out the Env User Manual.
  • Note: If you’re working with the RT-Thread mainline code, be sure to update your env-windows tool. You can download the latest version using the provided link.

Compilation

  • Navigate to the target folder: rtthread/bsp/qemu-vexpress-a9.
  • Right-click and select “ConEmu Here” to open the environment.
  • If “ConEmu Here” doesn’t appear in the context menu, it indicates that the steps outlined in the Env User Manual have not been followed correctly.

Open the env terminal and run scons -j16 to start the compilation process. The env-windows tool has already configured the necessary toolchain for us (default: arm-none-eabi-gcc), so there's no need to download any additional tools.

  • Toolchain Path: env-windows\tools\gnu_gcc\arm_gcc\mingw
  • Scons Command: Executes the SConscript file in the current folder.
  • -j16 Parameter: Utilizes 16 CPU cores to speed up the compilation. If your system has fewer than 16 cores, it will automatically use the available number of cores.

If the following compilation message appears, it indicates that the compilation was successful.

Execution

Run the qemu.bat command in the env terminal.

Since env-windows comes with QEMU integrated, you can directly use the qemu command from the env command line.

  • QEMU Path: env-windows\tools\qemu

Our RT-Thread is now up and running successfully!

Try entering the help command to explore the available commands you can execute!

Debugging

Method One (Recommended)

Replace the debugger configuration file located at qemu-vexpress-a9/.vscode/launch.json.

Update the file content as follows (this step may not be required; if the current file content differs and debugging issues arise, use the configuration information provided here as a reference).

Once the replacement is complete, run the qemu-dbg.bat command from the env command line.

After execution, you should see the following screen:

Next, open VS Code and press F5 to enter debug mode.

The result will be displayed as shown below:

Method Two

This method is a bit older and less convenient, but it serves as a backup if the above configuration doesn’t work.

First, run qemu-dbg.bat from the env command line.

Then, open another env command line in the current working directory and run arm-none-eabi-gdb rtthread.elf.

This will put you in the GDB debugging mode.

Next, execute the command target remote:1234.

You will then reach the breakpoint at the first instruction.

However, I’m not sure why the first instruction is located at 0x60000000. We can reach the first instruction by executing a few additional next commands.

RT-Thread also offers cost-effective hardware platforms. If you have the budget for one, you can check out the RT-Thread Aliexpress Shop here:
https://www.aliexpress.com/item/1005006676753692.html

RT-Thread IoT OS

An Open-Source Community-Powered Real-Time Operating System (RTOS) Project! Let’s develop, DIY, create, share, and explore this new IoT World together!