summaryrefslogtreecommitdiff
path: root/src/target/mips_ejtag.c
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 04:14:18 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 04:14:18 +0000
commitc6e80f63a3955baed6666e966ab1dd3950ea91b8 (patch)
tree7bd6ae47e80c42ef6699d8043e60108be5a03f32 /src/target/mips_ejtag.c
parenta351c57261d37d73d9e9942063e34e8fe5202380 (diff)
downloadopenocd+libswd-c6e80f63a3955baed6666e966ab1dd3950ea91b8.tar.gz
openocd+libswd-c6e80f63a3955baed6666e966ab1dd3950ea91b8.tar.bz2
openocd+libswd-c6e80f63a3955baed6666e966ab1dd3950ea91b8.tar.xz
openocd+libswd-c6e80f63a3955baed6666e966ab1dd3950ea91b8.zip
David Claffey <dnclaffey@gmail.com>:
This patch helps fix MIPS big endian (elf32-tradbigmips) targets. If "-endian big" is not set in target create, the endianess defaults to little. mw and md commands will still work, but binary file loads will have the incorrect word order loaded into memory. The EJTAG processor access data register (PrAcc) is little endian regardless of the CPU endianness; it is always loaded LSB first. This is confirmed by the fact that mips_ejtag_drscan_32() uses buf_set_u32() to load the scan field; buf_set_u32() is a little-endian formatter. For big endian targets, data buffers have to be modified so the LSB of each u32 or u16 is at the lower (first) memory location. If the drscan out_value word order is set using buf_set_u32() then it makes sense to also fixup the in_value with buf_get_u32(); a symmetry argument. This has no affect on little endian hosts. git-svn-id: svn://svn.berlios.de/openocd/trunk@2219 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target/mips_ejtag.c')
-rw-r--r--src/target/mips_ejtag.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c
index 2394b00c..4c8010b5 100644
--- a/src/target/mips_ejtag.c
+++ b/src/target/mips_ejtag.c
@@ -118,7 +118,7 @@ int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, u32 *data)
if (tap==NULL)
return ERROR_FAIL;
scan_field_t field;
- u8 t[4];
+ u8 t[4], r[4];
int retval;
field.tap = tap;
@@ -126,7 +126,7 @@ int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, u32 *data)
field.out_value = t;
buf_set_u32(field.out_value, 0, field.num_bits, *data);
- field.in_value = (u8*)data;
+ field.in_value = r;
@@ -139,6 +139,8 @@ int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, u32 *data)
return retval;
}
+ *data = buf_get_u32(field.in_value, 0, 32);
+
keep_alive();
return ERROR_OK;