Expectations and JTAG - Page 1
Forum section: electronics / beginners

author: mcsilvio
author_rank: Newbie
timestamp: October 10, 2019, 09:14:51 am
content: Hi all,I saw our man's video on JTAG and was really inspired. I am a software dev by day, but I don't have *much* experience with such low-level work. After I watched that great video, I had some cool ideas, but sadly reality was different to my expectations. I'd love your input on this. Here's what I expected to be true after watching the video.- I could send my own firmware to almost any device's CPU- I wouldn't be able to do much (or anything) if the device is complex and has many peripherals (e.g. phone)What I found:- There is not just one type of JTAG- Many devices make it near impossible to find the debugging pins- It won't be possible to have a datasheet for any device you choose.My dream:- JTAG an old phone, write anything to its screen. I read that I might need to incorporate a BLOB for interacting with the graphics system. Anyway, pipe dream.I'd love if you guys/gals could help settle some of these expectations. I guess a question could be: If I want to try writing my own firmware to some interesting device, what should I look out for to ensure that I would have a chance of succeeding?Please and thank you

author: Jeroen3
author_rank: Super Contributor
timestamp: October 10, 2019, 09:43:33 am
content: JTAG is a test interface. Standardized.Whatever else a chip or vendor incorporates behind this test interface is up to them.Flash programming, debugging or you name it.Using it requires the tool to know about the board and chip. If you didn't develop the board, or are able to find designs for it, you can't really use JTAG do to anything without heavy reverse engineering.That is, only if the chips JTAG ports aren't fused shut by OTP bytes.QuoteYou could operate the pins going to the external memory to reprogram it. It is very slow. Sometimes this is the only way to get DD-WRT on a router.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 10, 2019, 09:57:10 am
content: JTAG is not the "ability to instantly speak to any animal of the forest".However, if you are willing to spend more time understanding them, you may either learn more about each "animal" (by reading each chip datasheet), or by carefully observe and study each species by yourself (reverse engineering).Maybe reading more about JTAG basics will help understand what can and what can't do:https://www.fpga4fun.com/JTAG.html

author: magic
author_rank: Super Contributor
timestamp: October 10, 2019, 10:09:14 am
content: Quote from: mcsilvio on October 10, 2019, 09:14:51 amThe simplest solution: disconnect the screen from the SoC and figure out what it is and how to talk to itIf you want to run a firmware on the phone that writes something on the screen, your fist concern should be finding out what OS it runs, what APIs are available to access the screend or alternatively how the SoC with its integrated GPU works and write your own OS and drivers for everything.That will keep you busy for a whileQuote from: mcsilvio on October 10, 2019, 09:14:51 amFirst of all, datasheets. Pro tip: they aren't available to you. Failing that, months of reverse engineering. See how projects like nouveau are doing trying to write 3rd party GPU drivers for undocumented NVIDIA chips.

author: mcsilvio
author_rank: Newbie
timestamp: October 10, 2019, 10:23:22 am
content: Thanks all. You sure set the record straight! I appreciate it. Keep it coming. I want to know all the hurdles that make this implausible. Please.

author: MosherIV
author_rank: Super Contributor
timestamp: October 10, 2019, 05:52:08 pm
content: Welcome to the forum.You do not need jtag debugger to write to the phone screen. You develop an Apple or Android application and load it to the device.Jtag debuggers are not really used that much for application processors. Only the OS developers need that kind of low level debugging.The are used for embedded microcontrollers, mainly because these processors may not have a screen or console. So the only way to figure out what is going on is to insert break points and step through the code.There is no such thing as a general purpose jtag debugger. They are specific to processor families.We are pretty lucky with ARM Cortex M, some jtag debuggers can do any ARM processor no matter how many chip manufacturers.I know all this, because it is my day job. I am a specialised Embedded or Realtime Software engineer, though I am more of a system analyst or software architect now a days.Trying to use jtag to debug Apply/Android application would be like trying to debug a Windows application by single stepping through lines of code.

author: mcsilvio
author_rank: Newbie
timestamp: October 11, 2019, 07:14:51 am
content: Thanks Mosher,I just want to clarify. I am aware of application development (it's what I do), and I've made a couple cool android apps! This was meant to be more of a bare-metal, OS development exercise. Rather, and exercise in a bare-metal firmware with no OS.But if I can't blink an LED with a reasonable amount of effort, maybe my expectations were way off. What's a cool board that I can most easily write my own bare-metal program for (one with some cool periphs hopefully)?I just saw our man's video on the PC/104 spec and some of those boards looked cool!

author: thinkfat
author_rank: Unknown
timestamp: October 11, 2019, 07:22:35 am
content: Quote from: mcsilvio on October 11, 2019, 07:14:51 amI suggest you start from any of the widely available STM32 devboards. That will allow you to dabble in low-level programming up to running complex RTOS stuff and hardware debugging. Blinking a LED is what everybody starts with. The so called "Blue Pill" can be had for a dollar on ebay, a programming adapter is not much more.Forget about anything with x86, the debug adapters are expensive and the information not publicly or freely available.

author: mcsilvio
author_rank: Newbie
timestamp: October 11, 2019, 07:45:18 am
content: Thanks mate.