I'd like to get a multi-core debugging running with my STLINK adapter. I've got experiences in debugging with other tools (e.g., uTrace/Trace32 from Lauterbach). Now, I'd like to setup a multi-core arrangement as a hobby project at home - where I don't have a uTrace but only different versions of the STLink (much cheaper). Sadly, I'm not experienced at all in using OpenOCD. Any help is highly appreciated!
What I did so far
RTFM.1 I see many typical use cases in the manual, but not a systematic description on which commands include/require (which) sub-commands. This impedes recognizing the solution to my (exotic ?) use case.
Setup a working single-core OpenOCD configuration:
- The generated config file uses example OpenOCD script files from installation:
stlink.cfg
(interface:hla
),stm32f1x.cfg
(swj-dp.tcl
,mem_helper.tcl
) - That setup works nicely - but only with a single board/core...! Still, it shows that my STLINK and target boards are OK, and the tool versions can (in principle) communicate with each other.
- The generated config file uses example OpenOCD script files from installation:
Inspected other OpenOCD example files among my STM32CubeIDE installation.
stm32h7x_dual_core.cfg
is made for the wrong µ-controller, but it includes a dual-core option. Inside, I found this warning:# 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 }
Hence,
interface hla
cannot be used for multi-core debug (as far as this comment is correct, and I understand it).
[EDIT]
Integration of the dual-core variants in the STM32H7 family is described here. Still, these controllers only comprise a single TAP in the JTAG chain, which allows access to several Access Ports (APs) at an internal bus behind it.
[/EDIT]
The following steps describe how I tried to get an STLINK/JTAG configuration running for a single board, with a different interface setting than hla
.
Look for other
interface
options in OpenOCDOpenOCD supports a number of different interfaces,
**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 [...]
but together with my STLINK, I'm getting
interface
-related error messages unless I choose anhla
option or either of the following two:stlink_swd
- SWD won't support daisy chains, so that's not an option for me!stlink_jtag
- JTAG is what I'm looking for, but this doesn't seem to work:With the following minimal (?) script
interface st-link transport select stlink_jtag
I'm getting no connection but the following log (activating plenty of debug):
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():
Check the OpenOCD mailing list archives.
There are some hints that multicore-JTAG+STLINK hasn't been supported in earlier OpenOCD revisions, but there have been some (preliminary?) changes about STLINK driver code in OpenOCD that I don't understand. Therefore, I'm still wondering which is the current status.
The Question
Does anybody know if OpenOCD supports JTAG through STLINK at all, or if I'm trying in vain? Do I have to add the correct JTAG chain/TAP/target definitions to get rid of the basic error messages, or is it pointless to try further?
Details - I'm using the following tool versions:
- STM32CubeIDE for Windows, Version: 1.3.1 (Build: 6291_20200406_0752 (UTC)), including
- OpenOCD, Version 0.10.0+dev-01193-g5ce997d (2020-02-20-10:57)
- STLINK-V3SET (
Info : STLINK V3J6M2B4S1 (API v3) VID:PID 0483:374F
) - Target boards: 2x MCBSTM32, including STM32F103RB (With nucleo boards (STM32F4/STM32L4) I could try the same - but I think this is not the point).
1 "OpenOCD User’s Guide", 0.10.0+dev, STM, 20 February 2020 (st-openocd.pdf, part of STM32CubeIDE installation)