YesTeensy 4.1 uses JTAG, not SWD. It would in theory be done if you solder more wires and use a JTAG adaptor. Just know that SWD can not work.
If you do attempt this, here are the signal locations you'll need.
View attachment 29461
BOOT0 needs to be connected to GND for normal operation.
PSWITCH needs a low-to-high transition to turn on the 1.15V DC-DC power supply for the CPU.
MOD controls which JTAG device you access, either ARM debug or standard boundary scan. See the reference manual & datasheet for detail.
Probably Paul has a tip
Sorry if my previous experience caused me to provide incorrect information. I was still working with the MKL02 at the time but I had not experienced the blink codes until then, I was under the impression that the software changed in some way that cutting the JTAG connections may affect the power up sequence. It is very possible I had a bad connection somewhere.
I have connected JTAG to a Teensy with a GD32 chip, but I am still removing the chip completely as I did before and driving PSWITCH and a few other pins myself. Since I switched to my new method I did not have a reason to go back and find my fault.
Here is one of my Teensy with the MKL02 footprints. I have a new PCB made for the GD32 footprint but I have not been able to test it yet.
View attachment 31064
Thanks for sharing that.
This looks great, but not available for everybody's use, right ?
Anyway, I found a lot of hints that you shared. Very helpful. The last one on platformio.
(This looks more complicated than expected. Hopefully the jlink solution for the gdb server works also for me.)
By the way: this small 6 leg device looks very interesting for the job. What is it ?
I made now my own tests with GD32 and found the JTAG debugging instable. It seems that it is not reliably possible to halt the CPU so that the debugger gets a grip on the MCU before the first breakpoint passes by.
Uploading works. Sometimes also stepping. But unpredictable.
Question is: is it the hardware or the configuration of platformio. I am using the same config as others - reported as working - and use a simple blinking program.
Was this your experience ? Unpredictable behaviour ?
When I look on the pins of the GD32 that are unknown I find that these pins are silent - low or high.
Are you using the POR_B Signal to provide a reset by the JTAG connection ?
Are you making sure the project is being built with the Optimization set to DEBUG Og? It is possible the code is being optimized and causing breakpoints to be "passed by", same with stepping.