2013-01-15 11:21 AM
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! Charlie2013-01-15 12:50 PM
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);
}
}
2013-01-15 02:06 PM
Thanks Clive.
I've implemented the IAR keyword __ramfunc and the linker shows that all the relevant functions are now in RAM.