Add default for configTOTAL_MPU_REGIONS and change a runtime assert to compile time error

This commit is contained in:
IsaacDynamo 2024-01-16 23:12:46 +01:00
parent ee56d2cd97
commit 7822538c13
2 changed files with 13 additions and 4 deletions

View file

@ -1115,10 +1115,7 @@ static void prvSetupMPU( void )
extern uint32_t __privileged_data_end__[];
#endif /* if defined( __ARMCC_VERSION ) */
/* The only permitted number of regions are 8 or 16. */
configASSERT( ( configTOTAL_MPU_REGIONS == 8 ) || ( configTOTAL_MPU_REGIONS == 16 ) );
/* Ensure that the configTOTAL_MPU_REGIONS is configured correctly. */
/* Ensure that the device has the expected MPU type */
configASSERT( portMPU_TYPE_REG == portEXPECTED_MPU_TYPE_VALUE );
/* Check the expected MPU is present. */

View file

@ -86,6 +86,18 @@ typedef unsigned long UBaseType_t;
#define portMPU_REGION_CACHEABLE_BUFFERABLE ( 0x07UL << 16UL )
#define portMPU_REGION_EXECUTE_NEVER ( 0x01UL << 28UL )
/* MPU settings that can be overriden in FreeRTOSConfig.h. */
#ifndef configTOTAL_MPU_REGIONS
/* Define to 8 for backward compatibility. */
#define configTOTAL_MPU_REGIONS ( 8UL )
#endif
/* CM3 only supports 8 MPU regions */
/* Fail if FreeRTOSConfig.h overwrites configTOTAL_MPU_REGIONS with an invalid value */
#if ( configTOTAL_MPU_REGIONS != 8 )
#error configTOTAL_MPU_REGIONS must be 8 for this port.
#endif
#define portSTACK_REGION ( 3UL )
#define portGENERAL_PERIPHERALS_REGION ( 4UL )
#define portUNPRIVILEGED_FLASH_REGION ( 5UL )