target: Use target_addr_t for algorithm addresses.
[openocd.git] / src / target / target.c
index 49f205a975cf27b1d46e1ff39066511b7def1554..ed6f655eac68607285030188b894db34141a4979 100644 (file)
@@ -717,6 +717,15 @@ static int no_mmu(struct target *target, int *enabled)
        return ERROR_OK;
 }
 
+/**
+ * Reset the @c examined flag for the given target.
+ * Pure paranoia -- targets are zeroed on allocation.
+ */
+static inline void target_reset_examined(struct target *target)
+{
+       target->examined = false;
+}
+
 static int default_examine(struct target *target)
 {
        target_set_examined(target);
@@ -737,10 +746,12 @@ int target_examine_one(struct target *target)
 
        int retval = target->type->examine(target);
        if (retval != ERROR_OK) {
+               target_reset_examined(target);
                target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_FAIL);
                return retval;
        }
 
+       target_set_examined(target);
        target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
 
        return ERROR_OK;
@@ -828,7 +839,7 @@ static int target_soft_reset_halt(struct target *target)
 int target_run_algorithm(struct target *target,
                int num_mem_params, struct mem_param *mem_params,
                int num_reg_params, struct reg_param *reg_param,
-               uint32_t entry_point, uint32_t exit_point,
+               target_addr_t entry_point, target_addr_t exit_point,
                int timeout_ms, void *arch_info)
 {
        int retval = ERROR_FAIL;
@@ -869,7 +880,7 @@ done:
 int target_start_algorithm(struct target *target,
                int num_mem_params, struct mem_param *mem_params,
                int num_reg_params, struct reg_param *reg_params,
-               uint32_t entry_point, uint32_t exit_point,
+               target_addr_t entry_point, target_addr_t exit_point,
                void *arch_info)
 {
        int retval = ERROR_FAIL;
@@ -913,7 +924,7 @@ done:
 int target_wait_algorithm(struct target *target,
                int num_mem_params, struct mem_param *mem_params,
                int num_reg_params, struct reg_param *reg_params,
-               uint32_t exit_point, int timeout_ms,
+               target_addr_t exit_point, int timeout_ms,
                void *arch_info)
 {
        int retval = ERROR_FAIL;
@@ -1522,15 +1533,6 @@ static int target_profiling(struct target *target, uint32_t *samples,
                        num_samples, seconds);
 }
 
-/**
- * Reset the @c examined flag for the given target.
- * Pure paranoia -- targets are zeroed on allocation.
- */
-static void target_reset_examined(struct target *target)
-{
-       target->examined = false;
-}
-
 static int handle_target(void *priv);
 
 static int target_init_one(struct command_context *cmd_ctx,
@@ -3055,7 +3057,7 @@ static int handle_target(void *priv)
                                /* Target examination could have failed due to unstable connection,
                                 * but we set the examined flag anyway to repoll it later */
                                if (retval != ERROR_OK) {
-                                       target->examined = true;
+                                       target_set_examined(target);
                                        LOG_USER("Examination failed, GDB will be halted. Polling again in %dms",
                                                 target->backoff.times * polling_interval);
                                        return retval;
@@ -4983,7 +4985,7 @@ no_params:
                                if (goi->isconfigure) {
                                        /* START_DEPRECATED_TPIU */
                                        if (n->value == TARGET_EVENT_TRACE_CONFIG)
-                                               LOG_INFO("DEPRECATED target event %s", n->name);
+                                               LOG_INFO("DEPRECATED target event %s; use TPIU events {pre,post}-{enable,disable}", n->name);
                                        /* END_DEPRECATED_TPIU */
 
                                        bool replace = true;
@@ -5308,8 +5310,13 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
        }
 
        int e = target->type->examine(target);
-       if (e != ERROR_OK)
+       if (e != ERROR_OK) {
+               target_reset_examined(target);
                return JIM_ERR;
+       }
+
+       target_set_examined(target);
+
        return JIM_OK;
 }
 
@@ -5715,7 +5722,7 @@ static int target_create(struct jim_getopt_info *goi)
        /* COMMAND */
        jim_getopt_obj(goi, &new_cmd);
        /* does this command exist? */
-       cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
+       cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_NONE);
        if (cmd) {
                cp = Jim_GetString(new_cmd, NULL);
                Jim_SetResultFormatted(goi->interp, "Command/target: %s Exists", cp);
@@ -5978,10 +5985,10 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        int i;
        const char *targetname;
        int retval, len;
-       struct target *target = (struct target *) NULL;
+       struct target *target = NULL;
        struct target_list *head, *curr, *new;
-       curr = (struct target_list *) NULL;
-       head = (struct target_list *) NULL;
+       curr = NULL;
+       head = NULL;
 
        retval = 0;
        LOG_DEBUG("%d", argc);
@@ -5998,7 +6005,7 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                if (target) {
                        new = malloc(sizeof(struct target_list));
                        new->target = target;
-                       new->next = (struct target_list *)NULL;
+                       new->next = NULL;
                        if (!head) {
                                head = new;
                                curr = head;

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)