From fa0767ec4da91d0367b5c1e14ac40051d72ead9f Mon Sep 17 00:00:00 2001 From: Linghu Date: Wed, 20 Jun 2018 15:55:27 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91CMSIS-RTOS2?= =?UTF-8?q?-RTX5=20=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cm_backtrace/cm_backtrace.c | 14 ++++++++++++++ cm_backtrace/cmb_cfg.h | 2 +- cm_backtrace/cmb_def.h | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cm_backtrace/cm_backtrace.c b/cm_backtrace/cm_backtrace.c index 4d446e8..f3a29c2 100644 --- a/cm_backtrace/cm_backtrace.c +++ b/cm_backtrace/cm_backtrace.c @@ -267,6 +267,10 @@ static void get_cur_thread_stack_info(uint32_t sp, uint32_t *start_addr, size_t #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS) *start_addr = (uint32_t)vTaskStackAddr(); *size = vTaskStackSize() * sizeof( StackType_t ); +#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTX5) + //osRtxThread_t *thread = osRtxInfo.thread.run.curr; + *start_addr = (uint32_t) osRtxInfo.thread.run.curr->stack_mem; + *size = osRtxInfo.thread.run.curr->stack_size; #endif } @@ -291,6 +295,16 @@ static const char *get_cur_thread_name(void) { return (const char *)OSTCBCurPtr->NamePtr; #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS) return vTaskName(); +#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTX5) + //osRtxThread_t *thread = osRtxInfo.thread.run.curr; + + if ((osRtxInfo.thread.run.curr == NULL) || (osRtxInfo.thread.run.curr->id != osRtxIdThread)) { + return NULL; //lint !e{904} "Return statement before end of function" [MISRA Note 1] + } + if (osRtxInfo.thread.run.curr->state == osRtxObjectInactive) { + return NULL; //lint -e{904} "Return statement before end of function" [MISRA Note 1] + } + return osRtxInfo.thread.run.curr->name; #endif } diff --git a/cm_backtrace/cmb_cfg.h b/cm_backtrace/cmb_cfg.h index f33ba88..c0e8e2b 100644 --- a/cm_backtrace/cmb_cfg.h +++ b/cm_backtrace/cmb_cfg.h @@ -36,7 +36,7 @@ /* enable OS platform */ /* #define CMB_USING_OS_PLATFORM */ /* OS platform type, must config when CMB_USING_OS_PLATFORM is enable */ -/* #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_RTT or CMB_OS_PLATFORM_UCOSII or CMB_OS_PLATFORM_UCOSIII or CMB_OS_PLATFORM_FREERTOS */ +/* #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_RTT or CMB_OS_PLATFORM_UCOSII or CMB_OS_PLATFORM_UCOSIII or CMB_OS_PLATFORM_FREERTOS or CMB_OS_PLATFORM_RTX5 */ /* cpu platform type, must config by user */ #define CMB_CPU_PLATFORM_TYPE /* CMB_CPU_ARM_CORTEX_M0 or CMB_CPU_ARM_CORTEX_M3 or CMB_CPU_ARM_CORTEX_M4 or CMB_CPU_ARM_CORTEX_M7 */ /* enable dump stack information */ diff --git a/cm_backtrace/cmb_def.h b/cm_backtrace/cmb_def.h index 0d15d65..b7c4d39 100644 --- a/cm_backtrace/cmb_def.h +++ b/cm_backtrace/cmb_def.h @@ -45,6 +45,7 @@ #define CMB_OS_PLATFORM_UCOSII 1 #define CMB_OS_PLATFORM_UCOSIII 2 #define CMB_OS_PLATFORM_FREERTOS 3 +#define CMB_OS_PLATFORM_RTX5 4 #define CMB_PRINT_LANGUAGE_ENGLISH 0 #define CMB_PRINT_LANUUAGE_CHINESE 1 @@ -306,6 +307,8 @@ if (!(EXPR)) \ extern uint32_t *vTaskStackAddr(void);/* need to modify the FreeRTOS/tasks source code */ extern uint32_t vTaskStackSize(void); extern char * vTaskName(void); + #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTX5) + #include #else #error "not supported OS type" #endif /* (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT) */