Hi Pete,
Most Teensy 4.0 users don't need SWD since they are happy to program it via Arduino. The lack of SWD debugging is only a problem for people such as me who want to use normal, full-function, GCC, C++17 or whatever, GDB and suitable IDE (MCUXpresso). I am planning CPU-intensive, audio DSP and real-time control, while driving a small OLED display. I wouldn't want to do this without a robust, modern, C++ compiler and every debug capability I can get my hands on.
I have not yet actually got this going, even with a Teensy 3.6 which I did modifiy for this purpose, due to not actually needing the capability right now. This is a longer term project. However, I read all about it. There is also a trace facility in these ARM MPUs and I think a way that the LPC-Link2 and IDE (MCUXpresso) can support this. I recall it is a method of real-time streaming parts of the internal state of the chip to the outside world, where it can be displayed and analysed as part of the debug environment. This sounds really valuable to me, and would be a significant step beyond normal GDB debugging in the exact same CPU that GDB is running on, such as with x86-64 PCs.
After the discussions about the difficulty of modifying the Teensy 3.6 for SWD, and the revelation that it was a feature which was planned all along but not implemented (
https://forum.pjrc.com/threads/42728-Debugging-strategies/page3 msgs 61 & 62) I was expecting there would be no need to modify the 4.0 for this.
The Teensy products and the very large and enthusiastic user-base which supports them have a background entirely based on Arduino. As far as I know, Arduino has grown into a multi-microcontroller (8, 16 and 32 bit, with various completely different architectures) development system by which a somewhat C++ like compiler with a particular IDE arrangement can be used to program these devices via a USB port, using a bunch of relatively standardized C++-like libraries. Also, I think, there is some kind of standard subset of pins so I/O boards "shields" can be plugged into an Arduino compatible main board, with little regard to which kind of MPU is on it. As far as I know, it is then possible to cobble together various libraries, source code from other people and your own source code, compile and actually have things run properly. I have no idea how this could be achieved, with all the vagaries of compilers, MPUs, pin configuration etc.
The result is an entry-level MPU development system with very low cost, which runs on any platform (Windows, Linux or whatever, even ARM Linux I guess) which enables people to maintain their source code and have it run on even more powerful, and completely different MPUs, than whatever they started with some years ago.
However, as best I understand it, Arduino debugging is limited to inserting printf() statements in the code to report activity. I assume there is some single step debugging facility with breakpoints, but I have never looked close enough at Arduino to know.
Anyway, the existence of this extraordinarily compact and cost-effective Teensy 4.0 is entirely a result of this Arduino user base for actual Teensys, and beyond this, the broader Arduino user base who would be attracted to applying all their skills, effort and source code to new projects with the Teensy 4.0. So the design is optimized for Arduino. There are surely very good reasons it can't support SWD debug - and Paul explained why above. He needed JTAG control of the 1062 and this could only be done by blowing a fuse on it.
Paul kindly explained some other tricky things which I would need to do to get SWD debugging working, apart from installing a 1062 without the blown fuse.
My one, so far, Teensy 4.0 is currently awaiting a company to attempt the BGA removal and reflow, also removing the MKL02. There's no guarantee it will work, so I may try a few more in order get at least one working.
I should soon have an MIMXRT1060-EVK and will fire it up with MCUXpresso and the LPC-Link2 so I can properly learn how it all works with GCC and GDB.
Then I will attempt to achieve the same thing with the modified Teensy 4.0. The FLASH chip is different than that of the MIMXRT1060-EVK, but perhaps this won't matter much or at all. WMXZ, above, wrote that this would be a Teensy-alike - and indeed this is true, since this particular board would be incapable of loading firmware from USB using the Teensy loader program (Windows or Linux) or running under Arduino. However, in terms of running my firmware, it would be a real Teensy 4.0 in all other respects, with connections, capacitance, FLASH chip and everything else.
By then I will have some more Teensy 4.0s and the next step would be to establish how to use GCC to generate a hex file suitable for the Teensy loader software (Windows or Linux) to program my project into a normal Teensy 4.0. I should be able to unplug my SWD Teensy 4.0 from the prototype main board, plug in the normal Teensy 4.0, do the USB boot load operation and see my firmware run exactly as it does when I am developing it with GCC, GDB and MCUXpresso.
In order to be able to do this easy plug in swapping, I have had Samtec make (for very low cost, including just a few dollars for DHL courier!) the precisely defined pins and sockets needed for this. See
https://forum.pjrc.com/threads/57122-Teensy-4-0-Breakout-Kit?p=216537#post216537 . I haven't mounted these yet, since they would get in the way of the BGA reflow operation. It will report my progress here, but it may be a few months before I work on it properly.
If I can't get this going, then Plan B would be to use the SDK with ribbon cables, as short as possible,with grounds between the signal lines, to a little board with the same pin arrangement as a Teensy 4.0 (most easily done with a Teensy 4.0 with its components removed). That would plug into my prototype board for debugging. Theoretically it would work, but there would be extra cable capacitance, crosstalk, inductance, ringing etc. which could easily make development much more difficult, such as with ground noise, ADC input slew times and high-speed drive of the OLED display and other devices.