Skip to main content
Associate II
October 16, 2024
Solved

Execute specific functions from RAM

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.
mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
October 21, 2024

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.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.

10 replies

KnarfB
Super User
October 16, 2024

What compiler /IDE? What MCU exactly?  

 

nagarasrAuthor
Associate II
October 16, 2024

MCU - STM32H573VI

IDE - IAR 9.30.1

 

 

STTwo-32
ST 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 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
nagarasrAuthor
Associate II
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?

 

mƎALLEm
ST Technical Moderator
October 16, 2024
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.