On Mon, Jul 11, 2011 at 11:53 AM, Øyvind Harboe <[email protected]> wrote:
> I think there is a fundamental misunderstanding about JTAG
> and OpenOCD.
>
> Let me try to clarify:
>
> JTAG clocks in and out bits, not bytes, so the concept of
> "big/small-endian" does not enter the picture at the JTAG level.

Sat that we have 0x12345678 at addr 0x0 on LE host.
You will shift out byte 0x78 first, shifting out from LSB upwards.
I.e. You will be starting with shifting out addr 0x0 on the host.
Now, if the host is BE, you will again be shifting LSB first, but this
time that means that you will be starting withs shifting out addr 0x3
(on the host) first.

Am I correct so far ?


At what addr will EJTAG on the other side write this byte ? At addr
0x0, or addr 0x03 - this is the main question.

If it is LE, Byte0, as they say in manual, will be put to 0x0, and if
it is BE MIPS, it will be put always to 0x3.

So, the first 8 bits that MIPS EJTAG shifts in, which will be noted
Byte0 in their terminology and represent bits 7:0, will be put to
either addr 0x0 or 0x3 - depending on endianess of the MIPS target.

That would say to me that MIPS EJTAG is actually doing following :
1) Takes the value of Byte0, in this case 0x78
2) Cast it to uint32_t, getting 0x00000078
3) Stores the word in memory - and if it is BE MIPS, 0x78 byte will
end-up on addr 0x3.

This way, EJTAG is endianess-agnostic - it really do not care about
your host endianess, as long as you are are sending it LSB fist. It
will arrange then to store the Byte0 at appropriate address once it
gathers bits 7:0.

This is what I think.

Now, when EJTAG is sending back data to the host, it will also send
LSB first, i.e. it's Byte0. But in the case of BE, this Byte0 lives on
the address 0x3, so it will start with sending addr 0x3.

When receives data as a byte array, host can not give any conclusions
about target endianess. It just know that it gets LSB first, and we
have to use buf_get_u32() to make some meaning on the host of a byte
array value that came.

This way target endianess is completely unimportant to the OpenOCD,
and we can not even know it by observing bytes that come we will
always see LSB coming first.

Does this all makes sense for you ?


BR,
Drasko
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to