Why is debugging so expensive?

Spix

Active member
I am seriously considering hopping over to PIC32 just for one reason: I do want to have free limitless debugging facilities on also a FreeRTOS kernel on a PIC32 that has similar features. Main reason: I do not want to pay for getting a standard development feature that should be available in this completly open source board.

It seems that some commercial party has highjacked this feature and offers a "free" version with only 5 breakpoints which is enough for a "Hello World" example but not for most applications.
 
Well, the commercial party does presumably want to pay their developers. If you feel it is too onerous, you can always create your own debug environment and share it with others for free.

As somebody who does straddle this (I'm a GCC developer, currently working for IBM to enhance GCC for their platform), it can be tricky to price such things.
 
It comes down to strategy. Ultimately, chip manufacturers want to boost sales of chips. So some platforms will have more development tools available for a relatively low price than others. However, I would not expect free or inexpensive solutions to offer the same features as more expensive environments. That is, the more expensive IDE's and debugging environments will likely differentiate themselves in a number of ways, such as offering you the option to compile on multiple chip lines as opposed to just one (i.e. see the Atmel Visual Studio).

The more pressing issue, IMO, is how to make debugging as accessible to those new to programming as the Arduino experience aims to be. Defining breakpoints, looking at variable states, etc. are up a learning curve that presumes a basic knowledge of how a MCU works. That is, you are starting to straddle the border between Arduino enthusiast vs. Prosumer.
 
It is hard to justify $450 to proper debug a $20 Teensy board, when 99% (or more) of àll the code used ìs Open Source including Eclipse, RTOS, GCC etc etc.

You can't develop a proper RTOS application without being able to properly debug it on the target IMHO
 
As an educational tool, I consider a debugger and at least a minimal RTOS vital. Ie, any good programmer needs exposure to both. Otherwise they learn poor habits like "debugging is done with print statements" and "you need a messy state machine to do multiple things".

I didn't follow the $450 - there are a couple of ways to get a SWD connector on a teensy or compatible and then use GDB.
 
I didn't follow the $450 - there are a couple of ways to get a SWD connector on a teensy or compatible and then use GDB.

The hardware is only $20.

But getting the environment up and running requires some research, a lot of trial and error, and some knowledge how to set up toolchains and so on. Not trivial for someone who doesn't do this as part of past training or work.
 
@spix, Arduino is the wrong platform for you.
It not designed for RTOS and Teensy is (currently) not designed for Hardwaredebugging.
You don't buy a bycicle to go swimming.
Perhaps STM, or your mentioned PIC32 is better for you.
 
Agreed, I think there is an opportunity for this forum to document "the best way to use a debugger on a teensy program".

I bought a K20D50M board, which has SWD and CMSIS-DAP and is teensy 3.0 compatible. Then I used pyOCD and GDB. I never settled on a GUI (GDB is usable from the command line) - but there are many out there.

Others have soldered SWD wires on an actual teensy.
 
Expensive?
SWD debug pod for USB, not China-clones, are $22. Software like visual gdb and OCD are free or almost so.
No longer are we enslaved to Seeger/J-Link at $500. These do/did provide full JTAG support, beyond SWD. But rarely does one need more than what SWD provides. Even the SWD hardware trace is rarely used, so SWD becomes just GND, DATA and CLOCK. Two pins. And a sense-only pin for Vcc.

But SWD is not really the Teensy concept. Primarily because symbolic breakpoint debugging with SWD requires a traditional build process with an elf file output w/debug info, and compatible library sources, and with .h files w/function prototypes declared and used in the "normal" manner, with GCC but without the "unique" Arduino pre-processing, or with IAR, Keil, or Visual GDB.
 
Last edited:
So can somebody show this "greenhorn" how to proper debug for $20? A video will do or a good tutorial or both...
 
Some are not teensy compatible, but there is probably the same low cost SWD for Freescale. And SWD is agnostic as to CPU. It's the PC software for debugging and flashing with SWD that is the key. Others below are.

Free with IAR, Keil, and in-built to Visual GDB. Perhaps some versions of Eclipse too.
Many ST eval boards that are free or almost so, have an SWD programmer built-in to the board. Else you buy an ST-Link v2 from Mouser, etc.

flash & debug
https://www.youtube.com/watch?v=_ggJXbe885U
http://andybrown.me.uk/2014/09/09/stlinkv2/


Freescale must have the same.... let's google a bit
Here's one that uses a low cost Freescale Freedom board to be an SWD interface. Not sure what PC software would be used for debugging with this rig. But Surely there's a Freescale equivalent to the ST-Link pod.
http://mcuoneclipse.com/2013/04/21/using-the-freedom-board-as-jtag-programmer/
Here, the MS Visual Studio (free) is used with SWD and Freescale as the target. For the Teensy 3, "Visual Micro" exists but is not SWD oriented.

http://visualgdb.com/tutorials/arm/kinetis/

P&E micro has a grossly overpriced pod, but less than Seeger
http://www.pemicro.com/products/product_viewDetails.cfm?product_id=15320137

visual GDB is not free, but it's excellent. $90 as I recall.
http://visualgdb.com/?features=embedded
Says it supports Kenetis. It has several SWD and JTAG hardware drivers.
It, like Visual micro, uses MS Visual Studio as the IDE but GCC as the compiler targeting whatever GCC targets, including most all ARMs.
But it's not Mac compatible, nor Linux.
Visual Micro (free) with now-free Visual Studio (windows only) has a "software debugger" option. It acts like a debugger with trace and breakpoints. But it has no JTAG/SWD. Instead, in the IDE editor, you setup breakpoints and trace points/criteria. It then adds the requisite source code to your project to react to these debugging settings. This works in the Teensy and Arduino-alike projects since it's all software.

here's visual GDB, a non-Arduino but excellent and low cost development tool for many embedded projects, as well as Linux and Android.
http://visualgdb.com/tutorials/

So, more digging with Google will turn up more for Freescale. But the choices are few, as compared to other MCUs.

(Apologies to the forum here, I must add that per my experience with ARMs and with the embedded community, esp. avocational/student, ST rather than Freescale is more prevalent, so too the tools.)
 
Last edited:
If someone makes a teensy like CPU board with a SWD connector and a teensy like programmer daughter board that plugs into the SWD connector, I'll buy one. It would allow loading programs in the usual teensy way and then when needed, switching to using a debugger.
 
If someone makes a teensy like CPU board with a SWD connector and a teensy like programmer daughter board that plugs into the SWD connector, I'll buy one. It would allow loading programs in the usual teensy way and then when needed, switching to using a debugger.

In short, traditional JTAG debugger adapters were hundreds of dollars. Now with SWD, no longer so.

SWD, with two pins and ground is no cost. Third pin if you need trace (I don't use it.) The SWD to USB debugging pod are low cost as compared to full JTAG pods. I've used ST's ST-Link v2 ($25 for a non-fake one) - I suspect it'll work with the NXP/Freescale SWD as these are standard, and/or there should be an equivalent to ST-Link but from/for Freescale ARMs. Seeger's J-Link is $$$ but they now have an "educational" version; same hardware, commercial use prohibited, but it's more expensive. There are some others. And maybe NXP/Freescale will do what ST is doing with their low cost dev boards - put an SWD chip on the dev board. Teensy would need a piggy-back or some such.

The bigger question is that the IDE and how builds are done and how GCC command lines are constructed is not compatible with SWD or JTAG debugging. So a traditional IDE that's not Arduino-esque is needed, e.g., $95 Visual GDB (great) or professional level pricing for IAR or Keil. These are windows-only due to market share.

And Teensy uses the SWD pins for it's scheme with the bootloader chip.

On this forum is a user that cut traces to patch in a debugger.

Attolic's free non-commercial edition of Eclipse + GCC + GDB with support for some SWD pods might be a way to go. Haven't used it.

Visual Micro with MS Studio, both free, has a software-only debugger of sorts - OK for beginners.
 
Last edited:
If you have an ST-Link (or any other SWD debugger) and Keil, Crossworks, etc, then yes.

You can also just buy an L4 Nucleo board from Mouser for $10, whihc is way cheaper, but not a small and useful.
 
So does it allow code inline debugging full fletched with variable values etc etc?

We've moved off from Teensy which is Freescale based, to a board with an ST. In addition to onehorse's board, there are a myriad of ST Nucleo dev boards nearly free. Most with built-in SWD-USB. Some new ones are the small form factor like Teensy. See also http://www.stm32duino.com/

An ARM board lacking built-in SWD doesn't have to have an SWD or JTAG connnector - you can wire it up to : SWDIO, SWCLK, RESET, Vcc. As I did here, for a breadboard with Cortex M4 board and a $25 USB debug pod that has both JTAG and SWD (wires are for SWD).
2016-03-08_103924.jpg

Now back to your regularly scheduled Teensy thread.

Teensy can do SWD if you cut the PCB traces for SWDIO and SWCLK.
I couldn't find the thread on this forum where a fellow shows how he did the cuts to the traces. Just two.

Google search freescale swd
 
Last edited:
We've moved off from Teensy which is Freescale based, to a board with an ST. In addition to onehorse's board, there are a myriad of ST Nucleo dev boards nearly free. Most with built-in SWD-USB. Some new ones are the small form factor like Teensy. See also http://www.stm32duino.com/

An ARM board lacking built-in SWD doesn't have to have an SWD or JTAG connnector - you can wire it up to : SWDIO, SWCLK, RESET, Vcc. As I did here, for a breadboard with Cortex M4 board and a $25 USB debug pod that has both JTAG and SWD (wires are for SWD).
View attachment 6600

Now back to your regularly scheduled Teensy thread.

Teensy can do SWD if you cut the PCB traces for SWDIO and SWCLK.
I couldn't find the thread on this forum where a fellow shows how he did the cuts to the traces. Just two.

Google search freescale swd

om http://www.stm32duino.com/viewtopic.php?f=41&t=522&start=90 by stevech Tue Feb 23, 2016 7:59 pm states:
Maybe someone else knows of how to do real SWD debugging with free or cheap.
 
Last edited:
Back
Top