Ⅰ
File Description
As of August 2017, the latest version of FreeRTOS on the official website is V9.0.0 (some other places have already appeared V9.1.0), and we will use V9.0.0 as the standard for discussion.
After extracting the downloaded FreeRTOSv9.0.0 source code, we can see the following files:
Preview:
1. Comparison of FreeRTOS V9 and Previous Versions
a. The V9 kernel source code (FreeRTOS/Source) has significant differences, while the code in other parts (such as Demo examples and FreeRTOS-Plus) is basically the same;
b. The directory structure is the same, meaning the files in each directory are the same (only the content inside the files differs).
2. File Description
Careful friends may notice that there is a “readme.txt” file and some web link files in each directory after extraction. These two files provide the best description of the directory they are in. For the convenience of beginners, I will briefly describe the meaning of each layer of directories and the files within them.
First Layer Directory:
FreeRTOS: Contains demo examples and kernel source code (quite important, we need to extract most files from this directory);
FreeRTOS-Plus: Contains component source code and corresponding demo examples. Here, components can be understood as extended features, such as: CLI (Command-Line Interface) and FAT file system. Beginners can temporarily skip this content.
New – Direct to Task Notifications: Web links related to task descriptions;
New – FreeRTOS+TCP: Web links related to FreeRTOS and the TCP/IP protocol stack. A friend commented in the previous article that FreeRTOS does not support its own GUI, and I believe that a GUI will be added later.
Quick_Start_Guide: A quick guide that will guide you on how to quickly port and run FreeRTOS on your own platform. Beginners are advised to read the content under this webpage.
readme: A self-description file that describes each file in this directory.
Upgrading-to-FreeRTOS-9: Web links related to version upgrade instructions. For example: backward compatibility, creating tasks with static allocation, and other update instructions:
-Backward Compatibility
-Completely Statically Allocated Systems
-Creating Tasks and Other RTOS Objects Using Statically Allocated RAM
-Forcing an RTOS Task To Leave the Blocked State
-Deleting Tasks
-Obtaining a Task Handle from the Task Name
-Other Changes
Second Layer Directory:
FreeRTOS
tDemo: The contents of this directory are demo examples, and we can directly open the project files inside. If there is a corresponding platform (development board), we can run the examples provided by FreeRTOS.
Just a reminder: Many of the demo examples here are quite old, and new ones have been added gradually. For example, CORTEX_STM32F103_Keil is an old project from the early 2000s. The reason we need to port it again is that the examples are too old; otherwise, we would directly use the projects here.
FreeRTOS
tLicense: License file.
FreeRTOS
tSource: Kernel source code (needless to say, important files, we need to extract files from this directory).
links_to_doc_pages_for_the_demo_projects: Example descriptions, quite important, detailing different manufacturers’ demo examples and providing important information about each example, as follows:
FreeRTOS-Plus
tDemo: Similar to the above demo, but categorized under Plus.
FreeRTOS-Plus
tSource: Component source code.
Some Important Directories:
FreeRTOS
tSource
tportable
tMemMang: Memory management, every operating system has its own memory management, and there are five source files heap_1.c to heap_5.c here. In simple terms, there are 5 types of memory management methods, and we only need one.
FreeRTOS
tSource
tportable
tIAR: Low-level interfaces related to EWARM;
FreeRTOS
tSource
tportable
tRVDS: Low-level interfaces related to MDK-ARM;
Ⅱ
Extracting Useful Files to Build Projects
We will take STM32F103 + MDK-ARM as an example.
1. Extracting Useful Files from FreeRTOS
Based on the analysis above, I believe everyone has a general understanding of the extracted files. We mainly need to extract the files from the FreeRTOS
tSource directory + FreeRTOS
tDemo corresponding chip project’s FreeRTOSConfig.h.
Tip: The FreeRTOS
tSource
tportable directory is related to low-level interfaces, and many of them we won’t use;
We mainly extract three files:
MemMang: Memory management code;
IAR: Low-level code related to EWARM;
RVDS: Low-level code related to MDK-ARM;
2. Building Projects
I will not describe the entire process of building a project from scratch. I have already detailed how to create a new project; if you don’t understand, you can refer to my two articles below. We just need to add FreeRTOS-related source code based on the previously created STM32 project.
1.MDK-ARM_Creating a New Software Project Detailed Process
2.EWARM_Creating a New Software Project Detailed Process
After adding in MDK-ARM, as shown in the figure below:
The project created in EWARM, the extracted files, and the new project will be presented in the next article.
Ⅲ
Finally
Search for “EmbeddDeveloper” on WeChat or scan the QR code below to follow and see more exciting content in my bottom menu!
Long press to recognize the QR code in the image to follow
A thumbs up is also a support!