cancel
Showing results for 
Search instead for 
Did you mean: 

Running a particular function from RAM

charlieincanada69
Associate II
Posted on January 15, 2013 at 20:21

Hi,

As discussed in [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Ways%20to%20speed%20up%20writing%20to%20program%20flash&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx]another post I need one of my functions to run from RAM, whilst the rest of my code runs from Flash.

What is the easiest way of achieving this? I'm on IAR6.4, STM32F103.

Thanks!

Charlie
2 REPLIES 2
Posted on January 15, 2013 at 21:50

For IAR I think the directive is __ramfunc, please refer to documentation for more details.

http://supp.iar.com/Support/?note=82175&from=search+result

http://supp.iar.com/Support/?note=80737&from=search+result

STM32L-Discovery_Demo\Project\src\icc_measure_Ram.c

__ramfunc void RAM_FLASH_RUNPowerDownCmd(FunctionalState NewState)
{
if (NewState != DISABLE)
{
/* Unlock the RUN_PD bit */
FLASH->PDKEYR = FLASH_PDKEY1;
FLASH->PDKEYR = FLASH_PDKEY2;
/* Set the RUN_PD bit in FLASH_ACR register to put Flash in power down mode */
FLASH->ACR |= (uint32_t)FLASH_ACR_RUN_PD;
}
else
{
/* Clear the RUN_PD bit in FLASH_ACR register to put Flash in idle mode */
FLASH->ACR &= (uint32_t)(~(uint32_t)FLASH_ACR_RUN_PD);
}
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
charlieincanada69
Associate II
Posted on January 15, 2013 at 23:06

Thanks Clive.

I've implemented the IAR keyword __ramfunc and the linker shows that all the relevant functions are now in RAM.