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) */