Cstyle notes, freertos kernel details, based on cortex-m3, 0th

Source: Internet
Author: User
Freertos is a hard real-time kernel that supports many microprocessor architectures. We can go to its official website (www. freertos. you can also see that it supports dozens of microprocessor architectures. The reason why I chose to study this is to always make every bottom-layer software developer wish to look into the inside story of the RTOS kernel. I have chosen several types of RTOS, but some of them need to be charged, and some are not mature enough systems, some are mature, but the system is too large to be suitable for research. Freertos is different. Apart from the basic things required by RTOS, freertos has the biggest feature: Open Source + simple and supports a lot of MCU, many demos are provided for our reference. Its core content is only three files. Other features can be enriched by some plus. Freertos's latest version is 8.0.1. After downloading it from its official website, we can gradually analyze its kernel implementation. First, start with the directory structure.
+-FreeRTOS-Plus    Contains Freertos+ components and demo projects.+-FreeRTOS         Contains the FreeRTOS real time kernel sourcefiles and demo projects
    +-Demo      Contains the demo application projects.
        +-Common    The demo application files that are used by all the demos.        +-Dir x     The demo application build files for port x        +-Dir y     The demo application build files for port y
+-Source Contains the real time kernel source code.
        +-include   The core FreeRTOS kernel header files        |        +-Portable  Processor specific code.            |            +-Compiler x    All the ports supported for compiler x            +-Compiler y    All the ports supported for compiler y            +-MemMang       The sample heap implementations
The directory structure of the kernel is as follows. We can see that the core code of the kernel is reasonably separated from the processor hardware, in this way, we can easily port freertos to other hardware platforms, we are based on at91sam3x/A Atmel arm cortex-m3 kernel MCU at91sam3x/a to carefully study the kernel architecture and implementation. Its code is in the freertosv8.0.1 \ freertos \ demo \ cortex_atsam3x_atmel_studio directory, double-click the batch processing under the project root directory to automatically copy the required code to the relevant directory under the project root directory, and then use Si to create the project read code, you can also use the ateml studio tool officially provided by ateml to open the project file to compile the project. However, note that an error is reported during compilation. This is normal, it's just a good reminder. Just comment out the error.
At first glance, there seems to be a lot of kernel code. In fact, there are very few files required by the smallest system. The necessary files are as follows:
1.tasks.c,queue.cAndRequired by list. c
2. timers.cImplement software timer optional
3. andcroutine.c  implement Co-routine functionality (optional)
4. heap_x.c is required,The files under the memmang directory provide the memory management function. We recommend that you implement it by yourself. At the same time, the kernel provides three reference solutions, customers can use the built-in mollac library in our development tools or implement it by themselves.
5. For the MCU we selected, we also need other HW-related items, such as configuration files of cmsis for a specific development tool, such as makfile and configuration files. Supports almost all development tools we know: IAR, MDK, GCC, etc.

Reprinted please indicate the source [email protected] // http://blog.csdn.net/CStyle_0x007

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.