OpenOCD + STLINK-V3SET是否支持调试菊花链配置中的多个控制器?

时间:2020-04-22 17:55:25

标签: debugging stm32 openocd jtag

我想在我的STLINK适配器上运行多核调试。 我有使用其他工具进行调试的经验(例如,来自Lauterbach的uTrace / Trace32)。 现在,我想在家中建立一个多核设备作为一个业余项目-我没有uTrace,只有STLink的不同版本(便宜得多)。不幸的是,我完全没有使用OpenOCD的经验。 非常感谢您的帮助!

我到目前为止所做的

  1. RTFM。 1 我在手册中看到了许多典型的用例,但没有系统地描述哪些命令包含/需要(哪些)子命令。这阻碍了我(异国情调)用例的解决方案的认识。

  2. 设置有效的单核OpenOCD配置:

    • 生成的配置文件使用安装过程中的示例OpenOCD脚本文件: stlink.cfg(界面:hla), stm32f1x.cfgswj-dp.tclmem_helper.tcl
    • 该设置可以很好地工作-但只能使用单板/核心...! 不过,这表明我的STLINK和目标板都可以,并且这些工具版本可以(原则上)可以相互通信。
  3. 在我的STM32CubeIDE安装中检查了其他OpenOCD示例文件。

    stm32h7x_dual_core.cfg是为错误的µ控制器设计的,但是它包含双核选项。在里面,我发现了这个警告:

    # Issue a warning when hla is used, and fallback to single core configuration
    if { [set $_CHIPNAME.DUAL_CORE] && [using_hla] } {
        echo "Warning : hla does not support multicore debugging"
        set $_CHIPNAME.DUAL_CORE 0
    }
    

    因此,interface hla不能用于多核调试(据我所知,此注释正确无误)。

[编辑]

描述了STM32H7系列中双核变体的集成 here。 尽管如此,这些控制器在JTAG链中仅包含一个TAP,它允许访问位于其后面的内部总线上的多个访问端口(AP)。

[/ EDIT]


