Fixed a problem with MPU support.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14024 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-01-25 14:16:06 +00:00
parent 85927935a7
commit 9f5a8820b1
1 changed files with 21 additions and 20 deletions

View File

@ -30,6 +30,7 @@
/* Inclusion of the Cortex-Mx implementation specific parameters.*/
#include "cmparams.h"
#include "mpu.h"
/*===========================================================================*/
/* Module constants. */
@ -363,21 +364,6 @@
#error "unknown ARMv7-M variant"
#endif
/**
* @brief MPU guard page size.
*/
#if (PORT_ENABLE_GUARD_PAGES == TRUE) || defined(__DOXYGEN__)
#if CH_DBG_ENABLE_STACK_CHECK == FALSE
#error "PORT_ENABLE_GUARD_PAGES requires CH_DBG_ENABLE_STACK_CHECK"
#endif
#if __MPU_PRESENT == 0
#error "MPU not present in current device"
#endif
#define PORT_GUARD_PAGE_SIZE 32U
#else
#define PORT_GUARD_PAGE_SIZE 0U
#endif
/**
* @brief Port-specific information string.
*/
@ -404,14 +390,29 @@
#define CORTEX_MAX_KERNEL_PRIORITY 0U
#endif
/*===========================================================================*/
/* Module data structures and types. */
/*===========================================================================*/
/* The following code is not processed when the file is included from an
asm module.*/
#if !defined(_FROM_ASM_)
/**
* @brief MPU guard page size.
*/
#if (PORT_ENABLE_GUARD_PAGES == TRUE) || defined(__DOXYGEN__)
#if CH_DBG_ENABLE_STACK_CHECK == FALSE
#error "PORT_ENABLE_GUARD_PAGES requires CH_DBG_ENABLE_STACK_CHECK"
#endif
#if __MPU_PRESENT == 0
#error "MPU not present in current device"
#endif
#define PORT_GUARD_PAGE_SIZE 32U
#else
#define PORT_GUARD_PAGE_SIZE 0U
#endif
/*===========================================================================*/
/* Module data structures and types. */
/*===========================================================================*/
/**
* @brief Type of stack and memory alignment enforcement.
* @note In this architecture the stack alignment is enforced to 64 bits,
@ -699,7 +700,7 @@ struct port_context {
#else
#define port_switch(ntp, otp) do { \
_port_switch(ntp, otp); \
__port_switch(ntp, otp); \
\
/* Setting up the guard page for the switched-in thread.*/ \
mpuSetRegionAddress(PORT_USE_GUARD_MPU_REGION, \