FreeRTOS (the tutorial is very detailed)

Overview:

      I wrote part of the content about FreeRTOS before. For the convenience of reading, it is now summarized together. After learning everything, congratulations that you have a deeper understanding of FreeRTOS.

 Chapter 1 Porting FreeRTOS to STM32

 Chapter 2 FreeRTOS Create Task

 Chapter 3 FreeRTOS Task Management

Chapter 4 FreeRTOS Message Queue

Chapter 5 FreeRTOS Semaphore

Chapter 6 FreeRTOS Mutex

Chapter 7 FreeRTOS Event Group

Chapter 8 FreeRTOS Task Notification

Chapter 9 FreeRTOS Software Timer

Chapter 10 FreeRTOS Memory Management

Chapter 11 FreeRTOS Interrupt Management

Why learn RTOS

      When we enter the field of embedded, we often first come into contact with single-chip programming, and single-chip programming is the first choice for 51 single-chip to get started. The microcontroller programming mentioned here usually refers to bare-metal programming, that is, programs that do not add any RTOS (Real Time Operating System real-time operating system). Commonly used RTOSs include foreign FreeRTOS, μC/OS, RTX and domestic FreeRTOS, Huawei LiteOS and AliOS-Things, etc. Among them, the foreign open source and free FreeRTOS has the highest market share.

      In a bare-metal system, all programs are basically written by ourselves, and all operations are implemented in an infinite loop. Many small and medium-sized electronic products in real life use bare-metal systems, and they can also meet the needs. But why do we still need to learn RTOS programming, but the whole operating system needs to come in. One is the project needs. With more and more functions to be realized by the product, the simple bare metal system can no longer solve the problem perfectly, but will make the programming more complicated. If we want to reduce the difficulty of programming, we can consider introducing RTOS To achieve multi-task management, this is the biggest advantage of using RTOS. The second is the need for learning. You must learn more advanced things to achieve better career planning, and prepare for the future to marry Bai Fumei at the pinnacle of life, instead of blindly slamming on bare-metal programming. As a qualified embedded software engineer, learning is something that can never stop, and you have to prepare for the future at all times. When the book is used, you will hate it less, and I hope you will not feel this way when the opportunity comes.

      In order to help you clarify the routines of RTOS programming, we will briefly analyze the difference between these two programming methods in the chapter "Bare Metal System and Multitasking System". I call this difference the key to learning RTOS. Du Ermai, the future RTOS learning can be said to be easy. When explaining the difference between these two programming methods, we mainly talk about methodology, and will not involve specific code programming, mainly through pseudocode.

How to learn RTOS

       The styles of bare metal programming and RTOS programming are somewhat different, and many people say that learning RTOS is difficult, which causes learners to be afraid of RTOS programming when they hear RTOS programming.

      So how exactly do you learn an RTOS? The easiest way is to look at the API instructions in the RTOS on the system transplanted by others, and then call these APIs to achieve the functions you want. Completely, don't care about the underlying porting, this is the easiest and fastest way to get started. This method has its own advantages and disadvantages. If it is a product, the advantage is that it can quickly realize the function, push the product to the market, and win the first opportunity. The disadvantage is that when there is a problem with the program, it will be difficult to debug because of insufficient understanding of the RTOS. , battered, helpless. If it is learning, it is not advisable to simply call the API. We should study one of the RTOS in depth.

       At present, the existing RTOSs on the market have similar kernel implementation methods, and we only need to study one of them in depth. It is always the same. If you switch to other types of RTOS in the future, it will be handy when you use it. So how to learn an RTOS in depth? One of the most effective and difficult methods here is to read the source code of the RTOS and delve into the implementation of the kernel and each component. This process is boring and painful. But in order to be able to learn the essence of RTOS, who will go to hell if you don't go to hell?

      Although there are some books on the market that explain the source code of RTOS, if you have insufficient foundation and have not used this RTOS before, the source code will still look very boring, and you cannot grasp the composition and implementation of the entire RTOS from a global perspective.

FreeRTOS Copyright

      FreeRTOS was released by Richard Barry in the United States in 2003. Richard Barry is the owner and maintainer of FreeRTOS. In the past ten years, FreeRTOS has gone through 9 versions, and has worked closely with many semiconductor manufacturers. There are millions of developers. It is the RTOS with the highest market share at present.

      FreeRTOS was acquired by Amazon in 2018, renamed AWS FreeRTOS, the version number was upgraded to V10, and the open source agreement was changed from the original GPLv2+ to MIT. Compared with GPLv2+, MIT is more open, and you can completely understand that it is free to do whatever you want. The previous versions of V9 remain the same. Compared with V9, the V10 version has added some IoT-related components, and the core remains basically unchanged. Amazon's acquisition of FreeRTOS is also to enter the hot Internet of Things and artificial intelligence.

FreeRTOS billing issues

FreeRTOS

      FreeRTOS is an "open source and free" real-time operating system that follows the GPLv2+ license agreement. The open source mentioned here means that you can obtain the source code of FreeRTOS for free, and when your product uses FreeRTOS and does not modify the FreeRTOS kernel source code, all the code of your product can be closed source without open source , but when you modify the FreeRTOS kernel source code, you must open source the modified part and feed it back to the community. Other application parts do not need to be open source. Free means that whether you are an individual or a company, you can use it for free without paying a penny.

OpenRTOS

FreeRTOS and OpenRTOS have the same code, but the officially available services are different. FreeRTOS claims to be free, and OpenRTOS claims to charge. The specific differences between them are shown in the table

SaveRTOS

      SaveRTOS is also based on FreeRTOS, but SaveRTOS has made security-related designs for certain specific fields. For details about the security verification obtained by SaveRTOS, see the table. Of course, SaveRTOS also needs to be charged, and these security verifications are not done for nothing.

 First of all, first transplant FreeRTOS to STM32 to experience the difference between multitasking operating system and bare metal development. The tutorial has already been done before, and there is a deep study of the linked list of C language, as well as queues, pointer structures, etc., so that we can Later study becomes very easy.

Detailed explanation of C language linked list

Guess you like

Origin blog.csdn.net/qq_61672347/article/details/125748646