Skip to main content
ranran
Senior
March 10, 2020
Question

Running application from RAM

  • March 10, 2020
  • 6 replies
  • 1500 views

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

    This topic has been closed for replies.

    6 replies

    berendi
    Principal
    March 10, 2020

    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.

    ranran
    ranranAuthor
    Senior
    March 10, 2020

    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

    berendi
    Principal
    March 10, 2020

    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.
    March 10, 2020

    @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

    ranran
    ranranAuthor
    Senior
    March 11, 2020

    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!