Problem Description ------------------- The current flash organization in ARMv7-M MPU ports looks as follows: __FLASH_segment_start__ ------->+-----------+<----- __FLASH_segment_start__ | Vector | | Table | | + | | Kernel | | Code | +-----------+<----- __privileged_functions_end__ | | | | | | | Other | | Code | | | | | | | __FLASH_segment_end__ ------>+-----------+ The FreeRTOS kernel sets up the following MPU regions: * Unprivileged Code - __FLASH_segment_start__ to __FLASH_segment_end__. * Privileged Code - __FLASH_segment_start__ to __privileged_functions_end__. The above setup assumes that the FreeRTOS kernel code (i.e. privileged_functions) is placed at the beginning of the flash and, therefore, uses __FLASH_segment_start__ as the starting location of the privileged code. This prevents a user from placing the FreeRTOS kernel code outside of flash (say to an external RAM) and still have vector table at the beginning of flash (which is many times a hardware requirement). Solution -------- This commit addresses the above limitation by using a new variable __privileged_functions_start__ as the starting location of the privileged code. This enables users to place the FreeRTOS kernel code wherever they choose. The FreeRTOS kernel now sets up the following MPU regions: * Unprivileged Code - __FLASH_segment_start__ to __FLASH_segment_end__. * Privileged Code - __privileged_functions_start__ to __privileged_functions_end__. As a result, a user can now place the kernel code to an external RAM. A possible organization is: Flash External RAM +------------+ +-----------+<------ __privileged_functions_start__ | Vector | | | | Table | | | | | | | __FLASH_segment_start__ ----->+------------+ | Kernel | | | | Code | | | | | | | | | | | | | | Other | | | | Code | +-----------+<------ __privileged_functions_end__ | | | | | | __FLASH_segment_end__ ----->+------------+ Note that the above configuration places the vector table in an unmapped region. This is okay because we enable the background region, and so the vector table will still be accessible to the privileged code and not accessible to the unprivileged code (vector table is only needed by the privileged code). Backward Compatibility ---------------------- The FreeRTOS kernel code now uses a new variable, namely __privileged_functions_start__, which needs to be exported from linker script to indicate the starting location of the privileged code. All of our existing demos already export this variable and therefore, they will continue to work. If a user has created a project which does not export this variable, they will get a linker error for unresolved symbol __privileged_functions_start__. They need to export a variable __privileged_functions_start__ with the value equal to __FLASH_segment_start__. Issue ----- https://sourceforge.net/p/freertos/feature-requests/56/ Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> |
||
---|---|---|
.github | ||
include | ||
portable | ||
CONTRIBUTING.md | ||
croutine.c | ||
event_groups.c | ||
GitHub-FreeRTOS-Kernel-Home.url | ||
History.txt | ||
LICENSE.md | ||
list.c | ||
queue.c | ||
Quick_Start_Guide.url | ||
README.md | ||
SECURITY.md | ||
stream_buffer.c | ||
tasks.c | ||
timers.c |
Getting started
This repository contains FreeRTOS kernel source/header files and kernel ports only. This repository is referenced as a submodule in FreeRTOS/FreeRTOS repository, which contains pre-configured demo application projects under FreeRTOS/Demo
directory.
The easiest way to use FreeRTOS is to start with one of the pre-configured demo application projects. That way you will have the correct FreeRTOS source files included, and the correct include paths configured. Once a demo application is building and executing you can remove the demo application files, and start to add in your own application source files. See the FreeRTOS Kernel Quick Start Guide for detailed instructions and other useful links.
Additionally, for FreeRTOS kernel feature information refer to the Developer Documentation, and API Reference.
Getting help
If you have any questions or need assistance troubleshooting your FreeRTOS project, we have an active community that can help on the FreeRTOS Community Support Forum.
Cloning this repository
To clone using HTTPS:
git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git
Using SSH:
git clone git@github.com:FreeRTOS/FreeRTOS-Kernel.git
Repository structure
-
The root of this repository contains the three files that are common to every port - list.c, queue.c and tasks.c. The kernel is contained within these three files. croutine.c implements the optional co-routine functionality - which is normally only used on very memory limited systems.
-
The
./portable
directory contains the files that are specific to a particular microcontroller and/or compiler. See the readme file in the./portable
directory for more information. -
The
./include
directory contains the real time kernel header files.