以下步骤描述了我如何尝试使STLINK / JTAG配置在单板上运行,其接口设置与hla不同。

  1. 在OpenOCD中寻找其他interface选项

    OpenOCD支持许多不同的接口,

         **C:\Temp>** C:\ST\STM32CubeIDE_1.3.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.openocd.win32_1.3.0.202002181050\tools\bin\openocd.exe -c "interface st-link" -c "transport list"
         Open On-Chip Debugger 0.10.0+dev-01193-g5ce997d (2020-02-20-10:57)
         Licensed under GNU GPL v2
         For bug reports, read
                 http://openocd.org/doc/doxygen/bugs.html
         The following transports are available:
                 jtag
                 aice_jtag
                 stlink_swd
                 stlink_jtag
                 swd
                 stlink_swim
                 hla_jtag
                 hla_swd
         [...]
    

    但是与我的STLINK一起,我会收到与interface相关的错误消息,除非我选择hla选项或以下两个选项之一:

    • stlink_swd-SWD不支持菊花链,所以这不是我的选择!

    • stlink_jtag-我正在寻找JTAG,但这似乎不起作用:

      使用以下最小(?)脚本

          interface st-link
          transport select stlink_jtag
      

      我没有任何连接,但得到了以下日志(激活大量调试):

          Debug: 17 15 options.c:184 add_default_dirs(): bindir=/src/work/openocd/win32/build/bin
          Debug: 18 15 options.c:185 add_default_dirs(): pkgdatadir=/src/work/openocd/win32/build/share/openocd
          Debug: 19 15 options.c:186 add_default_dirs(): exepath=C:/ST/STM32CubeIDE_1.3.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.openocd.win32_1.3.0.202002181050/tools/bin
          Debug: 20 15 options.c:187 add_default_dirs(): bin2data=../share/openocd
          Debug: 21 15 configuration.c:42 add_script_search_dir(): adding C:\Users\x\AppData\Roaming/OpenOCD
          Debug: 22 15 configuration.c:42 add_script_search_dir(): adding C:/ST/STM32CubeIDE_1.3.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.openocd.win32_1.3.0.202002181050/tools/bin/../share/openocd/site
          Debug: 23 15 configuration.c:42 add_script_search_dir(): adding C:/ST/STM32CubeIDE_1.3.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.openocd.win32_1.3.0.202002181050/tools/bin/../share/openocd/scripts
          Debug: 24 15 configuration.c:97 find_file(): found openocd.cfg
          Debug: 25 15 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface st-link
          Debug: 26 15 command.c:143 script_debug(): command - interface ocd_interface st-link
          Debug: 28 15 command.c:364 register_command_handler(): registering 'ocd_st-link'...
          Debug: 29 15 command.c:364 register_command_handler(): registering 'ocd_st-link'...
          Debug: 30 15 command.c:364 register_command_handler(): registering 'ocd_st-link'...
          Debug: 31 15 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select stlink_jtag
          Debug: 32 15 command.c:143 script_debug(): command - ocd_transport ocd_transport select stlink_jtag
          Debug: 33 15 adi_v5_stlink.c:223 stlink_jtag_select(): stlink_jtag_select()
          Debug: 34 15 command.c:364 register_command_handler(): registering 'ocd_stlink_dap'...
          User : 35 15 command.c:693 command_run_line(): stlink_jtag
          User : 36 15 command.c:695 command_run_line(): 
          Info : 37 15 server.c:311 add_service(): Listening on port 6666 for tcl connections
          Info : 38 15 server.c:311 add_service(): Listening on port 4444 for telnet connections
          Debug: 39 15 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
          Debug: 40 15 command.c:143 script_debug(): command - init ocd_init
          Debug: 42 15 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
          Debug: 43 15 command.c:143 script_debug(): command - ocd_target ocd_target init
          Debug: 45 15 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
          Debug: 46 15 command.c:143 script_debug(): command - ocd_target ocd_target names
          Debug: 47 15 target.c:1438 handle_target_init_command(): Initializing targets...
          Debug: 48 15 stlink_usb.c:3755 stlink_dap_init(): stlink_dap_init()
          Debug: 49 15 stlink_usb.c:2674 stlink_usb_open(): stlink_usb_open
          Debug: 50 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x3744 serial: 
          Debug: 51 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x3748 serial: 
          Debug: 52 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x374b serial: 
          Debug: 53 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x3752 serial: 
          Debug: 54 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x374d serial: 
          Debug: 55 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x374e serial: 
          Debug: 56 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x374f serial: 
          Debug: 57 15 stlink_usb.c:2688 stlink_usb_open(): transport: 2 vid: 0x0483 pid: 0x3753 serial: 
          Info : 58 46 stlink_usb.c:1000 stlink_usb_version(): STLINK V3J6M2B4S1 (API v3) VID:PID 0483:374F
          Info : 59 46 stlink_usb.c:2810 stlink_usb_open(): using stlink api v3
          Debug: 60 46 stlink_usb.c:1230 stlink_exit_mode(): MODE: 0x01
          Debug: 61 46 stlink_usb.c:1278 stlink_usb_init_mode(): MODE: 0x01
          Info : 62 46 stlink_usb.c:1032 stlink_usb_check_voltage(): Target voltage: 3.278671
          Debug: 63 46 stlink_usb.c:1303 stlink_usb_init_mode(): MODE: 0x01
          Debug: 64 46 stlink_usb.c:1130 stlink_usb_mode_enter(): stlink_usb_mode_enter(JTAG)
          Debug: 65 46 stlink_usb.c:740 stlink_usb_error_check(): UNKNOWN_JTAG_CHAIN
          Error: 66 46 stlink_usb.c:2819 stlink_usb_open(): init mode failed (unable to connect to the target)
          Debug: 67 46 stlink_usb.c:1230 stlink_exit_mode(): MODE: 0x01
          Debug: 68 46 command.c:642 run_command(): Command failed with error code -4
          User : 69 46 command.c:705 command_run_line(): 
      
  2. 检查OpenOCD邮件列表档案。

    有些迹象表明,早期OpenOCD修订版不支持多核JTAG + STLINK,但是我不理解关于OpenOCD中STLINK驱动程序代码的一些更改(初步?)。 因此,我仍然想知道哪个是当前状态。

问题

有人知道OpenOCD是否完全通过STLINK支持JTAG,还是徒劳? 是否必须添加正确的JTAG链/ TAP /目标定义来摆脱基本错误消息,还是进一步尝试毫无意义?


详细信息-我正在使用以下工具版本:

  • 用于Windows的STM32CubeIDE,版本:1.3.1(内部版本:6291_20200406_0752(UTC)), 包括
  • OpenOCD版本0.10.0 + dev-01193-g5ce997d(2020-02-20-10:57)
  • STLINK-V3SET(Info : STLINK V3J6M2B4S1 (API v3) VID:PID 0483:374F
  • 目标板:2个MCBSTM32,包括 STM32F103RB (对于核板(STM32F4 / STM32L4),我可以尝试相同的方法,但我认为这不是重点。

1 “ OpenOCD用户指南”,STM,0.10.0 + dev,2020年2月20日( st-openocd.pdf ,是STM32CubeIDE安装的一部分)

1 个答案:

答案 0 :(得分:1)

可能有点晚了,但是:

来自UM2448 “ STLINK-V3SET不支持JTAG(菊花链)中的设备链接。