************************定义*************************
void LineCalc(LINE_STRUCT *p);
#define LINE_STRTUCT_DEFALUTS \
{ \
(void (*)(void *))LineCalc \
}
typedef struct
{
void (*calc)(void *); // Pointer to calculation functon
int16 mode;
int32 x1;
int32 y1; // (x1,y1)
int32 x2;
int32 y2; // (x2,y2)
int32 x;
int32 y;
} LINE_STRUCT;
*************************子程序*********************
void function(void)
{
LINE_STRUCT aoLine = LINE_STRTUCT_DEFALUTS;
aoLine.calc(&aoLine);
}
void LineCalc(LINE_STRUCT *p)
{
}
****************************************************
现在的问题是,子程序function()中加上aoLine.calc(&aoLine)语句就会跳入HardFault_Handler,删掉aoLine.calc(&aoLine)程序就可以正常跑,这个函数这种写法有问题吗?以前用ST的stm32f030,现要移植到gd32e230。如何解决这个问题?
|