请问为啥我用 sprintf 或者sscanf只要参数中有浮点数就会 hard fault
double a, b, c;
a = 1.111;
b = 2.222;
c = a+b;
sprintf(gps_buf, "%f %f %f\r\n", a, b, c);
只要执行到 sprintf
msh >psr: 0x01010000
r00: 0x00000001
r01: 0x00018608
r02: 0x00000008
r03: 0x00000208
r04: 0x20004030
r05: 0x00016768
r06: 0x08000000
r07: 0x00000208
r08: 0xdeadbeef
r09: 0xdeadbeef
r10: 0xdeadbeef
r11: 0xdeadbeef
r12: 0xffffffff
lr: 0x000117cf
pc: 0x000117de
hard fault on thread: gps_task
thread pri status sp stack size max used left tick error
gps_task 30 running 0x000001b8 0x00000800 39% 0x0000000a 000
a1 30 suspend 0x000000b0 0x00000200 34% 0x00000005 000
tshell 20 suspend 0x000000d0 0x00001000 05% 0x0000000a 000
tidle0 31 ready 0x00000060 0x00000200 23% 0x00000005 000
main 10 suspend 0x000000cc 0x00000800 14% 0x00000013 000
usage fault:
SCB_CFSR_UFSR:0x08 NOCP
更多回帖