Help with a HardFault on Cortex-M3

I'm stuck with a stupid issue on a Cortex-M3 (LPC1788 by NXP).

It's a classical issue that happens randomly and in different ways when the code is slightly changed, so it's very difficult to debug.

MCUXpresso (IDE from NXP) and Ozone (a software from Segger) says that IBUSERR and FORCED are set when HardFault exception occurs. I understand it is related to a program counter with a wrong address, maybe a corrupted function pointer. Indeed, when the HardFault triggers, MCUExpresso shows the stacked PC register as 0x824490, that is definitely wrong.

Stacked LR should say something about the calling function (GUI__DoAlphaBlending of emWin). Following disassembly the faulty instruction should be:

bx r3

Stacked R3 (at the fault moment) is 0x24491 (_GetDevProp of emWin), that should be correct, but stacked PC is 0x824490. It seems the 20-th bit was flipped for some reason.

I can't explain why this happens, except for a hardware issue with the MCU.

Reply to
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.