mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-02-20 00:55:28 -05:00
Arm-Cortex-R82: Add MPU support (#1347)
* arm-cortex-r82: Add MPU support This commit introduces support for the Memory Protection Unit (MPU) to the ARM Cortex-R82 port. The MPU enhances system security by allowing the definition of memory regions with specific access permissions. The following changes have been made: - Added MPU configuration functions in `port.c` to set up memory regions and their attributes. - Updated `portASM.S` to include assembly routines for MPU and context switching with MPU support. - Created `mpu_wrappers_v2_asm.c` to provide assembly wrappers for MPU operations. - Updated `portmacro.h` to include MPU-related macros and definitions. - Modified `task.h` to include MPU-related task attributes. - Updated `CMakeLists.txt` to include the new MPU source file. - Enhanced the `README.md` with instructions on MPU configuration. Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com> * cortex-r82: Minor code improvements This commit includes minor code improvements to enhance readability and maintainability of the Cortex-R82 port files. Changes include refactoring variable names, optimizing comments, and improving code structure without altering functionality. Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com> * tasks: Disable stack-depth check if MPU wrappers is set This stack-depth check should not be performed for ports where portUSING_MPU_WRAPPERS is set to 1. In this case, pxTopOfStack and pxNewTCB->pxTopOfStack reside in different memory regions: pxTopOfStack is in unprivileged SRAM, while pxNewTCB->pxTopOfStack is in privileged SRAM. This is because pxPortInitialiseStack() returns the address of `ullContext` array rather than the decremented pxTopOfStack, as is done in the non-MPU case. Consequently, this check is not valid in this scenario. Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com> --------- Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com>
This commit is contained in:
parent
d33d04b14c
commit
6cd736cfeb
10 changed files with 3130 additions and 504 deletions
21
tasks.c
21
tasks.c
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright 2026 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
|
@ -2007,19 +2008,19 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );
|
||||
}
|
||||
#endif /* portHAS_STACK_OVERFLOW_CHECKING */
|
||||
|
||||
#if ( portSTACK_GROWTH < 0 )
|
||||
{
|
||||
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxTopOfStack - pxNewTCB->pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
|
||||
}
|
||||
#else /* portSTACK_GROWTH */
|
||||
{
|
||||
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxNewTCB->pxTopOfStack - pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
|
||||
}
|
||||
#endif /* portSTACK_GROWTH */
|
||||
}
|
||||
#endif /* portUSING_MPU_WRAPPERS */
|
||||
|
||||
#if ( portSTACK_GROWTH < 0 )
|
||||
{
|
||||
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxTopOfStack - pxNewTCB->pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
|
||||
}
|
||||
#else /* portSTACK_GROWTH */
|
||||
{
|
||||
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxNewTCB->pxTopOfStack - pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize task state and task attributes. */
|
||||
#if ( configNUMBER_OF_CORES > 1 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue