- change signature for adi_jtag_dp_scan and adi_jtag_dp_scan_u32 to use swjdp_common_...
[openocd.git] / src / target / arm11.c
index 1ac952da9cd2d7c6c3fd5384c0c30ebf084fb605..e4f53f1a7fc533e502efd7d5902e380c5b86e317 100644 (file)
@@ -1,5 +1,6 @@
 /***************************************************************************
  *   Copyright (C) 2008 digenius technology GmbH.                          *
+ *   Michael Bruck                                                         *
  *                                                                         *
  *   Copyright (C) 2008 Oyvind Harboe oyvind.harboe@zylin.com              *
  *                                                                         *
 #endif
 
 #include "arm11.h"
-#include "jtag.h"
-#include "log.h"
+#include "target_type.h"
 
-#include <stdlib.h>
-#include <string.h>
 
 #if 0
 #define _DEBUG_INSTRUCTION_EXECUTION_
@@ -340,7 +338,9 @@ int arm11_check_init(arm11_common_t * arm11, u32 * dscr)
                if (*dscr & ARM11_DSCR_CORE_HALTED)
                {
                        /** \todo TODO: this needs further scrutiny because
-                         * arm11_on_enter_debug_state() never gets properly called
+                         * arm11_on_enter_debug_state() never gets properly called.
+                         * As a result we don't read the actual register states from
+                         * the target.
                          */
 
                        arm11->target->state    = TARGET_HALTED;
@@ -393,8 +393,8 @@ static int arm11_on_enter_debug_state(arm11_common_t * arm11)
                scan_field_t    chain5_fields[3];
 
                arm11_setup_field(arm11, 32, NULL, &R(WDTR),    chain5_fields + 0);
-               arm11_setup_field(arm11,  1, NULL, NULL,        chain5_fields + 1);
-               arm11_setup_field(arm11,  1, NULL, NULL,        chain5_fields + 2);
+               arm11_setup_field(arm11,  1, NULL, NULL,                chain5_fields + 1);
+               arm11_setup_field(arm11,  1, NULL, NULL,                chain5_fields + 2);
 
                arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE);
        }
@@ -683,7 +683,7 @@ int arm11_poll(struct target_s *target)
                        enum target_state old_state = target->state;
 
                        LOG_DEBUG("enter TARGET_HALTED");
-                       target->state           = TARGET_HALTED;
+                       target->state                   = TARGET_HALTED;
                        target->debug_reason    = arm11_get_DSCR_debug_reason(dscr);
                        arm11_on_enter_debug_state(arm11);
 
@@ -696,7 +696,7 @@ int arm11_poll(struct target_s *target)
                if (target->state != TARGET_RUNNING && target->state != TARGET_DEBUG_RUNNING)
                {
                        LOG_DEBUG("enter TARGET_RUNNING");
-                       target->state           = TARGET_RUNNING;
+                       target->state                   = TARGET_RUNNING;
                        target->debug_reason    = DBG_REASON_NOTHALTED;
                }
        }
@@ -1373,7 +1373,6 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
                        int timeout_ms, void *arch_info)
 {
                arm11_common_t *arm11 = target->arch_info;
-       armv4_5_algorithm_t *arm11_algorithm_info = arch_info;
 //     enum armv4_5_state core_state = arm11->core_state;
 //     enum armv4_5_mode core_mode = arm11->core_mode;
        u32 context[16];
@@ -1382,11 +1381,6 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
        int retval = ERROR_OK;
                LOG_DEBUG("Running algorithm");
 
-       if (arm11_algorithm_info->common_magic != ARMV4_5_COMMON_MAGIC)
-       {
-               LOG_ERROR("current target isn't an ARMV4/5 target");
-               return ERROR_TARGET_INVALID;
-       }
 
        if (target->state != TARGET_HALTED)
        {
@@ -1445,6 +1439,12 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
                exit(-1);
        }
 */
+
+
+/* arm11 at this point only supports ARM not THUMB mode
+   however if this test needs to be reactivated the current state can be read back
+   from CPSR */
+#if 0
        if (arm11_algorithm_info->core_mode != ARMV4_5_MODE_ANY)
        {
                LOG_DEBUG("setting core_mode: 0x%2.2x", arm11_algorithm_info->core_mode);
@@ -1452,6 +1452,7 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
                arm11->reg_list[ARM11_RC_CPSR].dirty = 1;
                arm11->reg_list[ARM11_RC_CPSR].valid = 1;
        }
+#endif
 
        if ((retval = breakpoint_add(target, exit_point, exit_breakpoint_size, BKPT_HARD)) != ERROR_OK)
        {
@@ -1539,12 +1540,6 @@ int arm11_target_create(struct target_s *target, Jim_Interp *interp)
 
        arm11->target = target;
 
-       /* prepare JTAG information for the new target */
-       arm11->jtag_info.tap    = target->tap;
-       arm11->jtag_info.scann_size     = 5;
-
-       CHECK_RETVAL(arm_jtag_setup_connection(&arm11->jtag_info));
-
        if (target->tap==NULL)
                return ERROR_FAIL;
 
@@ -1637,7 +1632,7 @@ int arm11_examine(struct target_s *target)
 
        arm11_check_init(arm11, NULL);
 
-       target->type->examined = 1;
+       target_set_examined(target);
 
        return ERROR_OK;
 }
@@ -1853,7 +1848,7 @@ arm11_common_t * arm11_find_target(const char * arg)
                        continue;
 
                /* if (t->type == arm11_target) */
-               if (0 == strcmp(t->type->name, "arm11"))
+               if (0 == strcmp(target_get_name(t), "arm11"))
                        return t->arch_info;
        }
 
@@ -1960,7 +1955,7 @@ int arm11_register_commands(struct command_context_s *cmd_ctx)
 
                RC_FINAL_BOOL(  "error_fatal",                  "Terminate program if transfer error was found (default: enabled)",
                                                memwrite_error_fatal)
-       )
+       ) /* memwrite */
 
        RC_FINAL_BOOL(          "no_increment",                 "Don't increment address on multi-read/-write (default: disabled)",
                                                memrw_no_increment)
@@ -1976,7 +1971,7 @@ int arm11_register_commands(struct command_context_s *cmd_ctx)
 
        RC_FINAL(                       "mcr",                                  "Write Coprocessor register",
                                                arm11_handle_mcr)
-       )
+       ) /* arm11 */
 
        return ERROR_OK;
 }

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)