Author Topic: Expectations and JTAG  (Read 944 times)

0 Members and 1 Guest are viewing this topic.

Offline mcsilvioTopic starter

  • Newbie
  • Posts: 4
  • Country: ca
Expectations and JTAG
« on: October 10, 2019, 09:14:51 am »
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
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4209
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Expectations and JTAG
« Reply #1 on: October 10, 2019, 09:43:33 am »
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.

Quote
I could send my own firmware to almost any device's CPU
You 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.
« Last Edit: October 10, 2019, 09:45:09 am by Jeroen3 »
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 7012
  • Country: ro
Re: Expectations and JTAG
« Reply #2 on: October 10, 2019, 09:57:10 am »
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
 
The following users thanked this post: mcsilvio

Offline magic

  • Super Contributor
  • ***
  • Posts: 7454
  • Country: pl
Re: Expectations and JTAG
« Reply #3 on: October 10, 2019, 10:09:14 am »
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.
The simplest solution: disconnect the screen from the SoC and figure out what it is and how to talk to it :P
If 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 while :-DD

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?
First 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.
 

Offline mcsilvioTopic starter

  • Newbie
  • Posts: 4
  • Country: ca
Re: Expectations and JTAG
« Reply #4 on: October 10, 2019, 10:23:22 am »
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.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Expectations and JTAG
« Reply #5 on: October 10, 2019, 05:52:08 pm »
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.
 

Offline mcsilvioTopic starter

  • Newbie
  • Posts: 4
  • Country: ca
Re: Expectations and JTAG
« Reply #6 on: October 11, 2019, 07:14:51 am »
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!
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Expectations and JTAG
« Reply #7 on: October 11, 2019, 07:22:35 am »
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!

I 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.
Everybody likes gadgets. Until they try to make them.
 

Offline mcsilvioTopic starter

  • Newbie
  • Posts: 4
  • Country: ca
Re: Expectations and JTAG
« Reply #8 on: October 11, 2019, 07:45:18 am »
Thanks mate.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf