Skip to main content
Graduate II
August 29, 2024
Solved

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

  • August 29, 2024
  • 5 replies
  • 1333 views

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!

    This topic has been closed for replies.
    Best answer by Passerby

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

    5 replies

    Graduate II
    August 29, 2024

    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?

    PasserbyAuthor
    Graduate II
    August 29, 2024

    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!

    Graduate II
    August 29, 2024

    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?

    PasserbyAuthorAnswer
    Graduate II
    August 29, 2024

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

    Graduate II
    August 29, 2024

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

    Explorer
    July 12, 2025

    Hello,
    I do not know if you are still around, but may I basically ask how was your app's .ld file config and how did you disable peripherals and irq? When I try to copy the app from qspi to RAM then jump to RAM, I can do it in ease. But whenever I try the same thing for SDRAM, I am not able to jump. 
    Thank you for your time.