OpenOCD

27 Aug 2014

Hi Everyone,

I am trying to get OpenOCD up and running correctly with an mbed LPC1768. The setup/versions I am running is:

  • OS X 10.9.4;
  • GNU ARM GCC 8.4 2014 Q2 from launchpad;
  • mbed LPC1768 with firmware version 141212;
  • OpenOCD V0.8.0 installed via homebrew;

I am using the simplest possible code, it just blinks one of the led's every 100ms, I have exported this from the online compiler, compiled with my local GCC and put the bin on to the mbed in the normal way. This works without issue.

I then start OpenOCD with the default mbed-lpc1768.cfg config file, this finds the board without problem.

I launch gdb, halt the mbed, load the code and when I attempt to start the code it does not function as expected:

stevembp:HelloWorld steve$ arm-none-eabi-gdb HelloWorld.elf 
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140529-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/steve/Documents/Development/HelloWorld/HelloWorld.elf...done.
(gdb) 
(gdb) 
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000000 in __isr_vector ()
(gdb) mon reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fff0080 msp: 0x10001ffc
(gdb) load
Loading section .text, size 0x6f9c lma 0x0
Loading section .ARM.exidx, size 0x8 lma 0x6f9c
Loading section .data, size 0xb4 lma 0x6fa4
Start address 0x308, load size 28760
Transfer rate: 67 bytes/sec, 7190 bytes/write.
(gdb) continue
Continuing.
lpc1768.cpu -- clearing lockup after double fault

Program received signal SIGINT, Interrupt.
0x00000000 in __isr_vector ()

This is the output from OpenOCD

stevembp:Development steve$ openocd -f /usr/local/share/openocd/scripts/board/mbed-lpc1768.cfg 
Open On-Chip Debugger 0.8.0 (2014-08-27-15:37)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'cmsis-dap'
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
adapter speed: 10 kHz
adapter_nsrst_delay: 200
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
Info : CMSIS-DAP: Interface ready
Info : clock speed 10 kHz
Info : IDCODE 0x2ba01477
Info : lpc1768.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from 3333
undefined debug reason 7 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fff0080 msp: 0x10001ffc
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1001). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1027). Workaround: increase "set remotetimeout" in GDB
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fff0080 msp: 0x10001ffc
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (5069). Workaround: increase "set remotetimeout" in GDB
Warn : Verification will fail since checksum in image (0x00000000) to be written to flash is different from calculated vector checksum (0xefff6cc6).
Warn : To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (401105). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1158). Workaround: increase "set remotetimeout" in GDB
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fff0080 msp: 0x10001ffc
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (5029). Workaround: increase "set remotetimeout" in GDB
Error: lpc1768.cpu -- clearing lockup after double fault
Polling target lpc1768.cpu failed, GDB will be halted. Polling again in 100ms
Polling target lpc1768.cpu succeeded again

The actual code I am compiling and attempting to run is

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    myled = 0;
    while(1) {
        myled = !myled;
        wait(0.1);
    }
}

I do not believe this is an issue with the way that I am compiling the code or the mbed as when I use pyOCD the same elf binary works as expected.

I have also tried this using the current OpenOCD development stream (also installed via homebrew) and I get exactly the same output.

Any help would be gratefully received.

Kind Regards,

Steve

12 Dec 2014

Hi Steve,

I am getting similar error. Have you got any solution?

/media/uploads/abhijeetb89/mbed_openocd_error.png

Regards,

Abhijeet

12 Dec 2014
Warn : Verification will fail since checksum in image (0x00000000) to be written to flash is different from calculated vector checksum (0xefff6cc6).

Could this be related to your problem? If this is a mbed-LPC1768 device, could you try programming the device using the USB MSD to copy over the .bin instead of using the load command in GDB? Just attach OpenOCD and GDB to debug once the binary has been copied over and the reset button depressed.