rtos: do not use LOG_OUTPUT
[openocd.git] / src / rtos / eCos.c
index 5c18916a12ee58908413bd4410f8ede84cb08d7c..6a0ed4ec0619bae71c0c5cbac1ce30ab88f68fbc 100644 (file)
@@ -26,6 +26,7 @@
 #include "target/target_type.h"
 #include "rtos.h"
 #include "helper/log.h"
+#include "helper/types.h"
 #include "rtos_ecos_stackings.h"
 
 static int eCos_detect_rtos(struct target *target);
@@ -87,8 +88,6 @@ static char *eCos_symbol_list[] = {
        NULL
 };
 
-#define ECOS_NUM_SYMBOLS (sizeof(eCos_symbol_list)/sizeof(char *))
-
 const struct rtos_type eCos_rtos = {
        .name = "eCos",
 
@@ -116,12 +115,12 @@ static int eCos_update_threads(struct rtos *rtos)
        param = (const struct eCos_params *) rtos->rtos_specific_params;
 
        if (rtos->symbols == NULL) {
-               LOG_OUTPUT("No symbols for eCos\r\n");
+               LOG_ERROR("No symbols for eCos");
                return -4;
        }
 
        if (rtos->symbols[eCos_VAL_thread_list].address == 0) {
-               LOG_OUTPUT("Don't have the thread list head\r\n");
+               LOG_ERROR("Don't have the thread list head");
                return -2;
        }
 
@@ -178,7 +177,7 @@ static int eCos_update_threads(struct rtos *rtos)
                        2,
                        (uint8_t *)&rtos->current_thread);
        if (retval != ERROR_OK) {
-               LOG_OUTPUT("Could not read eCos current thread from target\r\n");
+               LOG_ERROR("Could not read eCos current thread from target");
                return retval;
        }
 
@@ -225,7 +224,7 @@ static int eCos_update_threads(struct rtos *rtos)
                                2,
                                (uint8_t *)&thread_id);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Could not read eCos thread id from target\r\n");
+                       LOG_ERROR("Could not read eCos thread id from target");
                        return retval;
                }
                rtos->thread_details[tasks_found].threadid = thread_id;
@@ -236,7 +235,7 @@ static int eCos_update_threads(struct rtos *rtos)
                                param->pointer_width,
                                (uint8_t *)&name_ptr);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Could not read eCos thread name pointer from target\r\n");
+                       LOG_ERROR("Could not read eCos thread name pointer from target");
                        return retval;
                }
 
@@ -247,7 +246,7 @@ static int eCos_update_threads(struct rtos *rtos)
                                ECOS_THREAD_NAME_STR_SIZE,
                                (uint8_t *)&tmp_str);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Error reading thread name from eCos target\r\n");
+                       LOG_ERROR("Error reading thread name from eCos target");
                        return retval;
                }
                tmp_str[ECOS_THREAD_NAME_STR_SIZE-1] = '\x00';
@@ -266,7 +265,7 @@ static int eCos_update_threads(struct rtos *rtos)
                                4,
                                (uint8_t *)&thread_status);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Error reading thread state from eCos target\r\n");
+                       LOG_ERROR("Error reading thread state from eCos target");
                        return retval;
                }
 
@@ -300,7 +299,7 @@ static int eCos_update_threads(struct rtos *rtos)
                                param->pointer_width,
                                (uint8_t *) &thread_index);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Error reading next thread pointer in eCos thread list\r\n");
+                       LOG_ERROR("Error reading next thread pointer in eCos thread list");
                        return retval;
                }
        } while (thread_index != first_thread);
@@ -340,7 +339,7 @@ static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char *
                                2,
                                (uint8_t *)&id);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Error reading unique id from eCos thread\r\n");
+                       LOG_ERROR("Error reading unique id from eCos thread");
                        return retval;
                }
 
@@ -362,7 +361,7 @@ static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char *
                                param->pointer_width,
                                (uint8_t *)&stack_ptr);
                if (retval != ERROR_OK) {
-                       LOG_OUTPUT("Error reading stack frame from eCos thread\r\n");
+                       LOG_ERROR("Error reading stack frame from eCos thread");
                        return retval;
                }
 
@@ -379,9 +378,9 @@ static int eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
 {
        unsigned int i;
        *symbol_list = (symbol_table_elem_t *) malloc(
-                       sizeof(symbol_table_elem_t) * ECOS_NUM_SYMBOLS);
+                       sizeof(symbol_table_elem_t) * ARRAY_SIZE(eCos_symbol_list));
 
-       for (i = 0; i < ECOS_NUM_SYMBOLS; i++)
+       for (i = 0; i < ARRAY_SIZE(eCos_symbol_list); i++)
                (*symbol_list)[i].symbol_name = eCos_symbol_list[i];
 
        return 0;
@@ -405,7 +404,7 @@ static int eCos_create(struct target *target)
                i++;
        }
        if (i >= ECOS_NUM_PARAMS) {
-               LOG_OUTPUT("Could not find target in eCos compatibility list\r\n");
+               LOG_ERROR("Could not find target in eCos compatibility list");
                return -1;
        }
 

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)