Skip to content

Debugger does not start with ST-LINK and GIGA #2299

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

Open
3 tasks done
dav322 opened this issue Nov 30, 2023 · 16 comments
Open
3 tasks done

Debugger does not start with ST-LINK and GIGA #2299

dav322 opened this issue Nov 30, 2023 · 16 comments
Labels
status: waiting for information More information must be provided before work can proceed topic: debugger Related to the integrated debugger type: imperfection Perceived defect in any part of project

Comments

@dav322
Copy link

dav322 commented Nov 30, 2023

Describe the problem

when I try to start debugger I get request 2 canceled on connection close
does not start debugger.

I can upload the sketch and it runs to output the position. I have not tested my sketch with encoders attached yet.

To reproduce

connect stlink v3 to arduino giga with ribbon cable. connect both to pc
open arduino ide. click on start debugging
I have attached the sketch
sketch_nov17a.zip

Expected behavior

I expected the debugger to start and then stop at the breakpoint I set on the first line of the setup routine.

Arduino IDE version

nightly build 11-30-23

Operating system

Windows

Operating system version

windows 11

Additional context

probably not required

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@dav322 dav322 added the type: imperfection Perceived defect in any part of project label Nov 30, 2023
@kittaakos
Copy link
Contributor

Thanks for reporting this issue.

connect stlink

I saw some internal documentation that it won't work. @umbynos, can you please help tell users what is (and will be (#2281)) supported? Thank you!

@kittaakos kittaakos added status: waiting for information More information must be provided before work can proceed topic: debugger Related to the integrated debugger labels Dec 11, 2023
@umbynos
Copy link

umbynos commented Dec 11, 2023

Hello @dav322.
Debugger support has been added in mbed core v4.0.10 but debugging leverage some features that are not available in the IDE2 yet. Debugging the Giga with the stlink will be a supported use case.

@kittaakos kittaakos removed the status: waiting for information More information must be provided before work can proceed label Dec 11, 2023
@dav322
Copy link
Author

dav322 commented Dec 12, 2023

I would be happy using any debugger. Without debugging I can't use arduino ide. It is absolutely a requirement for a real development environment. I am already using 4.0.10 and it does not work.

@kittaakos
Copy link
Contributor

I am already using 4.0.10 and it does not work.

Please try with the nightly build and let us know if it's still the same: https://www.arduino.cc/en/software/#nightly-builds
We made some debugger changes (73b6dc4)

connect stlink v3 to arduino giga with ribbon cable.

Unfortunately, I do not have the hardware to try it out.

@dav322
Copy link
Author

dav322 commented Dec 14, 2023

to verify it is connected I clicked on tools -> get board info and it displayed
image

image

running this sketch

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Hello world");
  delay(1000);
}

I can upload the sketch using the upload button and it displays following on monitor

Hello world
Hello world
Hello world
Hello world
...

When I set a breakpoint on Serial.begin line and click on start debugging I get following lines in gdb-server tab

