Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with ST-Link multicore debugging of STM32H755ZiQ #1008

Open
i-ilak opened this issue Apr 21, 2024 · 2 comments
Open

Problems with ST-Link multicore debugging of STM32H755ZiQ #1008

i-ilak opened this issue Apr 21, 2024 · 2 comments

Comments

@i-ilak
Copy link

i-ilak commented Apr 21, 2024

I'm having trouble setting up the extension for multicore debugging of the STM32H755ZiQ. I don't think the extension has a bug, I'm more looking for hints on how to debug my issues and adjust the configuration to work correctly...

My reference here is your wiki page regarding multicore debugging and this issue. Debugging the CM7 works just fine, but the attaching the CM4 core crashes the gdb-server immediately.

I saw this statement on your wiki page

If you get Target unknown error 32 on the launch of the second gdbserver, it means the Cortex-M4 did not have time to start the Cortex-M0+.

But unfortunately no hints on how to try to debug this. Would appreciate any pointers on how to debug the issue.

Expected behavior
Launch multi-core debug session

Environment (please complete the following information):

  • Cortex-Debug Version: v1.12.1
  • OS: macOS, 14.3.1
  • GDB Version: ST-LINK_gdbserver 7.5.0
  • Compiler Toolchain Version: arm-none-eabi 13.2.rel1

Launch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Debug CM7 - ST-Link",
        "cwd": "${workspaceFolder}",
        "type": "cortex-debug",
        "executable": "${workspaceFolder}/build/CM7_firmware.elf",
        "loadFiles": [
            "${workspaceFolder}/build/CM7_firmware.hex",
            "${workspaceFolder}/build/CM4_firmware.hex",
        ],
        "request": "launch",        
        "servertype": "stlink",
        "device": "STM32H755ZI",
        "interface": "swd",
        "runToEntryPoint": "main",
        "svdFile": "${workspaceFolder}/STM32H755_CM7.svd",
        "v1": false,
        "showDevDebugOutput": "both",
        "serverArgs": [
            "-l", "1",
            "-m", "0",
            "-k",
            "-t","-s"
        ],
    },
    {
        "name": "Debug CM7+CM4 - ST-Link",
        "cwd": "${workspaceFolder}",
        "type": "cortex-debug",
        "executable": "${workspaceFolder}/build/CM7_firmware.elf",
        "loadFiles": [
            "${workspaceFolder}/build/CM7_firmware.elf",
            "${workspaceFolder}/build/CM4_firmware.elf",
        ],
        "request": "launch",
        "servertype": "stlink",
        "device": "STM32H755ZI",
        "interface": "swd",
        "serialNumber": "",
        //"runToEntryPoint": "main",
        "svdFile": "${workspaceFolder}/STM32H755_CM7.svd",
        "v1": false,
        "showDevDebugOutput": "both",
        "serverArgs": [
            "-l", "1",
            "-m", "0",
            "-k",
            "-t","-s"
        ],
        "chainedConfigurations": {
            "enabled": true,
            "waitOnEvent": "postInit",
            "detached": false,
            "delayMs":5000,    // Wait 5s, could be optimized
            "lifecycleManagedByParent": true,   
            "launches": [ 
                {
                    "name": "Attach CM4 - ST-Link",
                    "folder": "${workspaceFolder}"
                }
            ]
        }
    },
    {
        "name": "Attach CM4 - ST-Link",
        "cwd": "${workspaceFolder}",    
        "type": "cortex-debug",
        "executable": "${workspaceFolder}/build/CM4_firmware.elf",
        "request": "attach", 
        "servertype": "stlink",
        "device": "STM32H755ZI",
        "interface": "swd",
        "serialNumber": "",
        "svdFile": "${workspaceFolder}/STM32H755_CM4.svd",
        "v1": false,
        "showDevDebugOutput": "both",
        "serverArgs": [
            "-l", "1",
            "-m", "1",
            "-t", "-s",
        ],
    }
    ]
  }

Attach text from Debug Console

[2024-04-21T16:43:45.402Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.macos64_2.1.100.202310302101/tools/bin/ST-LINK_gdbserver -p 50000 -cp /Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.macos64_2.1.100.202311100844/tools/bin --swd --halt -l 1 -m 0 -k -t -s


STMicroelectronics ST-LINK GDB server. Version 7.5.0
Copyright (c) 2023, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 50000
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
        InitWhile                  : Enabled

Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Error: recv returned 0. Remote side has closed gracefully. Good.
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.15.0                  
      -------------------------------------------------------------------



Log output file:   /tmp/STM32CubeProgrammer_yAYvus.log
ST-Link Server is running on port : 7184
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Error: recv returned 0. Remote side has closed gracefully. Good.
Info : Remote address: 127.0.0.1
Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Info : STLINKV3 v3J14M5, PID 0x374E
ST-LINK SN  : 0045004B3532510A31333430
ST-LINK FW  : V3J14M5
Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Board       : NUCLEO-H755ZI-Q
Voltage     : 3.28V
SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x450
Revision ID : Rev V
Device name : STM32H7xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7/M4
BL Version  : 0x91



Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_T0ovoR.srec
  File          : ST-LINK_GDB_server_T0ovoR.srec
  Size          : 196.55 KB 
  Address       : 0x08000000 


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


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



Verifying ...




Download verified successfully 


Error: recv returned 0. Remote side has closed gracefully. Good.
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Error: recv returned 0. Remote side has closed gracefully. Good.
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.15.0                  
      -------------------------------------------------------------------



Log output file:   /tmp/STM32CubeProgrammer_TtCNoz.log
ST-Link Server is running on port : 7184
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Error: recv returned 0. Remote side has closed gracefully. Good.
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Info : default port : 7184
ST-LINK SN  : 0045004B3532510A31333430
ST-LINK FW  : V3J14M5
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Board       : NUCLEO-H755ZI-Q
Voltage     : 3.28V
SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x450
Revision ID : Rev V
Device name : STM32H7xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7/M4
BL Version  : 0x91



Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_ifhyLd.srec
  File          : ST-LINK_GDB_server_ifhyLd.srec
  Size          : 11.33 KB 
  Address       : 0x08100000 


Erasing memory corresponding to segment 0:
Erasing internal memory sector 8
Download in Progress:


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



Verifying ...




Download verified successfully 


Error: recv returned 0. Remote side has closed gracefully. Good.
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Info : Remote address: 127.0.0.1
Info : STLINKV3 v3J14M5, PID 0x374E
Error: recv returned 0. Remote side has closed gracefully. Good.
[2024-04-21T16:44:16.454Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.macos64_2.1.100.202310302101/tools/bin/ST-LINK_gdbserver -p 50007 -cp /Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.macos64_2.1.100.202311100844/tools/bin --swd --attach --halt -l 1 -m 1 -t -s


STMicroelectronics ST-LINK GDB server. Version 7.5.0
Copyright (c) 2023, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 50007
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled

Info : default port : 7184
Info : Remote address: 127.0.0.1
Info : stlinkserver already running, exit
Target unknown error 32

Error in initializing ST-LINK device.
Reason: Unknown. Please check power and cabling to target.
[2024-04-21T16:44:17.325Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
@lowkin18
Copy link

Were you able to resolve this?

I would also like to debug from vscode the STM32H755ZIT but cannot get to main of the application or anywhere in the application.

get warning "Could not step over: Cannot find bounds of current function (from exec-next --thread 1)

@Delzye
Copy link

Delzye commented Aug 27, 2024

Hi, I am using an STM32H755 with the extension, I needed to change "-m", "1" in the CM4 config to "-m", "3". As far as I understood, the CM4 is on port 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants