cancel
Showing results for 
Search instead for 
Did you mean: 

Running application from RAM

ranran
Senior II

Hello,

Is it that application can only run from ITCM ? When I try to run from other SRAM such as SRAM1, it get into MEM IRQ handler.

Another issue is that on running from ITCM the HAL_Delay is much faster compared with running from internal flash (Xip). From internal flash HAL_Delay(x) waits x millisecons ( just as expected), but with ITCM it will wait much less time (about ~x/10 ).

Thank you for any comment,

Ranran

6 REPLIES 6
berendi
Principal

Which MCU is that? SRAM1 must be enabled on some series.

> on running from ITCM the HAL_Delay is much faster compared with running from internal flash (Xip).

Something is seriously misconfigured then. Check/show all RCC and SysTick registers.

Hi,

Do you mean it can run from any SRAM (I did remember to enable SRAM1 clock but it did not help).

>Something is seriously misconfigured then. Check/show all RCC and SysTick registers.

But when running from internal flash there is no issue with the exact same simple application which toggled a led every 1 second using HAL_Delay(1000).

Thanks

I haven't checked it on all STM32 series, so I don't know if it can run from SRAM1 on yours. Moreover, I can't guess how did your code get to SRAM, is it properly linked, relocated, how are the clocks set up...​

Pavel A.
Evangelist III

@ranran​ How do you run the app in RAM - do you have a "bootloader" or load it with a debugger? If the latter, which one?

Once I've seen issues with loading a program into 'H7 RAM with Atollic debugger. It works basically, but interrupts and timers behaved strangely.

-- pa

All I asked was if it theoretically it can run from sram1. Thanks anyway.

Hi,

Yes, I use bootloader, which copies it to RAM and jump to start address.

The bootloader already works perfectly if it jumps to flash and run from flash.

The questions were raised about sram - which are theoretical question , to understand if what we are trying to do, can actually be done.

  1. Can it run only from ITCM only ? or can it run from any sram (as long it was enabled of course). I asked because trying to run from other sram failed in my case.
  2. we noticed that timer behaves strangely (faster) with same application and same clock initializations. The only difference is that in one case we jump to flash (and the interrupt vecotor is also in flash) and in other case we jump to itcm (and the interrupt vector is in itcm). Is there something which can explain it ?

Thanks!