From b69119668ed8d9633280f8b596fe9af60f51644b Mon Sep 17 00:00:00 2001 From: "Broadcom Corporation (Evan Hunter)" Date: Thu, 14 Apr 2011 10:25:01 +0200 Subject: RTOS Thread awareness support wip - works on Cortex-M3 with ThreadX and FreeRTOS Compared to original patch a few nits were fixed: - remove stricmp usage - unsigned compare fix - printf formatting fixes - fixed a bug with overrunning a memory buffer allocated with malloc. --- src/target/target.c | 21 +++++++++++++++++++++ src/target/target.h | 6 ++++++ 2 files changed, 27 insertions(+) (limited to 'src/target') diff --git a/src/target/target.c b/src/target/target.c index 026ca13b..abe1b43a 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -14,6 +14,9 @@ * Copyright (C) 2008 by Rick Altherr * * kc8apf@kc8apf.net> * * * + * Copyright (C) 2011 by Broadcom Corporation * + * Evan Hunter - ehunter@broadcom.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -44,6 +47,7 @@ #include "register.h" #include "trace.h" #include "image.h" +#include "rtos/rtos.h" static int target_read_buffer_default(struct target *target, uint32_t address, @@ -3704,6 +3708,7 @@ enum target_cfg_param { TCFG_COREID, TCFG_CHAIN_POSITION, TCFG_DBGBASE, + TCFG_RTOS, }; static Jim_Nvp nvp_config_opts[] = { @@ -3718,6 +3723,7 @@ static Jim_Nvp nvp_config_opts[] = { { .name = "-coreid", .value = TCFG_COREID }, { .name = "-chain-position", .value = TCFG_CHAIN_POSITION }, { .name = "-dbgbase", .value = TCFG_DBGBASE }, + { .name = "-rtos", .value = TCFG_RTOS }, { .name = NULL, .value = -1 } }; @@ -4024,6 +4030,18 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target) Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, target->dbgbase)); /* loop for more */ break; + + case TCFG_RTOS: + /* RTOS */ + { + int result = rtos_create( goi, target ); + if ( result != JIM_OK ) + { + return result; + } + } + /* loop for more */ + break; } } /* while (goi->argc) */ @@ -4746,6 +4764,9 @@ static int target_create(Jim_GetOptInfo *goi) target->endianness = TARGET_ENDIAN_UNKNOWN; + target->rtos = NULL; + target->rtos_auto_detect = false; + /* Do the rest as "configure" options */ goi->isconfigure = 1; e = target_configure(goi, target); diff --git a/src/target/target.h b/src/target/target.h index fd7de560..5b67bf34 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -8,6 +8,9 @@ * Copyright (C) 2008 by Spencer Oliver * * spen@spen-soft.co.uk * * * + * Copyright (C) 2011 by Broadcom Corporation * + * Evan Hunter - ehunter@broadcom.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -160,6 +163,9 @@ struct target uint32_t dbgbase; /* Really a Cortex-A specific option, but there is no system in place to support target specific options currently. */ + struct rtos *rtos; /* Instance of Real Time Operating System support */ + bool rtos_auto_detect; /* A flag that indicates that the RTOS has been specified as "auto" + * and must be detected when symbols are offered */ }; /** Returns the instance-specific name of the specified target. */ -- cgit v1.2.3