1 // SPDX-License-Identifier: GPL-2.0-or-later
3 /***************************************************************************
4 * Copyright (C) 2007 by Dominic Rath *
5 * Dominic.Rath@gmx.de *
7 * Copyright (C) 2007,2008,2009 by Øyvind Harboe *
8 * oyvind.harboe@zylin.com *
9 ***************************************************************************/
15 #include "arm926ejs.h"
16 #include <helper/time_support.h>
17 #include "target_type.h"
19 #include "arm_opcodes.h"
23 * The ARM926 is built around the ARM9EJ-S core, and most JTAG docs
24 * are in the ARM9EJ-S Technical Reference Manual (ARM DDI 0222B) not
25 * the ARM926 manual (ARM DDI 0198E). The scan chains are:
27 * 1 ... core debugging
29 * 3 ... external boundary scan (SoC-specific, unused here)
31 * 15 ... coprocessor 15
35 #define _DEBUG_INSTRUCTION_EXECUTION_
38 #define ARM926EJS_CP15_ADDR(opcode_1, opcode_2, crn, crm) ((opcode_1 << 11) | (opcode_2 << 8) | (crn << 4) | (crm << 0))
40 static int arm926ejs_cp15_read(struct target
*target
, uint32_t op1
, uint32_t op2
,
41 uint32_t crn
, uint32_t crm
, uint32_t *value
)
43 int retval
= ERROR_OK
;
44 struct arm7_9_common
*arm7_9
= target_to_arm7_9(target
);
45 struct arm_jtag
*jtag_info
= &arm7_9
->jtag_info
;
46 uint32_t address
= ARM926EJS_CP15_ADDR(op1
, op2
, crn
, crm
);
47 struct scan_field fields
[4];
48 uint8_t address_buf
[2] = {0, 0};
52 buf_set_u32(address_buf
, 0, 14, address
);
54 retval
= arm_jtag_scann(jtag_info
, 0xf, TAP_IDLE
);
55 if (retval
!= ERROR_OK
)
57 retval
= arm_jtag_set_instr(jtag_info
->tap
, jtag_info
->intest_instr
, NULL
, TAP_IDLE
);
58 if (retval
!= ERROR_OK
)
61 fields
[0].num_bits
= 32;
62 fields
[0].out_value
= NULL
;
63 fields
[0].in_value
= (uint8_t *)value
;
65 fields
[1].num_bits
= 1;
66 fields
[1].out_value
= &access_t
;
67 fields
[1].in_value
= &access_t
;
69 fields
[2].num_bits
= 14;
70 fields
[2].out_value
= address_buf
;
71 fields
[2].in_value
= NULL
;
73 fields
[3].num_bits
= 1;
74 fields
[3].out_value
= &nr_w_buf
;
75 fields
[3].in_value
= NULL
;
77 jtag_add_dr_scan(jtag_info
->tap
, 4, fields
, TAP_IDLE
);
79 int64_t then
= timeval_ms();
82 /* rescan with NOP, to wait for the access to complete */
85 jtag_add_dr_scan(jtag_info
->tap
, 4, fields
, TAP_IDLE
);
87 jtag_add_callback(arm_le_to_h_u32
, (jtag_callback_data_t
)value
);
89 retval
= jtag_execute_queue();
90 if (retval
!= ERROR_OK
)
93 if (buf_get_u32(&access_t
, 0, 1) == 1)
97 if ((timeval_ms()-then
) > 10) {
98 LOG_ERROR("cp15 read operation timed out");
103 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
104 LOG_DEBUG("addr: 0x%x value: %8.8x", address
, *value
);
107 retval
= arm_jtag_set_instr(jtag_info
->tap
, 0xc, NULL
, TAP_IDLE
);
108 if (retval
!= ERROR_OK
)
114 static int arm926ejs_mrc(struct target
*target
, int cpnum
, uint32_t op1
,
115 uint32_t op2
, uint32_t crn
, uint32_t crm
, uint32_t *value
)
118 LOG_ERROR("Only cp15 is supported");
121 return arm926ejs_cp15_read(target
, op1
, op2
, crn
, crm
, value
);
124 static int arm926ejs_cp15_write(struct target
*target
, uint32_t op1
, uint32_t op2
,
125 uint32_t crn
, uint32_t crm
, uint32_t value
)
127 int retval
= ERROR_OK
;
128 struct arm7_9_common
*arm7_9
= target_to_arm7_9(target
);
129 struct arm_jtag
*jtag_info
= &arm7_9
->jtag_info
;
130 uint32_t address
= ARM926EJS_CP15_ADDR(op1
, op2
, crn
, crm
);
131 struct scan_field fields
[4];
132 uint8_t value_buf
[4];
133 uint8_t address_buf
[2] = {0, 0};
134 uint8_t nr_w_buf
= 1;
135 uint8_t access_t
= 1;
137 buf_set_u32(address_buf
, 0, 14, address
);
138 buf_set_u32(value_buf
, 0, 32, value
);
140 retval
= arm_jtag_scann(jtag_info
, 0xf, TAP_IDLE
);
141 if (retval
!= ERROR_OK
)
143 retval
= arm_jtag_set_instr(jtag_info
->tap
, jtag_info
->intest_instr
, NULL
, TAP_IDLE
);
144 if (retval
!= ERROR_OK
)
147 fields
[0].num_bits
= 32;
148 fields
[0].out_value
= value_buf
;
149 fields
[0].in_value
= NULL
;
151 fields
[1].num_bits
= 1;
152 fields
[1].out_value
= &access_t
;
153 fields
[1].in_value
= &access_t
;
155 fields
[2].num_bits
= 14;
156 fields
[2].out_value
= address_buf
;
157 fields
[2].in_value
= NULL
;
159 fields
[3].num_bits
= 1;
160 fields
[3].out_value
= &nr_w_buf
;
161 fields
[3].in_value
= NULL
;
163 jtag_add_dr_scan(jtag_info
->tap
, 4, fields
, TAP_IDLE
);
165 int64_t then
= timeval_ms();
168 /* rescan with NOP, to wait for the access to complete */
171 jtag_add_dr_scan(jtag_info
->tap
, 4, fields
, TAP_IDLE
);
172 retval
= jtag_execute_queue();
173 if (retval
!= ERROR_OK
)
176 if (buf_get_u32(&access_t
, 0, 1) == 1)
180 if ((timeval_ms()-then
) > 10) {
181 LOG_ERROR("cp15 write operation timed out");
186 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
187 LOG_DEBUG("addr: 0x%x value: %8.8x", address
, value
);
190 retval
= arm_jtag_set_instr(jtag_info
->tap
, 0xf, NULL
, TAP_IDLE
);
191 if (retval
!= ERROR_OK
)
197 static int arm926ejs_mcr(struct target
*target
, int cpnum
, uint32_t op1
,
198 uint32_t op2
, uint32_t crn
, uint32_t crm
, uint32_t value
)
201 LOG_ERROR("Only cp15 is supported");
204 return arm926ejs_cp15_write(target
, op1
, op2
, crn
, crm
, value
);
207 static int arm926ejs_examine_debug_reason(struct target
*target
)
209 struct arm7_9_common
*arm7_9
= target_to_arm7_9(target
);
210 struct reg
*dbg_stat
= &arm7_9
->eice_cache
->reg_list
[EICE_DBG_STAT
];
214 embeddedice_read_reg(dbg_stat
);
215 retval
= jtag_execute_queue();
216 if (retval
!= ERROR_OK
)
219 /* Method-Of-Entry (MOE) field */
220 debug_reason
= buf_get_u32(dbg_stat
->value
, 6, 4);
222 switch (debug_reason
) {
224 LOG_DEBUG("no *NEW* debug entry (?missed one?)");
225 /* ... since last restart or debug reset ... */
226 target
->debug_reason
= DBG_REASON_DBGRQ
;
229 LOG_DEBUG("breakpoint from EICE unit 0");
230 target
->debug_reason
= DBG_REASON_BREAKPOINT
;
233 LOG_DEBUG("breakpoint from EICE unit 1");
234 target
->debug_reason
= DBG_REASON_BREAKPOINT
;
237 LOG_DEBUG("soft breakpoint (BKPT instruction)");
238 target
->debug_reason
= DBG_REASON_BREAKPOINT
;
241 LOG_DEBUG("vector catch breakpoint");
242 target
->debug_reason
= DBG_REASON_BREAKPOINT
;
245 LOG_DEBUG("external breakpoint");
246 target
->debug_reason
= DBG_REASON_BREAKPOINT
;
249 LOG_DEBUG("watchpoint from EICE unit 0");
250 target
->debug_reason
= DBG_REASON_WATCHPOINT
;
253 LOG_DEBUG("watchpoint from EICE unit 1");
254 target
->debug_reason
= DBG_REASON_WATCHPOINT
;
257 LOG_DEBUG("external watchpoint");
258 target
->debug_reason
= DBG_REASON_WATCHPOINT
;
261 LOG_DEBUG("internal debug request");
262 target
->debug_reason
= DBG_REASON_DBGRQ
;
265 LOG_DEBUG("external debug request");
266 target
->debug_reason
= DBG_REASON_DBGRQ
;
269 LOG_DEBUG("debug re-entry from system speed access");
270 /* This is normal when connecting to something that's
271 * already halted, or in some related code paths, but
272 * otherwise is surprising (and presumably wrong).
274 switch (target
->debug_reason
) {
275 case DBG_REASON_DBGRQ
:
278 LOG_ERROR("unexpected -- debug re-entry");
280 case DBG_REASON_UNDEFINED
:
281 target
->debug_reason
= DBG_REASON_DBGRQ
;
286 /* FIX!!!! here be dragons!!! We need to fail here so
287 * the target will interpreted as halted but we won't
288 * try to talk to it right now... a resume + halt seems
289 * to sync things up again. Please send an email to
290 * openocd development mailing list if you have hardware
291 * to donate to look into this problem....
293 LOG_WARNING("WARNING: mystery debug reason MOE = 0xc. Try issuing a resume + halt.");
294 target
->debug_reason
= DBG_REASON_DBGRQ
;
297 LOG_WARNING("WARNING: unknown debug reason: 0x%x", debug_reason
);
298 /* Oh agony! should we interpret this as a halt request or
299 * that the target stopped on it's own accord?
301 target
->debug_reason
= DBG_REASON_DBGRQ
;
302 /* if we fail here, we won't talk to the target and it will
303 * be reported to be in the halted state */
310 static int arm926ejs_get_ttb(struct target
*target
, uint32_t *result
)
312 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
316 retval
= arm926ejs
->read_cp15(target
, 0, 0, 2, 0, &ttb
);
317 if (retval
!= ERROR_OK
)
325 static int arm926ejs_disable_mmu_caches(struct target
*target
, int mmu
,
326 int d_u_cache
, int i_cache
)
328 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
329 uint32_t cp15_control
;
332 /* read cp15 control register */
333 retval
= arm926ejs
->read_cp15(target
, 0, 0, 1, 0, &cp15_control
);
334 if (retval
!= ERROR_OK
)
336 retval
= jtag_execute_queue();
337 if (retval
!= ERROR_OK
)
342 retval
= arm926ejs
->write_cp15(target
, 0, 0, 8, 7, 0x0);
343 if (retval
!= ERROR_OK
)
346 cp15_control
&= ~0x1U
;
350 uint32_t debug_override
;
351 /* read-modify-write CP15 debug override register
352 * to enable "test and clean all" */
353 retval
= arm926ejs
->read_cp15(target
, 0, 0, 15, 0, &debug_override
);
354 if (retval
!= ERROR_OK
)
356 debug_override
|= 0x80000;
357 retval
= arm926ejs
->write_cp15(target
, 0, 0, 15, 0, debug_override
);
358 if (retval
!= ERROR_OK
)
361 /* clean and invalidate DCache */
362 retval
= arm926ejs
->write_cp15(target
, 0, 0, 7, 5, 0x0);
363 if (retval
!= ERROR_OK
)
366 /* write CP15 debug override register
367 * to disable "test and clean all" */
368 debug_override
&= ~0x80000;
369 retval
= arm926ejs
->write_cp15(target
, 0, 0, 15, 0, debug_override
);
370 if (retval
!= ERROR_OK
)
373 cp15_control
&= ~0x4U
;
377 /* invalidate ICache */
378 retval
= arm926ejs
->write_cp15(target
, 0, 0, 7, 5, 0x0);
379 if (retval
!= ERROR_OK
)
382 cp15_control
&= ~0x1000U
;
385 retval
= arm926ejs
->write_cp15(target
, 0, 0, 1, 0, cp15_control
);
389 static int arm926ejs_enable_mmu_caches(struct target
*target
, int mmu
,
390 int d_u_cache
, int i_cache
)
392 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
393 uint32_t cp15_control
;
396 /* read cp15 control register */
397 retval
= arm926ejs
->read_cp15(target
, 0, 0, 1, 0, &cp15_control
);
398 if (retval
!= ERROR_OK
)
400 retval
= jtag_execute_queue();
401 if (retval
!= ERROR_OK
)
405 cp15_control
|= 0x1U
;
408 cp15_control
|= 0x4U
;
411 cp15_control
|= 0x1000U
;
413 retval
= arm926ejs
->write_cp15(target
, 0, 0, 1, 0, cp15_control
);
417 static int arm926ejs_post_debug_entry(struct target
*target
)
419 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
422 /* examine cp15 control reg */
423 retval
= arm926ejs
->read_cp15(target
, 0, 0, 1, 0, &arm926ejs
->cp15_control_reg
);
424 if (retval
!= ERROR_OK
)
426 retval
= jtag_execute_queue();
427 if (retval
!= ERROR_OK
)
429 LOG_DEBUG("cp15_control_reg: %8.8" PRIx32
"", arm926ejs
->cp15_control_reg
);
431 if (arm926ejs
->armv4_5_mmu
.armv4_5_cache
.ctype
== -1) {
432 uint32_t cache_type_reg
;
433 /* identify caches */
434 retval
= arm926ejs
->read_cp15(target
, 0, 1, 0, 0, &cache_type_reg
);
435 if (retval
!= ERROR_OK
)
437 retval
= jtag_execute_queue();
438 if (retval
!= ERROR_OK
)
440 armv4_5_identify_cache(cache_type_reg
, &arm926ejs
->armv4_5_mmu
.armv4_5_cache
);
443 arm926ejs
->armv4_5_mmu
.mmu_enabled
= (arm926ejs
->cp15_control_reg
& 0x1U
) ? 1 : 0;
444 arm926ejs
->armv4_5_mmu
.armv4_5_cache
.d_u_cache_enabled
= (arm926ejs
->cp15_control_reg
& 0x4U
) ? 1 : 0;
445 arm926ejs
->armv4_5_mmu
.armv4_5_cache
.i_cache_enabled
= (arm926ejs
->cp15_control_reg
& 0x1000U
) ? 1 : 0;
447 /* save i/d fault status and address register */
448 retval
= arm926ejs
->read_cp15(target
, 0, 0, 5, 0, &arm926ejs
->d_fsr
);
449 if (retval
!= ERROR_OK
)
451 retval
= arm926ejs
->read_cp15(target
, 0, 1, 5, 0, &arm926ejs
->i_fsr
);
452 if (retval
!= ERROR_OK
)
454 retval
= arm926ejs
->read_cp15(target
, 0, 0, 6, 0, &arm926ejs
->d_far
);
455 if (retval
!= ERROR_OK
)
458 LOG_DEBUG("D FSR: 0x%8.8" PRIx32
", D FAR: 0x%8.8" PRIx32
", I FSR: 0x%8.8" PRIx32
"",
459 arm926ejs
->d_fsr
, arm926ejs
->d_far
, arm926ejs
->i_fsr
);
461 uint32_t cache_dbg_ctrl
;
463 /* read-modify-write CP15 cache debug control register
464 * to disable I/D-cache linefills and force WT */
465 retval
= arm926ejs
->read_cp15(target
, 7, 0, 15, 0, &cache_dbg_ctrl
);
466 if (retval
!= ERROR_OK
)
468 cache_dbg_ctrl
|= 0x7;
469 retval
= arm926ejs
->write_cp15(target
, 7, 0, 15, 0, cache_dbg_ctrl
);
473 static void arm926ejs_pre_restore_context(struct target
*target
)
475 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
477 /* restore i/d fault status and address register */
478 arm926ejs
->write_cp15(target
, 0, 0, 5, 0, arm926ejs
->d_fsr
);
479 arm926ejs
->write_cp15(target
, 0, 1, 5, 0, arm926ejs
->i_fsr
);
480 arm926ejs
->write_cp15(target
, 0, 0, 6, 0, arm926ejs
->d_far
);
482 uint32_t cache_dbg_ctrl
;
484 /* read-modify-write CP15 cache debug control register
485 * to reenable I/D-cache linefills and disable WT */
486 arm926ejs
->read_cp15(target
, 7, 0, 15, 0, &cache_dbg_ctrl
);
487 cache_dbg_ctrl
&= ~0x7;
488 arm926ejs
->write_cp15(target
, 7, 0, 15, 0, cache_dbg_ctrl
);
491 static const char arm926_not
[] = "target is not an ARM926";
493 static int arm926ejs_verify_pointer(struct command_invocation
*cmd
,
494 struct arm926ejs_common
*arm926
)
496 if (arm926
->common_magic
!= ARM926EJS_COMMON_MAGIC
) {
497 command_print(cmd
, arm926_not
);
498 return ERROR_TARGET_INVALID
;
503 /** Logs summary of ARM926 state for a halted target. */
504 int arm926ejs_arch_state(struct target
*target
)
506 static const char *state
[] = {
507 "disabled", "enabled"
510 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
512 if (arm926ejs
->common_magic
!= ARM926EJS_COMMON_MAGIC
) {
513 LOG_ERROR("BUG: %s", arm926_not
);
514 return ERROR_TARGET_INVALID
;
517 arm_arch_state(target
);
518 LOG_USER("MMU: %s, D-Cache: %s, I-Cache: %s",
519 state
[arm926ejs
->armv4_5_mmu
.mmu_enabled
],
520 state
[arm926ejs
->armv4_5_mmu
.armv4_5_cache
.d_u_cache_enabled
],
521 state
[arm926ejs
->armv4_5_mmu
.armv4_5_cache
.i_cache_enabled
]);
526 int arm926ejs_soft_reset_halt(struct target
*target
)
528 int retval
= ERROR_OK
;
529 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
530 struct arm7_9_common
*arm7_9
= target_to_arm7_9(target
);
531 struct arm
*arm
= &arm7_9
->arm
;
532 struct reg
*dbg_stat
= &arm7_9
->eice_cache
->reg_list
[EICE_DBG_STAT
];
534 retval
= target_halt(target
);
535 if (retval
!= ERROR_OK
)
538 int64_t then
= timeval_ms();
540 while (!(timeout
= ((timeval_ms()-then
) > 1000))) {
541 if (buf_get_u32(dbg_stat
->value
, EICE_DBG_STATUS_DBGACK
, 1) == 0) {
542 embeddedice_read_reg(dbg_stat
);
543 retval
= jtag_execute_queue();
544 if (retval
!= ERROR_OK
)
548 if (debug_level
>= 1) {
549 /* do not eat all CPU, time out after 1 se*/
555 LOG_ERROR("Failed to halt CPU after 1 sec");
556 return ERROR_TARGET_TIMEOUT
;
559 target
->state
= TARGET_HALTED
;
561 /* SVC, ARM state, IRQ and FIQ disabled */
564 cpsr
= buf_get_u32(arm
->cpsr
->value
, 0, 32);
567 arm_set_cpsr(arm
, cpsr
);
568 arm
->cpsr
->dirty
= true;
570 /* start fetching from 0x0 */
571 buf_set_u32(arm
->pc
->value
, 0, 32, 0x0);
572 arm
->pc
->dirty
= true;
573 arm
->pc
->valid
= true;
575 retval
= arm926ejs_disable_mmu_caches(target
, 1, 1, 1);
576 if (retval
!= ERROR_OK
)
578 arm926ejs
->armv4_5_mmu
.mmu_enabled
= 0;
579 arm926ejs
->armv4_5_mmu
.armv4_5_cache
.d_u_cache_enabled
= 0;
580 arm926ejs
->armv4_5_mmu
.armv4_5_cache
.i_cache_enabled
= 0;
582 return target_call_event_callbacks(target
, TARGET_EVENT_HALTED
);
585 /** Writes a buffer, in the specified word size, with current MMU settings. */
586 int arm926ejs_write_memory(struct target
*target
, target_addr_t address
,
587 uint32_t size
, uint32_t count
, const uint8_t *buffer
)
590 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
592 /* FIX!!!! this should be cleaned up and made much more general. The
593 * plan is to write up and test on arm926ejs specifically and
594 * then generalize and clean up afterwards.
597 * Also it should be moved to the callbacks that handle breakpoints
598 * specifically and not the generic memory write fn's. See XScale code.
600 if (arm926ejs
->armv4_5_mmu
.mmu_enabled
&& (count
== 1) && ((size
== 2) || (size
== 4))) {
601 /* special case the handling of single word writes to bypass MMU
602 * to allow implementation of breakpoints in memory marked read only
604 if (arm926ejs
->armv4_5_mmu
.armv4_5_cache
.d_u_cache_enabled
) {
605 /* flush and invalidate data cache
607 * MCR p15,0,p,c7,c10,1 - clean cache line using virtual address
610 retval
= arm926ejs
->write_cp15(target
, 0, 1, 7, 10, address
&~0x3);
611 if (retval
!= ERROR_OK
)
616 retval
= target
->type
->virt2phys(target
, address
, &pa
);
617 if (retval
!= ERROR_OK
)
620 /* write directly to physical memory bypassing any read only MMU bits, etc. */
621 retval
= armv4_5_mmu_write_physical(target
, &arm926ejs
->armv4_5_mmu
, pa
, size
, count
, buffer
);
622 if (retval
!= ERROR_OK
)
625 retval
= arm7_9_write_memory(target
, address
, size
, count
, buffer
);
626 if (retval
!= ERROR_OK
)
630 /* If ICache is enabled, we have to invalidate affected ICache lines
631 * the DCache is forced to write-through, so we don't have to clean it here
633 if (arm926ejs
->armv4_5_mmu
.armv4_5_cache
.i_cache_enabled
) {
635 /* invalidate ICache single entry with MVA */
636 arm926ejs
->write_cp15(target
, 0, 1, 7, 5, address
);
638 /* invalidate ICache */
639 arm926ejs
->write_cp15(target
, 0, 0, 7, 5, address
);
646 static int arm926ejs_write_phys_memory(struct target
*target
,
647 target_addr_t address
, uint32_t size
,
648 uint32_t count
, const uint8_t *buffer
)
650 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
652 return armv4_5_mmu_write_physical(target
, &arm926ejs
->armv4_5_mmu
,
653 address
, size
, count
, buffer
);
656 static int arm926ejs_read_phys_memory(struct target
*target
,
657 target_addr_t address
, uint32_t size
,
658 uint32_t count
, uint8_t *buffer
)
660 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
662 return armv4_5_mmu_read_physical(target
, &arm926ejs
->armv4_5_mmu
,
663 address
, size
, count
, buffer
);
666 int arm926ejs_init_arch_info(struct target
*target
, struct arm926ejs_common
*arm926ejs
,
667 struct jtag_tap
*tap
)
669 struct arm7_9_common
*arm7_9
= &arm926ejs
->arm7_9_common
;
671 arm7_9
->arm
.mrc
= arm926ejs_mrc
;
672 arm7_9
->arm
.mcr
= arm926ejs_mcr
;
674 /* initialize arm7/arm9 specific info (including armv4_5) */
675 arm9tdmi_init_arch_info(target
, arm7_9
, tap
);
677 arm926ejs
->common_magic
= ARM926EJS_COMMON_MAGIC
;
679 arm7_9
->post_debug_entry
= arm926ejs_post_debug_entry
;
680 arm7_9
->pre_restore_context
= arm926ejs_pre_restore_context
;
681 arm7_9
->write_memory
= arm926ejs_write_memory
;
683 arm926ejs
->read_cp15
= arm926ejs_cp15_read
;
684 arm926ejs
->write_cp15
= arm926ejs_cp15_write
;
685 arm926ejs
->armv4_5_mmu
.armv4_5_cache
.ctype
= -1;
686 arm926ejs
->armv4_5_mmu
.get_ttb
= arm926ejs_get_ttb
;
687 arm926ejs
->armv4_5_mmu
.read_memory
= arm7_9_read_memory
;
688 arm926ejs
->armv4_5_mmu
.write_memory
= arm7_9_write_memory
;
689 arm926ejs
->armv4_5_mmu
.disable_mmu_caches
= arm926ejs_disable_mmu_caches
;
690 arm926ejs
->armv4_5_mmu
.enable_mmu_caches
= arm926ejs_enable_mmu_caches
;
691 arm926ejs
->armv4_5_mmu
.has_tiny_pages
= 1;
692 arm926ejs
->armv4_5_mmu
.mmu_enabled
= 0;
694 arm7_9
->examine_debug_reason
= arm926ejs_examine_debug_reason
;
696 /* The ARM926EJ-S implements the ARMv5TE architecture which
697 * has the BKPT instruction, so we don't have to use a watchpoint comparator
699 arm7_9
->arm_bkpt
= ARMV5_BKPT(0x0);
700 arm7_9
->thumb_bkpt
= ARMV5_T_BKPT(0x0) & 0xffff;
705 static int arm926ejs_target_create(struct target
*target
, Jim_Interp
*interp
)
707 struct arm926ejs_common
*arm926ejs
= calloc(1, sizeof(struct arm926ejs_common
));
709 /* ARM9EJ-S core always reports 0x1 in Capture-IR */
710 target
->tap
->ir_capture_mask
= 0x0f;
712 return arm926ejs_init_arch_info(target
, arm926ejs
, target
->tap
);
715 static void arm926ejs_deinit_target(struct target
*target
)
717 struct arm
*arm
= target_to_arm(target
);
718 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
720 arm7_9_deinit(target
);
721 arm_free_reg_cache(arm
);
725 COMMAND_HANDLER(arm926ejs_handle_cache_info_command
)
728 struct target
*target
= get_current_target(CMD_CTX
);
729 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
731 retval
= arm926ejs_verify_pointer(CMD
, arm926ejs
);
732 if (retval
!= ERROR_OK
)
735 return armv4_5_handle_cache_info_command(CMD
, &arm926ejs
->armv4_5_mmu
.armv4_5_cache
);
738 static int arm926ejs_virt2phys(struct target
*target
, target_addr_t
virtual, target_addr_t
*physical
)
741 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
744 int retval
= armv4_5_mmu_translate_va(target
, &arm926ejs
->armv4_5_mmu
,
746 if (retval
!= ERROR_OK
)
752 static int arm926ejs_mmu(struct target
*target
, int *enabled
)
754 struct arm926ejs_common
*arm926ejs
= target_to_arm926(target
);
756 if (target
->state
!= TARGET_HALTED
) {
757 LOG_TARGET_ERROR(target
, "not halted");
758 return ERROR_TARGET_NOT_HALTED
;
760 *enabled
= arm926ejs
->armv4_5_mmu
.mmu_enabled
;
764 static const struct command_registration arm926ejs_exec_command_handlers
[] = {
766 .name
= "cache_info",
767 .handler
= arm926ejs_handle_cache_info_command
,
768 .mode
= COMMAND_EXEC
,
770 .help
= "display information about target caches",
773 COMMAND_REGISTRATION_DONE
775 const struct command_registration arm926ejs_command_handlers
[] = {
777 .chain
= arm9tdmi_command_handlers
,
782 .help
= "arm926ejs command group",
784 .chain
= arm926ejs_exec_command_handlers
,
786 COMMAND_REGISTRATION_DONE
789 /** Holds methods for ARM926 targets. */
790 struct target_type arm926ejs_target
= {
794 .arch_state
= arm926ejs_arch_state
,
796 .target_request_data
= arm7_9_target_request_data
,
799 .resume
= arm7_9_resume
,
802 .assert_reset
= arm7_9_assert_reset
,
803 .deassert_reset
= arm7_9_deassert_reset
,
804 .soft_reset_halt
= arm926ejs_soft_reset_halt
,
806 .get_gdb_arch
= arm_get_gdb_arch
,
807 .get_gdb_reg_list
= arm_get_gdb_reg_list
,
809 .read_memory
= arm7_9_read_memory
,
810 .write_memory
= arm7_9_write_memory_opt
,
812 .checksum_memory
= arm_checksum_memory
,
813 .blank_check_memory
= arm_blank_check_memory
,
815 .run_algorithm
= armv4_5_run_algorithm
,
817 .add_breakpoint
= arm7_9_add_breakpoint
,
818 .remove_breakpoint
= arm7_9_remove_breakpoint
,
819 .add_watchpoint
= arm7_9_add_watchpoint
,
820 .remove_watchpoint
= arm7_9_remove_watchpoint
,
822 .commands
= arm926ejs_command_handlers
,
823 .target_create
= arm926ejs_target_create
,
824 .init_target
= arm9tdmi_init_target
,
825 .deinit_target
= arm926ejs_deinit_target
,
826 .examine
= arm7_9_examine
,
827 .check_reset
= arm7_9_check_reset
,
828 .virt2phys
= arm926ejs_virt2phys
,
829 .mmu
= arm926ejs_mmu
,
831 .read_phys_memory
= arm926ejs_read_phys_memory
,
832 .write_phys_memory
= arm926ejs_write_phys_memory
,
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)