Content originally posted in LPCWare by bmentink on Wed Nov 24 12:03:45 MST 2010
Thanks for the response ... I will look into the "volatile" aspect as pointed out in that link.
As to your question of where in the weeds my program goes ... as soon as it gets to the memcpy() function, it goes into a hard fault.
Edit: Here is some more detail
The function I am calling at the time this happens is called like this:
Quote:
memcpy ((U8 *)(pQueue->pTail), (U8 *)pFrame, 20);
pQueue->pTail address in the debugger is 0x10003290 and pFrame is 0x10005a1e, size = 20.
Soon as I step into/over that function I get a hard fault, and this is reported in GDB.
Quote:
Warn : Block read error address 0x10008000
Warn : lpc1766.cpu -- clearing lockup after double fault
Warn : Block read error address 0xfffffff8
Into the assembly code:
Quote:
42 memcpy ((U8 *)(pQueue->pTail), (U8 *)pFrame, sizeof(CAN_MSG));
00003b02: ldr.w r4, [r6, #4004] ; 0xfa4
--- FAILS HERE --> 00003b06: ldmia r5!, {r0, r1, r2, r3}
00003b08: stmia r4!, {r0, r1, r2, r3}
00003b0a: ldr r3, [r5, #0]
00003b0c: str r3, [r4, #0]
r5 has 0x10005a1e and r4 has 0x10003290
Still don't see why it fails.
Cheers,
Bernie