Hi All,
Since the BerliOS help forum page doesn’t seem to be very active, or current, I’ll ask this here. If I should be asking this elsewhere, please let me know.
I am using an arm926ejs device with OpenOCD. I need a way to write a register value through the telnet interface.
Quick way to see the issue. Open a telnet connection to OpenOCD (I am using SVN rev 725) and type:
armv4_5 reg
r0: 40038008 r0: 40038008 r0: 40038008 r0: 40038008
[snip]
arm7_9 write_core_reg 0 19 0
armv4_5 reg
r0: 40038008 r0: 40038008 r0: 40038008 r0: 40038008
[snip]
At first, it didn’t look like “arm7_9 write_core_reg 0 19 0” was working to write r0 = 0. After playing with it for a while, it simply appears that the register cache is not invalidated so the actual processor registers and what is seen through OpenOCD differ. I also notice that changing register values through the GDB interface doesn’t seem to refresh properly either.
After poking around in the code a few minutes, I made a stab at a fix:
Index: arm7_9_common.c
===================================================================
— arm7_9_common.c (revision 725)
+++ arm7_9_common.c (working copy)
@@ -1753,6 +1753,7 @@
u32 reg[16];
armv4_5_common_t *armv4_5 = target->arch_info;
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
- int retval;
if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
return ERROR_FAIL;
@@ -1806,7 +1807,13 @@
arm7_9->write_xpsr_im8(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 8) & ~0x20, 0, 0);
}
- return jtag_execute_queue();
-
if ((retval = jtag_execute_queue()) != ERROR_OK) {
-
LOG_ERROR(“JTAG error while writing core register”);
-
return retval;
-
}
-
/* registers are now invalid */
-
return armv4_5_invalidate_core_regs(target);
}
int arm7_9_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer)
Ok, so this is just the most recent try at a fix. I also tried calling jtag_execute_queue() before returning, but to no avail. With this patch in place, “armv4_5 reg” hangs after writing write_core_reg has been called. Eventually OpenOCD exits saying:
ftdi_write_data: usb bulk write failed
couldn’t write MPSSE commands to FT2232
I’m quite certain I am not properly invalidating the core registers, but have run out of time to play with it. Does anyone have a proper fix for this issue?
Cheers,
James Pellow