file not found SEGFAULT fix
[openocd.git] / src / target / arm926ejs.c
index ffa2b0d62f6554c457634be8cb9d508f65ecd8e0..110adee0404b43ffa2cf4df298bd11a840136ebc 100644 (file)
 #include "arm926ejs.h"
 #include "jtag.h"
 #include "log.h"
+#include "time_support.h"
 
 #include <stdlib.h>
 #include <string.h>
 
-#if 1
+#if 0
 #define _DEBUG_INSTRUCTION_EXECUTION_
 #endif
 
@@ -46,9 +47,9 @@ int arm926ejs_handle_read_cache_command(struct command_context_s *cmd_ctx, char
 int arm926ejs_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
 
 /* forward declarations */
-int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target);
+int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp);
 int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
-int arm926ejs_quit();
+int arm926ejs_quit(void);
 int arm926ejs_arch_state(struct target_s *target);
 int arm926ejs_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
 int arm926ejs_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
@@ -89,7 +90,7 @@ target_type_t arm926ejs_target =
        .remove_watchpoint = arm7_9_remove_watchpoint,
 
        .register_commands = arm926ejs_register_commands,
-       .target_command = arm926ejs_target_command,
+       .target_create = arm926ejs_target_create,
        .init_target = arm926ejs_init_target,
        .examine = arm9tdmi_examine,
        .quit = arm926ejs_quit,
@@ -561,7 +562,7 @@ int arm926ejs_arch_state(struct target_s *target)
                        "cpsr: 0x%8.8x pc: 0x%8.8x\n"
                        "MMU: %s, D-Cache: %s, I-Cache: %s",
                         armv4_5_state_strings[armv4_5->core_state],
-                        target_debug_reason_strings[target->debug_reason],
+                        Jim_Nvp_value2name_simple( nvp_target_debug_reason,target->debug_reason)->name,
                         armv4_5_mode_strings[armv4_5_mode_to_number(armv4_5->core_mode)],
                         buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32),
                         buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32),
@@ -579,11 +580,12 @@ int arm926ejs_soft_reset_halt(struct target_s *target)
        arm9tdmi_common_t *arm9tdmi = arm7_9->arch_info;
        arm926ejs_common_t *arm926ejs = arm9tdmi->arch_info;
        reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT];
-       int i;
        
        target_halt(target);
        
-       for (i=0; i<10; i++)
+       long long then=timeval_ms();
+       int timeout;
+       while (!(timeout=((timeval_ms()-then)>1000)))
        {
                if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0)
                {
@@ -593,10 +595,16 @@ int arm926ejs_soft_reset_halt(struct target_s *target)
                {
                        break;
                }
-               /* do not eat all CPU, time out after 1 se*/
-               usleep(100*1000);
+               if (debug_level>=1)
+               {
+                       /* do not eat all CPU, time out after 1 se*/
+                       alive_sleep(100);
+               } else
+               {
+                       keep_alive();
+               }
        }
-       if (i==10)
+       if (timeout)
        {
                LOG_ERROR("Failed to halt CPU after 1 sec");
                return ERROR_TARGET_TIMEOUT;
@@ -666,13 +674,13 @@ int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *ta
        
 }
 
-int arm926ejs_quit()
+int arm926ejs_quit(void)
 {
        
        return ERROR_OK;
 }
 
-int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, char *variant)
+int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, const char *variant)
 {
        arm9tdmi_common_t *arm9tdmi = &arm926ejs->arm9tdmi_common;
        arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common;
@@ -706,33 +714,14 @@ int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, in
        arm7_9->arm_bkpt = ARMV5_BKPT(0x0);
        arm7_9->thumb_bkpt = ARMV5_T_BKPT(0x0) & 0xffff;
        
-       arm7_9->sw_bkpts_use_wp = 0;
-       arm7_9->sw_bkpts_enabled = 1;
-       
        return ERROR_OK;
 }
 
-int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target)
+int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp)
 {
-       int chain_pos;
-       char *variant = NULL;
-       arm926ejs_common_t *arm926ejs = malloc(sizeof(arm926ejs_common_t));
-       memset(arm926ejs, 0, sizeof(*arm926ejs));
-       
-       if (argc < 4)
-       {
-               LOG_ERROR("'target arm926ejs' requires at least one additional argument");
-               exit(-1);
-       }
-       
-       chain_pos = strtoul(args[3], NULL, 0);
-       
-       if (argc >= 5)
-               variant = args[4];
-       
-       LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant);
+       arm926ejs_common_t *arm926ejs = calloc(1,sizeof(arm926ejs_common_t));
        
-       arm926ejs_init_arch_info(target, arm926ejs, chain_pos, variant);
+       arm926ejs_init_arch_info(target, arm926ejs, target->chain_position, target->variant);
 
        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)