From 017dc879a6a97becf6a55bd5ff0d73e047a8cae8 Mon Sep 17 00:00:00 2001 From: lanxb Date: Sun, 8 Apr 2018 15:11:14 +0800 Subject: [PATCH 1/2] Fixed IAR Embedded Workbench IDE (6.10.1.52143) asm error issue Signed-off-by: lanxb --- cm_backtrace/cmb_def.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cm_backtrace/cmb_def.h b/cm_backtrace/cmb_def.h index 16b5551..580179e 100644 --- a/cm_backtrace/cmb_def.h +++ b/cm_backtrace/cmb_def.h @@ -327,24 +327,25 @@ if (!(EXPR)) \ bx lr } #elif defined(__ICCARM__) +/* IAR iccarm specific functions */ +/* Close Raw Asm Code Warning */ +#pragma diag_suppress=Pe940 static uint32_t cmb_get_msp(void) { - register uint32_t result; - __asm("MRS %0, msp" : "=r" (result)); - return(result); + __asm("mrs r0, msp"); + __asm("bx lr"); } static uint32_t cmb_get_psp(void) { - register uint32_t result; - __asm("MRS %0, psp" : "=r" (result)); - return(result); + __asm("mrs r0, psp"); + __asm("bx lr"); } static uint32_t cmb_get_sp(void) { - register uint32_t result; - __asm("MOV %0, sp" : "=r" (result)); - return(result); + __asm("mov r0, sp"); + __asm("bx lr"); } +#pragma diag_default=Pe940 #elif defined(__GNUC__) __attribute__( ( always_inline ) ) static inline uint32_t cmb_get_msp(void) { register uint32_t result; From 56f25b68144bd0e294bb87531678bdd1694c19e8 Mon Sep 17 00:00:00 2001 From: lanxb Date: Sun, 8 Apr 2018 17:06:30 +0800 Subject: [PATCH 2/2] Add UCOSIII Implemented Signed-off-by: lanxb --- cm_backtrace/cm_backtrace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cm_backtrace/cm_backtrace.c b/cm_backtrace/cm_backtrace.c index 148266b..e348c3d 100644 --- a/cm_backtrace/cm_backtrace.c +++ b/cm_backtrace/cm_backtrace.c @@ -260,8 +260,10 @@ static void get_cur_thread_stack_info(uint32_t sp, uint32_t *start_addr, size_t *start_addr = (uint32_t) OSTCBCur->OSTCBStkBottom; *size = OSTCBCur->OSTCBStkSize * sizeof(OS_STK); #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSIII) - #error "not implemented, I hope you can do this" - //TODO ´ýʵÏÖ + extern OS_TCB *OSTCBCurPtr; + + *start_addr = (uint32_t) OSTCBCurPtr->StkBasePtr; + *size = OSTCBCurPtr->StkSize * sizeof(CPU_STK_SIZE); #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS) *start_addr = (uint32_t)vTaskStackAddr(); *size = vTaskStackSize() * sizeof( StackType_t ); @@ -284,8 +286,9 @@ static const char *get_cur_thread_name(void) { #endif /* OS_TASK_NAME_SIZE > 0 || OS_TASK_NAME_EN > 0 */ #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSIII) - #error "not implemented, I hope you can do this" - //TODO ´ýʵÏÖ + extern OS_TCB *OSTCBCurPtr; + + return (const char *)OSTCBCurPtr->NamePtr; #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS) return vTaskName(); #endif