Step 4 : Compile and Run

  • In this program, you are going to learn

  • How to ?

Topics in this section,

  • Perform compilation using below command:

$ scons
  • Note: For clean compilation, you can use following command:

$ scons --clean
  • If the compilation is correct, the “rtthread.elf” file will be generated in the BSP directory, which is a target file required for QEMU to run.

qemu-vexpress-a9$ ls -lrt rtthread.elf
    -rwxrwxr-x 1 test test 1866252 Apr 12 16:40 rtthread.elf
  • Use the ./qemu.sh command to run the Project.

$ ./qemu.sh
  • The above command will start the virtual machine and BSP project.

  • The initialization information is displayed and version number information is printed during the start-up of RT-Thread system.

  • The QEMU virtual machine also starts running as shown below:

test:qemu-vexpress-a9$ ./qemu.sh
    QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.18)
    Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

  |
- RT -     Thread Operating System
  |      5.1.0 build Apr 12 2024 16:40:27
 2006 - 2024 Copyright by RT-Thread team
[I/SDIO] SD card capacity 65536 KB.
[I/FileSystem] file system initialization done!

Hello RT-Thread!
msh />
  • Enter below command to check the list of commands which can be used:

msh />help
  • Run “ls” command to list the contents as shown below:

msh />ls
Directory /:
dev                 <DIR>
  • Now run below commands to print “hello RT-Thread”:

msh />echo "hello RT-Thread" hello.txt

msh />ls
Directory /:
dev                 <DIR>
hello.txt           15

msh />cat hello.txt
hello RT-thread