This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

28375d,在结构体当中使用函数指针,实际运行发现函数指针指向地址0x00000000,不知道原因是什么



原来程序在28335当中一切正常。

在28375d,在结构体当中使用函数指针,实际运行发现函数指针指向地址0x00000000,不知道原因是什么

使用的是xx.lib+xx.h的形式调用函数。

定义结构体

SINWAVE sin = SINWAVE_DEFAULTS;

#define SINWAVE_DEFAULTS {0, \
0,\
0,\
0,\
0,\
2500000,\
1,\
0,0,0, \
20000, \
0, \
0, \
0.00005, \
1.2, \
2.0943951, \
2.0943951, 0,\
(void (*)(Uint32))SINWAVE_calc,\
(void (*)(Uint32))SINWAVE_calc_bp,\
(void (*)(Uint32))SINWAVE_init}

/*------------------------------------------------------------------------------
------------------------------------------------------------------------------*/
void SINWAVE__calc(SINWAVE_handle);
void SINWAVE__init(SINWAVE_handle);
void SINWAVE_calc_bp(SINWAVE_handle);

在程序当中第一次调用该函数

sin.init(&sin);

出现问题直接跳入ILLEGAL中断当中

观察全局变量发现函数指针全部为0.