My C program (on an LPC2148) is generating a data-abort on what looks to be a perfectly innocent data fetch. The program is running in on-chip flash and reading data from on-chip RAM.
As I step through the program in mixed mode, I reach the following:
Fat_RootDir[FAT_SIZE+60] = (U8)(USER_FLASH_SIZE & 0xFF); 0x00070C50 E59F0138 LDR R0,[PC,#0x0138] 0x00070C54 E5900000 LDR R0,[R0] (remaining instructions omitted)
According to the debugger, the contents of PC+0x0138 is 0x40000188, which is the address of an array I want to modify. However, after the first instruction is executed, R0 holds 0x00154aa0. After the next instruction executes, I end up in the data-abort handler.
Note that this error is reproducible with data in different areas of on-chip RAM, with the program running in different addresses in on-chip flash, and with the program running on a different board.
What might cause the bad fetch from the first instruction?
Karl
this looks like the USB/Ethernet bootloader sample of Keil. If so, are you sure this code is executed "atomically" (hence, inside an IRQ without nested interrupts enabled, and no FIQ to interfere). Maybe R0 gets corrupted by an interrupt?
Forget it; this is strictly a pilot error, traced to an incorrect #define in one of my header files. The code was fetching exactly what I (incorrectly) told it to fetch. Thanks to Drew on the Keil Support team for pointing me in the right direction.
Back to our regularly scheduled programming...