OpenOCD和Eclipse,设置错误?

时间:2016-12-30 11:36:41

标签: eclipse openocd

当我从我的Olimex STM32-E407主板附带的旧Eclipse安装迁移时,我遇到了OpenOCD安装的一些困难。

旧的Eclipse设置工作正常;带有以下init脚本的Zylin嵌入式调试器:

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

这个运行脚本:

monitor soft_reset_halt
monitor wait_halt
monitor poll
thbreak main
continue

由于我切换到新的Eclipse,我可以选择不同的调试器,因为Zylin似乎已经过时(最新的Google结果在2010年之前)。在Eclipse Neon中,我选择了GDB OpenOCD Debug,它将从与旧Eclipse相同的OpenOCD实例开始。它不会从Eclipse本身启动可执行文件。

OpenOCD脚本如下所示:

-f ../scripts/interface/ftdi/olimex-arm-usb-tiny-h.cfg
-f ../scripts/board/olimex_stm32_e407.cfg

在Startup选项卡中,我复制了上面的initalization和run命令,将main.bin更改为Dev.elf并保存了设置。

从Eclipse开始调试会在下面的输出中产生。即使我使用旧日食中的原始main.bin - 之前有效! - 我似乎无法解决这个问题。

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

令我惊讶的是它如何重新连接GDB以及适配器速度正在切换的事实。我做错了什么?

1 个答案:

答案 0 :(得分:0)

我暂时找到了解决方案。

  1. 在GDB硬件调试中添加调试选项
  2. 使用gdb命令&#39; arm-none-eabi-gdb&#39; - 您需要PATH环境中的可执行文件。
  3. 使用远程目标&#39;通用TCP / IP&#39;作为localhost上的JTAG设备:3333
  4. 转到“启动”选项卡,然后选择默认设置。初始化命令:

    monitor reset halt
    monitor flash write_image erase main.bin 0x08000000
    monitor sleep 200
    
  5. 使用的运行命令是:

    monitor soft_reset_halt
    monitor wait_halt
    monitor poll
    thbreak main
    continue
    
  6. 这使用了旧的&#39;来自我最初的Eclipse示例项目的main.bin。如果你使用.elf文件,你应该使用它:

    monitor flash write_image erase main.elf
    

    这是因为.elf包含所有必需的标题。