X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Frtos%2FeCos.c;h=6a0ed4ec0619bae71c0c5cbac1ce30ab88f68fbc;hb=a84d237acfa06ed2e40d5db807ff1a1a7d28cd8d;hp=5c18916a12ee58908413bd4410f8ede84cb08d7c;hpb=7b032df3aa63905c16c63f1ba4414a04687f3777;p=fw%2Fopenocd diff --git a/src/rtos/eCos.c b/src/rtos/eCos.c index 5c18916a1..6a0ed4ec0 100644 --- a/src/rtos/eCos.c +++ b/src/rtos/eCos.c @@ -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; }