1

I am using the excellent http://platformio.org/ together with Visual Studio Code to develop for Teensy 3.6 (an Arduino compatible board).

This works great. But I wanted to do better debugging via SWD (serial wire debug). So I disconnected the Arduino-compatible USB-chip and connected via SWD and JLINK instead. Similar to this: https://mcuoneclipse.com/2017/04/29/modifying-the-teensy-3-5-and-3-6-for-arm-swd-debugging/

I can flash firmware that I built via platformio using the "J-Link Lite" software just fine. Also I can run the J-Link GDB Server without a problem. But I can't get the IDE integration to work.

My platformio.ini looks like this:

[env:teensy36]
platform = teensy
board = teensy36
framework = arduino
upload_protocol = jlink
debug_tool = jlink

Still the upload_protocol is ignored and when I invoke upload (platformio.exe run --target upload) via the IDE all I get is

Linking .pioenvs\teensy36\firmware.elf
Checking program size
text       data     bss     dec     hex filename
17348       172    2696   20216    4ef8 .pioenvs\teensy36\firmware.elf
Building .pioenvs\teensy36\firmware.hex
Uploading .pioenvs\teensy36\firmware.hex
Teensy Loader, Command Line, Version 2.1
Read ".pioenvs\teensy36\firmware.hex": 17520 bytes, 1.7% usage
Soft reboot is not implemented for Win32
Waiting for Teensy device...
(hint: press the reset button)

So it's still trying to upload via Arduino compatible USB connection instead of via SWD connection. How can I get platformio to change the upload method or upload_protocol?

user643011
  • 2,163
  • 3
  • 21
  • 38

1 Answers1

2

From Project Configuration File platformio.ini, it provides an example of how to configure Jlink GDB server:

[env:bluepill_f103c8]
...
; Debug options
debug_tool = custom
debug_server =
    JLinkGDBServer
    -singlerun
    -if
    SWD
    -select
    USB
    -port
    2331
    -device
    STM32F103C8

If JLinkGDBServer.exe is not included in PATH, then you need to specify the full file name of JLinkGDBServer.exe.

I have tried this, it works.

There is another example of using JlinkGDBServerCL.exe - J-Link and ST Nucleo.

Max Peng
  • 21
  • 2
  • Thanks for your reply! I independently discovered the custom configuration. But I encountered several bugs. Fortunately the platformio support is excellent. I spent many hours with the the platformio team over email and teamviewer to get this board going with SWD. When this is finally resolved I will post a separate answer, and I am positive the fixes will reach the platformio main branch. – user643011 Sep 11 '17 at 15:58