Beginner with platformio.ini

I am using windows 10 wishing to setup mbed debugging for st boards. My platformio.ini is:

[env:nucleo_f767zi]
platform = ststm32
framework = mbed
board = nucleo_f767zi
upload_port = COM[8]
upload_protocol = stlink
debug_tool = custom
debug_server =
  $PLATFORMIO_CORE_DIR/?????/openocd
  -f
  $PLATFORMIO_CORE_DIR/?????/tool-openocd/scripts/board/st_nucleo_f7.cfg

When I run debugging in vscode I get the following

Reading symbols from nucleo_f767zi/firmware.elf...
done.
PlatformIO Unified Debugger -> ly/pio-debug
PlatformIO: Initializing remote target...
GNU MCU Eclipse OpenOCD, 64-bitOpen On-Chip Debugger 0.10.0+dev-00593-g23ad80df4 (2019-04-22-20:25)
Licensed under GNU GPL v2
For bug reports, read
	openocd.bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 2000 kHz
Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.269404
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from pipe
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x08000764 msp: 0x2007ffc0
Info : device id = 0x10016451
Info : flash size = 2048 kbytes
Info : Single Bank 2048 kiB STM32F76x/77x found
Info : flash size = 1024 bytes
initialize (ticker=ticker@entry=0x8009858 <us_data>) at mbed_ticker_api.c:33
33	    if (ticker->queue->initialized) {
Temporary breakpoint 1 at 0x80038b0: file src\main.cpp, line 6.
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
Unable to match requested speed 2000 kHz, using 1800 kHz
Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800161c msp: 0x20080000
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800161c msp: 0x20080000
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800161c msp: 0x20080000
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1012). Workaround: increase "set remotetimeout" in GDB
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Loading section .text, size 0xa33c lma 0x8000000
Loading section .ARM.exidx, size 0x8 lma 0x800a33c
Loading section .data, size 0xad0 lma 0x800a344
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800161c msp: 0x20080000
Start address 0x800161c, load size 44564
Transfer rate: 16 KB/sec, 8912 bytes/write.
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
Unable to match requested speed 2000 kHz, using 1800 kHz
Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800161c msp: 0x20080000
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800161c msp: 0x20080000
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

Temporary breakpoint 1, main () at src\main.cpp:6
6	int main() {

Breakpoint 2, main () at src\main.cpp:9
9	        wait(0.5);

Please advise how I may improve my platformio.ini file?
Many thanks,
Kevin

So you want a cleaner platformio.ini?

Well given that PlatformIO already has the right OpenOCD file

There should be no difference between your custom setup and PlatformIO’s default. What happens you remove the debug_tooland debug_server lines? After all, your debug session seems to be working already.

Thank you for your reply: maxgerhardt. I removed the lines as suggested and this is the result:


Do I need the upload lines?
Can I set a speed?
How do I introduce a scrolling textbox or is it automatic in this forum?
Many thanks,
Kevin.

Triple backticks ``` (should be the key to the left of the 1 on your number key row) before and after where you’re going to insert the code/block text. :slightly_smiling_face:

Thank you pfeerick! That’s quick and easy.

@maxgerhardt

Thank you maxgerhardt.

The default upload tool is already stlink, so you also don’t need it.

Which speed? Flashing speed, monitor baud?

Thank you Max for your reply. When I first installed platformio plus vscode I used:
[env:nucleo_f767zi]
platform = ststm32
framework = mbed
board = nucleo_f767zi
and the debugger failed.
hence I tried adding all the extra lines. Now the only extra line is:
upload_port = COM[8]
and it still works!
Is this a requirement of only Windows 10?
Next question:
“Info : Unable to match requested speed 2000 kHz, using 1800 kHz”
“Unable to match requested speed 2000 kHz, using 1800 kHz”
I did not set 2000kHz?
Am I using the unified debugger or am I using GNU GDB?
Is there a requirement to have GDB installed?
Must it be a precise reversion “C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update\bin”?
How does the unified debugger relate to GDB?
Sorry for the delay in reply I am in New Zealand.
Kevin.