Skip to main content

Zephyr on STM32H563

Lately I am very interested in the hardware support of the Zephyr operating system and when I got my hands on a NUCLEO-H563ZI evaluation kit from STMicroelectronicsfor the STM32H563 MCU, I was eager to test the support of the latest and greatest Zephyr code base.

st-logo-blue-vertical.png

After updating the git repository for Zephyr, I tried building the hello-world example for this board:

dzu@krikkit:~/src/zephyr/hello_world$ west build -b nucleo_h563zi
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/dzu/src/zephyr/hello_world
-- CMake version: 3.25.1
-- Found Python3: /usr/local/bin/python3 (found suitable version "3.11.2", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: /home/dzu/.cache/zephyr
-- Zephyr version: 3.4.99 (/opt/src/git/zephyrproject/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: nucleo_h563zi
-- Found host-tools: zephyr 0.16.1 (/opt/zephyr-sdk-0.16.1)
-- Found toolchain: zephyr 0.16.1 (/opt/zephyr-sdk-0.16.1)
-- Found Dtc: /opt/zephyr-sdk-0.16.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /opt/src/git/zephyrproject/zephyr/boards/arm/nucleo_h563zi/nucleo_h563zi.dts
-- Generated zephyr.dts: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/dts.cmake
Parsing /opt/src/git/zephyrproject/zephyr/Kconfig
Loaded configuration '/opt/src/git/zephyrproject/zephyr/boards/arm/nucleo_h563zi/nucleo_h563zi_defconfig'
Merged configuration '/home/dzu/src/zephyr/hello_world/prj.conf'
Configuration saved to '/home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/.config'
Kconfig header saved to '/home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /opt/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi
-- west build: building application
[1/131] Preparing syscall dependency handling

[3/131] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (/opt/src/git/zephyrproject/zephyr), build: zephyr-v3.4.0-3382-g811b0bd8fb5d
[13/131] Building C object CMakeFiles/app.dir/src/main.c.obj
/home/dzu/src/zephyr/hello_world/src/main.c:9:6: warning: return type of 'main' is not 'int' [-Wmain]
    9 | void main(void)
      |      ^~~~
[131/131] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       16236 B         2 MB      0.77%
             RAM:        4228 B       256 KB      1.61%
           SRAM1:          0 GB       256 KB      0.00%
           SRAM2:          0 GB        64 KB      0.00%
           SRAM3:         16 KB       320 KB      5.00%
        IDT_LIST:          0 GB         2 KB      0.00%
dzu@krikkit:~/src/zephyr/hello_world$

Ok, so maybe I need to update my local hello-world app some time for the new signature of main, but apart from that the code just built fine. So let's see if we can flash it to the board:

dzu@krikkit:~/src/zephyr/hello_world$ west flash -d build/nucleo_h563zi/
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner stm32cubeprogrammer
-- runners.stm32cubeprogrammer: mass erase requested
FATAL ERROR: required program /home/dzu/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI not found; install it or add its location to PATH
dzu@krikkit:~/src/zephyr/hello_world$ 

So by default its want to use the STM32Cubeprogrammer which I do not have installed currently. Let's see if one of the other runners work:

dzu@krikkit:~/src/zephyr/hello_world$ cd build/nucleo_h563zi/
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner stm32cubeprogrammer
-- runners.stm32cubeprogrammer: mass erase requested
FATAL ERROR: required program /home/dzu/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI not found; install it or add its location to PATH
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash -r openocd
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner openocd
FATAL ERROR: board nucleo_h563zi does not support runner openocd
To fix, configure this runner in /opt/src/git/zephyrproject/zephyr/boards/arm/nucleo_h563zi/board.cmake and rebuild.
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ 

Hmm. Let's check the configuration for the supported runners:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ cat /opt/src/git/zephyrproject/zephyr/boards/arm/nucleo_h563zi/board.cmake
# SPDX-License-Identifier: Apache-2.0

board_runner_args(stm32cubeprogrammer "--erase" "--port=swd" "--reset-mode=hw")

board_runner_args(pyocd "--target=stm32h563zitx")

board_runner_args(jlink "--device=STM32H563ZI" "--reset-after-load")

include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$

So indeed using stm32cubeprogrammer is the default choice but pyocd and jlink should also work, so let's give pyocd a try:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash -r pyocd
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.hex
0007621 W Board ID 0878 is not recognized [mbed_board]
0008385 C Target type stm32h563zitx not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://pyocd.io/docs/target_support.html> for how to install additional target support. [__main__]
Traceback (most recent call last):
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/board/board.py", line 111, in __init__
    self.target = TARGET[self._target_type](session)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'stm32h563zitx'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/subcommands/load_cmd.py", line 81, in invoke
    session = ConnectHelper.session_with_chosen_probe(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/core/helpers.py", line 265, in session_with_chosen_probe
    return Session(probe, auto_open=auto_open, options=options, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/core/session.py", line 216, in __init__
    self._board = probe.create_associated_board() or Board(self)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/probe/stlink_probe.py", line 126, in create_associated_board
    return MbedBoard(self.session, board_info=board_info, board_id=self._board_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/board/mbed_board.py", line 68, in __init__
    super().__init__(session, target, board_info)
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/board/board.py", line 113, in __init__
    raise exceptions.TargetSupportError(
pyocd.core.exceptions.TargetSupportError: Target type stm32h563zitx not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://pyocd.io/docs/target_support.html> for how to install additional target support.
FATAL ERROR: command exited with status 1: pyocd flash -e sector -a 0x8000000 -t stm32h563zitx /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.hex
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ 

Aha. Pyocd lacks support for this specific target. As we saw that the default is to use STs own tool, let's choose that route to make some progress. I downloaded the STM32CubeProgrammer for GNU/Linux and installed it, alas not to my home directory but to a system-wide location, i.e. /opt/STMicroelectronics/STM32Cube/STM32CubeProgrammer/. The reasoning here is that I regularly back up my home directory but do not want to include things that I can easily recreate again. The specific name follows the suggested name but retargets it to /opt. Configuring the installer for this target directory is unfortunately not visible in the transcript below as the installer opens and uses a GUI for the installation. See, that's another time when I would have preferred a plain command line tool, as documentation would have been complete, but hey, it seems that vendor tools always want to display the vendor logo, and so they end up being GUIs that are not easily scriptable nor easy to document in such a text 🫣

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pushd /tmp
/tmp ~/src/zephyr/hello_world/build/nucleo_h563zi
dzu@krikkit:/tmp$ mkdir foo
dzu@krikkit:/tmp$ cd foo
dzu@krikkit:/tmp/foo$ unzip '/home/dzu/Downloads/en.stm32cubeprg-lin-v2-14-0.zip'
Archive:  /home/dzu/Downloads/en.stm32cubeprg-lin-v2-14-0.zip
   creating: jre/
   creating: jre/bin/
   creating: jre/lib/
   creating: jre/lib/amd64/
   creating: jre/lib/amd64/jli/
   creating: jre/lib/amd64/server/
   creating: jre/lib/cmm/
   creating: jre/lib/ext/
   creating: jre/lib/images/
   creating: jre/lib/images/cursors/
   creating: jre/lib/security/
   creating: jre/lib/security/policy/
   creating: jre/lib/security/policy/limited/
   creating: jre/lib/security/policy/unlimited/
  inflating: jre/ASSEMBLY_EXCEPTION  
  inflating: jre/LICENSE             
  inflating: jre/THIRD_PARTY_README  
  inflating: jre/bin/java            
  inflating: jre/bin/jjs             
  inflating: jre/bin/keytool         
  inflating: jre/bin/orbd            
  inflating: jre/bin/pack200         
  inflating: jre/bin/policytool      
  inflating: jre/bin/rmid            
  inflating: jre/bin/rmiregistry     
  inflating: jre/bin/servertool      
  inflating: jre/bin/tnameserv       
  inflating: jre/bin/unpack200       
  inflating: jre/lib/amd64/jli/libjli.so  
  inflating: jre/lib/amd64/jvm.cfg   
  inflating: jre/lib/amd64/libattach.so  
  inflating: jre/lib/amd64/libavplugin-53.so  
  inflating: jre/lib/amd64/libavplugin-54.so  
  inflating: jre/lib/amd64/libavplugin-55.so  
  inflating: jre/lib/amd64/libavplugin-56.so  
  inflating: jre/lib/amd64/libavplugin-57.so  
  inflating: jre/lib/amd64/libavplugin-ffmpeg-56.so  
  inflating: jre/lib/amd64/libavplugin-ffmpeg-57.so  
  inflating: jre/lib/amd64/libavplugin-ffmpeg-58.so  
  inflating: jre/lib/amd64/libawt.so  
  inflating: jre/lib/amd64/libawt_headless.so  
  inflating: jre/lib/amd64/libawt_xawt.so  
  inflating: jre/lib/amd64/libdecora_sse.so  
  inflating: jre/lib/amd64/libdt_socket.so  
  inflating: jre/lib/amd64/libfontmanager.so  
  inflating: jre/lib/amd64/libfreetype.so  
  inflating: jre/lib/amd64/libfxplugins.so  
  inflating: jre/lib/amd64/libglass.so  
  inflating: jre/lib/amd64/libglassgtk2.so  
  inflating: jre/lib/amd64/libglassgtk3.so  
  inflating: jre/lib/amd64/libgstreamer-lite.so  
  inflating: jre/lib/amd64/libhprof.so  
  inflating: jre/lib/amd64/libinstrument.so  
  inflating: jre/lib/amd64/libj2gss.so  
  inflating: jre/lib/amd64/libj2pcsc.so  
  inflating: jre/lib/amd64/libj2pkcs11.so  
  inflating: jre/lib/amd64/libjaas_unix.so  
  inflating: jre/lib/amd64/libjava.so  
  inflating: jre/lib/amd64/libjava_crw_demo.so  
  inflating: jre/lib/amd64/libjavafx_font.so  
  inflating: jre/lib/amd64/libjavafx_font_freetype.so  
  inflating: jre/lib/amd64/libjavafx_font_pango.so  
  inflating: jre/lib/amd64/libjavafx_iio.so  
  inflating: jre/lib/amd64/libjawt.so  
  inflating: jre/lib/amd64/libjdwp.so  
  inflating: jre/lib/amd64/libjfxmedia.so  
  inflating: jre/lib/amd64/libjpeg.so  
  inflating: jre/lib/amd64/libjsdt.so  
  inflating: jre/lib/amd64/libjsig.so  
  inflating: jre/lib/amd64/libjsound.so  
  inflating: jre/lib/amd64/libjsoundalsa.so  
  inflating: jre/lib/amd64/liblcms.so  
  inflating: jre/lib/amd64/libmanagement.so  
  inflating: jre/lib/amd64/libmlib_image.so  
  inflating: jre/lib/amd64/libnet.so  
  inflating: jre/lib/amd64/libnio.so  
  inflating: jre/lib/amd64/libnpt.so  
  inflating: jre/lib/amd64/libprism_common.so  
  inflating: jre/lib/amd64/libprism_es2.so  
  inflating: jre/lib/amd64/libprism_sw.so  
  inflating: jre/lib/amd64/libsaproc.so  
  inflating: jre/lib/amd64/libsctp.so  
  inflating: jre/lib/amd64/libsplashscreen.so  
  inflating: jre/lib/amd64/libsunec.so  
  inflating: jre/lib/amd64/libunpack.so  
  inflating: jre/lib/amd64/libverify.so  
  inflating: jre/lib/amd64/libzip.so  
  inflating: jre/lib/amd64/server/Xusage.txt  
  inflating: jre/lib/amd64/server/libjsig.so  
  inflating: jre/lib/amd64/server/libjvm.so  
  inflating: jre/lib/calendars.properties  
  inflating: jre/lib/charsets.jar    
  inflating: jre/lib/classlist       
  inflating: jre/lib/cmm/CIEXYZ.pf   
  inflating: jre/lib/cmm/GRAY.pf     
  inflating: jre/lib/cmm/LINEAR_RGB.pf  
  inflating: jre/lib/cmm/PYCC.pf     
  inflating: jre/lib/cmm/sRGB.pf     
  inflating: jre/lib/content-types.properties  
  inflating: jre/lib/currency.data   
  inflating: jre/lib/ext/cldrdata.jar  
  inflating: jre/lib/ext/dnsns.jar   
  inflating: jre/lib/ext/jaccess.jar  
  inflating: jre/lib/ext/jfxrt.jar   
  inflating: jre/lib/ext/localedata.jar  
  inflating: jre/lib/ext/meta-index  
  inflating: jre/lib/ext/nashorn.jar  
  inflating: jre/lib/ext/sunec.jar   
  inflating: jre/lib/ext/sunjce_provider.jar  
  inflating: jre/lib/ext/sunpkcs11.jar  
  inflating: jre/lib/ext/zipfs.jar   
  inflating: jre/lib/flavormap.properties  
  inflating: jre/lib/hijrah-config-umalqura.properties  
  inflating: jre/lib/images/cursors/cursors.properties  
  inflating: jre/lib/images/cursors/invalid32x32.gif  
  inflating: jre/lib/images/cursors/motif_CopyDrop32x32.gif  
  inflating: jre/lib/images/cursors/motif_CopyNoDrop32x32.gif  
  inflating: jre/lib/images/cursors/motif_LinkDrop32x32.gif  
  inflating: jre/lib/images/cursors/motif_LinkNoDrop32x32.gif  
  inflating: jre/lib/images/cursors/motif_MoveDrop32x32.gif  
  inflating: jre/lib/images/cursors/motif_MoveNoDrop32x32.gif  
  inflating: jre/lib/javafx.properties  
  inflating: jre/lib/jce.jar         
  inflating: jre/lib/jexec           
  inflating: jre/lib/jfxswt.jar      
  inflating: jre/lib/jsse.jar        
  inflating: jre/lib/logging.properties  
  inflating: jre/lib/management-agent.jar  
  inflating: jre/lib/meta-index      
  inflating: jre/lib/net.properties  
  inflating: jre/lib/psfont.properties.ja  
  inflating: jre/lib/psfontj2d.properties  
  inflating: jre/lib/resources.jar   
  inflating: jre/lib/rt.jar          
  inflating: jre/lib/security/blacklisted.certs  
  inflating: jre/lib/security/cacerts  
  inflating: jre/lib/security/java.policy  
  inflating: jre/lib/security/java.security  
  inflating: jre/lib/security/policy/limited/US_export_policy.jar  
  inflating: jre/lib/security/policy/limited/local_policy.jar  
  inflating: jre/lib/security/policy/unlimited/US_export_policy.jar  
  inflating: jre/lib/security/policy/unlimited/local_policy.jar  
  inflating: jre/lib/sound.properties  
  inflating: jre/lib/tzdb.dat        
  inflating: jre/readme.txt          
  inflating: jre/release             
  inflating: SetupSTM32CubeProgrammer-2.14.0.exe  ls
  inflating: SetupSTM32CubeProgrammer-2.14.0.linux  
dzu@krikkit:/tmp/foo$ ls
jre/  SetupSTM32CubeProgrammer-2.14.0.exe*  SetupSTM32CubeProgrammer-2.14.0.linux*
dzu@krikkit:/tmp/foo$ ./SetupSTM32CubeProgrammer-2.14.0.linux 
./SetupSTM32CubeProgrammer-2.14.0.linux
/tmp/foo
chdir /tmp/foo/.
current dir /tmp/foo
Command line arguments: 
====================
Installation started
Framework: 1.8.0_192-BellSoft-b03 (Oracle Corporation)
Platform: debian_linux,version=6.1.0-13-amd64,arch=x64,symbolicName=null,javaVersion=1.8.0_265
Installation finished
[ Writing the uninstaller data ... ]
dzu@krikkit:/tmp/foo$ popd
~/src/zephyr/hello_world/build/nucleo_h563zi
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner stm32cubeprogrammer
-- runners.stm32cubeprogrammer: mass erase requested
FATAL ERROR: required program /home/dzu/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI not found; install it or add its location to PATH
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ echo $PATH

Ok, as I deviated from the default installation into my home directory, I forgot to add the non-standard location to shells PATH environment variable. Let's do this and try again:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ echo $PATH
/home/dzu/src/lisp/bin:/opt/src/gocode/bin:/home/dzu/.local/bin:/home/dzu/node_modules/.bin:/home/dzu/.poetry/bin:/home/dzu/.cargo/bin:/home/dzu/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ PATH=/home/dzu/src/lisp/bin:/opt/src/gocode/bin:/home/dzu/.local/bin:/home/dzu/node_modules/.bin:/home/dzu/.poetry/bin:/home/dzu/.cargo/bin:/home/dzu/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ export PATH
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner stm32cubeprogrammer
-- runners.stm32cubeprogrammer: mass erase requested
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.14.0                  
      -------------------------------------------------------------------

ST-LINK SN  : 002B00054741500320383733
ST-LINK FW  : V3J10M3
Board       : NUCLEO-H563ZI
Voltage     : 3,28V
Warning:  Connection to AP 0 requested and failed, Connection established with AP 1

SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x484
Revision ID : Rev Z
Device name : STM32H5xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M33
BL Version  : 0xE3
SFSP Version: v2.2.0
Debug in Low Power mode enabled


Mass erase ... 

Mass erase successfully achieved
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.14.0                  
      -------------------------------------------------------------------

ST-LINK SN  : 002B00054741500320383733
ST-LINK FW  : V3J10M3
Board       : NUCLEO-H563ZI
Voltage     : 3,28V
Warning:  Connection to AP 0 requested and failed, Connection established with AP 1

SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x484
Revision ID : Rev Z
Device name : STM32H5xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M33
BL Version  : 0xE3
SFSP Version: v2.2.0
Debug in Low Power mode enabled



Memory Programming ...
Opening and parsing file: zephyr.hex
  File          : zephyr.hex
  Size          : 15,86 KB 
  Address       : 0x08000000 


Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
Download in Progress:
[==================================================] 100% 

File download complete
Time elapsed during download operation: 00:00:00.668

RUNNING Program ... 
  Address:      : 0x8000000
Application is running, Please Hold on...
Start operation achieved successfully
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west debug

Hurray, progress! Glancing at the serial terminal I indeed see Zephyr starting up on the board:

*** Booting Zephyr OS build zephyr-v3.4.0-3382-g811b0bd8fb5d ***
Hello World! nucleo_h563zi

Now let's see if we can also debug the program:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner pyocd
-- runners.pyocd: pyOCD GDB server running on port 3333
GNU gdb (Zephyr SDK 0.16.1) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.elf...
0002135 W Board ID 0878 is not recognized [mbed_board]
0002494 C Target type stm32h563zitx not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://pyocd.io/docs/target_support.html> for how to install additional target support. [__main__]
Traceback (most recent call last):
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/board/board.py", line 111, in __init__
    self.target = TARGET[self._target_type](session)
                  ~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'stm32h563zitx'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/subcommands/gdbserver_cmd.py", line 176, in invoke
    session = Session(probe_proxy,
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/core/session.py", line 216, in __init__
    self._board = probe.create_associated_board() or Board(self)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/probe/stlink_probe.py", line 126, in create_associated_board
    return MbedBoard(self.session, board_info=board_info, board_id=self._board_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/board/mbed_board.py", line 68, in __init__
    super().__init__(session, target, board_info)
  File "/home/dzu/.local/lib/python3.11/site-packages/pyocd/board/board.py", line 113, in __init__
    raise exceptions.TargetSupportError(
pyocd.core.exceptions.TargetSupportError: Target type stm32h563zitx not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://pyocd.io/docs/target_support.html> for how to install additional target support.
:3333: Die Wartezeit für die Verbindung ist abgelaufen.
"monitor" command not supported by this target.
"monitor" command not supported by this target.
You can't do that when your target is `exec'
(gdb) b main
Breakpoint 1 at 0x800051c: file /home/dzu/src/zephyr/hello_world/src/main.c, line 11.
(gdb) c
The program is not being run.
(gdb) q
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd list --targets

Hm. Obviously we need to get back to solving the pyocd problem as we need it for debugging the board. The pyocd project has grown its own distribution method for hardware support in the form of packages, so let's see which targets are currently supported and how we can possibly add additional support needed for the target at hand:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd list --targets
  Name                      Vendor                  Part Number                  Families   Source   
-----------------------------------------------------------------------------------------------------
  cc3220sf                  Texas Instruments       CC3220SF                                builtin  
  cortex_m                  Generic                 CoreSightTarget                         builtin  
  cy8c64_sysap              Cypress                 cy8c64_sysap                            builtin  
  cy8c64x5_cm0              Cypress                 cy8c64x5_cm0                            builtin  
  cy8c64x5_cm0_full_flash   Cypress                 cy8c64x5_cm0_full_flash                 builtin  
  cy8c64x5_cm4              Cypress                 cy8c64x5_cm4                            builtin  
  cy8c64x5_cm4_full_flash   Cypress                 cy8c64x5_cm4_full_flash                 builtin  
  cy8c64xa_cm0              Cypress                 cy8c64xA_cm0                            builtin  
  cy8c64xa_cm0_full_flash   Cypress                 cy8c64xA_cm0_full_flash                 builtin  
  cy8c64xa_cm4              Cypress                 cy8c64xA_cm4                            builtin  
  cy8c64xa_cm4_full_flash   Cypress                 cy8c64xA_cm4_full_flash                 builtin  
  cy8c64xx_cm0              Cypress                 cy8c64xx_cm0                            builtin  
  cy8c64xx_cm0_full_flash   Cypress                 cy8c64xx_cm0_full_flash                 builtin  
  cy8c64xx_cm0_nosmif       Cypress                 cy8c64xx_cm0_nosmif                     builtin  
  cy8c64xx_cm0_s25hx512t    Cypress                 cy8c64xx_cm0_s25hx512t                  builtin  
  cy8c64xx_cm4              Cypress                 cy8c64xx_cm4                            builtin  
  cy8c64xx_cm4_full_flash   Cypress                 cy8c64xx_cm4_full_flash                 builtin  
  cy8c64xx_cm4_nosmif       Cypress                 cy8c64xx_cm4_nosmif                     builtin  
  cy8c64xx_cm4_s25hx512t    Cypress                 cy8c64xx_cm4_s25hx512t                  builtin  
  cy8c6xx5                  Cypress                 CY8C6xx5                                builtin  
  cy8c6xx7                  Cypress                 CY8C6xx7                                builtin  
  cy8c6xx7_nosmif           Cypress                 CY8C6xx7_nosmif                         builtin  
  cy8c6xx7_s25fs512s        Cypress                 CY8C6xx7_S25FS512S                      builtin  
  cy8c6xxa                  Cypress                 CY8C6xxA                                builtin  
  hc32f003                  HDSC                    HC32F003                                builtin  
  hc32f005                  HDSC                    HC32F005                                builtin  
  hc32f030                  HDSC                    HC32F030                                builtin  
  hc32f072                  HDSC                    HC32F072                                builtin  
  hc32f120x6                HDSC                    HC32F120x6TA                            builtin  
  hc32f120x8                HDSC                    HC32F120x8TA                            builtin  
  hc32f160xa                HDSC                    HC32F160xA                              builtin  
  hc32f160xc                HDSC                    HC32F160xC                              builtin  
  hc32f190                  HDSC                    HC32F190                                builtin  
  hc32f196                  HDSC                    HC32F196                                builtin  
  hc32f451xc                HDSC                    HC32F451xC                              builtin  
  hc32f451xe                HDSC                    HC32F451xE                              builtin  
  hc32f452xc                HDSC                    HC32F452xC                              builtin  
  hc32f452xe                HDSC                    HC32F452xE                              builtin  
  hc32f460xc                HDSC                    HC32F460xC                              builtin  
  hc32f460xe                HDSC                    HC32F460xE                              builtin  
  hc32f4a0xg                HDSC                    HC32F4A0xG                              builtin  
  hc32f4a0xi                HDSC                    HC32F4A0xI                              builtin  
  hc32l072                  HDSC                    HC32L072                                builtin  
  hc32l073                  HDSC                    HC32L073                                builtin  
  hc32l110                  HDSC                    HC32L110                                builtin  
  hc32l130                  HDSC                    HC32L130                                builtin  
  hc32l136                  HDSC                    HC32L136                                builtin  
  hc32l190                  HDSC                    HC32L190                                builtin  
  hc32l196                  HDSC                    HC32L196                                builtin  
  hc32m120                  HDSC                    HC32M120                                builtin  
  hc32m120x6                HDSC                    HC32M120                                builtin  
  hc32m423xa                HDSC                    HC32M423xA                              builtin  
  k20d50m                   NXP                     K20D50M                                 builtin  
  k22f                      NXP                     K22F                                    builtin  
  k22fa12                   NXP                     K22FA12                                 builtin  
  k28f15                    NXP                     K28F15                                  builtin  
  k32l2b3                   NXP                     K32L2B3                                 builtin  
  k32w042s                  NXP                     K32W042S                                builtin  
  k64f                      NXP                     K64F                                    builtin  
  k66f18                    NXP                     K66F18                                  builtin  
  k82f25615                 NXP                     K82F25615                               builtin  
  ke15z7                    NXP                     KE15Z7                                  builtin  
  ke17z7                    NXP                     KE17Z7                                  builtin  
  ke18f16                   NXP                     KE18F16                                 builtin  
  kinetis                   NXP                     Kinetis                                 builtin  
  kl02z                     NXP                     KL02Z                                   builtin  
  kl05z                     NXP                     KL05Z                                   builtin  
  kl25z                     NXP                     KL25Z                                   builtin  
  kl26z                     NXP                     KL26Z                                   builtin  
  kl27z4                    NXP                     KL27Z4                                  builtin  
  kl28z                     NXP                     KL28x                                   builtin  
  kl43z4                    NXP                     KL43Z4                                  builtin  
  kl46z                     NXP                     KL46Z                                   builtin  
  kl82z7                    NXP                     KL82Z7                                  builtin  
  kv10z7                    NXP                     KV10Z7                                  builtin  
  kv11z7                    NXP                     KV11Z7                                  builtin  
  kw01z4                    NXP                     KW01Z4                                  builtin  
  kw24d5                    NXP                     KW24D5                                  builtin  
  kw36z4                    NXP                     KW36Z4                                  builtin  
  kw40z4                    NXP                     KW40Z4                                  builtin  
  kw41z4                    NXP                     KW41Z4                                  builtin  
  lpc11u24                  NXP                     LPC11U24                                builtin  
  lpc11xx_32                NXP                     LPC11XX_32                              builtin  
  lpc1768                   NXP                     LPC1768                                 builtin  
  lpc4088                   NXP                     LPC4088                                 builtin  
  lpc4088dm                 NXP                     LPC4088dm                               builtin  
  lpc4088qsb                NXP                     LPC4088qsb                              builtin  
  lpc4330                   NXP                     LPC4330                                 builtin  
  lpc54114                  NXP                     LPC54114                                builtin  
  lpc54608                  NXP                     LPC54608                                builtin  
  lpc5526                   NXP                     LPC5526                                 builtin  
  lpc55s28                  NXP                     LPC55S28                                builtin  
  lpc55s36                  NXP                     LPC55S36                                builtin  
  lpc55s69                  NXP                     LPC55S69                                builtin  
  lpc800                    NXP                     LPC800                                  builtin  
  lpc824                    NXP                     LPC824                                  builtin  
  lpc845                    NXP                     LPC845                                  builtin  
  m2354kjfae                Nuvoton                 M2354KJFAE                              builtin  
  m252kg6ae                 Nuvoton                 M252KG6AE                               builtin  
  m263kiaae                 Nuvoton                 M263KIAAE                               builtin  
  m467hjhae                 Nuvoton                 M467HJHAE                               builtin  
  m487jidae                 Nuvoton                 M487JIDAE                               builtin  
  max32600                  Maxim                   MAX32600                                builtin  
  max32620                  Maxim                   MAX32620                                builtin  
  max32625                  Maxim                   MAX32625                                builtin  
  max32630                  Maxim                   MAX32630                                builtin  
  max32660                  Maxim                   MAX32660                                builtin  
  max32670                  Maxim                   MAX32670                                builtin  
  mimxrt1010                NXP                     MIMXRT1011xxxxx                         builtin  
  mimxrt1015                NXP                     MIMXRT1015xxxxx                         builtin  
  mimxrt1020                NXP                     MIMXRT1021xxxxx                         builtin  
  mimxrt1024                NXP                     MIMXRT1024xxxxx                         builtin  
  mimxrt1050                NXP                     MIMXRT1052xxxxB_hyperflash              builtin  
  mimxrt1050_hyperflash     NXP                     MIMXRT1052xxxxB_hyperflash              builtin  
  mimxrt1050_quadspi        NXP                     MIMXRT1052xxxxB_quadspi                 builtin  
  mimxrt1060                NXP                     MIMXRT1062xxxxA                         builtin  
  mimxrt1064                NXP                     MIMXRT1064xxxxA                         builtin  
  mimxrt1170_cm4            NXP                     MIMXRT1176xxxxx_CM4                     builtin  
  mimxrt1170_cm7            NXP                     MIMXRT1176xxxxx_CM7                     builtin  
  mps3_an522                Arm                     AN522                                   builtin  
  mps3_an540                Arm                     AN540                                   builtin  
  musca_a1                  Arm                     MuscaA1                                 builtin  
  musca_b1                  Arm                     MuscaB1                                 builtin  
  musca_s1                  Arm                     MuscaS1                                 builtin  
  ncs36510                  ONSemiconductor         NCS36510                                builtin  
  nrf51                     Nordic Semiconductor    NRF51                                   builtin  
  nrf51822                  Nordic Semiconductor    NRF51                                   builtin  
  nrf52                     Nordic Semiconductor    NRF52832                                builtin  
  nrf52832                  Nordic Semiconductor    NRF52832                                builtin  
  nrf52833                  Nordic Semiconductor    NRF52833                                builtin  
  nrf52840                  Nordic Semiconductor    NRF52840                                builtin  
  rp2040                    Raspberry Pi            RP2040Core0                             builtin  
  rp2040_core0              Raspberry Pi            RP2040Core0                             builtin  
  rp2040_core1              Raspberry Pi            RP2040Core1                             builtin  
  rtl8195am                 Realtek Semiconductor   RTL8195AM                               builtin  
  s5js100                   Samsung                 S5JS100                                 builtin  
  stm32f051                 STMicroelectronics      STM32F051                               builtin  
  stm32f103rc               STMicroelectronics      STM32F103RC                             builtin  
  stm32f412xe               STMicroelectronics      STM32F412xE                             builtin  
  stm32f412xg               STMicroelectronics      STM32F412xG                             builtin  
  stm32f429xg               STMicroelectronics      STM32F429xG                             builtin  
  stm32f429xi               STMicroelectronics      STM32F429xI                             builtin  
  stm32f439xg               STMicroelectronics      STM32F439xG                             builtin  
  stm32f439xi               STMicroelectronics      STM32F439xI                             builtin  
  stm32f767zi               STMicroelectronics      STM32F767xx                             builtin  
  stm32l031x6               STMicroelectronics      STM32L031x6                             builtin  
  stm32l432kc               STMicroelectronics      STM32L432xC                             builtin  
  stm32l475xc               STMicroelectronics      STM32L475xC                             builtin  
  stm32l475xe               STMicroelectronics      STM32L475xE                             builtin  
  stm32l475xg               STMicroelectronics      STM32L475xG                             builtin  
  w7500                     WIZnet                  W7500                                   builtin  
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd pack --help
usage: pyocd pack [-h] [-v] [-q] [-L LOGGERS=LEVEL] [--color [{always,auto,never}]] [-c] [-u] [-s] [-f GLOB]
                  [-i GLOB] [-n] [-H]
                  ...

options:
  -h, --help            show this help message and exit

logging:
  -v, --verbose         Increase logging level. Can be specified multiple times.
  -q, --quiet           Decrease logging level. Can be specified multiple times.
  -L LOGGERS=LEVEL, --log-level LOGGERS=LEVEL
                        Set log level of loggers whose name matches any of the comma-separated list of glob-
                        style patterns. Log level must be one of (critical, error, warning, info, debug).
                        Can be specified multiple times. Example: -L*.trace,pyocd.core.*=debug
  --color [{always,auto,never}]
                        Control color logging. Default is auto.

subcommands:
  
    clean               Delete the pack index and all installed packs.
    find                Report pack(s) in the index containing matching device part numbers.
    install             Download and install pack(s) containing matching device part numbers.
    show                Show the list of installed packs.
    update              Update the pack index.

pack operations:
  -c, --clean           (Deprecated; use clean subcommand.) Erase all stored pack information.
  -u, --update          (Deprecated; use update subcommand.) Update the pack index.
  -s, --show            (Deprecated; use show subcommand.) Show the list of installed packs.
  -f GLOB, --find GLOB  (Deprecated; use find subcommand.) Report pack(s) in the index containing matching
                        device part numbers.
  -i GLOB, --install GLOB
                        (Deprecated; use install subcommand.) Download and install pack(s) containing
                        matching device part numbers.

pack options:
  -n, --no-download     Just list the pack(s) that would be downloaded, don't actually download anything.
  -H, --no-header       Don't print a table header.
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd pack find stm32h563zitx
0001287 W No matching devices. Please make sure the pack index is up to date. [pack_cmd]
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ 

Obviously, it will be a good idea to refresh the package archieve used by pyocd:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd pack update
0001024 I Updating pack index... [pack_cmd]
00:06:01 [INFO] Downloaded http://www.keil.com/pack/index.pidx
00:06:01 [INFO] Found 1068 Pdsc entries
00:06:02 [WARN] Sending fatal alert BadCertificate
00:06:02 [ERROR] download of Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("download.segger.com")), port: None, path: "/cmsis/SEGGER.CMSIS-embOS.pdsc", query: None, fragment: None } failed: error sending request for url (https://download.segger.com/cmsis/SEGGER.CMSIS-embOS.pdsc): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
00:06:06 [ERROR] download of Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("www.mcu.com.cn")), port: None, path: "/Cmsemicon.BAT32G135-A.pdsc", query: None, fragment: None } failed: Response code in invalid range: 404
00:06:19 [WARN] Unknown file category header 
00:06:19 [WARN] Unknown file category header 
00:06:19 [WARN] Unknown file category header 
00:06:19 [WARN] Unknown file category header 
00:06:19 [WARN] cannot parse integer from empty string
00:06:19 [WARN] cannot parse integer from empty string
00:06:19 [WARN] cannot parse integer from empty string
00:06:19 [WARN] cannot parse integer from empty string
00:06:19 [WARN] cannot parse integer from empty string
00:06:19 [WARN] cannot parse integer from empty string
00:06:19 [WARN] Support for two parent processors not implemented!
00:06:19 [WARN] No Core found!
00:06:19 [WARN] Support for two parent processors not implemented!
00:06:19 [WARN] Support for two parent processors not implemented!
00:06:19 [WARN] No Core found!
00:06:19 [WARN] No Core found!
00:06:20 [WARN] No Core found!
00:06:20 [WARN] No Core found!
00:06:20 [WARN] No Core found!
00:06:20 [WARN] XML error: Expecting </META> found </html>
00:06:21 [WARN] No Core found!
00:06:21 [WARN] No Core found!
00:06:21 [WARN] No Core found!
00:06:21 [WARN] No Core found!
00:06:21 [WARN] No Core found!
00:06:21 [WARN] No Core found!
00:06:22 [WARN] Device found without a processor ATSAMDA1E14A
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] tried to parse element "package" from element "head"
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:23 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] No Core found!
00:06:24 [WARN] Support for two parent processors not implemented!

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd pack find stm32h563zitx
  Part            Vendor               Pack                 Version   Installed  
---------------------------------------------------------------------------------
  STM32H563ZITx   STMicroelectronics   Keil.STM32H5xx_DFP   1.2.0     False      
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ 

Success! We can now install the required pieces with another simple command and retry debugging our target:

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ pyocd pack install stm32h563zitx
Downloading packs (press Control-C to cancel):
    Keil.STM32H5xx_DFP.1.2.0
Downloading descriptors (001/001)
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner pyocd
-- runners.pyocd: pyOCD GDB server running on port 3333
GNU gdb (Zephyr SDK 0.16.1) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.elf...
0001897 W Board ID 0878 is not recognized [mbed_board]
0002307 I Target type is stm32h563zitx [board]
0003086 I DP IDR = 0x6ba02477 (v2 rev6) [dap]
0003237 I APB-AP#0 IDR = 0x54770002 (APB-AP var0 rev5) [ap]
0003480 I AHB-AP#1 IDR = 0x84770001 (AHB-AP var0 rev8) [ap]
0003567 I APB-AP#0 Class 0x1 ROM table #0 @ 0xe00e0000 (designer=020:ST part=484) [rom_table]
0003616 I [0]<e00e4000:DBGMCU class=15 designer=020:ST part=000> [rom_table]
0003698 I AHB-AP#1 Class 0x1 ROM table #0 @ 0xe00fe000 (designer=020:ST part=484) [rom_table]
0003748 I [0]<e00ff000:ROM class=1 designer=43b:Arm part=4c9> [rom_table]
0003758 I   AHB-AP#1 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b:Arm part=4c9) [rom_table]
0003762 I   [0]<e000e000:SCS M33 class=9 designer=43b:Arm part=d21 devtype=00 archid=2a04 devid=0:0:0> [rom_table]
0003764 I   [1]<e0001000:DWT M33 class=9 designer=43b:Arm part=d21 devtype=00 archid=1a02 devid=0:0:0> [rom_table]
0003818 I   [2]<e0002000:BPU M33 class=9 designer=43b:Arm part=d21 devtype=00 archid=1a03 devid=0:0:0> [rom_table]
0003820 I   [3]<e0000000:ITM M33 class=9 designer=43b:Arm part=d21 devtype=43 archid=1a01 devid=0:0:0> [rom_table]
0003822 I   [5]<e0041000:ETM M33 class=9 designer=43b:Arm part=d21 devtype=13 archid=4a13 devid=0:0:0> [rom_table]
0003824 I   [6]<e0042000:CTI M33 class=9 designer=43b:Arm part=d21 devtype=14 archid=1a14 devid=40800:0:0> [rom_table]
0003825 I [1]<e0040000:TPIU M33 class=9 designer=43b:Arm part=d21 devtype=11 archid=0000 devid=ca1:0:0> [rom_table]
0003828 I CPU core #0 is Cortex-M33 r0p4 [cortex_m_v8m]
0003830 I FPU present: FPv5-SP-D16-M [cortex_m]
0003832 I 4 hardware watchpoints [dwt]
0003835 I 8 hardware breakpoints, 1 literal comparators [fpb]
0003849 I Semihost server started on port 4444 (core 0) [server]
Remote debugging using :3333
0005892 I GDB server started on port 3333 (core 0) [gdbserver]
0005895 I Client connected to port 3333! [gdbserver]
arch_cpu_idle () at /opt/src/git/zephyrproject/zephyr/arch/arm/core/aarch32/cpu_idle.S:135
135		cpsie	i
0011078 I Attempting to load RTOS plugins [gdbserver]
Successfully halted device
Resetting target
Loading section rom_start, size 0x24c lma 0x8000000
Loading section text, size 0x32c0 lma 0x800024c
Loading section .ARM.exidx, size 0x8 lma 0x800350c
Loading section initlevel, size 0x98 lma 0x8003514
Loading section device_area, size 0x118 lma 0x80035ac
Loading section sw_isr_table, size 0x418 lma 0x80036c4
Loading section log_const_area, size 0x28 lma 0x8003adc
Loading section rodata, size 0x3cc lma 0x8003b04
Loading section datas, size 0x7c lma 0x8003ed0
Loading section device_states, size 0x1c lma 0x8003f4c
Loading section .last_section, size 0x4 lma 0x8003f68
[==================================================] 100%
0011786 I Erased 0 bytes (0 sectors), programmed 0 bytes (0 pages), skipped 16384 bytes (16 pages) at 28.08 kB/s [loader]
Start address 0x08000b10, load size 16236
Transfer rate: 26 KB/sec, 955 bytes/write.
(gdb) s
z_arm_reset () at /opt/src/git/zephyrproject/zephyr/arch/arm/core/aarch32/cortex_m/reset.S:120
120	    msr BASEPRI, r0
(gdb) 
149	    ldr r0, =z_interrupt_stacks
(gdb) 
150	    ldr r1, =CONFIG_ISR_STACK_SIZE + MPU_GUARD_ALIGN_AND_SIZE
(gdb) 
151	    adds r0, r0, r1
(gdb) 
152	    msr PSP, r0
(gdb) 
153	    mrs r0, CONTROL
(gdb) 
154	    movs r1, #2
(gdb) b  main
Breakpoint 1 at 0x800051c: file /home/dzu/src/zephyr/hello_world/src/main.c, line 11.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, main () at /home/dzu/src/zephyr/hello_world/src/main.c:11
11		printk("Hello World! %s\n", CONFIG_BOARD);
(gdb) 

Excellent. As is clearly visible in the transcript, the debugger works well, as I can step into Zephyr setup code and jump to the main function with the help of a breakpoint.

But now that we have pyocd working, I really wonder if STs CubeProgrammer is required at all, or if pyocd is now also able to flash. So let's exit the debugger and retry with the pyocd runner:

(gdb) q
A debugging session is active.

	Inferior 1 [Remote target] will be detached.

Quit anyway? (y or n) y
Detaching from program: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.elf, Remote target
0246190 I Client detached [gdbserver]
0246190 I Client disconnected from port 3333! [gdbserver]
Ending remote debugging.
[Inferior 1 (Remote target) detached]
0246259 I Semihost server stopped [server]
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash -r pyocd
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.hex
0002004 W Board ID 0878 is not recognized [mbed_board]
0003974 I Loading /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.hex at 0x08000000 [load_cmd]
[==================================================] 100%
0004477 I Erased 0 bytes (0 sectors), programmed 0 bytes (0 pages), skipped 16384 bytes (16 pages) at 33.70 kB/s [loader]
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ 

Extra cool. So we can take out the proprietary programmer again and just work with Free Software. Just for the fun of it, here is a side by side comparison of the two tools doing the same job, i.e. flashing a target device. One of the tools is a proprietary vendor tool and the other one is Free Software. Can you tell, which one is which? Which one do you prefer?

dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner stm32cubeprogrammer
-- runners.stm32cubeprogrammer: mass erase requested
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.14.0                  
      -------------------------------------------------------------------

ST-LINK SN  : 002B00054741500320383733
ST-LINK FW  : V3J10M3
Board       : NUCLEO-H563ZI
Voltage     : 3,29V
Warning:  Connection to AP 0 requested and failed, Connection established with AP 1

SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x484
Revision ID : Rev Z
Device name : STM32H5xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M33
BL Version  : 0xE3
SFSP Version: v2.2.0
Debug in Low Power mode enabled


Mass erase ... 

Mass erase successfully achieved
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.14.0                  
      -------------------------------------------------------------------

ST-LINK SN  : 002B00054741500320383733
ST-LINK FW  : V3J10M3
Board       : NUCLEO-H563ZI
Voltage     : 3,28V
Warning:  Connection to AP 0 requested and failed, Connection established with AP 1

SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x484
Revision ID : Rev Z
Device name : STM32H5xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M33
BL Version  : 0xE3
SFSP Version: v2.2.0
Debug in Low Power mode enabled



Memory Programming ...
Opening and parsing file: zephyr.hex
  File          : zephyr.hex
  Size          : 15,86 KB 
  Address       : 0x08000000 


Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
Download in Progress:
[==================================================] 100% 

File download complete
Time elapsed during download operation: 00:00:00.624

RUNNING Program ... 
  Address:      : 0x8000000
Application is running, Please Hold on...
Start operation achieved successfully
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ west flash -r pyocd
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.hex
0002095 W Board ID 0878 is not recognized [mbed_board]
0003936 I Loading /home/dzu/src/zephyr/hello_world/build/nucleo_h563zi/zephyr/zephyr.hex at 0x08000000 [load_cmd]
[==================================================] 100%
0004453 I Erased 0 bytes (0 sectors), programmed 0 bytes (0 pages), skipped 16384 bytes (16 pages) at 31.74 kB/s [loader]
dzu@krikkit:~/src/zephyr/hello_world/build/nucleo_h563zi$ 

Summary

So the latest Zephyr code indeed works well with the nucleo_h563zi eval board from ST. But it needs additional pyocd configuration data, which can be installed via the package sub-command of pyocd. No proprietary vendor tools are required for flashing or debugging the target!

Comments

Comments powered by Disqus