cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32H7]I use BootRom to jump to sdram to run the program,but the jump from boot to app is slow

Passerby
Associate III

Hello,

I wrote a Boot program in flash to initialize sdram and copy the app program to run in sdram. The current state is able to jump and run normally, but the length of jump time seems to be positively correlated with the size of global variables in my app. For example, if I define a 1MB size array in the app and use it, the jump time will be significantly longer for several seconds,

May I ask why this is, is there any way to solve this problem?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Passerby
Associate III

Add the C compiler condition "--no_unaligned_access" to the APP

View solution in original post

5 REPLIES 5
BarryWhit
Lead II

Define "Jump time". A jump instruction would normally take on the order of a few cycles. Are you claiming that a single jump instruction takes several seconds to execute? If not, what do you mean?

 

Obviously the time it takes to copy data from flash to SDRAM is proportional to the amount of data, so what exactly is it that's taking more time than you think it should? How are you measuring? What are you measuring? Can you show your bootloader code?

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.

Hello @BarryWhit 

    This is my Jump code , other code is close peripherals and irq.

 

    xvJumpAppResetFunction = (_xvJumpAppResetFunction) (*(__IO uint32_t*) (appJumpAPP_APPAddress + 4)); 
    __set_PSP(*(__IO uint32_t*) appJumpAPP_APPAddress);
    __set_CONTROL(0);                                                                                       
    __set_MSP(*(__IO uint32_t*) appJumpAPP_APPAddress);                                                     
    xvJumpAppResetFunction();    

 

   Jump Time is form  'xvJumpAppResetFunction();'  to App main();

   Normal jump takes 2-3s, if the app defines a large size of global variables, it may take more than 10s.

 

Thanks!

BarryWhit
Lead II

How are you measuring the elapsed time between the call and main? 

What's the code which appJumpAPP_APPAddress+4 points to?

 

The usual entry point for a compiled program is not main, but _start (depending on your stdlib and  linker flags and so on). So, what code is executing after the call and before main is reached?  What preparations does it perform before calling main?

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.
Passerby
Associate III

Add the C compiler condition "--no_unaligned_access" to the APP

BarryWhit
Lead II

Scare them away with questions, that's what I always say. :flexed_biceps:

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.