This article refers to the FreeRTOS official website and mainly discusses the introduction of FreeRTOS, the composition of the source code package, methods for establishing project engineering, and how to obtain official reference materials.
2. Introduction to FreeRTOS
FreeRTOS is a market-leading real-time operating system (RTOS) aimed at microcontrollers and small microprocessors, developed in collaboration with world-leading chip companies. FreeRTOS is currently managed by Amazon and is distributed for free under the MIT open-source license, including a real-time kernel and a continuously enriching set of IoT libraries.
The FreeRTOS codebase supports over 40 MCU architectures and more than 10 toolchains, including the latest RISC-V and ARMv8-M (Arm Cortex-M33) microcontrollers.
3. Structure of the FreeRTOS Source Code Package
The latest source code package can be downloaded from the FreeRTOS official website. The current version is FreeRTOSv202212.01, and the download link is as follows:
https://www.freertos.org/a00104.html
The FreeRTOS source code package mainly contains two subdirectories, namely FreeRTOS and FreeRTOS-Plus.
Among them, the FreeRTOS directory contains the real-time kernel source files and example projects; the FreeRTOS-Plus library implements additional features of the FreeRTOS kernel, including modules like FreeRTOS-Plus-TCP, FreeRTOS-Plus-CLI, and FreeRTOS-Plus-IO, along with example projects.
The FreeRTOS directory contains the real-time kernel source files directory Source and the example project directory Demo.
The FreeRTOS/Source directory contains the core RTOS code, including task.c, queue.c, and list.c. It also includes four optional codes: timers.c implements software timers; croutine.c implements coroutine functionality; event_groups.c implements event group functionality; stream_buffer.c implements stream buffer functionality.
The FreeRTOS/portable directory contains portable layer codes corresponding to different compilers and chip architectures, located in FreeRTOS/Source/portable/[compiler]/[architecture]. Here, [compiler] and [architecture] represent the compiler and chip architecture, respectively, such as FreeRTOS/Source/portable/RVDS/ARM_CM3 indicating the portable layer code for ARM Cortex-M3 architecture processors under RVDS and Keil development environments.
In addition, the FreeRTOS/portable directory also contains memory management heap allocation scheme codes, located in FreeRTOS/Source/portable/MemMang directory, supporting five allocation schemes from heap_1.c to heap_5.c.
The FreeRTOS/Demo directory contains a common directory for all example projects, as well as dedicated directories corresponding to different compilers and chip architectures. For example, the FreeRTOS/Demo/CORTEX_STM32F103_Keil directory is the Keil project directory for the STM32F103 microcontroller, corresponding to the ARM Cortex-M3 architecture.
4. Method for Establishing FreeRTOS Project Engineering
This section mainly introduces the essential source files, header files, configuration files, and optional source files required to create a FreeRTOS project based on the FreeRTOS source package.
2. Essential Source Files
The FreeRTOS project must include the following source files:
(1) FreeRTOS/Source/tasks.c
(2) FreeRTOS/Source/queue.c
(3) FreeRTOS/Source/list.c
(4) FreeRTOS/Source/portable/[compiler]/[architecture]/port.c
(5) FreeRTOS/Source/portable/MemMang/heap_x.c, where x is 1 to 5
The compiler should include the following header file paths:
(1) FreeRTOS/Source/include
(2) FreeRTOS/Source/portable/[compiler]/[architecture]
(3) The directory containing the FreeRTOSConfig.h configuration file used in the example project
The configuration file FreeRTOSConfig.h is used to tailor the RTOS kernel for the built application and configure parameters such as CPU frequency and interrupt priority according to the actual hardware situation.
Each example project under FreeRTOS/Demo contains the configuration file FreeRTOSConfig.h. When creating a new project, select the FreeRTOSConfig.h file from the same compiler and chip architecture as a template and modify it accordingly.
The optional source files for the FreeRTOS project include:
(1) FreeRTOS/Source/timers.c, for software timer functionality;
(2) FreeRTOS/Source/event_groups.c, for event group functionality;
(3) FreeRTOS/Source/stream_buffer.c, for stream buffer functionality;
(4) FreeRTOS/Source/croutine.c, for coroutine functionality. Note that coroutine functionality has been deprecated and is not recommended for new designs.
This section introduces the source files and header files required to create a FreeRTOS project based on the FreeRTOS source package. Some errors may occur during the compilation of the project; after successful compilation, debugging may also encounter some issues that need to be analyzed and resolved specifically.
5. Official Reference Materials
Below are the official FreeRTOS website and download links for two technical manuals. Those who need them can copy the links into their browsers. The technical support on the FreeRTOS official website is very comprehensive and rich, greatly facilitating project development work, making it the best reference material for developers.
https://www.freertos.org/
https://www.freertos.org/fr-content-src/uploads/2018/07/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf
https://www.freertos.org/fr-content-src/uploads/2018/07/FreeRTOS_Reference_Manual_V10.0.0.pdf
Source: Embedded System Development
Due to recent changes in the WeChat public account push rules, many readers have reported not being able to see updated articles in time. According to the latest rules, it is recommended to click on “Recommended Reading, Share, Collect” more often to become a regular reader.
Recommended Reading:
-
BYD Xi’an factory caught fire, cause unknown!
-
In just three months, ZhiHuiJun’s startup project has received three rounds of financing.
-
Investing 100 million yuan! Honor responds to rumors of establishing a new company for self-research chips.
Please click 【View】 to give the author a thumbs up.