FLASH/NOR: Remove useless file stellaris.h
[openocd.git] / src / target / armv7a.c
1 /***************************************************************************
2 * Copyright (C) 2009 by David Brownell *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include <helper/replacements.h>
24
25 #include "armv7a.h"
26 #include "arm_disassembler.h"
27
28 #include "register.h"
29 #include <helper/binarybuffer.h>
30 #include <helper/command.h>
31
32 #include <stdlib.h>
33 #include <string.h>
34 #include <unistd.h>
35
36 #include "arm_opcodes.h"
37
38
39 static void armv7a_show_fault_registers(struct target *target)
40 {
41 uint32_t dfsr, ifsr, dfar, ifar;
42 struct armv7a_common *armv7a = target_to_armv7a(target);
43 struct arm_dpm *dpm = armv7a->armv4_5_common.dpm;
44 int retval;
45
46 retval = dpm->prepare(dpm);
47 if (retval != ERROR_OK)
48 return;
49
50 /* ARMV4_5_MRC(cpnum, op1, r0, CRn, CRm, op2) */
51
52 /* c5/c0 - {data, instruction} fault status registers */
53 retval = dpm->instr_read_data_r0(dpm,
54 ARMV4_5_MRC(15, 0, 0, 5, 0, 0),
55 &dfsr);
56 if (retval != ERROR_OK)
57 goto done;
58
59 retval = dpm->instr_read_data_r0(dpm,
60 ARMV4_5_MRC(15, 0, 0, 5, 0, 1),
61 &ifsr);
62 if (retval != ERROR_OK)
63 goto done;
64
65 /* c6/c0 - {data, instruction} fault address registers */
66 retval = dpm->instr_read_data_r0(dpm,
67 ARMV4_5_MRC(15, 0, 0, 6, 0, 0),
68 &dfar);
69 if (retval != ERROR_OK)
70 goto done;
71
72 retval = dpm->instr_read_data_r0(dpm,
73 ARMV4_5_MRC(15, 0, 0, 6, 0, 2),
74 &ifar);
75 if (retval != ERROR_OK)
76 goto done;
77
78 LOG_USER("Data fault registers DFSR: %8.8" PRIx32
79 ", DFAR: %8.8" PRIx32, dfsr, dfar);
80 LOG_USER("Instruction fault registers IFSR: %8.8" PRIx32
81 ", IFAR: %8.8" PRIx32, ifsr, ifar);
82
83 done:
84 /* (void) */ dpm->finish(dpm);
85 }
86
87 int armv7a_arch_state(struct target *target)
88 {
89 static const char *state[] =
90 {
91 "disabled", "enabled"
92 };
93
94 struct armv7a_common *armv7a = target_to_armv7a(target);
95 struct arm *armv4_5 = &armv7a->armv4_5_common;
96
97 if (armv7a->common_magic != ARMV7_COMMON_MAGIC)
98 {
99 LOG_ERROR("BUG: called for a non-ARMv7A target");
100 return ERROR_INVALID_ARGUMENTS;
101 }
102
103 arm_arch_state(target);
104
105 LOG_USER("MMU: %s, D-Cache: %s, I-Cache: %s",
106 state[armv7a->armv4_5_mmu.mmu_enabled],
107 state[armv7a->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled],
108 state[armv7a->armv4_5_mmu.armv4_5_cache.i_cache_enabled]);
109
110 if (armv4_5->core_mode == ARM_MODE_ABT)
111 armv7a_show_fault_registers(target);
112 if (target->debug_reason == DBG_REASON_WATCHPOINT)
113 LOG_USER("Watchpoint triggered at PC %#08x",
114 (unsigned) armv7a->dpm.wp_pc);
115
116 return ERROR_OK;
117 }
118
119
120 const struct command_registration armv7a_command_handlers[] = {
121 {
122 .chain = dap_command_handlers,
123 },
124 COMMAND_REGISTRATION_DONE
125 };
126

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)