cancel
Showing results for 
Search instead for 
Did you mean: 

x-cube-sbsfu mem manage fault exception

JQiao.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
JQiao.1
Associate II

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.

View solution in original post

2 REPLIES 2
JQiao.1
Associate II

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.

CMYL
ST Employee

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