target/hla_target: set cortex_m->common_magic
[openocd.git] / src / target / hla_target.c
index d9de2d3a2aa2bf807960c072c9b055e6fe3d309f..3e359b950eed923a3dcc2e80b93bda743ba68fe4 100644 (file)
@@ -37,6 +37,7 @@
 #include "target_type.h"
 #include "armv7m.h"
 #include "cortex_m.h"
+#include "arm_adi_v5.h"
 #include "arm_semihosting.h"
 #include "target_request.h"
 #include <rtt/rtt.h>
@@ -202,17 +203,19 @@ static int adapter_target_create(struct target *target,
 {
        LOG_DEBUG("%s", __func__);
        struct adiv5_private_config *pc = target->private_config;
-       if (pc != NULL && pc->ap_num > 0) {
+       if (pc && pc->ap_num > 0) {
                LOG_ERROR("hla_target: invalid parameter -ap-num (> 0)");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct cortex_m_common *cortex_m = calloc(1, sizeof(struct cortex_m_common));
-       if (cortex_m == NULL) {
+       if (!cortex_m) {
                LOG_ERROR("No memory creating target");
                return ERROR_FAIL;
        }
 
+       cortex_m->common_magic = CORTEX_M_COMMON_MAGIC;
+
        adapter_init_arch_info(target, cortex_m, target->tap);
 
        return ERROR_OK;
@@ -620,7 +623,7 @@ static int adapter_write_memory(struct target *target, target_addr_t address,
        return adapter->layout->api->write_mem(adapter->handle, address, size, count, buffer);
 }
 
-static const struct command_registration adapter_command_handlers[] = {
+static const struct command_registration hla_command_handlers[] = {
        {
                .chain = arm_command_handlers,
        },
@@ -646,7 +649,7 @@ struct target_type hla_target = {
        .target_create = adapter_target_create,
        .target_jim_configure = adiv5_jim_configure,
        .examine = cortex_m_examine,
-       .commands = adapter_command_handlers,
+       .commands = hla_command_handlers,
 
        .poll = adapter_poll,
        .arch_state = armv7m_arch_state,

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)