As I migrated from the old Eclipse installation that comes with my Olimex STM32-E407 board I came across some difficulty with the OpenOCD installation.
The old Eclipse settings worked fine; a Zylin embedded debugger with the following init script:
target remote localhost:3333
monitor reset halt
monitor wait_halt
monitor sleep 100
monitor poll
monitor flash write_image erase main.bin 0x08000000
monitor sleep 200
And this run script:
monitor soft_reset_halt
monitor wait_halt
monitor poll
thbreak main
continue
Since I switched to the new Eclipse I could choose a different debugger as Zylin seems to be outdated (latest Google results were prior to ~2010). In Eclipse Neon, I opted for GDB OpenOCD Debug which will start from the same OpenOCD instance as the old Eclipse. It will not launch the executable from Eclipse itself.
The OpenOCD script looks like the following:
-f ../scripts/interface/ftdi/olimex-arm-usb-tiny-h.cfg
-f ../scripts/board/olimex_stm32_e407.cfg
At the Startup tab I copied the initalization and run commands per above, changed main.bin to Dev.elf and saved the settings.
Starting debug from Eclipse yields in the output below. Even when I use the original main.bin from the old eclipse - which worked previously! - I cannot seem to get around this issue.
Open On-Chip Debugger 0.10.0-rc1
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : clock speed 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10076413
Info : flash size = 1024kbytes
undefined debug reason 7 - target needs reset
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002b8 msp: 0x20020000
adapter speed: 8000 kHz
Info : dropped 'gdb' connection
Info : accepting 'gdb' connection on tcp/3333
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002b8 msp: 0x20020000
background polling: on
TAP: stm32f4x.cpu (enabled)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002b8 msp: 0x20020000
auto erase enabled
Error: couldn't open Dev.elf
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002b8 msp: 0x20020000
adapter speed: 8000 kHz
Info : Padding image section 0 with 1 bytes
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002b8 msp: 0x20020000
Info : dropped 'gdb' connection
What surprises me is how it keeps reconnecting GDB and the fact that the adapter speed is switching. What am I doing wrong?
I have found a solution for the time being.
Go to the Startup tab and select default settings. Initalization commands:
The used run commands are:
This uses the 'old' main.bin from my initial Eclipse example project. If you use the .elf file you should use this instead:
This is due to the fact that .elf contain all the required headers.