Environment: iar 8.40.1 MCU: mk64
1. Keyword __ramfunc
iar can use keyword __ramfunc will function in ram, the function call with __ramfunc without __ramfunc function will be alert and cpu execution will be slower. __ramfunc address can not be specified.
ox1fff0015 is in sram
2. Modify icf file
1. Add automatic copy
initialize by copy { readwrite, section RAMCODE};
2. The section RAMCODE put the ram
place in DATA_region {section RAMCODE};
3. Add the test code
//方式1
void testfun(void) @"RAMCODE"
{
uint8_t a=3, b=4, c;
c=a+b;
PRINTF("\r\n c is value is %d\r\n", c);
}
//方式2
#pragma location = "RAMCODE"
void testfun(void) //@"RAMCODE"
{
uint8_t a=3, b=4, c;
c=a+b;
PRINTF("\r\n c is value is %d\r\n", c);
}
//方式3 该方法可以同时将多个函数放到 RAMCODE中
#pragma default_function_attributes = @"RAMCODE"
void testfun1(void) //@"RAMCODE"
{
uint8_t a=3, b=4, c;
c=a+b;
PRINTF("\r\n c is value is %d\r\n", c);
}
void testfun2(void) //@"RAMCODE"
{
uint8_t a=3, b=4, c;
c=a+b;
PRINTF("\r\n c is value is %d\r\n", c);
}
.
.
.
#pragma default_function_attributes =