removed a couple of exit()'s from error handling.
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 19 Aug 2008 09:31:51 +0000 (09:31 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 19 Aug 2008 09:31:51 +0000 (09:31 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@932 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/arm11.c
src/target/arm11_dbgtap.c

index cc584c382e294efe93a0f4ee9ba78ec692b92914..59b6c4fe7c85032515b3da368ffe7ebf5558e46d 100644 (file)
@@ -1,5 +1,7 @@
 /***************************************************************************
  *   Copyright (C) 2008 digenius technology GmbH.                          *
+ *   
+ *   Copyright (C) 2008 Oyvind Harboe oyvind.harboe@zylin.com              *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -1237,7 +1239,7 @@ int arm11_write_memory(struct target_s *target, u32 address, u32 size, u32 count
                LOG_ERROR("use 'arm11 memwrite burst disable' to disable fast burst mode");
 
            if (arm11_config_memwrite_error_fatal)
-               exit(-1);
+               return ERROR_FAIL;
        }
     }
 #endif
@@ -1349,8 +1351,7 @@ int arm11_target_command(struct command_context_s *cmd_ctx, char *cmd, char **ar
 
     if (argc < 4)
     {
-       LOG_ERROR("'target arm11' 4th argument <jtag chain pos>");
-       exit(-1);
+       return ERROR_COMMAND_SYNTAX_ERROR;
     }
 
     int chain_pos = strtoul(args[3], NULL, 0);
@@ -1369,8 +1370,8 @@ int arm11_target_command(struct command_context_s *cmd_ctx, char *cmd, char **ar
 
     if (device->ir_length != 5)
     {
-       LOG_ERROR("'target arm11' expects 'jtag_device 5 0x01 0x1F 0x1E'");
-       exit(-1);
+               LOG_ERROR("'target arm11' expects 'jtag_device 5 0x01 0x1F 0x1E'");
+               return ERROR_COMMAND_SYNTAX_ERROR;
     }
 
     target->arch_info = arm11;
@@ -1424,8 +1425,8 @@ int arm11_examine(struct target_s *target)
     case 0x07B76000:   LOG_INFO("found ARM1176"); break;
     default:
     {
-       LOG_ERROR("'target arm11' expects IDCODE 0x*7B*7****");
-       exit(-1);
+               LOG_ERROR("'target arm11' expects IDCODE 0x*7B*7****");
+               return ERROR_FAIL;
     }
     }
 
@@ -1435,7 +1436,7 @@ int arm11_examine(struct target_s *target)
        arm11->debug_version != ARM11_DEBUG_V61)
     {
        LOG_ERROR("Only ARMv6 v6 and v6.1 architectures supported.");
-       exit(-1);
+       return ERROR_FAIL;
     }
 
 
@@ -1543,7 +1544,7 @@ void arm11_build_reg_cache(target_t *target)
        ARM11_REGCACHE_COUNT != asizeof(arm11_reg_defs) ||
        ARM11_REGCACHE_COUNT != ARM11_RC_MAX)
     {
-       LOG_ERROR("arm11->reg_values inconsistent (%d " ZU " " ZU " %d)", ARM11_REGCACHE_COUNT, asizeof(arm11->reg_values), asizeof(arm11_reg_defs), ARM11_RC_MAX);
+       LOG_ERROR("BUG: arm11->reg_values inconsistent (%d " ZU " " ZU " %d)", ARM11_REGCACHE_COUNT, asizeof(arm11->reg_values), asizeof(arm11_reg_defs), ARM11_RC_MAX);
        exit(-1);
     }
 
index 3513e5997ece7720e8d5e9b93cba05f00b292432..bef62f9a875fcde6eb1c3fe3d6339d03a86db91c 100644 (file)
@@ -1,6 +1,8 @@
 /***************************************************************************
  *   Copyright (C) 2008 digenius technology GmbH.                          *
  *                                                                         *
+ *   Copyright (C) 2008 Oyvind Harboe oyvind.harboe@zylin.com              *
+ *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
@@ -129,7 +131,7 @@ static int arm11_in_handler_SCAN_N(u8 *in_value, void *priv, struct scan_field_s
     if (v != 0x10)
     {
         LOG_ERROR("'arm11 target' JTAG communication error SCREG SCAN OUT 0x%02x (expected 0x10)", v);
-        exit(-1);
+        return ERROR_FAIL;
     }
 
     JTAG_DEBUG("SCREG SCAN OUT 0x%02x", v);