cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube_FW_WL_V1.2.0, application LoRaWAN_SBSFU_1_Slot_DualCore. Bug in the MPU configurations??? (file .\2_Images_SBSFU\CM4\Inc\sfu_low_level_security.h)

G.Buldo
Associate

I'm creating a new lora project starting from STM32Cube_FW_WL_V1.2.0, application LoRaWAN_SBSFU_1_Slot_DualCore.

I reserved some space (from 0x0801A000 to 0x0801BFFF) for some configurations. 

I modified the file mapping_fwimg.ld like below

.\STM32Cube_FW_WL_V1.2.0\Projects\NUCLEO-WL55JC\Applications\LoRaWAN_SBSFU_1_Slot_DualCore\Linker_Common\STM32CubeIDE\mapping_fwimg.ld

/* Dwl slot #1 : (2 kbytes) */

SLOT_Blob_Dwl_1_start = 0x08002800;

SLOT_Blob_Dwl_1_end  = 0x08002FFF;

/* Active slot #2 (92 kbytes) */

SLOT_Active_2_header = 0x0803F000;

SLOT_Active_2_start  = 0x08003000;

SLOT_Active_2_end   = 0x08018FFF;

/***** NVM FLASH Data *****/

/* WARNING: Symbols not used. The NVMS address is defined in lora_app.c */

LW_NVM_ROM_start__  = 0x0801A000;

LW_NWM_ROM_end__   = 0x0801BFFF;

/* Active slot #1 (60 kbytes) */

SLOT_Active_1_header = 0x0803F800;

SLOT_Active_1_start  = 0x0801C000;

SLOT_Active_1_end   = 0x0802AFFF;

When trying to read the LW_NVM_ROM_Region from the application, i got an hard fault due to an Memory Management Fault.

Finally i found out that the are from from 0x08018000 ==> 0x0801AFFF (12 kbytes) is protected:

.\STM32Cube_FW_WL_V1.2.0\Projects\NUCLEO-WL55JC\Applications\LoRaWAN_SBSFU_1_Slot_DualCore\2_Images_SBSFU\CM4\Inc\sfu_low_level_security.h

/**

 * @brief Region 4 - Enable the execution for active slot in unprivileged mode.

 *          Read only capability configured

 *          In addition to region 3, from 0x08004000 ==> 0x08017FFF (80 kbytes)

 */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_RGNV MPU_REGION_NUMBER4

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_START FLASH_BASE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_SIZE MPU_REGION_SIZE_128KB

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_SREG 0xC1U  /*!< 128 Kbytes / 8 * 5 ==> 80 Kbytes */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_PERM MPU_REGION_PRIV_RO_URO

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_EXECV MPU_INSTRUCTION_ACCESS_ENABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_TEXV MPU_TEX_LEVEL0

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_B   MPU_ACCESS_BUFFERABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_C   MPU_ACCESS_NOT_CACHEABLE

/**

 * @brief Region 5 - Enable the execution for active slot in unprivileged mode.

 *          Read only capability configured

 *          In addition to region 4, from 0x08018000 ==> 0x0801AFFF (12 kbytes)

 */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_RGNV MPU_REGION_NUMBER5

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_START ((uint32_t)0x08018000)

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_SIZE MPU_REGION_SIZE_16KB

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_SREG 0xC0U  /*!< 16 Kbytes / 8 * 6 ==> 12 Kbytes */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_PERM MPU_REGION_NO_ACCESS

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_EXECV MPU_INSTRUCTION_ACCESS_DISABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_TEXV MPU_TEX_LEVEL0

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_B   MPU_ACCESS_BUFFERABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_C   MPU_ACCESS_NOT_CACHEABLE

Now the question:

I cannot find a reason why this area should be not accessible in the example project.

Can i just remove this protection like this?

.\STM32Cube_FW_WL_V1.2.0\Projects\NUCLEO-WL55JC\Applications\LoRaWAN_SBSFU_1_Slot_DualCore\2_Images_SBSFU\CM4\Inc\sfu_low_level_security.h

/**

 * @brief Region 4 - Enable the execution for active slot in unprivileged mode.

 *          Read only capability configured

 *          In addition to region 3, from 0x08004000 ==> 0x08017FFF (80 kbytes)

 */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_RGNV MPU_REGION_NUMBER4

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_START FLASH_BASE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_SIZE MPU_REGION_SIZE_128KB

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_SREG 0xC1U  /*!< 128 Kbytes / 8 * 5 ==> 80 Kbytes */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_PERM MPU_REGION_PRIV_RO_URO

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_EXECV MPU_INSTRUCTION_ACCESS_ENABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_TEXV MPU_TEX_LEVEL0

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_B   MPU_ACCESS_BUFFERABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST_C   MPU_ACCESS_NOT_CACHEABLE

/**

 * @brief Region 5 - Enable the execution for active slot in unprivileged mode.

 *          Read only capability configured

 *          In addition to region 4, from 0x08018000 ==> 0x0801BFFF (16 kbytes)

 */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_RGNV MPU_REGION_NUMBER5

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_START ((uint32_t)0x08018000)

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_SIZE MPU_REGION_SIZE_16KB

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_SREG 0x00U  /*!< 16 Kbytes / 8 * 8 ==> 16 Kbytes */

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_PERM MPU_REGION_PRIV_RW_URO

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_EXECV MPU_INSTRUCTION_ACCESS_DISABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_TEXV MPU_TEX_LEVEL0

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_B   MPU_ACCESS_BUFFERABLE

#define APP_PROTECT_MPU_FLASHEXE_ADJUST2_C   MPU_ACCESS_NOT_CACHEABLE

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @G.Buldo​ 

Sorry for such late answer.

Looking at the project I cannot see any reason why this region is protected.

I suppose this is something that comes from another mapping and was left here unintentionally ...

Best regards

Jocelyn

G.Buldo
Associate

Thank you, this is what i expected.