This article is a continuation of the Series on RT-Thread STM32 Tutorials and carries the discussion on RT-Thread RTOS and implementation with STM32. The aim of this series is to provide easy and practical examples that anyone can understand. In this Getting Started STM32 with RT-Thread RTOS post, we will see how to install the IDE and create the first program.
You can find a video explanation of this tutorial here.
Getting Started STM32 with RT-Thread RTOS
In our last post, we have seen RT-Thread RTOS Introduction. In this post, we will start coding directly.
Tools and Components Required
- STM32F411 Dev Board (You can use any STM32F4 controller)
- RT-Thread Studio
RT-Thread Studio
We need to use the IDE to write code. RT-Thread supports many IDEs including IAR, Keil, etc. But they have launched its Innovative and Powerful Embedded Integrated Development Environment called RT-Thread Studio. RT-Thread Studio is built on Eclipse but has innovative interface interaction designs and it is deep customization of Eclipse, easy and simple to use, even new developers can easily get started.
RT-Thread Studio has the features of project creation and management, code editing, SDK management, RT-Thread configuration, build configuration, debugging configuration, program download, and debugging. Also, it combined the graphical configuration system with packages and component resources, reducing the duplication of work and improving development efficiency.
RT-Thread Studio Features
RT-Thread studio is a one-stop development tool, it has an easy-to-use graphical configuration system and a wealth of software packages and components resources, which makes IoT development simple and efficient.
- The community version is free forever.
- Supports mainstream C/C++ language development.
- Powerful code editing and refactoring functionality.
- SDK Manager supports online downloads and updates the latest source package of RT-Thread.
- Easy-to-use project creation wizard can quickly validate prototypes.
- Brand new graphical configuration system, which supports both schema diagram and tree diagram configuration.
- The software package market offers a variety of package resources.
- Rich debugging facilities to quickly view and track code issues.
Okay, Let’s stop the theory here. We will start creating the project.
RT-Thread Studio Installation
Please download the RT-Thread Studio from their official website.
- Install the RT-Thread Studio. Click Next.
- Accept the Agreement and click Next.
- Install the RT-Thread Studio in the proper location.

- Click Next and Install.


- Wait until it installs the RT-Thread Studio. Then launch RT-Thread Studio.
That’s it. It will open the RT-Thread Studio.
Project Creation
Follow the below video to create a project.
Build Error
If you use the latest RT-Thread Studio version 4.0.3 and the latest CSL (Chip Support Library) version 0.2.3, then you will get the below build error.
../drivers/drv_usart.c:338:16: error: ‘struct serial_configure’ has no member named ‘flowcontrol’
../drivers/drv_usart.c:340:10: error: ‘RT_SERIAL_FLOWCONTROL_NONE’ undeclared
../drivers/drv_usart.c:343:10: error: ‘RT_SERIAL_FLOWCONTROL_CTSRTS’ undeclared
We can solve this error by three methods.
- Downgrade the RT-Thread OS version to 4.0.2, and use the latest CSL (0.2.3)
- Downgrade the CSL version to 0.0.2, and use the latest RT-Thread OS version (4.0.3)
- Use the RT-Thread OS version over 4.1.0, then you won’t see the error.
We have explained the second method in the video. Please check that, if you don’t know how to do that. But we suggest you to use the third method. You can install that through the SDK manager.
You can also change the Chip Support Library by below easy method.
- Right-click the Project name in the Project Explorer
- Click Modify Project
- Click Chip support package version
- Then select your desired CSL version.
By this method, you can change the OS version also.
Source Code
We are not going to modify the source code. We will just use the default program now. The application main.c will be present under the HelloWorld/applications/main.c directory. You can also get the complete source code from GitHub.
/* * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2023-02-10 RT-Thread first version */ #include <rtthread.h> #define DBG_TAG "main" #define DBG_LVL DBG_LOG #include <rtdbg.h> int main(void) { int count = 1; while (count++) { LOG_D("Hello RT-Thread!"); rt_thread_mdelay(1000); } return RT_EOK; }
Build the source code. It should build without any errors.
Connections
In this project, we are using the STM32F411 and its UART1 (PA9 and PA10) for Debug prints.
Flashing and Demo
Flash the Code using RT-Thread Studio. Please refer to the below image.
Once you flash the code, then open any serial terminal application. Here, I am going to use the RT-Thread Studio’s inbuilt terminal. Set the baud rate (115200). You should see the print “Hello RT-Thread!“. Refer to the below images.



Video Explanation
What’s Next
In our next post, we will discuss about the RT-Thread RTOS thread management and STM32 GPIOs.
You can also read the below tutorials.
Embedded Software | Firmware | Linux Devic Deriver | RTOS
Hi, I’m SLR. I am a tech blogger and an Embedded Engineer. I am always eager to learn and explore tech-related concepts. And also, I wanted to share my knowledge with everyone in a more straightforward way with easy practical examples. I strongly believe that learning by doing is more powerful than just learning by reading. I love to do experiments. If you want to help or support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!