Skip to main content
JQiao.1
Associate II
April 3, 2024
Solved

x-cube-sbsfu mem manage fault exception

  • April 3, 2024
  • 2 replies
  • 1697 views

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

This topic has been closed for replies.
Best answer by JQiao.1

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.

2 replies

JQiao.1
JQiao.1AuthorBest answer
Associate II
April 3, 2024

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.

Technical Moderator
April 4, 2024

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