2024-08-28 08:50 PM
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!
Solved! Go to Solution.
2024-08-29 02:50 AM
Add the C compiler condition "--no_unaligned_access" to the APP
2024-08-28 09:11 PM - edited 2024-08-28 09:12 PM
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?
2024-08-28 10:12 PM
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!
2024-08-28 10:31 PM - edited 2024-08-28 10:32 PM
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?
2024-08-29 02:50 AM
Add the C compiler condition "--no_unaligned_access" to the APP
2024-08-29 04:11 AM
Scare them away with questions, that's what I always say. :flexed_biceps: