rtos: Use 'bool' as return type for detect_rtos() 74/4274/2
authorMarc Schink <openocd-dev@marcschink.de>
Sun, 29 Oct 2017 10:39:51 +0000 (11:39 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 6 Dec 2017 21:01:12 +0000 (21:01 +0000)
Change-Id: I91ad0431d44ed94f48d20c4690f8642d66f52a9b
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4274
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/rtos/ChibiOS.c
src/rtos/FreeRTOS.c
src/rtos/ThreadX.c
src/rtos/eCos.c
src/rtos/embKernel.c
src/rtos/linux.c
src/rtos/mqx.c
src/rtos/rtos.h
src/rtos/uCOS-III.c

index 1bc1af8fcd5d15441da1eb2ac1d26d0fed6c9488..ef0bb16cf42ed4721fe5c1313b650f657e835d31 100644 (file)
@@ -103,7 +103,7 @@ static struct ChibiOS_params ChibiOS_params_list[] = {
 };
 #define CHIBIOS_NUM_PARAMS ((int)(sizeof(ChibiOS_params_list)/sizeof(struct ChibiOS_params)))
 
-static int ChibiOS_detect_rtos(struct target *target);
+static bool ChibiOS_detect_rtos(struct target *target);
 static int ChibiOS_create(struct target *target);
 static int ChibiOS_update_threads(struct rtos *rtos);
 static int ChibiOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list);
@@ -510,7 +510,7 @@ static int ChibiOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
        return 0;
 }
 
-static int ChibiOS_detect_rtos(struct target *target)
+static bool ChibiOS_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        ((target->rtos->symbols[ChibiOS_VAL_rlist].address != 0) ||
@@ -519,14 +519,14 @@ static int ChibiOS_detect_rtos(struct target *target)
                if (target->rtos->symbols[ChibiOS_VAL_ch_debug].address == 0) {
                        LOG_INFO("It looks like the target may be running ChibiOS "
                                        "without ch_debug.");
-                       return 0;
+                       return false;
                }
 
                /* looks like ChibiOS with memory map enabled.*/
-               return 1;
+               return true;
        }
 
-       return 0;
+       return false;
 }
 
 static int ChibiOS_create(struct target *target)
index 83961eb9573cedb5683858999d678fba19de94e0..6027d6739d021efb6a54297f43df9f84aa4326e0 100644 (file)
@@ -99,7 +99,7 @@ static const struct FreeRTOS_params FreeRTOS_params_list[] = {
 
 #define FREERTOS_NUM_PARAMS ((int)(sizeof(FreeRTOS_params_list)/sizeof(struct FreeRTOS_params)))
 
-static int FreeRTOS_detect_rtos(struct target *target);
+static bool FreeRTOS_detect_rtos(struct target *target);
 static int FreeRTOS_create(struct target *target);
 static int FreeRTOS_update_threads(struct rtos *rtos);
 static int FreeRTOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list);
@@ -528,14 +528,14 @@ static int FreeRTOS_get_thread_ascii_info(struct rtos *rtos, threadid_t thread_i
 
 #endif
 
-static int FreeRTOS_detect_rtos(struct target *target)
+static bool FreeRTOS_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        (target->rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address != 0)) {
                /* looks like FreeRTOS */
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 static int FreeRTOS_create(struct target *target)
index ab8a66e93b262627a6e75e78fa4a67c4dc0a9013..b7dbe6d1111bdf057d8f78c1a34cd4d7ae1e7f8a 100644 (file)
@@ -35,7 +35,7 @@ static const struct rtos_register_stacking *get_stacking_info_arm926ejs(const st
 static int is_thread_id_valid(const struct rtos *rtos, int64_t thread_id);
 static int is_thread_id_valid_arm926ejs(const struct rtos *rtos, int64_t thread_id);
 
-static int ThreadX_detect_rtos(struct target *target);
+static bool ThreadX_detect_rtos(struct target *target);
 static int ThreadX_create(struct target *target);
 static int ThreadX_update_threads(struct rtos *rtos);
 static int ThreadX_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list);
@@ -492,14 +492,14 @@ static int ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
        return 0;
 }
 
-static int ThreadX_detect_rtos(struct target *target)
+static bool ThreadX_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        (target->rtos->symbols[ThreadX_VAL_tx_thread_created_ptr].address != 0)) {
                /* looks like ThreadX */
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 #if 0
index edc3d8b51014d0630ae8c5c71b335b9ad65e0f4e..9e41030eed60ebba7bca1a0ed41a339c4ab02955 100644 (file)
@@ -27,7 +27,7 @@
 #include "helper/types.h"
 #include "rtos_ecos_stackings.h"
 
-static int eCos_detect_rtos(struct target *target);
+static bool eCos_detect_rtos(struct target *target);
 static int eCos_create(struct target *target);
 static int eCos_update_threads(struct rtos *rtos);
 static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list);
@@ -363,14 +363,14 @@ static int eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
        return 0;
 }
 
-static int eCos_detect_rtos(struct target *target)
+static bool eCos_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        (target->rtos->symbols[eCos_VAL_thread_list].address != 0)) {
                /* looks like eCos */
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 static int eCos_create(struct target *target)
index e515383ac935193938edb43fbc0fad48db0ca243..a40c86c3fa9726f053311de3d93a402f7de78222 100644 (file)
@@ -31,7 +31,7 @@
 
 #define EMBKERNEL_MAX_THREAD_NAME_STR_SIZE (64)
 
-static int embKernel_detect_rtos(struct target *target);
+static bool embKernel_detect_rtos(struct target *target);
 static int embKernel_create(struct target *target);
 static int embKernel_update_threads(struct rtos *rtos);
 static int embKernel_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list);
@@ -107,13 +107,13 @@ static const struct embKernel_params embKernel_params_list[] = {
                }
 };
 
-static int embKernel_detect_rtos(struct target *target)
+static bool embKernel_detect_rtos(struct target *target)
 {
        if (target->rtos->symbols != NULL) {
                if (target->rtos->symbols[SYMBOL_ID_sCurrentTask].address != 0)
-                       return 1;
+                       return true;
        }
-       return 0;
+       return false;
 }
 
 static int embKernel_create(struct target *target)
index 3efaab133f97bc6dad71aa6a2cd7785cee5eca92..3b2a2b0c34b440fb72effcc1ab450213820dd434 100644 (file)
@@ -309,10 +309,10 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
        return ERROR_OK;
 }
 
-static int linux_os_detect(struct target *target)
+static bool linux_os_detect(struct target *target)
 {
        LOG_INFO("should no be called");
-       return 0;
+       return false;
 }
 
 static int linux_os_smp_init(struct target *target);
index 63a48c54b3d6355d81bec7c98d798d98d089a5a6..531b03b572757bafa96062d91fa40a3a5485a070 100644 (file)
@@ -244,9 +244,9 @@ static int mqx_is_scheduler_running(
 }
 
 /*
- * API function, return 1 if MQX is present
+ * API function, return true if MQX is present
  */
-static int mqx_detect_rtos(
+static bool mqx_detect_rtos(
        struct target *target
 )
 {
@@ -254,9 +254,9 @@ static int mqx_detect_rtos(
                (target->rtos->symbols != NULL) &&
                (target->rtos->symbols[mqx_VAL_mqx_kernel_data].address != 0)
        ) {
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 /*
index 70c1193e54840c460afd1c520a7aaea7e2492d66..87aa5027d231ecb3f9260047796752e115e74dce 100644 (file)
@@ -59,7 +59,7 @@ struct rtos {
 
 struct rtos_type {
        const char *name;
-       int (*detect_rtos)(struct target *target);
+       bool (*detect_rtos)(struct target *target);
        int (*create)(struct target *target);
        int (*smp_init)(struct target *target);
        int (*update_threads)(struct rtos *rtos);
index 0a0fb3e9e7e785f56cebe6dfe6ebbead2dd3b33d..8e63ea4e6c740c5ecffd2c3b664b0a37ea022bd1 100644 (file)
@@ -241,7 +241,7 @@ static int uCOS_III_update_thread_offsets(struct rtos *rtos)
        return ERROR_OK;
 }
 
-static int uCOS_III_detect_rtos(struct target *target)
+static bool uCOS_III_detect_rtos(struct target *target)
 {
        return target->rtos->symbols != NULL &&
                        target->rtos->symbols[uCOS_III_VAL_OSRunning].address != 0;

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)