2024-04-02 05:48 PM
Am testing the x-cube-sbsfu on H7A3 (using H7B3 project with OTFDEC disabled).
After enabling SFU_MPU_PROTECT_ENABLE, I always ran into mem manage fault when the function HAL_RCC_GetPCLK1Freq is called during HAL_UART_Init:
An MPU or Execute Never (XN) default memory map access violation has occurred on an instruction fetch (CFSR.IACCVIOL, MMFAR).
The MPU setting for RCC is as below:
/**
* @brief Region 1 - Enable the read/write operations for RCC peripheral area in privileged mode.
* Execution capability disabled
* Inner region inside the Region 0
*/
#define SFU_PROTECT_MPU_PERIPH_2_RGNV MPU_REGION_NUMBER1
#define SFU_PROTECT_MPU_PERIPH_2_START RCC_BASE
#define SFU_PROTECT_MPU_PERIPH_2_SIZE MPU_REGION_SIZE_1KB
#define SFU_PROTECT_MPU_PERIPH_2_SREG 0x00U /*!< All subregions activated */
#define SFU_PROTECT_MPU_PERIPH_2_PERM MPU_REGION_PRIV_RW
#define SFU_PROTECT_MPU_PERIPH_2_EXECV MPU_INSTRUCTION_ACCESS_DISABLE
#define SFU_PROTECT_MPU_PERIPH_2_TEXV MPU_TEX_LEVEL0
#define SFU_PROTECT_MPU_PERIPH_2_B MPU_ACCESS_BUFFERABLE
#define SFU_PROTECT_MPU_PERIPH_2_C MPU_ACCESS_NOT_CACHEABLE
what do I need to change to avoid this exception? Thanks
Solved! Go to Solution.
2024-04-03 01:16 PM
I figured out why and RCC's MPU protection is not the culprit: the MPU setting for internal flash is set to instruction execution disabled.
2024-04-03 01:16 PM
I figured out why and RCC's MPU protection is not the culprit: the MPU setting for internal flash is set to instruction execution disabled.
2024-04-03 05:46 PM
Hello @JQiao.1
Well done !!
Just to give more clarifications to community:
You changed the following line in sfu_low_level_security.h file in Region1 (line 111)
from
#define SFU_PROTECT_MPU_PERIPH_2_EXECV MPU_INSTRUCTION_ACCESS_DISABLE
to
#define SFU_PROTECT_MPU_PERIPH_2_EXECV MPU_INSTRUCTION_ACCESS_ENABLE
do you confirm ?
Best Regards,
Younes