openocd: use macro ARRAY_SIZE()
[openocd.git] / src / rtos / nuttx.c
index 8c3076e161d9151cd221641f221f2bae2b589714..c52547120c1383688324520d6c9819bbab2fdada 100644 (file)
@@ -72,7 +72,7 @@ struct tcb {
        uint8_t  dat[512];
 };
 
-struct {
+static struct {
        uint32_t addr;
        uint32_t prio;
 } g_tasklist[TASK_QUEUE_NUM];
@@ -174,7 +174,7 @@ static int rcmd_offset(const char *cmd, const char *name)
 static int nuttx_thread_packet(struct connection *connection,
        char const *packet, int packet_size)
 {
-       char cmd[GDB_BUFFER_SIZE / 2 + 1] = ""; /* Extra byte for nul-termination */
+       char cmd[GDB_BUFFER_SIZE / 2 + 1] = ""; /* Extra byte for null-termination */
 
        if (!strncmp(packet, "qRcmd", 5)) {
                size_t len = unhexify((uint8_t *)cmd, packet + 6, sizeof(cmd));
@@ -314,7 +314,7 @@ static int nuttx_update_threads(struct rtos *rtos)
 
                        state = tcb.dat[state_offset - 8];
                        thread->extra_info_str = NULL;
-                       if (state < sizeof(task_state_str)/sizeof(char *)) {
+                       if (state < ARRAY_SIZE(task_state_str)) {
                                thread->extra_info_str = malloc(256);
                                snprintf(thread->extra_info_str, 256, "pid:%d, %s",
                                    tcb.dat[pid_offset - 8] |
@@ -352,7 +352,7 @@ static int nuttx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
        bool cm4_fpu_enabled = false;
        struct armv7m_common *armv7m_target = target_to_armv7m(rtos->target);
        if (is_armv7m(armv7m_target)) {
-               if (armv7m_target->fp_feature == FPv4_SP) {
+               if (armv7m_target->fp_feature == FPV4_SP) {
                        /* Found ARM v7m target which includes a FPU */
                        uint32_t cpacr;
 
@@ -380,12 +380,12 @@ static int nuttx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
            (uint32_t)thread_id + xcpreg_offset, reg_list, num_regs);
 }
 
-static int nuttx_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
+static int nuttx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
 {
        unsigned int i;
 
-       *symbol_list = (symbol_table_elem_t *) calloc(1,
-               sizeof(symbol_table_elem_t) * ARRAY_SIZE(nuttx_symbol_list));
+       *symbol_list = (struct symbol_table_elem *) calloc(1,
+               sizeof(struct symbol_table_elem) * ARRAY_SIZE(nuttx_symbol_list));
 
        for (i = 0; i < ARRAY_SIZE(nuttx_symbol_list); i++)
                (*symbol_list)[i].symbol_name = nuttx_symbol_list[i];
@@ -401,4 +401,3 @@ struct rtos_type nuttx_rtos = {
        .get_thread_reg_list = nuttx_get_thread_reg_list,
        .get_symbol_list_to_lookup = nuttx_get_symbol_list_to_lookup,
 };
-

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)