In my current project I use uVision 5.38 and the compiler default V6 compiler. As a controller I have a LPC1788 that crashes to the HardFault_Handler on the 3rd (or 4th) assembly instruction.
At the start of the project I have the following instructions from startup_LPC177x_8x.s
LDR R0, =SystemInit BLX R0
In SystemInit I have the following instructions
PUSH {r7,lr} MOVW r1,#0xC1A0 MOVT r1,#0x400F MOVS r0,#0x21
However if I press F11 once I am on the "PUSH {r7, lr}" instruction the next instruction is at address 0x00000188, in other words HardFault_Handler. Where the cpu get's "stuck" on the B instruction (to the same location).
If I try the blinky demo (for the LPC1788) the SystemInit looks like this
PUSH {r4-r8,lr} MOVW r5,#0xC0C4 MOVT r5,#0x400F MOVS r0,#0x21
This code does not trigger a HardFault_Handler.
Any suggestions on how to fix this?
Yes, you are correct. Reducing/checking the stack and heap sizes fixed this part.
Thanks for the help.