1、函数指定地址
按照http://www.keil.com/support/docs/2215.htm
C166: LOCATING PROGRAM SECTIONS TO SPECIAL MEMORY AREAS的方法一
编写sub_00000.c
#include "variables.h"
//#pragma RENAMECLASS(NCODE=FLASH_CODE)
int sub_00000(int a,int b)
{
int c;
c = a+b;
return c;
}
main.c
...
//#pragma RENAMECLASS
void main (void) { /* execution starts here */
c = sub_00000(a,b);
...
编译选项L166
?PR?SUB_00000%FCODE(0x20000),
?HD?MAIN%HDATA(0x82000)
进行调式,查看sub_00000的地址为0x200000,结果正确。