Waiting for gdb server to start...[2023-12-14T21:32:30.584Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\david\\Documents\\Arduino\\giga\\test\\sketch_dec14a" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.10/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1800 kHz
Info : STLINK V3J13M4B5S1 (API v3) VID:PID 0483:374F
Info : Target voltage: 3.225347
Info : stm32h7x.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x08049d8c psp: 0x24002860
Info : Device: STM32H74x/75x
Info : flash size probed value 2048
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
Info : Device: STM32H74x/75x
Info : flash size probed value 2048
Info : STM32H7 flash has dual banks
Info : Bank (1) size is 1024 kb, base address is 0x08100000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Padding image section 0 at 0x0805b6f8 with 8 bytes (bank write end alignment)
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
 and these lines in debug console
Cortex-Debug: VSCode debugger extension version 1.5.1 git(be7d3c8+dirty). Usaage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from C:\Users\david\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-objdump.exe --syms -C -h -w C:/Users\david\AppData\Local\Temp\arduino\sketches\FD26ADCEFE08EBA501EA55F802AE2D01\sketch_dec14a.ino.elf
Reading symbols from c:/users\david\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p C:/Users\david\AppData\Local\Temp\arduino\sketches\FD26ADCEFE08EBA501EA55F802AE2D01\sketch_dec14a.ino.elf
Launching GDB: "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "C:/Users\\david\\AppData\\Local\\Temp\\arduino\\sketches\\FD26ADCEFE08EBA501EA55F802AE2D01\\sketch_dec14a.ino.elf"
    IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problems
Launching gdb-server: "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\david\\Documents\\Arduino\\giga\\test\\sketch_dec14a" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.10/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
    Please check TERMINAL tab (gdb-server) for output from C:\Users\david\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2/bin/openocd
Finished reading symbols from objdump: Time: 871 ms
Finished reading symbols from nm: Time: 852 ms
WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
Reading symbols from C:/Users\david\AppData\Local\Temp\arduino\sketches\FD26ADCEFE08EBA501EA55F802AE2D01\sketch_dec14a.ino.elf...done.
0x08049d8c in HAL_PWR_EnterSLEEPMode ()
Program stopped, probably due to a reset and/or halt issued by debugger
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
end debug console

launch.json was:

{
  "version": "0.2.0",
  "configurations": [
    {
      "configId": "arduino:mbed_giga:giga:programmer=stlink",
      "cwd": "${workspaceRoot}",
      "request": "launch",
      "type": "cortex-debug",
      "executable": "C:\\Users\\david\\AppData\\Local\\Temp\\arduino\\sketches\\FD26ADCEFE08EBA501EA55F802AE2D01/sketch_dec14a.ino.elf",
      "toolchainPrefix": "arm-none-eabi",
      "svdFile": "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.10/svd/STM32H747_CM7.svd",
      "overrideRestartCommands": [
        "monitor reset halt",
        "monitor gdb_sync",
        "c"
      ],
      "postAttachCommands": [
        "set remote hardware-watchpoint-limit 2",
        "monitor reset halt",
        "monitor gdb_sync",
        "c"
      ],
      "name": "Arduino Giga R1 (stlink)",
      "serverpath": "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd",
      "servertype": "openocd",
      "armToolchainPath": "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/",
      "configFiles": [
        "interface/stlink.cfg",
        "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.10/debugger/select_hla.cfg",
        "target/stm32h7x_dual_bank.cfg"
      ]
    }
  ]
}

end launch.json

To verify the stlink / giga is working I started an empty project with STM32CUBEIDE.
Program loaded and stopped at first line of main
image

to make it run again with arduino ide I run this command after putting giga in boot mode.

"%LOCALAPPDATA%\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1\dfu-util" --device ,0x0483:0xdf11 -D "%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\mbed_giga\4.0.10\bootloaders\GIGA\bootloader.bin" -a0 --dfuse-address=0x8000000

a 2nd try had these log files showing it stopped. Clicking on step seemed to step into routines and follow code as expected.

debug console

Reading symbols from C:/Users\david\AppData\Local\Temp\arduino\sketches\FD26ADCEFE08EBA501EA55F802AE2D01\sketch_dec14a.ino.elf...done.
0x08049d8c in HAL_PWR_EnterSLEEPMode ()
Program stopped, probably due to a reset and/or halt issued by debugger
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, setup () at C:\Users\david\Documents\Arduino\giga\test\sketch_dec14a/sketch_dec14a.ino:3
3	  Serial.begin(115200);


gdb_server

Waiting for gdb server to start...[2023-12-14T21:39:51.076Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\david\\Documents\\Arduino\\giga\\test\\sketch_dec14a" -f "C:/Program Files/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\david\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.10/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1800 kHz
Info : STLINK V3J13M4B5S1 (API v3) VID:PID 0483:374F
Info : Target voltage: 3.225347
Info : stm32h7x.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x08049d8c psp: 0x24002860
Info : Device: STM32H74x/75x
Info : flash size probed value 2048
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
Info : Device: STM32H74x/75x
Info : flash size probed value 2048
Info : STM32H7 flash has dual banks
Info : Bank (1) size is 1024 kb, base address is 0x08100000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Padding image section 0 at 0x0805b6f8 with 8 bytes (bank write end alignment)
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000

@victoryred

This comment was marked as resolved.

@kittaakos

This comment was marked as resolved.

@umbynos
Copy link

umbynos commented Dec 18, 2023

It seems it could be a problem related to an old bootloader, could you please try to update it? https://support.arduino.cc/hc/en-us/articles/7991505977116-Burn-the-bootloader-on-GIGA-R1-WiFi

@victoryred

This comment was marked as off-topic.

@kittaakos

This comment was marked as resolved.

@umbynos
Copy link

umbynos commented Dec 20, 2023

PR upstream to change request type: arduino/ArduinoCore-mbed#806

@kittaakos
Copy link
Contributor

@dav322, have you had the chance to workaround the bug in the mbed platform using the steps I have provided at #2299 (comment)? Feel free to let me know if you need help. Thank you!

@kittaakos kittaakos added the status: waiting for information More information must be provided before work can proceed label Jan 15, 2024
@victoryred

This comment was marked as off-topic.

@victoryred

This comment was marked as off-topic.

@kittaakos

This comment was marked as off-topic.

@victoryred

This comment was marked as off-topic.

@per1234 per1234 changed the title arduino ide nightly build 11-30. set up small sketch. Debugger does not start with stlink and arduino giga Debugger does not start with ST-LINK and GIGA Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for information More information must be provided before work can proceed topic: debugger Related to the integrated debugger type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants