Teensy 4.1 Uploading with JLink

Well the base error is that PlatformIO doesn’t seem to be able to execute any commands from inside VSCode to the Jlink tools.

When I do “Start Debugging” in VSCode with the above platformio.ini, I do get the JLink output, telling me it failed to start (since no JLink is connected of course)

And I do get the “Verbose Upload” JLink output as indicated above.

I’m not excluding antivirus to be a culprit if you get no output at all.

It seems to help in your setup though to specify explicit commands.

For uploading you can also try the platformio.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
upload_protocol = custom
upload_command =
   $PROJECT_PACKAGES_DIR/tool-jlink/JLink.exe 
   -device 
   MIMXRT1062xxxxA
   -if 
   jtag
   -autoconnect 
   1
   -NoGui 
   1
   -CommanderScript 
   upload.jlink

And a upload.jlink file at the same level as the platformio.ini with content

h
loadfile .pio\build\teensy41\firmware.hex
r
q

Then check “Verbose Upload” if the tool is invoked correctly and flashes correctly (docs).