PlatformIO Community

Debugging not starts

I have struggled “a bit” with debug RP2040
Now i hav install VS code and PlatformIO on a new installation of WIN 10
and tried first with a BluePill “stm”
i can Download firmware to the chip use J-LINK EDU
but when Debugging the terminal ends with
Linking .pio\build\bluepill_f103c8\firmware.elf
Checking size .pio\build\bluepill_f103c8\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [ ] 3.7% (used 764 bytes from 20480 bytes)
Flash: [= ] 12.4% (used 8136 bytes from 65536 bytes)
Building .pio\build\bluepill_f103c8\firmware.bin
======================================== [SUCCESS] Took 18.68 seconds ========================================
and does not start Debug Consule the “icon” Debug close (cant put in picture)

and nothing in debug console (not starting debugger) can some come up with an input :wink:

platform = ststm32
board = bluepill_f103c8
framework = arduino
build_type = debug
upload_protocol = jlink
debug_tool = jlink
debug_init_break = tbreak setup

Open a CLI and execute

pio debug --interface=gdb -x .pioinit

What is the output?

SEGGER J-Link GDB Server V7.50a Command Line Version

JLinkARM.dll V7.50a (DLL compiled Jul  8 2021 18:16:52)

Command line: -singlerun -if SWD -select USB -device STM32F103C8 -port 2331
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 STM32F103C8
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V10 compiled Nov  2 2021 12:14:50
Hardware: V10.10
S/N: 260109354
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 3.27 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...C:\Users\hs\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
Reading symbols from C:\Users\hs\Documents\PlatformIO\Projects\bluepill\.pio\build\bluepill_f103c8\firmware.elf...
PlatformIO Unified Debugger ->
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
Connected to
Reading all registers
Read 4 bytes @ address 0x080002D8 (Data = 0x68184B01)
HAL_GetTick ()
    at C:\Users\hs\.platformio\packages\framework-arduinoststm32\system\Drivers\STM32F1xx_HAL_Driver\Src/stm32f1xx_hal.c:306
306       return uwTick;
Received monitor command: clrbp
Received monitor command: speed auto
SSelect auto target interface speed (2000 kHz)
Received monitor command: reset
elect auto target interface speed (2000 kHz)
RResetting target
Receivedesetting target
 monitor command: halt
Halting target CPU...
...Target halted (PC = 0x0800014C)
Downloading 268 bytes @ address 0x08000000
Downloading 11612 bytes @ address 0x0800010C
Downloading 1488 bytes @ address 0x08002E68
Downloading 16 bytes @ address 0x08003438
Downloading 8 bytes @ address 0x08003448
Downloading 136 bytes @ address 0x08003450
Writing register (PC = 0x 800014c)
Loading section .isr_vector, size 0x10c lma 0x8000000
Loading section .text, size 0x2d5c lma 0x800010c
Loading section .rodata, size 0x5d0 lma 0x8002e68
Loading section .init_array, size 0x10 lma 0x8003438
Loading section .fini_array, size 0x8 lma 0x8003448
Loading section .data, size 0x88 lma 0x8003450
Start address 0x800014c, load size 13528
Transfer rate: 4403 KB/sec, 2254 bytes/write.
Read 4 bytes @ address 0x0800014C (Data = 0x46854811)
Read 2 bytes @ address 0x0800014C (Data = 0x4811)
Reading 64 bytes @ address 0x080022C0
Read 2 bytes @ address 0x080022CE (Data = 0x2101)
Temporary breakpoint 1 at 0x80022ce: file src\main.cpp, line 9.
PlatformIO: Initialization completed
(gdb) PlatformIO: Resume the execution to `debug_init_break = tbreak setup`
PlatformIO: More configuration options ->
Setting breakpoint @ address 0x080022CE, Size = 2, BPHandle = 0x0001
Starting target CPU...
...Breakpoint reached @ address 0x080022CE
Reading all registers
Removing breakpoint @ address 0x080022CE, Size = 2
Read 4 bytes @ address 0x080022CE (Data = 0x20112101)

Temporary breakpoint 1, setup () at src\main.cpp:9
9         pinMode(LED_BUILTIN, OUTPUT);

Yeah so it flashes it and starts, so that’s working.

This is now the third topic about debugging in which it works from the commandline but not via the VSCode GUI.

Hi and thanks for you reply
On my old WIN7 PC with an old Platformio and upgraded after install VS code 2022 (had VD code 2015 upgraded to 2022) it works
the problem with this came after I removed all VS code and Platformio because I had weird things in debug RP2040 then I could not debug so I thought format C: and completely fresh WIN10 and VS code and Platformio
maybe I should try with a VS code 2015?
can well see I’m not the only one

I’ve opened about this but I cannot get a reproduction of the issue. I’m already at the lastest VSCode 1.64.0 version and have the newest PlatformIO extension and switched around the Microsoft C/C++ extension but it is still working.

Can you copy the VScode Help → About information and show a screenshot of your installed VSCode extensions with their exact versions?

I will when home and thanks for you time

On the working WIN7 PC with upgradet VS code and Platformio
About is
Version: 1.64.0 (user setup)
Commit: 5554b12acf27056905806867f251c859323ff7e9
Date: 2022-02-03T04:22:20.678Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
OS: Windows_NT x64 6.1.7601

PS C:\Users\hs\Documents\PlatformIO\Projects\blue_2> code --list-extensions --show-versions

From the not working PC
Version: 1.64.0 (user setup)
Commit: 5554b12acf27056905806867f251c859323ff7e9
Date: 2022-02-03T04:22:20.678Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
OS: Windows_NT x64 10.0.14393
PS C:\Users\hs\Documents\PlatformIO\Projects\bluepill> code --list-extensions --show-versions

It currently looks like it’s a problem with fresh PlatformIO installations and those using the builtin Python interpreter. Best to wait for an official solution as linked above.

In the meantime, I’ve modified my PlatformIO extension settings to not use the builtin Core and not use the portable Python interpreter, did a pip install platformio in my PC-global Python 3.8.6 installation, added the Scripts folder of my Python3 installation to my PATH and restarted VSCode; The PlatformIO extension will pick up this global PIO installation now and debugging works properly.

Thanks Max
I will see if a fix come

Please update the PlatformIO IDE extension to the latest version. Does it work now?

Hi Ivan
i think i have the newest (i have not used platformio for 2 years and just startet again)
the only old is i testet PY 3.9 and same problem with 3.10
Please tell me wath to upgrade you can see my extension list above

KR Henrik

You need to update the PlatformIO IDE extension in VSCode. This one PlatformIO IDE - Visual Studio Marketplace

Hi Ivan
Thanks it is now working on the STM 10 * to you for fast support
now I can try with RP2040 which was the one that started my uninstallation :wink:
because it behaved strangely with unknown stack.
Tests tomorrow and creates a new thread if teasing otherwise I write an ok here :wink:

KR Henrik

1 Like