Teensy 4.1 Uploading with JLink

I have managed to get it working. I added/removed a few things to my ini after @maxgerhardt 's suggestions.
Here is my platformio.ini:

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
upload_protocol = custom
upload_flags =
   -device
   MIMXRT1062xxx6A
   -speed
   4000
   -if
   jtag
   -jtagconf
   -1,-1
   -autoconnect
   1
   -NoGui
   1
   -CommanderScript
   "upload.jlink"
upload_command = $PROJECT_PACKAGES_DIR\tool-jlink\JLink.exe $UPLOAD_FLAGS
debug_tool = custom
debug_server = 
   C:\Users\\\<user>\\.platformio\packages\tool-jlink\JLinkGDBServerCL.exe 
   -singlerun 
   -if 
   jtag 
   -select 
   USB 
   -device 
   MIMXRT1062xxx6A 
   -port 
   2331
   -speed
   4000
debug_port = localhost:2331
debug_init_cmds =
   target extended-remote $DEBUG_PORT

with an upload.jlink file at the root of the project:

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

Thanks for helping @maxgerhardt
I’m still not sure what the underlying issue is, I doubt I will look into it much further but if a dev is interested I can work with them to figure it out.

2 Likes