如下:在MPLAB X IDE开发环境中(XC8 编译器),将fuc1定位到0x400处,然后通过该地址调用函数,结果发现不能调用,
typedef unsigned char (* func_t)(unsigned char a,unsigned char b);
(1)loacte my fucntion at 0x400
unsigned char fuc1(unsigned char a,unsigned char b)__at(0x400)
{
// a+b;
NOP();
NOP();
NOP();
return a*b;
}
(2) fucntion pointer point to fuc1
func_t ptr = (func_t)(&fuc1); //用取址符号可以调用
//func_t ptr = (func_t)(0x400) //直接使用地址无法调用
mmm = ptr(3,9);
|