This chapter covers the basics of the Zephyr RTOS Synchronization sample application including creating, building, running, and debugging steps. A simple application that demonstrates basic sanity of the kernel. Two threads (A and B) take turns printing a greeting message to the console and use sleep requests and semaphores to control the rate at which messages are generated. This application can also be built and run on QEMU emulator.
Note: To build, run and debug ZephyrRTOS applications with QEMU emulator, please install the xplor-studio-zephyr blueprint first. Please refer to Guidelines for more information.
Create a new project
Select “File - New - C/C++ Project” choose Zephyr application then Next.
Select Toolchains: RISC-V Custom Toolchains and enter the Project name. Then click Next.
Enter Author then click Next button.
Then click the Finish button. Select Zephyr Base Path then click Next:
Select target board configuration:
Select toolchain path then click Next and Finish.
The build step is the same as the quick-start project’s step. Please refer to Build project for more information.
If there is any problem related to the CMake, such as:
Please make sure that the version of CMake is 3.20 or higher.
After building successfully, you will see the messages in the Console view:
Running and Debugging project with QEMU emulator
Run project on QEMU Emulator
- Right-click on current project > Run As > RISV-C application with QEMU
The output of the application is shown in the Console view:
Debug project on QEMU Emulator
The XploR Studio offers several ways to debug applications:
- Select the Helloworld project entry in the Project Explorer then open the Debug Configuration Dialog. Doing so will enable eclipse to automatically fill out the necessary debug configuration information.
In Debug Configuration Dialog, create new one by double click on RISC-V Debugging:
On tab Debugger, choose option QEMU in Virtual Platforms. Click Apply then click Debug.
- Select the Helloworld project entry in the Project Explorer then clicking Debug As/RISC-V application with QEMU
- Right-click on current project > Debug As > RISV-C application with QEMU
After selecting Debug As RISC-V application with QEMU, the IDE changes to the debug perspective and automatically sets a breakpoint in the first line of code in the main() function.
Other functions of debugging (such as Resume, Step Into, Step Over, Step Return, Terminate, …) are the same as the quick-start project’s. Please refer to Running and Debugging project with QEMU emulator for more information.
About other ZephyrRTOS views (Thread view, … ), please refer to Zephyr OS views for more information.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.