In today’s embedded systems field, the selection and performance evaluation of real-time operating systems (RTOS) have become a focal point for developers. <span>rtos-benchmark</span> project was created to help developers accurately assess the performance of different real-time operating systems. Below, we will delve into various aspects of this project.
Project Overview
<span>rtos-benchmark</span> is a performance benchmarking project based on Zephyr, aimed at measuring the performance of specific operating system operations. It currently supports the <span>qemu_x86</span> and <span>frdm_k64f</span> boards on Zephyr, as well as the <span>frdm_k64f</span> board on FreeRTOS. More boards and operating systems will be added in the future to make it more comprehensive and adaptable to different needs. It is important to note that while benchmarking can be run on QEMU, it is not recommended, and results should be treated with caution.
Environment Setup
For developers using <span>rtos-benchmark</span>, setting up the environment is crucial. Different RTOS and development boards have different requirements for environment configuration.
Common Steps
First, you need to install the GNU ARM compiler, specifically the GNU ARM embedded toolchain for the <span>frdm_k64f</span> board, and set <span>ARMGCC_DIR</span> to the installation directory.
Zephyr-Specific Steps
Developers can refer to Zephyr’s “Quick Start Guide” to install and set up the Zephyr environment. This is necessary for building free applications, and also remember to set the environment variable for the 3rd Party GNU ARM embedded toolchain:
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
export GNUARMEMB_TOOLCHAIN_PATH=<path to installed toolchain>
FreeRTOS-Specific Steps
For FreeRTOS users, you first need to download and build the <span>FRDM-K64F SDK</span> from the NXP MCUXpresso SDK Builder. Choose Linux as the host operating system and check the FreeRTOS option to enable FreeRTOS support and examples in the SDK. An example command is as follows:
mkdir freertos/SDK_<version>_FRDM-K64F
unzip ~/Downloads/SDK_<version>_FRDM-K64F.zip -d <SDK Install Dir>/SDK_<version>_FRDM-K64F
Don’t forget to install <span>pyOCD</span>, which is used for flashing the <span>FRDM_K64F</span>.
Building and Flashing
Once the application environment is successfully configured, you can proceed with the building and flashing functions.
For building Zephyr on the <span>FRDM K64F</span>, you can use the following commands:
cmake -GNinja -DRTOS=zephyr -DBOARD=frdm_k64f -S . -B build
ninja -C build
ninja -C build flash
If you want to build on other boards, simply specify the board name in the <span>cmake</span> command.
For FreeRTOS, the commands for building and flashing are similar:
cmake -GNinja -DRTOS=freertos -DBOARD=frdm_k64f -DMCUX_SDK_PATH=<SDK Install Dir>/SDK_<version>_FRDM-K64F -S . -B build
ninja -C build
inja -C build flash
Connecting and Debugging
Connect the <span>frdm_k64f</span> to the host and open a serial terminal (such as <span>screen</span> or <span>minicom</span>) to view the output:
minicom -D /dev/ttyACM0
Conclusion
<span>rtos-benchmark</span> is an invaluable tool for developers looking to evaluate and compare the performance of different real-time operating systems. Its flexible support and scalability allow the project to adapt to various hardware environments and needs, bringing convenience and efficiency to embedded development. The continuous updates of the project also mean that more features will be introduced in the future, making it worth developers’ attention and use.
Project address: https://github.com/zephyrproject-rtos/rtos-benchmark