3
votes

There may be rude expression because I'm not a native English speaker. I hope you to understand.

I have a JTAG debugger like below and I would like to create an application to control JTAG.

enter image description here

I know that many tools to do this are. actually I also have using the IAR IDE tool but I want to know how IAR compiler to control the JTAG.

How to control the JTAG device to write a binary file to the flash memory? Any information is ok. if you have any clue then please let me know.

Thanks for reading.

1
read the jlink manual0___________

1 Answers

3
votes

In the JTAG standard is implemented a protocol that allows communication with microcontrollers that also speak this protocol and have the hardware interface. The protocol is implemented as a state machine (https://en.wikipedia.org/wiki/Finite-state_machine). A diagram of the JTAG state machine is in https://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/s2009/jgs33_rrw32/Final%20Paper/index.html (i.e. the TCP/IP stack/protocol is also a state machine : http://telescript.denayer.wenk.be/~hcr/cn/idoceo/tcp_linkstates.html).

Basically in the JTAG standard is specified which registers on the uC are accessed and in which state the state machine has to be in to be able to access a specific register, see https://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/s2009/jgs33_rrw32/Final%20Paper/index.html for more details.

So if you want to write a program to control a JTAG programmer you have to implement the JTAG state machine in code because the corresponding state machine in the microcontroller on the other end of the cable only understands this protocol.

An implementation of the TCP state machine in C is in https://www.oryx-embedded.com/doc/tcp__fsm_8c_source.html, in i.e. https://aticleworld.com/state-machine-using-c/ is also an implementation of a state machine