From: David B. <dbr...@us...> - 2009-11-17 02:59:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via e722396890bdb07553959258c585853edfbb291c (commit) via 36a538c6d76c6a7483e6925c12669cd91807d918 (commit) via c5e00268365045a57354b53c63673990329e6d59 (commit) via 1d4a09c2ef22dc10ec8a40183b8dd1b1102af20d (commit) via 1f3e067b860927f18f88c5dbb11c7aefe22252a5 (commit) via 9d57f4d5a1bad5c5bd42df56f402413be828d915 (commit) via 6030f2ca03abcb934ce5b75be898ef74a0e89be0 (commit) from 47f2305229486f14eed948025c21c6ab73471d4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e722396890bdb07553959258c585853edfbb291c Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:58:58 2009 -0800 ARMv7-A: no exit() calls Also, switch integrity check over to the correct magic number, and remove duplicate v4/v5 #define. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 8b16336..fdaca31 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -187,10 +187,10 @@ int armv7a_arch_state(struct target *target) struct armv7a_common *armv7a = target_to_armv7a(target); struct armv4_5_common_s *armv4_5 = &armv7a->armv4_5_common; - if (armv4_5->common_magic != ARMV4_5_COMMON_MAGIC) + if (armv7a->common_magic != ARMV7_COMMON_MAGIC) { - LOG_ERROR("BUG: called for a non-ARMv4/5 target"); - exit(-1); + LOG_ERROR("BUG: called for a non-ARMv7A target"); + return ERROR_INVALID_ARGUMENTS; } LOG_USER("target halted in %s state due to %s, current mode: %s\n" diff --git a/src/target/armv7a.h b/src/target/armv7a.h index a4be9e2..4d29ef9 100644 --- a/src/target/armv7a.h +++ b/src/target/armv7a.h @@ -73,7 +73,6 @@ enum ARMV7A_SPSR_UND = 36 }; -#define ARMV4_5_COMMON_MAGIC 0x0A450A45 #define ARMV7_COMMON_MAGIC 0x0A450999 /* VA to PA translation operations opc2 values*/ commit 36a538c6d76c6a7483e6925c12669cd91807d918 Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:57:12 2009 -0800 Cortex-A8: no exit() calls, add missing v7-A init Eventually there should be a v7a init routine, but for now all that is inlined here. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index f099be9..f4b5550 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -984,7 +984,7 @@ static int cortex_a8_set_breakpoint(struct target *target, if (brp_i >= cortex_a8->brp_num) { LOG_ERROR("ERROR Can not find free Breakpoint Register Pair"); - exit(-1); + return ERROR_FAIL; } breakpoint->set = brp_i + 1; if (breakpoint->length == 2) @@ -1180,19 +1180,14 @@ static int cortex_a8_read_memory(struct target *target, uint32_t address, { struct armv7a_common *armv7a = target_to_armv7a(target); struct swjdp_common *swjdp = &armv7a->swjdp_info; - - int retval = ERROR_OK; - - /* sanitize arguments */ - if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + int retval = ERROR_INVALID_ARGUMENTS; /* cortex_a8 handles unaligned memory access */ // ??? dap_ap_select(swjdp, swjdp_memoryap); - switch (size) - { + if (count && buffer) { + switch (size) { case 4: retval = mem_ap_read_buf_u32(swjdp, buffer, 4 * count, address); break; @@ -1202,9 +1197,7 @@ static int cortex_a8_read_memory(struct target *target, uint32_t address, case 1: retval = mem_ap_read_buf_u8(swjdp, buffer, count, address); break; - default: - LOG_ERROR("BUG: we shouldn't get here"); - exit(-1); + } } return retval; @@ -1215,17 +1208,12 @@ int cortex_a8_write_memory(struct target *target, uint32_t address, { struct armv7a_common *armv7a = target_to_armv7a(target); struct swjdp_common *swjdp = &armv7a->swjdp_info; - - int retval; - - /* sanitize arguments */ - if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + int retval = ERROR_INVALID_ARGUMENTS; // ??? dap_ap_select(swjdp, swjdp_memoryap); - switch (size) - { + if (count && buffer) { + switch (size) { case 4: retval = mem_ap_write_buf_u32(swjdp, buffer, 4 * count, address); break; @@ -1235,12 +1223,10 @@ int cortex_a8_write_memory(struct target *target, uint32_t address, case 1: retval = mem_ap_write_buf_u8(swjdp, buffer, count, address); break; - default: - LOG_ERROR("BUG: we shouldn't get here"); - exit(-1); + } } - if (target->state == TARGET_HALTED) + if (retval == ERROR_OK && target->state == TARGET_HALTED) { /* The Cache handling will NOT work with MMU active, the wrong addresses will be invalidated */ /* invalidate I-Cache */ @@ -1453,19 +1439,18 @@ static int cortex_a8_init_target(struct command_context *cmd_ctx, int cortex_a8_init_arch_info(struct target *target, struct cortex_a8_common *cortex_a8, struct jtag_tap *tap) { - struct arm *armv4_5; - struct armv7a_common *armv7a; - - armv7a = &cortex_a8->armv7a_common; - armv4_5 = &armv7a->armv4_5_common; + struct armv7a_common *armv7a = &cortex_a8->armv7a_common; + struct arm *armv4_5 = &armv7a->armv4_5_common; struct swjdp_common *swjdp = &armv7a->swjdp_info; + /* REVISIT v7a setup should be in a v7a-specific routine */ + armv4_5_init_arch_info(target, armv4_5); + armv7a->common_magic = ARMV7_COMMON_MAGIC; + /* Setup struct cortex_a8_common */ cortex_a8->common_magic = CORTEX_A8_COMMON_MAGIC; armv4_5->arch_info = armv7a; - armv4_5_init_arch_info(target, armv4_5); - /* prepare JTAG information for the new target */ cortex_a8->jtag_info.tap = tap; cortex_a8->jtag_info.scann_size = 4; commit c5e00268365045a57354b53c63673990329e6d59 Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:55:49 2009 -0800 XScale: fewere exit() calls Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/xscale.c b/src/target/xscale.c index 9e93c02..e97e082 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -585,7 +585,7 @@ static int xscale_send(struct target *target, uint8_t *buffer, int count, int si break; default: LOG_ERROR("BUG: size neither 4, 2 nor 1"); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } jtag_add_dr_out(target->tap, 3, @@ -850,7 +850,7 @@ static int xscale_arch_state(struct target *target) if (armv4_5->common_magic != ARMV4_5_COMMON_MAGIC) { LOG_ERROR("BUG: called for a non-ARMv4/5 target"); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } LOG_USER("target halted in %s state due to %s, current mode: %s\n" @@ -1865,8 +1865,8 @@ static int xscale_read_memory(struct target *target, uint32_t address, *buffer++ = buf32[i] & 0xff; break; default: - LOG_ERROR("should never get here"); - exit(-1); + LOG_ERROR("invalid read size"); + return ERROR_INVALID_ARGUMENTS; } } commit 1d4a09c2ef22dc10ec8a40183b8dd1b1102af20d Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:55:30 2009 -0800 MIPS: no exit() calls Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/mips32.c b/src/target/mips32.c index 6ba433c..1315744 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -268,7 +268,7 @@ int mips32_arch_state(struct target *target) if (mips32->common_magic != MIPS32_COMMON_MAGIC) { LOG_ERROR("BUG: called for a non-MIPS32 target"); - exit(-1); + return ERROR_FAIL; } LOG_USER("target halted due to %s, pc: 0x%8.8" PRIx32 "", diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index d1d3481..864ede0 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -513,10 +513,9 @@ int mips_m4k_set_breakpoint(struct target *target, struct breakpoint *breakpoint bp_num++; if (bp_num >= mips32->num_inst_bpoints) { - LOG_DEBUG("ERROR Can not find free FP Comparator(bpid: %d)", + LOG_ERROR("Can not find free FP Comparator(bpid: %d)", breakpoint->unique_id ); - LOG_WARNING("ERROR Can not find free FP Comparator"); - exit(-1); + return ERROR_FAIL; } breakpoint->set = bp_num + 1; comparator_list[bp_num].used = 1; @@ -724,9 +723,8 @@ int mips_m4k_set_watchpoint(struct target *target, struct watchpoint *watchpoint wp_num++; if (wp_num >= mips32->num_data_bpoints) { - LOG_DEBUG("ERROR Can not find free FP Comparator"); - LOG_WARNING("ERROR Can not find free FP Comparator"); - exit(-1); + LOG_ERROR("Can not find free FP Comparator"); + return ERROR_FAIL; } if (watchpoint->length != 4) commit 1f3e067b860927f18f88c5dbb11c7aefe22252a5 Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:54:51 2009 -0800 ARMv7-M: no exit() calls Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 132b786..3b01fa9 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -424,13 +424,13 @@ int armv7m_run_algorithm(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } // regvalue = buf_get_u32(reg_params[i].value, 0, 32); @@ -487,13 +487,13 @@ int armv7m_run_algorithm(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32)); commit 9d57f4d5a1bad5c5bd42df56f402413be828d915 Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:52:50 2009 -0800 ARMv4/ARMv5: no exit() calls Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index b60b8b2..717c826 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -342,7 +342,7 @@ int armv4_5_arch_state(struct target *target) if (armv4_5->common_magic != ARMV4_5_COMMON_MAGIC) { LOG_ERROR("BUG: called for a non-ARMv4/5 target"); - exit(-1); + return ERROR_FAIL; } LOG_USER("target halted in %s state due to %s, current mode: %s\ncpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "", @@ -651,13 +651,13 @@ int armv4_5_run_algorithm_inner(struct target *target, int num_mem_params, struc if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } if ((retval = armv4_5_set_core_reg(reg, reg_params[i].value)) != ERROR_OK) @@ -674,7 +674,7 @@ int armv4_5_run_algorithm_inner(struct target *target, int num_mem_params, struc else { LOG_ERROR("BUG: can't execute algorithms when not in ARM or Thumb state"); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } if (armv4_5_algorithm_info->core_mode != ARMV4_5_MODE_ANY) @@ -724,13 +724,15 @@ int armv4_5_run_algorithm_inner(struct target *target, int num_mem_params, struc if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - exit(-1); + retval = ERROR_INVALID_ARGUMENTS; + continue; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - exit(-1); + retval = ERROR_INVALID_ARGUMENTS; + continue; } buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32)); commit 6030f2ca03abcb934ce5b75be898ef74a0e89be0 Author: David Brownell <dbr...@us...> Date: Mon Nov 16 17:51:55 2009 -0800 ARM11: fewer exit() calls Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11.c b/src/target/arm11.c index 4d9016f..f0ed85f 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -1665,13 +1665,13 @@ static int arm11_run_algorithm(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - exit(-1); + return ERROR_INVALID_ARGUMENTS; } arm11_set_reg(reg,reg_params[i].value); // printf("%i: Set %s =%08x\n", i, reg_params[i].reg_name,val); @@ -1750,13 +1750,15 @@ static int arm11_run_algorithm(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - exit(-1); + retval = ERROR_INVALID_ARGUMENTS; + goto del_breakpoint; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - exit(-1); + retval = ERROR_INVALID_ARGUMENTS; + goto del_breakpoint; } buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32)); ----------------------------------------------------------------------- Summary of changes: src/target/arm11.c | 10 ++++++---- src/target/armv4_5.c | 14 ++++++++------ src/target/armv7a.c | 6 +++--- src/target/armv7a.h | 1 - src/target/armv7m.c | 8 ++++---- src/target/cortex_a8.c | 47 ++++++++++++++++------------------------------- src/target/mips32.c | 2 +- src/target/mips_m4k.c | 10 ++++------ src/target/xscale.c | 8 ++++---- 9 files changed, 46 insertions(+), 60 deletions(-) hooks/post-receive -- Main OpenOCD repository |