HardFault_Handler

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

HardFault_Handler

825 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rithus on Sat Apr 12 08:04:48 MST 2014
Hi all, i am using lpc1769 and whenever i run the program i will have a hard fault handler when i have a sprintf function in a header file is there any solution to this?

void callprint(int x)
{
char *msg;

sprintf(msg,"%d%d\n",x,x);
Uart_Send((uint8_t *)msg , strlen(msg));

}
0 项奖励
回复
2 回复数

804 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rithus on Sat Apr 12 12:09:57 MST 2014
thanks it works!
0 项奖励
回复

804 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Sat Apr 12 08:18:01 MST 2014
You have not allocated memory for the output string.

Try changing

char *msg;

to

char msg[128];
0 项奖励
回复