Page 1 of 1

Using JTAG adapters/breakouts for system software debugging?

Posted: Wed Oct 24, 2018 10:22 am
by Schol-R-LEA
I mentioned this in a recent thread on the OS Dev forum, but I felt this was a general enough question to ask, and felt it might not fit exactly on that forum. I am going to go look on this myself, but I am asking less for general information, and more personal experiences with it - hence why I put this in General Ramblings.

I have heard of using ICEs (yes, I know most of them aren't emulators, but the term is a historical one) for debugging software as well as hardware, including certain JTAG adapter modules. It is my understanding that this is a fairly common practice for both professional embedded systems development and maker-grade development projects. However, I have no experience with such, and I am wondering what the different options for this were.

I know that some JTAG modules are fairly simple, often with two or three part 7S display. Others I have seen connect to a small TFT display, and IIUC, the most expensive models have micro-USB connectors to connect them to a PC workstation, either for SSH or connecting to a (usually proprietary) IDE/Debugging application. Does anyone here know much about this?

I am specifically wondering if the Arduino IDE is connected via JTAG, or if they use a proprietary (or at least Arduino-specific) adapter system. I do mean to look that up myself, though, but if anyone can comment on it, please do.

EDIT: After some quick searches, I did find these, which I will post for anyone who (like myself) isn't really familiar with these topics.

Apparently, Arduinos don't use a JTAG itself for connectin g to the PC, but instead a USB connector on the Arduino device. Duh, I should have guessed that, I suppose.

There seems to be a fair bit about using various Arduinos as JTAG adapters, though, including this article on connecting a non-Arduino board through an Arduino to the Arduino IDE, and this one about a library of JTAG debugging scripts. This also discusses the topic.

Re: Using JTAG adapters/breakouts for system software debugg

Posted: Wed Oct 24, 2018 2:06 pm
by nullplan
Arduinos come preprogrammed with a bootloader that runs a serial program that connects to the IDE. If the boot loader is overwritten (AFAIK the IDE can do that) the program becomes pretty permanent, at least in the absence of an AVR Dragon or something.

Re: Using JTAG adapters/breakouts for system software debugg

Posted: Wed Oct 24, 2018 2:48 pm
by Octacone
nullplan wrote:Arduinos come preprogrammed with a bootloader that runs a serial program that connects to the IDE. If the boot loader is overwritten (AFAIK the IDE can do that) the program becomes pretty permanent, at least in the absence of an AVR Dragon or something.
AFAIK when it comes to Arduino you can re-burn the bootloader as many times as you want.

Re: Using JTAG adapters/breakouts for system software debugg

Posted: Thu Oct 25, 2018 1:36 am
by Velko
Octacone wrote:AFAIK when it comes to Arduino you can re-burn the bootloader as many times as you want.
True. But if the current bootloader on the chip is damaged, you have to connect external hardware to Arduino's ISP header, to do it. Might be a problem, if you have none.

The simplest (codenamed "bsd") programmer involves connecting ISP pins to computer's LPT port using few resistors. But LPT ports are a rarity nowadays. Then there are lots of DIY or pre-built programming boards available. I am using self-built USBasp.

You probably need to switch from Arduino IDE to generic AVR tools - like AVRDUDE.

Personally, I've never bothered with Arduino IDE, library or bootloader. Straight Avr-gcc + avr- libc gives you way more control (and makes more sense in OSDev community :D). Sure, you have to consult chip's datasheet from time to time, but I do not see a problem with that.