cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB linker file

thealbertdev
Associate III

I'm having issues with a project based on an STM32WB5MM where some devices fail to operate BLE (like advertising, for example). The project integrates SBSFU and BLE_ota.

I'm reviewing the linker files and I see differences in the management of the BLE buffer between a standalone application and an application with OTA and SBSFU.

In the standalone application generated by STM32CubeIDE, I have this in the linker file:

 

 

  .ARM.attributes 0       : { *(.ARM.attributes) }
   MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED
   MB_MEM1 (NOLOAD)       : { *(MB_MEM1) } >RAM_SHARED

   /* used by the startup to initialize .MB_MEM2 data */
  _siMB_MEM2 = LOADADDR(.MB_MEM2);
  .MB_MEM2 :
  {
    _sMB_MEM2 = . ;
    *(MB_MEM2) ;
    _eMB_MEM2 = . ;
  } >RAM_SHARED AT> FLASH

 

 

and in the application with integrated SBSFU and OTA, I have:

 

 

  .ARM.attributes 0       : { *(.ARM.attributes) }
  MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED
  MB_MEM1 (NOLOAD)       : { *(MB_MEM1) } >RAM_SHARED
  MB_MEM2 (NOLOAD)       : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED

 

 

where the symbol _siMB_MEM2 does not appear, and the buffer contents are not preloaded from flash. This linker is taken from the SBSFU package and matches the BLE_HeartRate_ota example.

I can also see that, in the standalone application, the symbol _siMB_MEM2 is used to initialize that memory section during startup. This initialization is not present in the SBSFU/OTA example nor in BLE_HeartRate_ota.

In startup_stm32wb5mmghx.s:

 

 

/* Copy the data segment initializers from flash to SRAM */
  INIT_DATA _sdata, _edata, _sidata
  INIT_DATA _sMB_MEM2, _eMB_MEM2, _siMB_MEM2

 

 

Since in the SBSFU/OTA version the microcontroller can switch between applications, should I assume that the buffer initialization is not needed? Or should I always reinitialize that buffer, and thus avoid using the example linker files? I'm a bit confused by the BLE instability.

Thanks in advance.

1 REPLY 1
STTwo-32
ST Employee

Hello @thealbertdev 

Could you please take a look at this Post. It may be helpful.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.