Debugging a teensy with Platformio vscode plugin

Update

I read in one place that the teensy 4.1 has debugging capability built in and elsewhere that 4.1 requires an extra bit of hardware. Can you clarify?

I seem to have made progress. I am using the plartformio vscode plugin successfully. I am able to build and upload. When I click on ‘debug’ I see some packages being recompiled, and something being uploaded. Buit after a moment of showing activity, the debug plug in stops and it looks like nothing is happening.

Do I have to modify my code and put in, for example, debug.start() or something like that?

Can someone shed some light on this?

Original

I have never done this before. Reading the help it seems to imply that I need an extra bit of hardware. In other words the simple usb connection from myraspberry pi to the teensy won’t be sufficient for debugging. Is that correct?

Hi @pitosalas,

I have never done this before. Reading the help it seems to imply that I need an extra bit of hardware. In other words the simple usb connection from myraspberry pi to the teensy won’t be sufficient for debugging. Is that correct?

That’s correct, it’s not possible to debug the Teensy 4.1 board even with additional hardware. Although, some developers use a GDB stub as a workaround GitHub - ftrias/TeensyDebug: GDB proxy and debugging support to Teensy 3/4

Thanks. I do wonder then why Platformio (vs code IDE) has a debug task, which does a lot of recoiling and reuploading, but in the end doesn’t do anything. You would think there would be a simple error message somewhere.

Or are those commands meant to work with the GDB proxy?

I guess here’s the high level question: do most people programming Teensy with Platformio just do print statements to debug?

Also do Arduino type debuggers give better debugging support?

Thanks!

I do wonder then why Platformio (vs code IDE) has a debug task, which does a lot of recoiling and reuploading, but in the end doesn’t do anything.

That’s probably a mistake in the board manifest, there is no easy way to debug this board.

do most people programming Teensy with Platformio just do print statements to debug?

I believe so.

Also do Arduino type debuggers give better debugging support?

I’m not sure what debuggers you mean, it’s a limitation imposed by the hardware.

Let’s say I switch from the teensy to one of the several Arduino or similar SBC. And I continue to use PlatformIO for deploying. Would the debug features be usable without additional special hardware? (The most important debug features are setting breakpoints, stepping and examing variables.) Which Arduino-family boards would you recommend?

It is not an “Arduino family” board but the ESP32-S3 has a built-in debugger.
See the great article by eduardogb: How to use JTAG built-in debugger of the ESP32-S3 in PLATFORMIO

1 Like

Very technically, the Teensy 4 is hardware-debuggable if you have extreme skills in microsoldering and an external debug probe like a J-Link:

You should use the exact platformio.ini as provided in that project.