tms470 half-word access issue

Working with the TMS470R1A256 development board, made by Olimex, sold by Sparkfun. Also using the Olimex ARM-USB-TINY jtag adapter.

# interface
interface ft2232
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15ba 0x0004

# jtag scan chain - single ARM7 device
jtag_device 4 0x1 0xf 0xe

# target
target arm7tdmi big reset_halt 0

Strange results on 16-bit reads and writes. Somehow bits 8-11 are always zero. 32- and 8-bit reads and writes are okay. Test script and results shown below.

# set up RAM to start at 0x10000000
mww 0xFFFFFE10 0x00001000
mww 0xFFFFFE14 0x00000050
mww 0xFFFFFE00 0x00000000
mww 0xFFFFFE04 0x000001A0

# 32-bit write, all ones
mww 0x10000000 0xffffffff

# read back in 32-, 16-, and 8-bit sizes
mdw 0x10000000
0x10000000: ffffffff # okay
mdh 0x10000000
0x10000000: f0ff  # ????
mdb 0x10000000
0x10000000: ff  # okay

# clear 32-bit word, set MSB all ones
mww 0x10000000 0x00000000
mwb 0x10000000 0xff

# read back in 32-, 16-, and 8-bit sizes
mdw 0x10000000
0x10000000: ff000000  # okay
mdh 0x10000000
0x10000000: f000  # ????
mdb 0x10000000
0x10000000: ff  # okay

# clear 32-bit word, set MSW all ones
mww 0x10000000 0x00000000
mwh 0x10000000 0xffff

# read back in 32-, 16-, and 8-bit sizes
mdw 0x10000000
0x10000000: f0ff0000 # ????
mdh 0x10000000
0x10000000: f0ff # ????
mdb 0x10000000
0x10000000: f0  # ????

Can anyone reproduce/confirm this problem?

Any suggestions on fix or workaround? How can I go about debugging this?

I believe there’s a bug in the endianness helper code. I’ve fixed that here in my local tree, just haven’t found a time to clean up the changes.

In src/helper/types.h the h_u16_to_le macro in the big-endian case, and the h_u16_to_be macro in the little-endian case are wrong, there’s an additional zero in the value used to mask the first byte.

Regards,

Dominic

Thanks Dominic, that fixed the issue.

I now have a working OpenOCD flash module for the TMS470. Shall I submit a patch to this forum or to you directly?

The OpenOCD development mailinglist is the best place for patches:

http://developer.berlios.de/mail/?group_id=4148

If you don’t want to register yourself there you could send me the patch directly: Dominic Rath gmx net

Regards,

Dominic