]> begriffs open source - freertos/commit
Add support for privileged heap to ARMV8-M ports (#85)
authorGaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Tue, 14 Jul 2020 23:22:14 +0000 (16:22 -0700)
committerGitHub <noreply@github.com>
Tue, 14 Jul 2020 23:22:14 +0000 (16:22 -0700)
commitb6a43866da8fe030243c42b4e1a5fe2072cebe96
tree1ae2155d79fe8b6381fe500c967897174b664713
parent587a83d647619bb0a508661c7bb4d6df89851582
Add support for privileged heap to ARMV8-M ports (#85)

If xTaskCreate API is used to create a task, the task's stack is
allocated on heap using pvPortMalloc. This places the task's stack
in the privileged data section, if the heap is placed in the
privileged data section.

We use a separate MPU region to grant a task access to its stack.
If the task's stack is in the privileged data section, this results in
overlapping MPU regions as privileged data section is already protected
using a separate MPU region. ARMv8-M does not allow overlapping MPU
regions and this results in a fault. This commit ensures to not use a
separate MPU region for the task's stack if it lies within the
privileged data section.

Note that if the heap memory is placed in the privileged data section,
the xTaskCreate API cannot be used to create an unprivileged task as
the task's stack will be in the privileged data section and the task
won't have access to it. xTaskCreateRestricted and
xTaskCreateRestrictedStatic API should be used to create unprivileged
tasks.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
portable/ARMv8M/non_secure/port.c
portable/GCC/ARM_CM23/non_secure/port.c
portable/GCC/ARM_CM23_NTZ/non_secure/port.c
portable/GCC/ARM_CM33/non_secure/port.c
portable/GCC/ARM_CM33_NTZ/non_secure/port.c
portable/IAR/ARM_CM23/non_secure/port.c
portable/IAR/ARM_CM23_NTZ/non_secure/port.c
portable/IAR/ARM_CM33/non_secure/port.c
portable/IAR/ARM_CM33_NTZ/non_secure/port.c