ADIv5 header cleanup (+ #defines)
[openocd.git] / src / target / target.c
index c29c45e419e0cd211b59d3074aa016b85f5832cf..1eb65a62e0f40f3938062a03b2957e0be955f4da 100644 (file)
@@ -477,6 +477,11 @@ int target_process_reset(struct command_context *cmd_ctx, enum target_reset_mode
        /* We want any events to be processed before the prompt */
        retval = target_call_timer_callbacks_now();
 
+       struct target *target;
+       for (target = all_targets; target; target = target->next) {
+               target->type->check_reset(target);
+       }
+
        return retval;
 }
 
@@ -499,6 +504,12 @@ static int default_examine(struct target *target)
        return ERROR_OK;
 }
 
+/* no check by default */
+static int default_check_reset(struct target *target)
+{
+       return ERROR_OK;
+}
+
 int target_examine_one(struct target *target)
 {
        return target->type->examine(target);
@@ -708,6 +719,9 @@ static int target_init_one(struct command_context *cmd_ctx,
        if (type->examine == NULL)
                type->examine = default_examine;
 
+       if (type->check_reset== NULL)
+               type->check_reset = default_check_reset;
+
        int retval = type->init_target(cmd_ctx, target);
        if (ERROR_OK != retval)
        {
@@ -1753,6 +1767,7 @@ static int handle_target(void *priv)
                int did_something = 0;
                if (runSrstAsserted)
                {
+                       LOG_INFO("Waking up GDB, srst asserted detected.");
                        target_call_event_callbacks_all(TARGET_EVENT_GDB_HALT);
                        Jim_Eval(interp, "srst_asserted");
                        did_something = 1;
@@ -1764,6 +1779,7 @@ static int handle_target(void *priv)
                }
                if (runPowerDropout)
                {
+                       LOG_INFO("Waking up GDB, power dropout detected.");
                        target_call_event_callbacks_all(TARGET_EVENT_GDB_HALT);
                        Jim_Eval(interp, "power_dropout");
                        did_something = 1;
@@ -1806,6 +1822,14 @@ static int handle_target(void *priv)
                        /* polling may fail silently until the target has been examined */
                        if ((retval = target_poll(target)) != ERROR_OK)
                        {
+                               /* FIX!!!!! If we add a LOG_INFO() here to output a line in GDB
+                                * *why* we are aborting GDB, then we'll spam telnet when the
+                                * poll is failing persistently.
+                                *
+                                * If we could implement an event that detected the
+                                * target going from non-pollable to pollable, we could issue
+                                * an error only upon the transition.
+                                */
                                target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT);
                                return retval;
                        }
@@ -2156,7 +2180,7 @@ static void handle_md_output(struct command_context *cmd_ctx,
        const char *value_fmt;
        switch (size) {
        case 4: value_fmt = "%8.8x "; break;
-       case 2: value_fmt = "%4.2x "; break;
+       case 2: value_fmt = "%4.4x "; break;
        case 1: value_fmt = "%2.2x "; break;
        default:
                /* "can't happen", caller checked */
@@ -4887,6 +4911,20 @@ int target_register_commands(struct command_context *cmd_ctx)
        return register_commands(cmd_ctx, NULL, target_command_handlers);
 }
 
+static bool target_reset_nag = true;
+
+bool get_target_reset_nag(void)
+{
+       return target_reset_nag;
+}
+
+COMMAND_HANDLER(handle_target_reset_nag)
+{
+       return CALL_COMMAND_HANDLER(handle_command_parse_bool,
+                       &target_reset_nag, "Nag after each reset about options to improve "
+                       "performance");
+}
+
 static const struct command_registration target_exec_command_handlers[] = {
        {
                .name = "fast_load_image",
@@ -4916,7 +4954,7 @@ static const struct command_registration target_exec_command_handlers[] = {
                .handler = handle_virt2phys_command,
                .mode = COMMAND_ANY,
                .help = "translate a virtual address into a physical address",
-               .usage = "virual_address",
+               .usage = "virtual_address",
        },
        {
                .name = "reg",
@@ -5088,6 +5126,14 @@ static const struct command_registration target_exec_command_handlers[] = {
                        "and write the 8/16/32 bit values",
                .usage = "arrayname bitwidth address count",
        },
+       {
+               .name = "reset_nag",
+               .handler = handle_target_reset_nag,
+               .mode = COMMAND_ANY,
+               .help = "Nag after each reset about options that could have been "
+                               "enabled to improve performance. ",
+               .usage = "['enable'|'disable']",
+       },
        COMMAND_REGISTRATION_DONE
 };
 int target_register_user_commands(struct command_context *cmd_ctx)

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)