HardFault_Handler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HardFault_Handler

324 Views
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 Kudos
Reply
2 Replies

303 Views
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 Kudos
Reply

303 Views
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 Kudos
Reply