Skip to content

Commit fa00da3

Browse files
arc: Workaround the ARC 600 problem with DEBUG.RA bit
It has been found that in ARC 600 (at least in AXS101) writing RA | IS | SS will not step instruction, as expected - RA bit mustn't be set. This problem doesn't happen on other cores or because of other bits in DEBUG. RA is set by the processor itself and since OpenOCD does read-modify-write of register when stepping, it is required to explicitly disable RA while stepping. Signed-off-by: Anton Kolesov <[email protected]>
1 parent a6157c3 commit fa00da3

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/target/arc32.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ int arc32_config_step(struct target *target, int enable_step)
394394
LOG_DEBUG("ARC600 extra single step bit to set.");
395395
}
396396

397+
if (arc32->on_step_reset_debug_ra) {
398+
LOG_DEBUG("Resetting DEBUG.RA bit.");
399+
value &= ~SET_CORE_RESET_APPLIED; /* Reset the RA bit. */
400+
}
401+
397402
CHECK_RETVAL(arc_jtag_write_aux_reg_one(&arc32->jtag_info, AUX_DEBUG_REG,
398403
value));
399404
LOG_DEBUG("core debug step mode enabled [debug-reg:0x%08" PRIx32 "]", value);

src/target/arc32.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ struct arc32_common {
146146
/* Whether DEBUG.SS bit is present. This is a unique feature of ARC 600. */
147147
bool has_debug_ss;
148148

149+
/* Workaround for a problem with ARC 600 - writing RA | IS | SS will not
150+
* step an instruction - it must be only a (IS | SS). However RA is set by
151+
* the processor itself and since OpenOCD does read-modify-write of DEBUG
152+
* register when stepping, it is required to explicitly disable RA before
153+
* stepping. */
154+
bool on_step_reset_debug_ra;
155+
149156
/* CCM memory regions (optional). */
150157
arc32_address_t iccm0_start;
151158
arc32_address_t iccm0_end;

src/target/arc_ocd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ int arc_ocd_arc600_target_create(struct target *target, Jim_Interp *interp)
160160
struct arc_common *arc = calloc(1, sizeof(struct arc_common));
161161

162162
arc->arc32.has_debug_ss = true;
163+
arc->arc32.on_step_reset_debug_ra = true;
163164

164165
CHECK_RETVAL(arc_ocd_init_arch_info(target, arc, target->tap));
165166

0 commit comments

Comments
 (0)