Arduino IDE 2 & Debug feature
Re: Arduino IDE 2 & Debug feature
When installed with Arduino and the json file. It's installed like that.
Issue will be to support all variants of the same menu.
Issue will be to support all variants of the same menu.
Re: Arduino IDE 2 & Debug feature
To get to see the Cortex Peripheral Register I hade to put the STM32F411.svd fil and the debug_custom.json in the sketch folder .
{
"svdFile": "STM32F411.svd"
}
Some how it did not work to have it on there i find it.
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer_V2_10\SVD
Re: Arduino IDE 2 & Debug feature
I've raised issues on Arduino IDE 2 to ease integration and fix some issues
Re: Arduino IDE 2 & Debug feature
I can report that this works with Windows 10, Arduino IDE 2.0.4 and a Blackpill STM32F401CC!
Thanks a lot for this!

Thanks a lot for this!

-
- Posts: 23
- Joined: Tue Feb 18, 2020 3:37 pm
Re: Arduino IDE 2 & Debug feature
Hi everybody.
Yesterday I downloaded last STM32 core versione (2.5.0). I'm on a Linux 64 bit.
I tried to debug an STM32F103RE board but I received this error:
Failed to launch GDB: Error erasing flash with vFlashErase packet (from target-download)
This is the gdb-server console:
Waiting for gdb server to start...[2023-04-01T08:17:51.149Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/home/luca/.arduino15/packages/STMicroelectronics/tools/xpack-openocd/0.12.0-1/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/luca/Arduino/USB2Serial -f /home/luca/Programmi/arduino-ide_2.0.4_Linux_64bit/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f /tmp/arduino/sketches/A82E8181912A665379318CFFA24A839D/openocd.cfg
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J30S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.178590
Info : [stm32f1x.cpu] Cortex-M3 r1p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
[stm32f1x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x08000282 msp: 0x2000fff0
Info : device id = 0x10036414
Info : flash size = 512 KiB
Error: timed out while waiting for target halted
Error: timed out while waiting for target halted
Error executing event gdb-flash-erase-start on target stm32f1x.cpu:
TARGET: stm32f1x.cpu - Not halted
Error: Target not halted
Error: failed erasing sectors 0 to 8
Error: flash_erase returned -304
Error: timed out while waiting for target halted
shutdown command invoked
[2023-04-01T08:17:54.716Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
Is ther something I do wrong?
Luca
Yesterday I downloaded last STM32 core versione (2.5.0). I'm on a Linux 64 bit.
I tried to debug an STM32F103RE board but I received this error:
Failed to launch GDB: Error erasing flash with vFlashErase packet (from target-download)
This is the gdb-server console:
Waiting for gdb server to start...[2023-04-01T08:17:51.149Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/home/luca/.arduino15/packages/STMicroelectronics/tools/xpack-openocd/0.12.0-1/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/luca/Arduino/USB2Serial -f /home/luca/Programmi/arduino-ide_2.0.4_Linux_64bit/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f /tmp/arduino/sketches/A82E8181912A665379318CFFA24A839D/openocd.cfg
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J30S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.178590
Info : [stm32f1x.cpu] Cortex-M3 r1p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
[stm32f1x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x08000282 msp: 0x2000fff0
Info : device id = 0x10036414
Info : flash size = 512 KiB
Error: timed out while waiting for target halted
Error: timed out while waiting for target halted
Error executing event gdb-flash-erase-start on target stm32f1x.cpu:
TARGET: stm32f1x.cpu - Not halted
Error: Target not halted
Error: failed erasing sectors 0 to 8
Error: flash_erase returned -304
Error: timed out while waiting for target halted
shutdown command invoked
[2023-04-01T08:17:54.716Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
Is ther something I do wrong?
Luca
Re: Arduino IDE 2 & Debug feature
Which board? How you wired stlink? You need to connect nrst pin.
-
- Posts: 23
- Joined: Tue Feb 18, 2020 3:37 pm
Re: Arduino IDE 2 & Debug feature
Hi fpiSTM.
The first board on which I tried was a home made board. I connected STLink with the board via SWDIO SWCLK. I tried also to connect reset pin of the STLink with target reset, but still the same error.
So I moved to a BluePill board and Blink sketch. Same connections as above (SWDIO, SWCLK and reset) and still the same error.
[2023-04-01T18:13:55.117Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/home/luca/.arduino15/packages/STMicroelectronics/tools/xpack-openocd/0.12.0-1/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/luca/Arduino/Blink -f /home/luca/Programmi/arduino-ide_2.0.3_Linux_64bit/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f /tmp/arduino-sketch-1D6FDBDFE15223D462CC37CDCB623A6D/openocd.cfg
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J30S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.174951
Info : [stm32f1x.cpu] Cortex-M3 r1p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
[stm32f1x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x08004476 msp: 0x20004fe0
Info : device id = 0x20036410
Info : flash size = 64 KiB
Error: timed out while waiting for target halted
Error: timed out while waiting for target halted
Error executing event gdb-flash-erase-start on target stm32f1x.cpu:
TARGET: stm32f1x.cpu - Not halted
Error: Target not halted
Error: failed erasing sectors 0 to 27
Error: flash_erase returned -304
Error: timed out while waiting for target halted
shutdown command invoked
[2023-04-01T18:13:58.631Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
My PC configuration: Linux 64 bit (Kubuntu), Arduino IDE 2.0.3 and 2.0.4. On both Arduino IDE version there is the same error.
I remember that I didn't use reset pin connection on my first debug experiments.
Luca
The first board on which I tried was a home made board. I connected STLink with the board via SWDIO SWCLK. I tried also to connect reset pin of the STLink with target reset, but still the same error.
So I moved to a BluePill board and Blink sketch. Same connections as above (SWDIO, SWCLK and reset) and still the same error.
[2023-04-01T18:13:55.117Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/home/luca/.arduino15/packages/STMicroelectronics/tools/xpack-openocd/0.12.0-1/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/luca/Arduino/Blink -f /home/luca/Programmi/arduino-ide_2.0.3_Linux_64bit/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f /tmp/arduino-sketch-1D6FDBDFE15223D462CC37CDCB623A6D/openocd.cfg
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J30S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.174951
Info : [stm32f1x.cpu] Cortex-M3 r1p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
[stm32f1x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x08004476 msp: 0x20004fe0
Info : device id = 0x20036410
Info : flash size = 64 KiB
Error: timed out while waiting for target halted
Error: timed out while waiting for target halted
Error executing event gdb-flash-erase-start on target stm32f1x.cpu:
TARGET: stm32f1x.cpu - Not halted
Error: Target not halted
Error: failed erasing sectors 0 to 27
Error: flash_erase returned -304
Error: timed out while waiting for target halted
shutdown command invoked
[2023-04-01T18:13:58.631Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
My PC configuration: Linux 64 bit (Kubuntu), Arduino IDE 2.0.3 and 2.0.4. On both Arduino IDE version there is the same error.
I remember that I didn't use reset pin connection on my first debug experiments.
Luca
Re: Arduino IDE 2 & Debug feature
I know I've tested BluePill and Nrst pins was required to work. I've tested on Linux, Mac and Windows.
Openocd is the good one. But can't see if it is the gdb provided within the core which is used.
Openocd is the good one. But can't see if it is the gdb provided within the core which is used.
-
- Posts: 23
- Joined: Tue Feb 18, 2020 3:37 pm
Re: Arduino IDE 2 & Debug feature
How can I check which gdb program is used when debugger session started?
-
- Posts: 23
- Joined: Tue Feb 18, 2020 3:37 pm
Re: Arduino IDE 2 & Debug feature
Ok, I found the issue: my STLink clone doesn't had the RST connection (even if it was labeled as RST on output connector)
I made the connection and now debugger is working!
Luca

I made the connection and now debugger is working!
Luca