STLink Debugger

Hey Guys!

I get the following error when I try to build my code with the STLink V2 debugger support:

DebugInvalidOptions: Unknown debug tool `stlink`. Please use one of `blackmagic, jlink` or `custom`:

I’m using an Arduino Due, based on the documentation what I found here: Arduino Due (Programming Port) — PlatformIO latest documentation and here: ST-LINK — PlatformIO latest documentation
I guessed it should work without any hacking.

This is my .ini project file:

[env:due]
platform = atmelsam
board = due
framework = arduino
debug_tool = stlink
upload_protocol = stlink

And the full output of the build command:

> Executing task in folder center_fire: platformio run <

Processing due (platform: atmelsam; board: due; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/due.html
PLATFORM: Atmel SAM > Arduino Due (Programming Port)
HARDWARE: AT91SAM3X8E 84MHz 32KB RAM (512KB Flash)
DebugInvalidOptions: Unknown debug tool `stlink`. Please use one of `blackmagic, jlink` or `custom`:
File "/Users/peter/.platformio/penv/lib/python2.7/site-packages/platformio/builder/main.py", line 173:
env.SConscript("$BUILD_SCRIPT")
File "/Users/peter/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/Users/peter/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 250:
exec _file_ in call_stack[-1].globals
File "/Users/peter/.platformio/platforms/atmelsam/builder/main.py", line 162:
target_elf = env.BuildProgram()
File "/Users/peter/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/Users/peter/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 90:
env.PrintConfiguration()
File "/Users/peter/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/Users/peter/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/pioplatform.py", line 167:
env.subst("$DEBUG_TOOL"))
File "/Users/peter/.platformio/penv/lib/python2.7/site-packages/platformio/managers/platform.py", line 763:
(tool_name, ", ".join(sorted(list(debug_tools)))))
================================================================== [ERROR] Took 0.58 seconds ==================================================================
The terminal process terminated with exit code: 1

What do I miss here?

Thanks!

Works for me.

pio run -t upload
[..]
arm-none-eabi-objcopy -O binary .pioenvs\due\firmware.elf .pioenvs\due\firmware.bin
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   2.6% (used 2600 bytes from 98304 bytes)
PROGRAM: [          ]   4.2% (used 22088 bytes from 524288 bytes)
.pioenvs\due\firmware.elf  :
section            size        addr
.text             22080      524288
.ARM.exidx            8      546368
.relocate          2260   537329664
.bss               2600   537331924
.ARM.attributes      41           0
.comment            224           0
.debug_frame       2820           0
Total             30033
<lambda>(["upload"], [".pioenvs\due\firmware.bin"])
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba, stlink
CURRENT: upload_protocol = stlink
openocd -s C:\Users\Maxi\.platformio\packages\tool-openocd/scripts -f interface/stlink.cfg -c "set CHIPNAME at91sam3X8E; set CPUTAPID 0x2ba01477" -f target/at91sam3XXX.cfg -c "program {{.pioenvs\due\firmware.bin}} verify reset ; shutdown"
GNU MCU Eclipse 32-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-10:20)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
0x2ba01477
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : clock speed 480 kHz

What is your pio --version?

pio --version
PlatformIO, version 4.0.0a2

I tired to update the environment, the version stayed the same but it updated/downloaded a few components. So now it compiles <*

Thanks for the help!