diff options
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/arm11.c | 4 | ||||
-rw-r--r-- | src/target/arm720t.c | 4 | ||||
-rw-r--r-- | src/target/arm7_9_common.c | 28 | ||||
-rw-r--r-- | src/target/arm920t.c | 20 | ||||
-rw-r--r-- | src/target/arm926ejs.c | 10 | ||||
-rw-r--r-- | src/target/arm966e.c | 4 | ||||
-rw-r--r-- | src/target/arm9tdmi.c | 8 | ||||
-rw-r--r-- | src/target/arm_adi_v5.c | 8 | ||||
-rw-r--r-- | src/target/armv4_5.c | 10 | ||||
-rw-r--r-- | src/target/armv7a.c | 2 | ||||
-rw-r--r-- | src/target/armv7m.c | 4 | ||||
-rw-r--r-- | src/target/cortex_m3.c | 16 | ||||
-rw-r--r-- | src/target/etb.c | 10 | ||||
-rw-r--r-- | src/target/etm.c | 62 | ||||
-rw-r--r-- | src/target/etm_dummy.c | 6 | ||||
-rw-r--r-- | src/target/oocd_trace.c | 2 | ||||
-rw-r--r-- | src/target/target.c | 116 | ||||
-rw-r--r-- | src/target/target_request.c | 6 | ||||
-rw-r--r-- | src/target/trace.c | 8 | ||||
-rw-r--r-- | src/target/xscale.c | 50 |
20 files changed, 189 insertions, 189 deletions
diff --git a/src/target/arm11.c b/src/target/arm11.c index 4236ac8..65e0780 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2014,7 +2014,7 @@ static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name) if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; - switch (args[0][0]) + switch (CMD_ARGV[0][0]) { case '0': /* 0 */ case 'f': /* false */ @@ -2056,7 +2056,7 @@ COMMAND_HANDLER(arm11_handle_vcr) case 0: break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], arm11_vcr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], arm11_vcr); break; default: return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 53d2224..a0cde5d 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -432,7 +432,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command) if (CMD_ARGC >= 1) { uint32_t opcode; - COMMAND_PARSE_NUMBER(u32, args[0], opcode); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], opcode); if (CMD_ARGC == 1) { @@ -453,7 +453,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command) else if (CMD_ARGC == 2) { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); if ((retval = arm720t_write_cp15(target, opcode, value)) != ERROR_OK) { diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 19c9791..bd018b4 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2771,8 +2771,8 @@ COMMAND_HANDLER(handle_arm7_9_write_xpsr_command) return ERROR_FAIL; } - COMMAND_PARSE_NUMBER(u32, args[0], value); - COMMAND_PARSE_NUMBER(int, args[1], spsr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], value); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], spsr); /* if we're writing the CPSR, mask the T bit */ if (!spsr) @@ -2815,9 +2815,9 @@ COMMAND_HANDLER(handle_arm7_9_write_xpsr_im8_command) return ERROR_FAIL; } - COMMAND_PARSE_NUMBER(u32, args[0], value); - COMMAND_PARSE_NUMBER(int, args[1], rotate); - COMMAND_PARSE_NUMBER(int, args[2], spsr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], value); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], rotate); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], spsr); arm7_9->write_xpsr_im8(target, value, rotate, spsr); if ((retval = jtag_execute_queue()) != ERROR_OK) @@ -2855,9 +2855,9 @@ COMMAND_HANDLER(handle_arm7_9_write_core_reg_command) return ERROR_FAIL; } - COMMAND_PARSE_NUMBER(int, args[0], num); - COMMAND_PARSE_NUMBER(u32, args[1], mode); - COMMAND_PARSE_NUMBER(u32, args[2], value); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], num); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], mode); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value); return arm7_9_write_core_reg(target, num, mode, value); } @@ -2875,11 +2875,11 @@ COMMAND_HANDLER(handle_arm7_9_dbgrq_command) if (CMD_ARGC > 0) { - if (strcmp("enable", args[0]) == 0) + if (strcmp("enable", CMD_ARGV[0]) == 0) { arm7_9->use_dbgrq = 1; } - else if (strcmp("disable", args[0]) == 0) + else if (strcmp("disable", CMD_ARGV[0]) == 0) { arm7_9->use_dbgrq = 0; } @@ -2907,11 +2907,11 @@ COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command) if (CMD_ARGC > 0) { - if (strcmp("enable", args[0]) == 0) + if (strcmp("enable", CMD_ARGV[0]) == 0) { arm7_9->fast_memory_access = 1; } - else if (strcmp("disable", args[0]) == 0) + else if (strcmp("disable", CMD_ARGV[0]) == 0) { arm7_9->fast_memory_access = 0; } @@ -2939,11 +2939,11 @@ COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command) if (CMD_ARGC > 0) { - if (strcmp("enable", args[0]) == 0) + if (strcmp("enable", CMD_ARGV[0]) == 0) { arm7_9->dcc_downloads = 1; } - else if (strcmp("disable", args[0]) == 0) + else if (strcmp("disable", CMD_ARGV[0]) == 0) { arm7_9->dcc_downloads = 0; } diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 58e92c3..fbb8d7f 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -688,7 +688,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) return ERROR_OK; } - if ((output = fopen(args[0], "w")) == NULL) + if ((output = fopen(CMD_ARGV[0], "w")) == NULL) { LOG_DEBUG("error opening cache content file"); return ERROR_OK; @@ -885,7 +885,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) /* restore CP15 MMU and Cache settings */ arm920t_write_cp15_physical(target, ARM920T_CP15_PHYS_ADDR(0, 0x1, 0), cp15_ctrl_saved); - command_print(cmd_ctx, "cache content successfully output to %s", args[0]); + command_print(cmd_ctx, "cache content successfully output to %s", CMD_ARGV[0]); fclose(output); @@ -934,7 +934,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command) return ERROR_OK; } - if ((output = fopen(args[0], "w")) == NULL) + if ((output = fopen(CMD_ARGV[0], "w")) == NULL) { LOG_DEBUG("error opening mmu content file"); return ERROR_OK; @@ -1168,7 +1168,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command) fprintf(output, "%i: 0x%8.8" PRIx32 " 0x%8.8" PRIx32 " 0x%8.8" PRIx32 " %s\n", i, i_tlb[i].cam, i_tlb[i].ram1, i_tlb[i].ram2, (i_tlb[i].cam & 0x20) ? "(valid)" : "(invalid)"); } - command_print(cmd_ctx, "mmu content successfully output to %s", args[0]); + command_print(cmd_ctx, "mmu content successfully output to %s", CMD_ARGV[0]); fclose(output); @@ -1210,7 +1210,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command) if (CMD_ARGC >= 1) { int address; - COMMAND_PARSE_NUMBER(int, args[0], address); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], address); if (CMD_ARGC == 1) { @@ -1230,7 +1230,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command) else if (CMD_ARGC == 2) { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); if ((retval = arm920t_write_cp15_physical(target, address, value)) != ERROR_OK) { command_print(cmd_ctx, "couldn't access reg %i", address); @@ -1264,7 +1264,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) if (CMD_ARGC >= 1) { uint32_t opcode; - COMMAND_PARSE_NUMBER(u32, args[0], opcode); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], opcode); if (CMD_ARGC == 1) { @@ -1280,7 +1280,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) else if (CMD_ARGC == 2) { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); if ((retval = arm920t_write_cp15_interpreted(target, opcode, value, 0)) != ERROR_OK) { command_print(cmd_ctx, "couldn't execute %8.8" PRIx32 "", opcode); @@ -1291,9 +1291,9 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) else if (CMD_ARGC == 3) { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[2], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], address); if ((retval = arm920t_write_cp15_interpreted(target, opcode, value, address)) != ERROR_OK) { command_print(cmd_ctx, "couldn't execute %8.8" PRIx32 "", opcode); diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 4e20664..6678054 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -728,10 +728,10 @@ COMMAND_HANDLER(arm926ejs_handle_cp15_command) return ERROR_OK; } - COMMAND_PARSE_NUMBER(int, args[0], opcode_1); - COMMAND_PARSE_NUMBER(int, args[1], opcode_2); - COMMAND_PARSE_NUMBER(int, args[2], CRn); - COMMAND_PARSE_NUMBER(int, args[3], CRm); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], opcode_1); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], opcode_2); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], CRn); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[3], CRm); retval = arm926ejs_verify_pointer(cmd_ctx, arm926ejs); if (retval != ERROR_OK) @@ -761,7 +761,7 @@ COMMAND_HANDLER(arm926ejs_handle_cp15_command) else { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[4], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], value); if ((retval = arm926ejs->write_cp15(target, opcode_1, opcode_2, CRn, CRm, value)) != ERROR_OK) { command_print(cmd_ctx, "couldn't access register"); diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 0c08a60..ffc65cd 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -182,7 +182,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) if (CMD_ARGC >= 1) { uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[0], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); if (CMD_ARGC == 1) { @@ -205,7 +205,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) else if (CMD_ARGC == 2) { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); if ((retval = arm966e_write_cp15(target, address, value)) != ERROR_OK) { command_print(cmd_ctx, diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index b582eae..3f074be 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -856,11 +856,11 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) if (CMD_ARGC > 0) { vector_catch_value = 0x0; - if (strcmp(args[0], "all") == 0) + if (strcmp(CMD_ARGV[0], "all") == 0) { vector_catch_value = 0xdf; } - else if (strcmp(args[0], "none") == 0) + else if (strcmp(CMD_ARGV[0], "none") == 0) { /* do nothing */ } @@ -872,7 +872,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) unsigned j; for (j = 0; arm9tdmi_vectors[j].name; j++) { - if (strcmp(args[i], arm9tdmi_vectors[j].name) == 0) + if (strcmp(CMD_ARGV[i], arm9tdmi_vectors[j].name) == 0) { vector_catch_value |= arm9tdmi_vectors[j].value; break; @@ -882,7 +882,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) /* complain if vector wasn't found */ if (!arm9tdmi_vectors[j].name) { - command_print(cmd_ctx, "vector '%s' not found, leaving current setting unchanged", args[i]); + command_print(cmd_ctx, "vector '%s' not found, leaving current setting unchanged", CMD_ARGV[i]); /* reread current setting */ vector_catch_value = buf_get_u32( diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index dcae818..7f4bc58 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1375,7 +1375,7 @@ DAP_COMMAND_HANDLER(dap_baseaddr_command) apsel = swjdp->apsel; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], apsel); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1403,7 +1403,7 @@ DAP_COMMAND_HANDLER(dap_memaccess_command) memaccess_tck = swjdp->memaccess_tck; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], memaccess_tck); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], memaccess_tck); break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1426,7 +1426,7 @@ DAP_COMMAND_HANDLER(dap_apsel_command) apsel = 0; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], apsel); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1452,7 +1452,7 @@ DAP_COMMAND_HANDLER(dap_apid_command) apsel = swjdp->apsel; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], apsel); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); break; default: return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 4c2a6e5..5f0fe42 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -424,11 +424,11 @@ COMMAND_HANDLER(handle_armv4_5_core_state_command) if (CMD_ARGC > 0) { - if (strcmp(args[0], "arm") == 0) + if (strcmp(CMD_ARGV[0], "arm") == 0) { armv4_5->core_state = ARMV4_5_STATE_ARM; } - if (strcmp(args[0], "thumb") == 0) + if (strcmp(CMD_ARGV[0], "thumb") == 0) { armv4_5->core_state = ARMV4_5_STATE_THUMB; } @@ -455,15 +455,15 @@ COMMAND_HANDLER(handle_armv4_5_disassemble_command) switch (CMD_ARGC) { case 3: - if (strcmp(args[2], "thumb") != 0) + if (strcmp(CMD_ARGV[2], "thumb") != 0) goto usage; thumb = 1; /* FALL THROUGH */ case 2: - COMMAND_PARSE_NUMBER(int, args[1], count); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], count); /* FALL THROUGH */ case 1: - COMMAND_PARSE_NUMBER(u32, args[0], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); if (address & 0x01) { if (!thumb) { command_print(cmd_ctx, "Disassemble as Thumb"); diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 31ab4b4..7f5b834 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -264,7 +264,7 @@ COMMAND_HANDLER(handle_dap_info_command) apsel = swjdp->apsel; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], apsel); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); break; default: return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/armv7m.c b/src/target/armv7m.c index e9d46df..4fe5794 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -771,7 +771,7 @@ COMMAND_HANDLER(handle_dap_baseaddr_command) apsel = swjdp->apsel; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], apsel); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -834,7 +834,7 @@ COMMAND_HANDLER(handle_dap_info_command) apsel = swjdp->apsel; break; case 1: - COMMAND_PARSE_NUMBER(u32, args[0], apsel); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); break; default: return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 0584434..9cb4b98 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1782,10 +1782,10 @@ COMMAND_HANDLER(handle_cortex_m3_disassemble_command) errno = 0; switch (CMD_ARGC) { case 2: - COMMAND_PARSE_NUMBER(ulong, args[1], count); + COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], count); /* FALL THROUGH */ case 1: - COMMAND_PARSE_NUMBER(u32, args[0], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); break; default: command_print(cmd_ctx, @@ -1836,25 +1836,25 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command) unsigned catch = 0; if (CMD_ARGC == 1) { - if (strcmp(args[0], "all") == 0) { + if (strcmp(CMD_ARGV[0], "all") == 0) { catch = VC_HARDERR | VC_INTERR | VC_BUSERR | VC_STATERR | VC_CHKERR | VC_NOCPERR | VC_MMERR | VC_CORERESET; goto write; - } else if (strcmp(args[0], "none") == 0) { + } else if (strcmp(CMD_ARGV[0], "none") == 0) { goto write; } } while (CMD_ARGC-- > 0) { unsigned i; for (i = 0; i < ARRAY_SIZE(vec_ids); i++) { - if (strcmp(args[CMD_ARGC], vec_ids[i].name) != 0) + if (strcmp(CMD_ARGV[CMD_ARGC], vec_ids[i].name) != 0) continue; catch |= vec_ids[i].mask; break; } if (i == ARRAY_SIZE(vec_ids)) { - LOG_ERROR("No CM3 vector '%s'", args[CMD_ARGC]); + LOG_ERROR("No CM3 vector '%s'", CMD_ARGV[CMD_ARGC]); return ERROR_INVALID_ARGUMENTS; } } @@ -1892,11 +1892,11 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) if (CMD_ARGC > 0) { - if (!strcmp(args[0], "on")) + if (!strcmp(CMD_ARGV[0], "on")) { cortex_m3_write_debug_halt_mask(target, C_HALT | C_MASKINTS, 0); } - else if (!strcmp(args[0], "off")) + else if (!strcmp(CMD_ARGV[0], "off")) { cortex_m3_write_debug_halt_mask(target, C_HALT, C_MASKINTS); } diff --git a/src/target/etb.c b/src/target/etb.c index 2ad5156..25d6d0b 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -359,25 +359,25 @@ COMMAND_HANDLER(handle_etb_config_command) return ERROR_COMMAND_SYNTAX_ERROR; } - target = get_target(args[0]); + target = get_target(CMD_ARGV[0]); if (!target) { - LOG_ERROR("ETB: target '%s' not defined", args[0]); + LOG_ERROR("ETB: target '%s' not defined", CMD_ARGV[0]); return ERROR_FAIL; } arm = target_to_arm(target); if (!is_arm(arm)) { - command_print(cmd_ctx, "ETB: '%s' isn't an ARM", args[0]); + command_print(cmd_ctx, "ETB: '%s' isn't an ARM", CMD_ARGV[0]); return ERROR_FAIL; } - tap = jtag_tap_by_string(args[1]); + tap = jtag_tap_by_string(CMD_ARGV[1]); if (tap == NULL) { - command_print(cmd_ctx, "ETB: TAP %s does not exist", args[1]); + command_print(cmd_ctx, "ETB: TAP %s does not exist", CMD_ARGV[1]); return ERROR_FAIL; } diff --git a/src/target/etm.c b/src/target/etm.c index 044ccb0..72e8b3d 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1179,22 +1179,22 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update, etmv1_tracemode_t tracemode; /* what parts of data access are traced? */ - if (strcmp(args[0], "none") == 0) + if (strcmp(CMD_ARGV[0], "none") == 0) tracemode = ETMV1_TRACE_NONE; - else if (strcmp(args[0], "data") == 0) + else if (strcmp(CMD_ARGV[0], "data") == 0) tracemode = ETMV1_TRACE_DATA; - else if (strcmp(args[0], "address") == 0) + else if (strcmp(CMD_ARGV[0], "address") == 0) tracemode = ETMV1_TRACE_ADDR; - else if (strcmp(args[0], "all") == 0) + else if (strcmp(CMD_ARGV[0], "all") == 0) tracemode = ETMV1_TRACE_DATA | ETMV1_TRACE_ADDR; else { - command_print(cmd_ctx, "invalid option '%s'", args[0]); + command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[0]); return ERROR_INVALID_ARGUMENTS; } uint8_t context_id; - COMMAND_PARSE_NUMBER(u8, args[1], context_id); + COMMAND_PARSE_NUMBER(u8, CMD_ARGV[1], context_id); switch (context_id) { case 0: @@ -1210,27 +1210,27 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update, tracemode |= ETMV1_CONTEXTID_32; break; default: - command_print(cmd_ctx, "invalid option '%s'", args[1]); + command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[1]); return ERROR_INVALID_ARGUMENTS; } - if (strcmp(args[2], "enable") == 0) + if (strcmp(CMD_ARGV[2], "enable") == 0) tracemode |= ETMV1_CYCLE_ACCURATE; - else if (strcmp(args[2], "disable") == 0) + else if (strcmp(CMD_ARGV[2], "disable") == 0) tracemode |= 0; else { - command_print(cmd_ctx, "invalid option '%s'", args[2]); + command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[2]); return ERROR_INVALID_ARGUMENTS; } - if (strcmp(args[3], "enable") == 0) + if (strcmp(CMD_ARGV[3], "enable") == 0) tracemode |= ETMV1_BRANCH_OUTPUT; - else if (strcmp(args[3], "disable") == 0) + else if (strcmp(CMD_ARGV[3], "disable") == 0) tracemode |= 0; else { - command_print(cmd_ctx, "invalid option '%s'", args[3]); + command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[3]); return ERROR_INVALID_ARGUMENTS; } @@ -1377,10 +1377,10 @@ COMMAND_HANDLER(handle_etm_config_command) if (CMD_ARGC != 5) return ERROR_COMMAND_SYNTAX_ERROR; - target = get_target(args[0]); + target = get_target(CMD_ARGV[0]); if (!target) { - LOG_ERROR("target '%s' not defined", args[0]); + LOG_ERROR("target '%s' not defined", CMD_ARGV[0]); return ERROR_FAIL; } @@ -1404,7 +1404,7 @@ COMMAND_HANDLER(handle_etm_config_command) * "normal full" ... */ uint8_t port_width; - COMMAND_PARSE_NUMBER(u8, args[1], port_width); + COMMAND_PARSE_NUMBER(u8, CMD_ARGV[1], port_width); switch (port_width) { /* before ETMv3.0 */ @@ -1438,39 +1438,39 @@ COMMAND_HANDLER(handle_etm_config_command) break; default: command_print(cmd_ctx, - "unsupported ETM port width '%s'", args[1]); + "unsupported ETM port width '%s'", CMD_ARGV[1]); return ERROR_FAIL; } - if (strcmp("normal", args[2]) == 0) + if (strcmp("normal", CMD_ARGV[2]) == 0) { portmode |= ETM_PORT_NORMAL; } - else if (strcmp("multiplexed", args[2]) == 0) + else if (strcmp("multiplexed", CMD_ARGV[2]) == 0) { portmode |= ETM_PORT_MUXED; } - else if (strcmp("demultiplexed", args[2]) == 0) + else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0) { portmode |= ETM_PORT_DEMUXED; } else { - command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", args[2]); + command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", CMD_ARGV[2]); return ERROR_FAIL; } - if (strcmp("half", args[3]) == 0) + if (strcmp("half", CMD_ARGV[3]) == 0) { portmode |= ETM_PORT_HALF_CLOCK; } - else if (strcmp("full", args[3]) == 0) + else if (strcmp("full", CMD_ARGV[3]) == 0) { portmode |= ETM_PORT_FULL_CLOCK; } else { - command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", args[3]); + command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", CMD_ARGV[3]); return ERROR_FAIL; } @@ -1482,7 +1482,7 @@ COMMAND_HANDLER(handle_etm_config_command) for (i = 0; etm_capture_drivers[i]; i++) { - if (strcmp(args[4], etm_capture_drivers[i]->name) == 0) + if (strcmp(CMD_ARGV[4], etm_capture_drivers[i]->name) == 0) { int retval; if ((retval = etm_capture_drivers[i]->register_commands(cmd_ctx)) != ERROR_OK) @@ -1501,7 +1501,7 @@ COMMAND_HANDLER(handle_etm_config_command) { /* no supported capture driver found, don't register an ETM */ free(etm_ctx); - LOG_ERROR("trace capture driver '%s' not found", args[4]); + LOG_ERROR("trace capture driver '%s' not found", CMD_ARGV[4]); return ERROR_FAIL; } @@ -1766,14 +1766,14 @@ COMMAND_HANDLER(handle_etm_image_command) if (CMD_ARGC >= 2) { etm_ctx->image->base_address_set = 1; - COMMAND_PARSE_NUMBER(int, args[1], etm_ctx->image->base_address); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], etm_ctx->image->base_address); } else { etm_ctx->image->base_address_set = 0; } - if (image_open(etm_ctx->image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(etm_ctx->image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK) { free(etm_ctx->image); etm_ctx->image = NULL; @@ -1829,7 +1829,7 @@ COMMAND_HANDLER(handle_etm_dump_command) if (etm_ctx->trace_depth == 0) etm_ctx->capture_driver->read_trace(etm_ctx); - if (fileio_open(&file, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) + if (fileio_open(&file, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) { return ERROR_FAIL; } @@ -1886,7 +1886,7 @@ COMMAND_HANDLER(handle_etm_load_command) return ERROR_FAIL; } - if (fileio_open(&file, args[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK) + if (fileio_open(&file, CMD_ARGV[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK) { return ERROR_FAIL; } @@ -1959,7 +1959,7 @@ COMMAND_HANDLER(handle_etm_trigger_percent_command) if (CMD_ARGC > 0) { uint32_t new_value; - COMMAND_PARSE_NUMBER(u32, args[0], new_value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], new_value); if ((new_value < 2) || (new_value > 100)) { diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index b0ab1fb..ae53802 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -30,18 +30,18 @@ COMMAND_HANDLER(handle_etm_dummy_config_command) struct target *target; struct arm *arm; - target = get_target(args[0]); + target = get_target(CMD_ARGV[0]); if (!target) { - LOG_ERROR("target '%s' not defined", args[0]); + LOG_ERROR("target '%s' not defined", CMD_ARGV[0]); return ERROR_FAIL; } arm = target_to_arm(target); if (!is_arm(arm)) { - command_print(cmd_ctx, "target '%s' isn't an ARM", args[0]); + command_print(cmd_ctx, "target '%s' isn't an ARM", CMD_ARGV[0]); return ERROR_FAIL; } diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index 47c2bb4..74f8955 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -316,7 +316,7 @@ COMMAND_HANDLER(handle_oocd_trace_config_command) oocd_trace->etm_ctx = arm->etm; /* copy name of TTY device used to communicate with OpenOCD + trace */ - oocd_trace->tty = strndup(args[1], 256); + oocd_trace->tty = strndup(CMD_ARGV[1], 256); } else { diff --git a/src/target/target.c b/src/target/target.c index 88fea17..3143180 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1650,9 +1650,9 @@ COMMAND_HANDLER(handle_targets_command) if (CMD_ARGC == 1) { - target = get_target(args[0]); + target = get_target(CMD_ARGV[0]); if (target == NULL) { - command_print(cmd_ctx,"Target: %s is unknown, try one of:\n", args[0]); + command_print(cmd_ctx,"Target: %s is unknown, try one of:\n", CMD_ARGV[0]); goto DumpTargets; } if (!target->tap->enabled) { @@ -1908,10 +1908,10 @@ COMMAND_HANDLER(handle_reg_command) } /* access a single register by its ordinal number */ - if ((args[0][0] >= '0') && (args[0][0] <= '9')) + if ((CMD_ARGV[0][0] >= '0') && (CMD_ARGV[0][0] <= '9')) { unsigned num; - COMMAND_PARSE_NUMBER(uint, args[0], num); + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num); struct reg_cache *cache = target->reg_cache; count = 0; @@ -1938,19 +1938,19 @@ COMMAND_HANDLER(handle_reg_command) } } else /* access a single register by its name */ { - reg = register_get_by_name(target->reg_cache, args[0], 1); + reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], 1); if (!reg) { - command_print(cmd_ctx, "register %s not found in current target", args[0]); + command_print(cmd_ctx, "register %s not found in current target", CMD_ARGV[0]); return ERROR_OK; } } /* display a register */ - if ((CMD_ARGC == 1) || ((CMD_ARGC == 2) && !((args[1][0] >= '0') && (args[1][0] <= '9')))) + if ((CMD_ARGC == 1) || ((CMD_ARGC == 2) && !((CMD_ARGV[1][0] >= '0') && (CMD_ARGV[1][0] <= '9')))) { - if ((CMD_ARGC == 2) && (strcmp(args[1], "force") == 0)) + if ((CMD_ARGC == 2) && (strcmp(CMD_ARGV[1], "force") == 0)) reg->valid = 0; if (reg->valid == 0) @@ -1967,7 +1967,7 @@ COMMAND_HANDLER(handle_reg_command) if (CMD_ARGC == 2) { uint8_t *buf = malloc(DIV_ROUND_UP(reg->size, 8)); - str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0); + str_to_buf(CMD_ARGV[1], strlen(CMD_ARGV[1]), buf, reg->size, 0); reg->type->set(reg, buf); @@ -2007,11 +2007,11 @@ COMMAND_HANDLER(handle_poll_command) } else if (CMD_ARGC == 1) { - if (strcmp(args[0], "on") == 0) + if (strcmp(CMD_ARGV[0], "on") == 0) { jtag_poll_set_enabled(true); } - else if (strcmp(args[0], "off") == 0) + else if (strcmp(CMD_ARGV[0], "off") == 0) { jtag_poll_set_enabled(false); } @@ -2035,7 +2035,7 @@ COMMAND_HANDLER(handle_wait_halt_command) unsigned ms = 5000; if (1 == CMD_ARGC) { - int retval = parse_uint(args[0], &ms); + int retval = parse_uint(CMD_ARGV[0], &ms); if (ERROR_OK != retval) { command_print(cmd_ctx, "usage: %s [seconds]", CMD_NAME); @@ -2106,7 +2106,7 @@ COMMAND_HANDLER(handle_halt_command) if (CMD_ARGC == 1) { unsigned wait; - retval = parse_uint(args[0], &wait); + retval = parse_uint(CMD_ARGV[0], &wait); if (ERROR_OK != retval) return ERROR_COMMAND_SYNTAX_ERROR; if (!wait) @@ -2136,7 +2136,7 @@ COMMAND_HANDLER(handle_reset_command) if (CMD_ARGC == 1) { const Jim_Nvp *n; - n = Jim_Nvp_name2value_simple(nvp_reset_modes, args[0]); + n = Jim_Nvp_name2value_simple(nvp_reset_modes, CMD_ARGV[0]); if ((n->name == NULL) || (n->value == RESET_UNKNOWN)) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -2157,13 +2157,13 @@ COMMAND_HANDLER(handle_resume_command) struct target *target = get_current_target(cmd_ctx); target_handle_event(target, TARGET_EVENT_OLD_pre_resume); - /* with no args, resume from current pc, addr = 0, - * with one arguments, addr = args[0], + /* with no CMD_ARGV, resume from current pc, addr = 0, + * with one arguments, addr = CMD_ARGV[0], * handle breakpoints, not debugging */ uint32_t addr = 0; if (CMD_ARGC == 1) { - COMMAND_PARSE_NUMBER(u32, args[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); current = 0; } @@ -2177,14 +2177,14 @@ COMMAND_HANDLER(handle_step_command) LOG_DEBUG("-"); - /* with no args, step from current pc, addr = 0, - * with one argument addr = args[0], + /* with no CMD_ARGV, step from current pc, addr = 0, + * with one argument addr = CMD_ARGV[0], * handle breakpoints, debugging */ uint32_t addr = 0; int current_pc = 1; if (CMD_ARGC == 1) { - COMMAND_PARSE_NUMBER(u32, args[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); current_pc = 0; } @@ -2256,13 +2256,13 @@ COMMAND_HANDLER(handle_md_command) default: return ERROR_COMMAND_SYNTAX_ERROR; } - bool physical=strcmp(args[0], "phys")==0; + bool physical=strcmp(CMD_ARGV[0], "phys")==0; int (*fn)(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); if (physical) { CMD_ARGC--; - args++; + CMD_ARGV++; fn=target_read_phys_memory; } else { @@ -2274,11 +2274,11 @@ COMMAND_HANDLER(handle_md_command) } uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[0], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); unsigned count = 1; if (CMD_ARGC == 2) - COMMAND_PARSE_NUMBER(uint, args[1], count); + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], count); uint8_t *buffer = calloc(count, size); @@ -2298,14 +2298,14 @@ COMMAND_HANDLER(handle_mw_command) { return ERROR_COMMAND_SYNTAX_ERROR; } - bool physical=strcmp(args[0], "phys")==0; + bool physical=strcmp(CMD_ARGV[0], "phys")==0; int (*fn)(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); const char *cmd_name = CMD_NAME; if (physical) { CMD_ARGC--; - args++; + CMD_ARGV++; fn=target_write_phys_memory; } else { @@ -2315,14 +2315,14 @@ COMMAND_HANDLER(handle_mw_command) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[0], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); unsigned count = 1; if (CMD_ARGC == 3) - COMMAND_PARSE_NUMBER(uint, args[2], count); + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], count); struct target *target = get_current_target(cmd_ctx); unsigned wordsize; @@ -2357,7 +2357,7 @@ COMMAND_HANDLER(handle_mw_command) } -static COMMAND_HELPER(parse_load_image_command_args, struct image *image, +static COMMAND_HELPER(parse_load_image_command_CMD_ARGV, struct image *image, uint32_t *min_address, uint32_t *max_address) { if (CMD_ARGC < 1 || CMD_ARGC > 5) @@ -2368,7 +2368,7 @@ static COMMAND_HELPER(parse_load_image_command_args, struct image *image, if (CMD_ARGC >= 2) { uint32_t addr; - COMMAND_PARSE_NUMBER(u32, args[1], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], addr); image->base_address = addr; image->base_address_set = 1; } @@ -2379,11 +2379,11 @@ static COMMAND_HELPER(parse_load_image_command_args, struct image *image, if (CMD_ARGC >= 4) { - COMMAND_PARSE_NUMBER(u32, args[3], *min_address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], *min_address); } if (CMD_ARGC == 5) { - COMMAND_PARSE_NUMBER(u32, args[4], *max_address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], *max_address); // use size (given) to find max (required) *max_address += *min_address; } @@ -2404,7 +2404,7 @@ COMMAND_HANDLER(handle_load_image_command) int i; struct image image; - int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args, + int retval = CALL_COMMAND_HANDLER(parse_load_image_command_CMD_ARGV, &image, &min_address, &max_address); if (ERROR_OK != retval) return retval; @@ -2414,7 +2414,7 @@ COMMAND_HANDLER(handle_load_image_command) struct duration bench; duration_start(&bench); - if (image_open(&image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(&image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK) { return ERROR_OK; } @@ -2502,11 +2502,11 @@ COMMAND_HANDLER(handle_dump_image_command) } uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[1], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], address); uint32_t size; - COMMAND_PARSE_NUMBER(u32, args[2], size); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], size); - if (fileio_open(&fileio, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) + if (fileio_open(&fileio, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) { return ERROR_OK; } @@ -2579,7 +2579,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify) if (CMD_ARGC >= 2) { uint32_t addr; - COMMAND_PARSE_NUMBER(u32, args[1], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], addr); image.base_address = addr; image.base_address_set = 1; } @@ -2591,7 +2591,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify) image.start_address_set = 0; - if ((retval = image_open(&image, args[0], (CMD_ARGC == 3) ? args[2] : NULL)) != ERROR_OK) + if ((retval = image_open(&image, CMD_ARGV[0], (CMD_ARGC == 3) ? CMD_ARGV[2] : NULL)) != ERROR_OK) { return retval; } @@ -2755,14 +2755,14 @@ COMMAND_HANDLER(handle_bp_command) } uint32_t addr; - COMMAND_PARSE_NUMBER(u32, args[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); uint32_t length; - COMMAND_PARSE_NUMBER(u32, args[1], length); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length); int hw = BKPT_SOFT; if (CMD_ARGC == 3) { - if (strcmp(args[2], "hw") == 0) + if (strcmp(CMD_ARGV[2], "hw") == 0) hw = BKPT_HARD; else return ERROR_COMMAND_SYNTAX_ERROR; @@ -2777,7 +2777,7 @@ COMMAND_HANDLER(handle_rbp_command) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t addr; - COMMAND_PARSE_NUMBER(u32, args[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); struct target *target = get_current_target(cmd_ctx); breakpoint_remove(target, addr); @@ -2818,13 +2818,13 @@ COMMAND_HANDLER(handle_wp_command) switch (CMD_ARGC) { case 5: - COMMAND_PARSE_NUMBER(u32, args[4], data_mask); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], data_mask); // fall through case 4: - COMMAND_PARSE_NUMBER(u32, args[3], data_value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], data_value); // fall through case 3: - switch (args[2][0]) + switch (CMD_ARGV[2][0]) { case 'r': type = WPT_READ; @@ -2836,13 +2836,13 @@ COMMAND_HANDLER(handle_wp_command) type = WPT_ACCESS; break; default: - LOG_ERROR("invalid watchpoint mode ('%c')", args[2][0]); + LOG_ERROR("invalid watchpoint mode ('%c')", CMD_ARGV[2][0]); return ERROR_COMMAND_SYNTAX_ERROR; } // fall through case 2: - COMMAND_PARSE_NUMBER(u32, args[1], length); - COMMAND_PARSE_NUMBER(u32, args[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); break; default: @@ -2865,7 +2865,7 @@ COMMAND_HANDLER(handle_rwp_command) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t addr; - COMMAND_PARSE_NUMBER(u32, args[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); struct target *target = get_current_target(cmd_ctx); watchpoint_remove(target, addr); @@ -2886,7 +2886,7 @@ COMMAND_HANDLER(handle_virt2phys_command) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t va; - COMMAND_PARSE_NUMBER(u32, args[0], va); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], va); uint32_t pa; struct target *target = get_current_target(cmd_ctx); @@ -3025,7 +3025,7 @@ COMMAND_HANDLER(handle_profile_command) return ERROR_COMMAND_SYNTAX_ERROR; } unsigned offset; - COMMAND_PARSE_NUMBER(uint, args[0], offset); + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], offset); timeval_add_time(&timeout, offset, 0); @@ -3088,8 +3088,8 @@ COMMAND_HANDLER(handle_profile_command) free(samples); return retval; } - writeGmon(samples, numSamples, args[1]); - command_print(cmd_ctx, "Wrote %s", args[1]); + writeGmon(samples, numSamples, CMD_ARGV[1]); + command_print(cmd_ctx, "Wrote %s", CMD_ARGV[1]); break; } } @@ -4543,7 +4543,7 @@ COMMAND_HANDLER(handle_fast_load_image_command) struct image image; - int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args, + int retval = CALL_COMMAND_HANDLER(parse_load_image_command_CMD_ARGV, &image, &min_address, &max_address); if (ERROR_OK != retval) return retval; @@ -4551,7 +4551,7 @@ COMMAND_HANDLER(handle_fast_load_image_command) struct duration bench; duration_start(&bench); - if (image_open(&image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(&image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK) { return ERROR_OK; } @@ -4795,7 +4795,7 @@ int target_register_user_commands(struct command_context *cmd_ctx) register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY, - "same args as load_image, image stored in memory " + "same CMD_ARGV as load_image, image stored in memory " "- mainly for profiling purposes"); register_command(cmd_ctx, NULL, "fast_load", diff --git a/src/target/target_request.c b/src/target/target_request.c index c5de691..1d618cc 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -270,7 +270,7 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command) if (CMD_ARGC > 0) { - if (!strcmp(args[0], "enable") || !strcmp(args[0], "charmsg")) + if (!strcmp(CMD_ARGV[0], "enable") || !strcmp(CMD_ARGV[0], "charmsg")) { /* don't register if this command context is already receiving */ if (!receiving) @@ -278,9 +278,9 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command) receiving = 1; add_debug_msg_receiver(cmd_ctx, target); } - charmsg_mode = !strcmp(args[0], "charmsg"); + charmsg_mode = !strcmp(CMD_ARGV[0], "charmsg"); } - else if (!strcmp(args[0], "disable")) + else if (!strcmp(CMD_ARGV[0], "disable")) { /* no need to delete a receiver if none is registered */ if (receiving) diff --git a/src/target/trace.c b/src/target/trace.c index 88f4ed3..f2fd790 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -66,7 +66,7 @@ COMMAND_HANDLER(handle_trace_point_command) return ERROR_OK; } - if (!strcmp(args[0], "clear")) + if (!strcmp(CMD_ARGV[0], "clear")) { if (trace->trace_points) { @@ -87,7 +87,7 @@ COMMAND_HANDLER(handle_trace_point_command) } uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[0], address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); trace->trace_points[trace->num_trace_points].address = address; trace->trace_points[trace->num_trace_points].hit_counter = 0; trace->num_trace_points++; @@ -105,7 +105,7 @@ COMMAND_HANDLER(handle_trace_history_command) trace->trace_history_pos = 0; trace->trace_history_overflowed = 0; - if (!strcmp(args[0], "clear")) + if (!strcmp(CMD_ARGV[0], "clear")) { /* clearing is implicit, we've just reset position anyway */ return ERROR_OK; @@ -114,7 +114,7 @@ COMMAND_HANDLER(handle_trace_history_command) if (trace->trace_history) free(trace->trace_history); - COMMAND_PARSE_NUMBER(u32, args[0], trace->trace_history_size); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], trace->trace_history_size); trace->trace_history = malloc(sizeof(uint32_t) * trace->trace_history_size); command_print(cmd_ctx, "new trace history size: %i", (int)(trace->trace_history_size)); diff --git a/src/target/xscale.c b/src/target/xscale.c index 3af28d0..9500a33 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3001,9 +3001,9 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command) return ERROR_OK; } - if ((target = get_target(args[0])) == NULL) + if ((target = get_target(CMD_ARGV[0])) == NULL) { - LOG_ERROR("target '%s' not defined", args[0]); + LOG_ERROR("target '%s' not defined", CMD_ARGV[0]); return ERROR_FAIL; } @@ -3012,7 +3012,7 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command) if (retval != ERROR_OK) return retval; - COMMAND_PARSE_NUMBER(u32, args[1], handler_address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], handler_address); if (((handler_address >= 0x800) && (handler_address <= 0x1fef800)) || ((handler_address >= 0xfe000800) && (handler_address <= 0xfffff800))) @@ -3040,10 +3040,10 @@ COMMAND_HANDLER(xscale_handle_cache_clean_address_command) return ERROR_COMMAND_SYNTAX_ERROR; } - target = get_target(args[0]); + target = get_target(CMD_ARGV[0]); if (target == NULL) { - LOG_ERROR("target '%s' not defined", args[0]); + LOG_ERROR("target '%s' not defined", CMD_ARGV[0]); return ERROR_FAIL; } xscale = target_to_xscale(target); @@ -3051,7 +3051,7 @@ COMMAND_HANDLER(xscale_handle_cache_clean_address_command) if (retval != ERROR_OK) return retval; - COMMAND_PARSE_NUMBER(u32, args[1], cache_clean_address); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], cache_clean_address); if (cache_clean_address & 0xffff) { @@ -3132,12 +3132,12 @@ COMMAND_HANDLER(xscale_handle_mmu_command) if (CMD_ARGC >= 1) { - if (strcmp("enable", args[0]) == 0) + if (strcmp("enable", CMD_ARGV[0]) == 0) { xscale_enable_mmu_caches(target, 1, 0, 0); xscale->armv4_5_mmu.mmu_enabled = 1; } - else if (strcmp("disable", args[0]) == 0) + else if (strcmp("disable", CMD_ARGV[0]) == 0) { xscale_disable_mmu_caches(target, 1, 0, 0); xscale->armv4_5_mmu.mmu_enabled = 0; @@ -3173,7 +3173,7 @@ COMMAND_HANDLER(xscale_handle_idcache_command) if (CMD_ARGC >= 1) { - if (strcmp("enable", args[0]) == 0) + if (strcmp("enable", CMD_ARGV[0]) == 0) { xscale_enable_mmu_caches(target, 0, dcache, icache); @@ -3182,7 +3182,7 @@ COMMAND_HANDLER(xscale_handle_idcache_command) else if (dcache) xscale->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled = 1; } - else if (strcmp("disable", args[0]) == 0) + else if (strcmp("disable", CMD_ARGV[0]) == 0) { xscale_disable_mmu_caches(target, 0, dcache, icache); @@ -3218,7 +3218,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command) } else { - COMMAND_PARSE_NUMBER(u8, args[0], xscale->vector_catch); + COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], xscale->vector_catch); buf_set_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 16, 8, xscale->vector_catch); xscale_write_dcsr(target, -1, -1); } @@ -3259,19 +3259,19 @@ COMMAND_HANDLER(xscale_handle_vector_table_command) else { int idx; - COMMAND_PARSE_NUMBER(int, args[1], idx); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], idx); uint32_t vec; - COMMAND_PARSE_NUMBER(u32, args[2], vec); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], vec); if (idx < 1 || idx >= 8) err = 1; - if (!err && strcmp(args[0], "low") == 0) + if (!err && strcmp(CMD_ARGV[0], "low") == 0) { xscale->static_low_vectors_set |= (1<<idx); xscale->static_low_vectors[idx] = vec; } - else if (!err && (strcmp(args[0], "high") == 0)) + else if (!err && (strcmp(CMD_ARGV[0], "high") == 0)) { xscale->static_high_vectors_set |= (1<<idx); xscale->static_high_vectors[idx] = vec; @@ -3305,7 +3305,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) return ERROR_OK; } - if ((CMD_ARGC >= 1) && (strcmp("enable", args[0]) == 0)) + if ((CMD_ARGC >= 1) && (strcmp("enable", CMD_ARGV[0]) == 0)) { struct xscale_trace_data *td, *next_td; xscale->trace.buffer_enabled = 1; @@ -3323,19 +3323,19 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) } xscale->trace.data = NULL; } - else if ((CMD_ARGC >= 1) && (strcmp("disable", args[0]) == 0)) + else if ((CMD_ARGC >= 1) && (strcmp("disable", CMD_ARGV[0]) == 0)) { xscale->trace.buffer_enabled = 0; } - if ((CMD_ARGC >= 2) && (strcmp("fill", args[1]) == 0)) + if ((CMD_ARGC >= 2) && (strcmp("fill", CMD_ARGV[1]) == 0)) { uint32_t fill = 1; if (CMD_ARGC >= 3) - COMMAND_PARSE_NUMBER(u32, args[2], fill); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], fill); xscale->trace.buffer_fill = fill; } - else if ((CMD_ARGC >= 2) && (strcmp("wrap", args[1]) == 0)) + else if ((CMD_ARGC >= 2) && (strcmp("wrap", CMD_ARGV[1]) == 0)) { xscale->trace.buffer_fill = -1; } @@ -3397,14 +3397,14 @@ COMMAND_HANDLER(xscale_handle_trace_image_command) if (CMD_ARGC >= 2) { xscale->trace.image->base_address_set = 1; - COMMAND_PARSE_NUMBER(int, args[1], xscale->trace.image->base_address); + COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], xscale->trace.image->base_address); } else { xscale->trace.image->base_address_set = 0; } - if (image_open(xscale->trace.image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(xscale->trace.image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK) { free(xscale->trace.image); xscale->trace.image = NULL; @@ -3446,7 +3446,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command) return ERROR_OK; } - if (fileio_open(&file, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) + if (fileio_open(&file, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) { return ERROR_OK; } @@ -3505,7 +3505,7 @@ COMMAND_HANDLER(xscale_handle_cp15) struct reg *reg = NULL; if (CMD_ARGC > 0) { - COMMAND_PARSE_NUMBER(u32, args[0], reg_no); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], reg_no); /*translate from xscale cp15 register no to openocd register*/ switch (reg_no) { @@ -3552,7 +3552,7 @@ COMMAND_HANDLER(xscale_handle_cp15) else if (CMD_ARGC == 2) { uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[1], value); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); /* send CP write request (command 0x41) */ xscale_send_u32(target, 0x41); |