cancel
Showing results for 
Search instead for 
Did you mean: 

bl SystemInit execution time in startup_stm32fxxxx.s

Hi :

I noticed bl SystemInit called before executing movs r1, #0 in STM32Cube_FW_F7_V1.16.1\Projects\STM32756G_EVAL\Examples\FMC\FMC_SDRAM_DataMemory\SW4STM32\startup_stm32f756xx.s while after executing LoopFillZerobss in STM32Cube_FW_F7_V1.16.1\Projects\STM32746G-Discovery\Examples\FMC\FMC_SDRAM_DataMemory\SW4STM32\startup_stm32f746xx.s.

Is there any difference between these two project?

In my project, application works fine when bl SystemInit called before executing movs r1, #0, but can't work when after executing LoopFillZerobss. I use 32 bit sdram IS42S328200D which almost same as STM32756G_EVAL.

18 REPLIES 18

Hello @周 剑强​ ,

As suspected by @Community member​ there are data that need to be loaded to the external RAM. FMC should be initialized before load in this case. As a workaround you can call SystemInit before the data loading/.bss zeroing as you actually did. I've summarily checked the functions, and they should work normally before memory initialization.

Otherwise, I don't think I would be able to put it more succinctly than @Community member​ . The startup code is a part of the project, and should be updated accordingly to the use-case.

Best regards,

@SBEN .2​ 

Hi SBEN:

As you said, so why STM32746G-Discovery\Examples\FMC\FMC_SDRAM_DataMemory don't place bl SystemInit before executing movs r1, #0?

Hi Tesla DeLorean:

Can you explain more details about "U​sing NOINIT or NOLOAD sections is a hack to cover the failure to get the system in to a viable state"?

Hello @周 剑强​ 

I've already asked the question internally, once I have the answer I'll update you.

Best regards,

Walid

Hi ​Walid ZRELLI:

Is there any update?​

>>Either way, for MDK-ARM for example, scatter loading is done before SystemInit is called.

It is not.

The scatter loader is call be __main, which in turn calls the user's main() function.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

If the linker puts no content in these sections,and the system fails to set up the memories behind them, no data gets copied into them, and the failure gets swept under the carpet until some code later in main() sets up the memory properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Piranha
Chief II

As for the intention of design...

https://github.com/ARM-software/CMSIS_5/blob/ee79c2197e6529f5274893e3764d0ded04aff22e/Device/_Template_Vendor/Vendor/Device/Source/GCC/startup_Device.S#L95

In their templates ARM is calling SystemInit() before the data/bss initialization. The function is meant to initialize the base peripherals - CPU, buses and memories, which need to be functional so that further code can initialize the necessary memory regions.

what confused me is that sometimes ST call SystemInit() before the data/bss initialization, but sometimes not. but according other member's reply,U​sing NOINIT or NOLOAD sections can call SystemInit() after the data/bss initialization