Skip to main content
Graduate
October 16, 2024
Solved

Execute specific functions from RAM

  • October 16, 2024
  • 2 replies
  • 5977 views

Hi, I would like to know the procedure to execute specific functions from RAM.

I have tried __ramfunc at beginning of the function but it requires all the subsequent functions also to be run from RAM. This would require lot of manual code updates. Is there a way to do it from linker script? I tried placing the functions like below but it would not move the function from ROM to RAM.

place in RAM_region { readwrite,
                                    block CSTACK,
                                    block HEAP,
                                    readonly object function1 // this is my expected function to run from RAM
};

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Did you test the project I shared as it is and checked how it works?

    Are you using an RTOS? if yes start with a simple code (without RTOS), then move on to a complex code.

    For the interrupt, I suggested to follow the application note section: 2.2 Execute an interrupt handler from CCM SRAM.

    2 replies

    Super User
    October 16, 2024

    What compiler /IDE? What MCU exactly?  

     

    nagarasrAuthor
    Graduate
    October 16, 2024

    MCU - STM32H573VI

    IDE - IAR 9.30.1

     

     

    Technical Moderator
    October 16, 2024

    Hello @nagarasr and welcome to the ST Community :smiling_face_with_smiling_eyes:.

    I think this article may help you.

    Best Regards.

    STTwo-32 

    nagarasrAuthor
    Graduate
    October 16, 2024

    Hi STTwo-32,

    I am using STM32H573VI MCU and IAR 9.30.1 IDE. I went through the article but it did not contain the required information. There exists lot of code currently written by other over so many years and now we are facing timing issues. To increase the execution speed, we are tying to run specific functions only from RAM. How do I select those specific functions via Linker script and do not disturb the code base?