Hi Eugene,
Thank you for your patience,
We could consider the Boot ROM and normal FLASH as normal memory for the MPU.
However, the definition of their attributes for memory regions will depend on your application, this includes the privilege attribute.
Unfortunately ,we do not have specific examples to define a memory region in MPU for the BootROM for your reference.
If we check the prvSetupMPU() , from FreeRTOS port.c we can see that already 5 MPU regions are defined for the kernel operation:
#define portPRIVILEGED_FLASH_REGION ( 0UL )
#define portUNPRIVILEGED_FLASH_REGION ( 1UL )
#define portUNPRIVILEGED_SYSCALLS_REGION ( 2UL )
#define portPRIVILEGED_RAM_REGION ( 3UL )
#define portSTACK_REGION ( 4UL )
For example, privileged flash has the region 0 assigned. The attributes for this specific Flash area are defined using the RBAR register of the MPU.
portMPU_RNR_REG = portPRIVILEGED_FLASH_REGION;// equals to region number 0 of the MPU
portMPU_RBAR_REG = ( ( ( uint32_t ) __privileged_functions_start__ ) & portMPU_RBAR_ADDRESS_MASK ) |
( portMPU_REGION_NON_SHAREABLE ) | ( portMPU_REGION_PRIVILEGED_READ_ONLY );
By default the MPU blocks access to the memory areas that are not explicitly configured on the MPU for any privileged or unprivileged program.
However, we can see that the last sentence of the prvSetupMPU() function:
portMPU_CTRL_REG |= ( portMPU_PRIV_BACKGROUND_ENABLE | portMPU_ENABLE );
Enables the MPU and the PRIVDEFENA bit . The last bit will enable the access to the un-mapped
Memory areas to privileged privileged programs. For example, this means that a privileged function can access to SRAM areas that were not defined on the MPU .
You could leave the five regions defined by FreeRTOS as they are. If we check closer only necessary attributes are granted for proper kernel operation.
I hope this helps
Regards,
Diego