最近在调试LPC4337+FATFS,FLASH用的是MX25L512,但是读写一直不成功。通过Debug监视一个局部变量,发现FATFS文件系统其在一个毫不相干的判断语句后,其值被修改了。
if (fp->flag & FA__ERROR) return FR_INT_ERR;
上面的代码就是执行后被监视的局部变量值发生变化的语句。在注释后发现其下一条语句依然会把监视的值改掉。
是栈出了问题么?
部分MAP文件:Memory Map of the image
Image Entry point : 0x1a000115
Load Region LR_IROM1 (Base: 0x1a000000, Size: 0x00008150, Max: 0x00080000, ABSOLUTE, COMPRESSED[0x0000802c])
Execution Region RW_IRAM1 (Base: 0x10000000, Size: 0x00000c00, Max: 0x00008000, ABSOLUTE)
Base Addr Size Type Attr Idx E Section Name Object
0x10000000 0x00000c00 Zero RW 8448 .bss endpoint.o
Execution Region RW_RAM3 (Base: 0x10080000, Size: 0x00003200, Max: 0x0000a000, ABSOLUTE)
Base Addr Size Type Attr Idx E Section Name Object
0x10080000 0x00003200 Zero RW 1524 .bss board_keil_mcb_18574357.o
Execution Region ER_IROM1 (Base: 0x1a000000, Size: 0x00008000, Max: 0x00080000, ABSOLUTE)
Base Addr Size Type Attr Idx E Section Name Object
。。。。。
Execution Region RW_IRAM2 (Base: 0x20000000, Size: 0x00008cc8, Max: 0x00010000, ABSOLUTE, COMPRESSED[0x0000002c])
Base Addr Size Type Attr Idx E Section Name Object
0x20000000 0x00000018 Data RW 421 .data generichid.o
0x20000018 0x00000010 Data RW 1117 .data drv_lpc43xx.o
0x20000028 0x00000081 Data RW 1526 .data board_keil_mcb_18574357.o
0x200000a9 0x00000003 PAD
0x200000ac 0x0000003c Data RW 5262 .data tasks.o
0x200000e8 0x0000000e Data RW 8211 .data usbtask.o
0x200000f6 0x00000003 Data RW 8382 .data devicestandardreq.o
0x200000f9 0x00000003 PAD
0x200000fc 0x00000034 Data RW 8449 .data endpoint.o
0x20000130 0x00000003 Data RW 8627 .data usbcontroller.o
0x20000133 0x00000002 Data RW 8682 .data hal_lpc18xx.o