cmd: add missing usage vars
[fw/openocd] / src / target / cortex_m.c
index 2a283cdbc88e0ca59a7f990986d02071ef110621..f181060ab08a0ed42f165872fcaab92925171710 100644 (file)
@@ -59,9 +59,6 @@
 
 
 /* forward declarations */
-static int cortex_m3_set_breakpoint(struct target *target, struct breakpoint *breakpoint);
-static int cortex_m3_unset_breakpoint(struct target *target, struct breakpoint *breakpoint);
-static void cortex_m3_enable_watchpoints(struct target *target);
 static int cortex_m3_store_core_reg_u32(struct target *target,
                enum armv7m_regtype type, uint32_t num, uint32_t value);
 
@@ -341,7 +338,7 @@ static int cortex_m3_examine_debug_reason(struct target *target)
 
 static int cortex_m3_examine_exception_reason(struct target *target)
 {
-       uint32_t shcsr, except_sr, cfsr = -1, except_ar = -1;
+       uint32_t shcsr = 0, except_sr = 0, cfsr = -1, except_ar = -1;
        struct armv7m_common *armv7m = target_to_armv7m(target);
        struct adiv5_dap *swjdp = &armv7m->dap;
        int retval;
@@ -1142,7 +1139,7 @@ static int cortex_m3_deassert_reset(struct target *target)
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_set_breakpoint(struct target *target, struct breakpoint *breakpoint)
 {
        int retval;
@@ -1217,7 +1214,7 @@ cortex_m3_set_breakpoint(struct target *target, struct breakpoint *breakpoint)
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_unset_breakpoint(struct target *target, struct breakpoint *breakpoint)
 {
        int retval;
@@ -1272,7 +1269,7 @@ cortex_m3_unset_breakpoint(struct target *target, struct breakpoint *breakpoint)
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
 {
        struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
@@ -1322,7 +1319,7 @@ cortex_m3_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
        return cortex_m3_set_breakpoint(target, breakpoint);
 }
 
-static int
+int
 cortex_m3_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
 {
        struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
@@ -1350,7 +1347,7 @@ cortex_m3_remove_breakpoint(struct target *target, struct breakpoint *breakpoint
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_set_watchpoint(struct target *target, struct watchpoint *watchpoint)
 {
        int dwt_num = 0;
@@ -1415,7 +1412,7 @@ cortex_m3_set_watchpoint(struct target *target, struct watchpoint *watchpoint)
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_unset_watchpoint(struct target *target, struct watchpoint *watchpoint)
 {
        struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
@@ -1452,7 +1449,7 @@ cortex_m3_unset_watchpoint(struct target *target, struct watchpoint *watchpoint)
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
 {
        struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
@@ -1503,7 +1500,7 @@ cortex_m3_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
        return ERROR_OK;
 }
 
-static int
+int
 cortex_m3_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
 {
        struct cortex_m3_common *cortex_m3 = target_to_cm3(target);
@@ -1526,7 +1523,7 @@ cortex_m3_remove_watchpoint(struct target *target, struct watchpoint *watchpoint
        return ERROR_OK;
 }
 
-static void cortex_m3_enable_watchpoints(struct target *target)
+void cortex_m3_enable_watchpoints(struct target *target)
 {
        struct watchpoint *watchpoint = target->watchpoints;
 
@@ -1596,7 +1593,7 @@ static int cortex_m3_load_core_reg_u32(struct target *target,
                break;
 
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -1676,7 +1673,7 @@ static int cortex_m3_store_core_reg_u32(struct target *target,
                break;
 
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -1687,7 +1684,7 @@ static int cortex_m3_read_memory(struct target *target, uint32_t address,
 {
        struct armv7m_common *armv7m = target_to_armv7m(target);
        struct adiv5_dap *swjdp = &armv7m->dap;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        /* cortex_m3 handles unaligned memory access */
        if (count && buffer) {
@@ -1712,7 +1709,7 @@ static int cortex_m3_write_memory(struct target *target, uint32_t address,
 {
        struct armv7m_common *armv7m = target_to_armv7m(target);
        struct adiv5_dap *swjdp = &armv7m->dap;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        if (count && buffer) {
                switch (size) {
@@ -1820,7 +1817,7 @@ cortex_m3_dwt_addreg(struct target *t, struct reg *r, struct dwt_reg *d)
        r->type = &dwt_reg_type;
 }
 
-static void
+void
 cortex_m3_dwt_setup(struct cortex_m3_common *cm3, struct target *target)
 {
        uint32_t dwtcr;
@@ -2147,7 +2144,7 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command)
                        }
                        if (i == ARRAY_SIZE(vec_ids)) {
                                LOG_ERROR("No CM3 vector '%s'", CMD_ARGV[CMD_ARGC]);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
                }
 write:
@@ -2302,6 +2299,7 @@ static const struct command_registration cortex_m3_command_handlers[] = {
                .name = "cortex_m3",
                .mode = COMMAND_EXEC,
                .help = "Cortex-M3 command group",
+               .usage = "",
                .chain = cortex_m3_exec_command_handlers,
        },
        COMMAND_REGISTRATION_DONE