cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo STM32H5 debugging OpenOCD

margce
Associate III

Hi all,

I recently got a Nucleo STM32H563ZI board to start doing development with the STM32H5x family of microcontrollers but I'm having issues trying to setup a debug session in VSCode. I've download the STM32 OpenOCD version and compiled it as it seems to have support for STM32h5x.

 

Has anyone successfully launched a debug session in VSCode? 

I'm using Cortex-Debug and have tried different configurations with openocd but no luck. 

Thanks!

martin

1 ACCEPTED SOLUTION

Accepted Solutions
margce
Associate III

This can now be closed, I saw the file STM32H5_Nucleo Debug.cfg which I have generated from CubeMX code example.

View solution in original post

12 REPLIES 12
margce
Associate III

This can now be closed, I saw the file STM32H5_Nucleo Debug.cfg which I have generated from CubeMX code example.

MarcTsimio
Associate

Hi all. 

I have the same problem with stm32h563zi using Clion as IDE. In order to debug I was seeking for stm32h563xx.cfg in the official OPENOCD repository (https://sourceforge.net/p/openocd/code/ci/master/tree/) but found 3 main conf files to be combined (h563zi.cfg, stm32h5x.cfg, stm32x5x_common.cfg). However I couldn't make.

I would like to try the solution above but I couldn't generate the file STM32H5_Nucleo Debug.cfg. Can anyone help?

Thank you

Hi Marc

On the last stable OpenOCD version I have installed on my Macbook which is v0.12.0 there is no support for stm32h5x so what I did that download the STM32 OpenOcd and compile the source. Clone the repo and follow the instruction for to configure and compile for your system. ST custom version has support for stm32h5 the config file i'm using looks like this

# This is an NUCLEO-H563ZI board with a single STM32H563ZITx chip
#
# Generated by STM32CubeIDE
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)

source [find interface/stlink-dap.cfg]

set WORKAREASIZE 0x8000

transport select "dapdirect_swd"

set CHIPNAME STM32H563ZITx
set BOARDNAME NUCLEO-H563ZI

# Enable debug when in low power modes
set ENABLE_LOW_POWER 1

# Stop Watchdog counters when halt
set STOP_WATCHDOG 1

# STlink Debug clock frequency
set CLOCK_FREQ 8000

# Reset configuration
# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1
set CORE_RESET 0

# ACCESS PORT NUMBER
set AP_NUM 1
# GDB PORT
set GDB_PORT 3333

# BCTM CPU variables
source [find target/stm32h5x.cfg]

 

Hi

I am facing the same issue. Can you please share the compile steps for to compile the STM32 Openocd for windows if known. 

Thanks

SSing

Dear SSing20,

I built OpenOCD windows binary for STM32H5 merged with latest commit.
If you like, use this.
http://nemuisan.blog.bai.ne.jp/?eid=192848#OPENOCD

Best regards,
Nemui.

I'm facing the same issue for STM32H503xx.

Can you please share the cortex-debug configuration in VS code?

Thanks in advance.

Hi 

The configuration I'm using for cortex-debug is as follows, note that I define the "serverpath" variable to the version of openocd that I've download and compiled locally as the latest version of openOcd that I've installed in the system from homebrew does not support STM32H5 targets yet

This is the system openocd 

(base) ➜  ~ which openocd
/opt/homebrew/bin/openocd
(base) ➜  ~ openocd --verion
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
openocd: unrecognized option `--verion'

 This is the ST version that adds support for H5

(base) ➜  ~/tools/bin pwd
/Users/tinno/tools/bin
(base) ➜  ~/tools/bin ./openocd --version
Open On-Chip Debugger 0.12.0-00017-g26301c4dd-dirty (2023-12-11-10:38) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

The cortex-debug config looks like this

{
            "executable": "${workspaceFolder}/port/NUCLEO_STM32H563/Output/App.elf",
            "cwd": "${workspaceRoot}",
            "name": "APP-OPENOCD",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            "serverpath": "/Users/tinno/tools/bin/openocd",
            "runToEntryPoint": "application_main",
            "serverArgs": [
            ],
            "osx": {
                "configFiles": ["port/NUCLEO_STM32H563/debugOpenOcd.cfg"],
                "armToolchainPath": "/Applications/ARM/bin/",
                "executable": "${workspaceFolder}/port/NUCLEO_STM32H563/Output/App.elf",
            },
            "preLaunchCommands": [
                "symbol-file port/NUCLEO_STM32H563/Output/App.elf",
                "monitor reset halt",
                "break application_main",
            ], 
            "postLaunchCommands": [
                "continue"
            ]
            ,"preRestartCommands": [
            ],
            "svdFile": "${workspaceFolder}/port/NUCLEO_STM32H563/STM32H563.svd",
            "liveWatch": {
                "enabled": false,
                "samplesPerSecond": 1
            }
}

The file with debugOpenOcd.cfg is the one I copied from STM32 as shown in my previous comments

 

Hi!

Can you show how you compiling ST version so one can I use and other steps to get openocd working with STM32H5.

./openocd --version

Thanks.

Hi, 

I all i did was to clone the repo from Github then just follow the README file. It's all well documented there, make sure to get all the prerequisites, configure, compile and install. Most of the steps depend on your OS so check it out.

I decided to install in a separate install path so it didn't replace my global "standard" openocd.

 

Martin