You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FreeRTOS-Kernel/portable
Gaurav-Aggarwal-AWS 334de5d8ab
Enable ARMv7-M MPU ports to place FreeRTOS kernel code outside of flash (#46)
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>
5 years ago
..
ARMClang Re-sync with upstream and stripping away none kernel related. 5 years ago
ARMv8M Add "Tickless Idle" support for ARMv8M ports (#29) 5 years ago
BCC/16BitDOS version bump to v10.3.1 (#16) 5 years ago
CCS version bump to v10.3.1 (#16) 5 years ago
CodeWarrior version bump to v10.3.1 (#16) 5 years ago
Common version bump to v10.3.1 (#16) 5 years ago
GCC Enable ARMv7-M MPU ports to place FreeRTOS kernel code outside of flash (#46) 5 years ago
IAR Enable ARMv7-M MPU ports to place FreeRTOS kernel code outside of flash (#46) 5 years ago
Keil Re-sync with upstream and stripping away none kernel related. 5 years ago
MPLAB version bump to v10.3.1 (#16) 5 years ago
MSVC-MingW The Windows port layer is built with both MSVC and GCC. GCC generated a warning relating to the variable lWaitForYield being set but not used. This change removes the variable. 5 years ago
MemMang Fix Coverity warnings: In most cases the return value of xTaskResumeAll() is cast to void when it is not needed. This PR fixes a couple of instances in the heap_n.c implementations where that was not the case. 5 years ago
MikroC/ARM_CM4F version bump to v10.3.1 (#16) 5 years ago
Paradigm/Tern_EE version bump to v10.3.1 (#16) 5 years ago
RVDS Enable ARMv7-M MPU ports to place FreeRTOS kernel code outside of flash (#46) 5 years ago
Renesas version bump to v10.3.1 (#16) 5 years ago
Rowley version bump to v10.3.1 (#16) 5 years ago
SDCC/Cygnal version bump to v10.3.1 (#16) 5 years ago
Softune version bump to v10.3.1 (#16) 5 years ago
Tasking/ARM_CM4F version bump to v10.3.1 (#16) 5 years ago
ThirdParty Synopsys ARC port, adding support for ARC EM and HS cores -- continued from PR #8. (#28) 5 years ago
WizC/PIC18 version bump to v10.3.1 (#16) 5 years ago
oWatcom/16BitDOS version bump to v10.3.1 (#16) 5 years ago
readme.txt Re-sync with upstream and stripping away none kernel related. 5 years ago

readme.txt

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

Each real time kernel port consists of three files that contain the core kernel
components and are common to every port, and one or more files that are
specific to a particular microcontroller and/or compiler.


+ The FreeRTOS/Source/Portable/MemMang directory contains the five sample
memory allocators as described on the http://www.FreeRTOS.org WEB site.

+ The other directories each contain files specific to a particular
microcontroller or compiler, where the directory name denotes the compiler
specific files the directory contains.



For example, if you are interested in the [compiler] port for the [architecture]
microcontroller, then the port specific files are contained in
FreeRTOS/Source/Portable/[compiler]/[architecture] directory.  If this is the
only port you are interested in then all the other directories can be
ignored.