GDB is unable to keep stepping through instructions when I feed changes into the PLLCON register.
My setup is GDB → OpenOCD → USB-JTAG → LPC2378-STK
I am executing the code from Flash.
lpc2378_init: LDR R0, =PLLFEED
MOV R1, #0xAA
MOV R2, #0x55
@ 1. Disconnect PLL (if connected) and feed
LDR R3, =PLLSTAT
LDR R4, [R3]
TST R4, #(1 << 25) @ PLLSTAT:25 set means connected
BNE pll_disable @ If already disconnected, skip
LDR R6, =PLLCON
MOV R5, #(1 << 1) @ Prep value for PLLCON (bit 1 set means connect)
TST R4, #(1 << 24) @ Check PLLSTAT:24 to see if PLL is already enabled
ORREQ R5, R5, #1 @ Prep value for PLLCON (enabled bit)
STRB R5, [R6] @ Update PLLCON
STRB R1, [R0] @ PLLFEED <- 0xAA
=> STRB R2, [R0] @ PLLFEED <- 0x55
While stepping through that last line of code, OpenOCD issues an error message:
Error: timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Then GDB seems to stay stuck on that line of code, but in fact the processor is no longer halted:
(gdb)
(gdb)
(gdb)
timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Program received signal SIGINT, Interrupt.
lpc2378_init () at hwinit.s:86
(gdb) monitor poll
target state: running
(gdb)
After this happens, I am no longer able to halt the processor using OpenOCD.
> halt
timed out while waiting for target halted
Runtime error, file "command.c", line 436:
I have tried setting a breakpoint after the PLL setup code (no stepping through this time), and the breakpoint simply doesn’t work; also I cannot halt the processor using OpenOCD (same message as above).
I would be very grateful if you have any idea what’s going on here and/or how to get around it.