我正在尝试使用eclipse上的openocd一次调试多个设备。我有2个STM32F303发现对象,我已将hla_serial标志设置为适当的板,但是仍然没有运气。

单独的板运行正常,但是在尝试调试时,Eclipse表示最后一个顺序出错。

因此,如果有人有经验。谢谢

最佳答案

我们只能在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


打开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'


因此,请在openocd根目录的文件夹面板内创建一个派生配置(例如stm32f4discovery-mydevice1.cfg,假设使用stm32f4discovery)。使用像Notepad ++这样的东西来复制序列,因为它是十六进制数字。

# 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)?


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

openocd.exe -f board/stm32f4discovery-mydevice1.cfg


在每个Eclipse项目中,为每个项目提供不同的电路板配置,您很高兴。

09-25 16:56