OpenOCD一次调试多个设备

xDa*_*Dan 4 eclipse debugging openocd

我试图在eclipse上使用openocd同时调试多个设备.我有2x STM32F303发现borards,我已将hla_serial标志设置为正确的板,但仍然没有运气.

单独的板子没问题,但是当试图调试它时,Eclipse说它在最后一个序列中的错误.

所以如果有人有这方面的经验.谢谢

小智 9

我们可以在OpenOCD的0.9+使用hla_serial选项.我建议从GNU ARM Eclipse项目下载 或自己编译.

要获得hla_serial,在阅读包含此选项(http://openocd.zylin.com/#/c/2198/)的补丁后找到的最简单的方法,更具体的函数" string_descriptor_equal ",是提供错误的序列,所以它会打印正确的.

下面的命令将创建文件log_with_correct_serial.txt.切换板配置文件,用于当前使用的配置文件.

openocd.exe -d3 -f board/stm32f4discovery.cfg  -c "hla_serial wrong_serial" 2>log_with_correct_serial.txt
Run Code Online (Sandbox Code Playgroud)

打开log_with_correct_serial.txt,你会发现包含类似内容的正确序列

 Debug: 229 23 libusb1_common.c:67 string_descriptor_equal(): Device serial number 'xxxxxxxxxxx' doesn't match requested serial 'wrong_serial'
Run Code Online (Sandbox Code Playgroud)

所以创建派生配置(例如stm32f4discovery-mydevice1.cfg,假定stm32f4discovery使用)文件夹内上OpenOCD的根目录下.使用Notepad ++之类的东西来复制serial,因为它是十六进制数字.

# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
# http://www.st.com/internet/evalboard/product/252419.jsp
# hla_serial thanks to http://wunderkis.de/stlink-serialno/index.html

source [find board/stm32f4discovery.cfg]
hla_serial V?nIpSU)?
Run Code Online (Sandbox Code Playgroud)

现在打开您的设备,您可以使用以下命令开始使用ST-Link适配器进行调试.

openocd.exe -f board/stm32f4discovery-mydevice1.cfg
Run Code Online (Sandbox Code Playgroud)

在每个eclipse项目中为每个项目提供不同的板配置,你很高兴.