Compare commits

..

No commits in common. 'master' and '1.4.1' have entirely different histories.

@ -36,7 +36,7 @@
[PRINT_MAIN_STACK_INFO] = "====== Main stack information ======", [PRINT_MAIN_STACK_INFO] = "====== Main stack information ======",
[PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow", [PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow",
[PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow", [PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow",
[PRINT_CALL_STACK_INFO] = "Show more call stack info by run: addr2line -e %s%s -afpiC %.*s", [PRINT_CALL_STACK_INFO] = "Show more call stack info by run: addr2line -e %s%s -a -f %.*s",
[PRINT_CALL_STACK_ERR] = "Dump call stack has an error", [PRINT_CALL_STACK_ERR] = "Dump call stack has an error",
[PRINT_FAULT_ON_THREAD] = "Fault on thread %s", [PRINT_FAULT_ON_THREAD] = "Fault on thread %s",
[PRINT_FAULT_ON_HANDLER] = "Fault on interrupt or bare metal(no OS) environment", [PRINT_FAULT_ON_HANDLER] = "Fault on interrupt or bare metal(no OS) environment",

@ -36,7 +36,7 @@
[PRINT_MAIN_STACK_INFO] = "============ 主堆栈信息 ============", [PRINT_MAIN_STACK_INFO] = "============ 主堆栈信息 ============",
[PRINT_THREAD_STACK_OVERFLOW] = "错误:线程栈(%08x)发生溢出", [PRINT_THREAD_STACK_OVERFLOW] = "错误:线程栈(%08x)发生溢出",
[PRINT_MAIN_STACK_OVERFLOW] = "错误:主栈(%08x)发生溢出", [PRINT_MAIN_STACK_OVERFLOW] = "错误:主栈(%08x)发生溢出",
[PRINT_CALL_STACK_INFO] = "查看更多函数调用栈信息请运行addr2line -e %s%s -afpiC %.*s", [PRINT_CALL_STACK_INFO] = "查看更多函数调用栈信息请运行addr2line -e %s%s -a -f %.*s",
[PRINT_CALL_STACK_ERR] = "获取函数调用栈失败", [PRINT_CALL_STACK_ERR] = "获取函数调用栈失败",
[PRINT_FAULT_ON_THREAD] = "在线程(%s)中发生错误异常", [PRINT_FAULT_ON_THREAD] = "在线程(%s)中发生错误异常",
[PRINT_FAULT_ON_HANDLER] = "在中断或裸机环境下发生错误异常", [PRINT_FAULT_ON_HANDLER] = "在中断或裸机环境下发生错误异常",

@ -36,7 +36,7 @@
[PRINT_MAIN_STACK_INFO] = "============ 主堆栈信息 ============", [PRINT_MAIN_STACK_INFO] = "============ 主堆栈信息 ============",
[PRINT_THREAD_STACK_OVERFLOW] = "错误:线程栈(%08x)发生溢出", [PRINT_THREAD_STACK_OVERFLOW] = "错误:线程栈(%08x)发生溢出",
[PRINT_MAIN_STACK_OVERFLOW] = "错误:主栈(%08x)发生溢出", [PRINT_MAIN_STACK_OVERFLOW] = "错误:主栈(%08x)发生溢出",
[PRINT_CALL_STACK_INFO] = "查看更多函数调用栈信息请运行addr2line -e %s%s -afpiC %.*s", [PRINT_CALL_STACK_INFO] = "查看更多函数调用栈信息请运行addr2line -e %s%s -a -f %.*s",
[PRINT_CALL_STACK_ERR] = "获取函数调用栈失败", [PRINT_CALL_STACK_ERR] = "获取函数调用栈失败",
[PRINT_FAULT_ON_THREAD] = "在线程(%s)中发生错误异常", [PRINT_FAULT_ON_THREAD] = "在线程(%s)中发生错误异常",
[PRINT_FAULT_ON_HANDLER] = "在中断或裸机环境下发生错误异常", [PRINT_FAULT_ON_HANDLER] = "在中断或裸机环境下发生错误异常",

@ -112,16 +112,14 @@ static const char * const print_info[] = {
#include "Languages/zh-CN/cmb_zh_CN.h" #include "Languages/zh-CN/cmb_zh_CN.h"
#elif (CMB_PRINT_LANGUAGE == CMB_PRINT_LANGUAGE_CHINESE_UTF8) #elif (CMB_PRINT_LANGUAGE == CMB_PRINT_LANGUAGE_CHINESE_UTF8)
#include "Languages/zh-CN/cmb_zh_CN_UTF8.h" #include "Languages/zh-CN/cmb_zh_CN_UTF8.h"
#elif (CMB_PRINT_LANGUAGE == CMB_PRINT_LANGUAGE_CUSTOM)
#include "cmb_language_custom.h"
#else #else
#error "CMB_PRINT_LANGUAGE defined error in 'cmb_cfg.h'" #error "CMB_PRINT_LANGUAGE defined error in 'cmb_cfg.h'"
#endif #endif
}; };
static char fw_name[CMB_NAME_MAX + 1] = {0}; static char fw_name[CMB_NAME_MAX] = {0};
static char hw_ver[CMB_NAME_MAX + 1] = {0}; static char hw_ver[CMB_NAME_MAX] = {0};
static char sw_ver[CMB_NAME_MAX + 1] = {0}; static char sw_ver[CMB_NAME_MAX] = {0};
static uint32_t main_stack_start_addr = 0; static uint32_t main_stack_start_addr = 0;
static size_t main_stack_size = 0; static size_t main_stack_size = 0;
static uint32_t code_start_addr = 0; static uint32_t code_start_addr = 0;
@ -189,31 +187,26 @@ void cm_backtrace_firmware_info(void) {
* @param start_addr stack start address * @param start_addr stack start address
* @param size stack size * @param size stack size
*/ */
static void get_cur_thread_stack_info(uint32_t *sp, uint32_t *start_addr, size_t *size) { static void get_cur_thread_stack_info(uint32_t sp, uint32_t *start_addr, size_t *size) {
CMB_ASSERT(start_addr); CMB_ASSERT(start_addr);
CMB_ASSERT(size); CMB_ASSERT(size);
#if (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT) #if (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT)
*start_addr = (uint32_t) rt_thread_self()->stack_addr; *start_addr = (uint32_t) rt_thread_self()->stack_addr;
*size = rt_thread_self()->stack_size; *size = rt_thread_self()->stack_size;
*sp = (uint32_t)rt_thread_self()->sp;
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSII) #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSII)
extern OS_TCB *OSTCBCur; extern OS_TCB *OSTCBCur;
*start_addr = (uint32_t) OSTCBCur->OSTCBStkBottom; *start_addr = (uint32_t) OSTCBCur->OSTCBStkBottom;
*size = OSTCBCur->OSTCBStkSize * sizeof(OS_STK); *size = OSTCBCur->OSTCBStkSize * sizeof(OS_STK);
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSIII) #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSIII)
extern OS_TCB *OSTCBCurPtr; extern OS_TCB *OSTCBCurPtr;
*start_addr = (uint32_t) OSTCBCurPtr->StkBasePtr; *start_addr = (uint32_t) OSTCBCurPtr->StkBasePtr;
*size = OSTCBCurPtr->StkSize * sizeof(CPU_STK_SIZE); *size = OSTCBCurPtr->StkSize * sizeof(CPU_STK_SIZE);
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS) #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS)
*start_addr = (uint32_t)vTaskStackAddr(); *start_addr = (uint32_t)vTaskStackAddr();
*size = vTaskStackSize() * sizeof( StackType_t ); *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)thread->stack_mem;
*size = thread->stack_size;
#endif #endif
} }
@ -222,11 +215,7 @@ static void get_cur_thread_stack_info(uint32_t *sp, uint32_t *start_addr, size_t
*/ */
static const char *get_cur_thread_name(void) { static const char *get_cur_thread_name(void) {
#if (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT) #if (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT)
#if (RT_VER_NUM < 0x50001)
return rt_thread_self()->name; return rt_thread_self()->name;
#else
return rt_thread_self()->parent.name;
#endif
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSII) #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSII)
extern OS_TCB *OSTCBCur; extern OS_TCB *OSTCBCur;
@ -237,13 +226,11 @@ static const char *get_cur_thread_name(void) {
#endif /* OS_TASK_NAME_SIZE > 0 || OS_TASK_NAME_EN > 0 */ #endif /* OS_TASK_NAME_SIZE > 0 || OS_TASK_NAME_EN > 0 */
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSIII) #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_UCOSIII)
extern OS_TCB *OSTCBCurPtr; extern OS_TCB *OSTCBCurPtr;
return (const char *)OSTCBCurPtr->NamePtr; return (const char *)OSTCBCurPtr->NamePtr;
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS) #elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_FREERTOS)
return vTaskName(); return vTaskName();
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTX5)
return osRtxInfo.thread.run.curr->name;
#endif #endif
} }
@ -254,8 +241,6 @@ static const char *get_cur_thread_name(void) {
* dump current stack information * dump current stack information
*/ */
static void dump_stack(uint32_t stack_start_addr, size_t stack_size, uint32_t *stack_pointer) { static void dump_stack(uint32_t stack_start_addr, size_t stack_size, uint32_t *stack_pointer) {
uint32_t deep = CMB_DUMP_STACK_DEPTH_SIZE;
if (stack_is_overflow) { if (stack_is_overflow) {
if (on_thread_before_fault) { if (on_thread_before_fault) {
cmb_println(print_info[PRINT_THREAD_STACK_OVERFLOW], stack_pointer); cmb_println(print_info[PRINT_THREAD_STACK_OVERFLOW], stack_pointer);
@ -269,7 +254,7 @@ static void dump_stack(uint32_t stack_start_addr, size_t stack_size, uint32_t *s
} }
} }
cmb_println(print_info[PRINT_THREAD_STACK_INFO]); cmb_println(print_info[PRINT_THREAD_STACK_INFO]);
for (; (uint32_t) stack_pointer < stack_start_addr + stack_size && deep; stack_pointer++, deep--) { for (; (uint32_t) stack_pointer < stack_start_addr + stack_size; stack_pointer++) {
cmb_println(" addr: %08x data: %08x", stack_pointer, *stack_pointer); cmb_println(" addr: %08x data: %08x", stack_pointer, *stack_pointer);
} }
cmb_println("===================================="); cmb_println("====================================");
@ -296,31 +281,6 @@ static bool disassembly_ins_is_bl_blx(uint32_t addr) {
} }
} }
size_t cm_backtrace_call_stack_any(uint32_t *buffer, size_t size, uint32_t sp, uint32_t stack_start_addr, uint32_t stack_size)
{
uint32_t pc;
size_t depth = 0;
/* copy called function address */
for (; sp < stack_start_addr + stack_size; sp += sizeof(size_t)) {
/* the *sp value may be LR, so need decrease a word to PC */
pc = *((uint32_t *) sp) - sizeof(size_t);
/* the Cortex-M using thumb instruction, so the pc must be an odd number */
if (pc % 2 == 0) {
continue;
}
/* fix the PC address in thumb mode */
pc = *((uint32_t *) sp) - 1;
if ((pc >= code_start_addr + sizeof(size_t)) && (pc <= code_start_addr + code_size) && (depth < CMB_CALL_STACK_MAX_DEPTH)
/* check the the instruction before PC address is 'BL' or 'BLX' */
&& disassembly_ins_is_bl_blx(pc - sizeof(size_t)) && (depth < size)) {
/* the second depth function may be already saved, so need ignore repeat */
buffer[depth++] = pc;
}
}
return depth;
}
/** /**
* backtrace function call stack * backtrace function call stack
* *
@ -332,10 +292,6 @@ size_t cm_backtrace_call_stack_any(uint32_t *buffer, size_t size, uint32_t sp, u
*/ */
size_t cm_backtrace_call_stack(uint32_t *buffer, size_t size, uint32_t sp) { size_t cm_backtrace_call_stack(uint32_t *buffer, size_t size, uint32_t sp) {
uint32_t stack_start_addr = main_stack_start_addr, pc; uint32_t stack_start_addr = main_stack_start_addr, pc;
#ifdef CMB_USING_OS_PLATFORM
uint32_t tcb_sp;
#endif
size_t depth = 0, stack_size = main_stack_size; size_t depth = 0, stack_size = main_stack_size;
bool regs_saved_lr_is_valid = false; bool regs_saved_lr_is_valid = false;
@ -355,19 +311,23 @@ size_t cm_backtrace_call_stack(uint32_t *buffer, size_t size, uint32_t sp) {
#ifdef CMB_USING_OS_PLATFORM #ifdef CMB_USING_OS_PLATFORM
/* program is running on thread before fault */ /* program is running on thread before fault */
if (on_thread_before_fault) { if (on_thread_before_fault) {
get_cur_thread_stack_info(&tcb_sp, &stack_start_addr, &stack_size); get_cur_thread_stack_info(sp, &stack_start_addr, &stack_size);
} }
} else { } else {
/* OS environment */ /* OS environment */
if (cmb_get_sp() == cmb_get_psp()) { if (cmb_get_sp() == cmb_get_psp()) {
get_cur_thread_stack_info(&tcb_sp, &stack_start_addr, &stack_size); get_cur_thread_stack_info(sp, &stack_start_addr, &stack_size);
} }
#endif /* CMB_USING_OS_PLATFORM */ #endif /* CMB_USING_OS_PLATFORM */
} }
if (stack_is_overflow) { if (stack_is_overflow) {
sp = stack_start_addr; if (sp < stack_start_addr) {
sp = stack_start_addr;
} else if (sp > stack_start_addr + stack_size) {
sp = stack_start_addr + stack_size;
}
} }
/* copy called function address */ /* copy called function address */
@ -424,13 +384,12 @@ static void print_call_stack(uint32_t sp) {
* @param sp the stack pointer when on assert occurred * @param sp the stack pointer when on assert occurred
*/ */
void cm_backtrace_assert(uint32_t sp) { void cm_backtrace_assert(uint32_t sp) {
CMB_ASSERT(init_ok);
#ifdef CMB_USING_OS_PLATFORM #ifdef CMB_USING_OS_PLATFORM
uint32_t tcb_sp;
uint32_t cur_stack_pointer = cmb_get_sp(); uint32_t cur_stack_pointer = cmb_get_sp();
#endif #endif
CMB_ASSERT(init_ok);
cmb_println(""); cmb_println("");
cm_backtrace_firmware_info(); cm_backtrace_firmware_info();
@ -449,7 +408,7 @@ void cm_backtrace_assert(uint32_t sp) {
#ifdef CMB_USING_DUMP_STACK_INFO #ifdef CMB_USING_DUMP_STACK_INFO
uint32_t stack_start_addr; uint32_t stack_start_addr;
size_t stack_size; size_t stack_size;
get_cur_thread_stack_info(&tcb_sp, &stack_start_addr, &stack_size); get_cur_thread_stack_info(sp, &stack_start_addr, &stack_size);
dump_stack(stack_start_addr, stack_size, (uint32_t *) sp); dump_stack(stack_start_addr, stack_size, (uint32_t *) sp);
#endif /* CMB_USING_DUMP_STACK_INFO */ #endif /* CMB_USING_DUMP_STACK_INFO */
@ -604,7 +563,7 @@ static uint32_t statck_del_fpu_regs(uint32_t fault_handler_lr, uint32_t sp) {
* @param fault_handler_sp the stack pointer on fault handler * @param fault_handler_sp the stack pointer on fault handler
*/ */
void cm_backtrace_fault(uint32_t fault_handler_lr, uint32_t fault_handler_sp) { void cm_backtrace_fault(uint32_t fault_handler_lr, uint32_t fault_handler_sp) {
uint32_t stack_pointer = fault_handler_sp, saved_regs_addr = stack_pointer, tcb_stack_pointer = 0; uint32_t stack_pointer = fault_handler_sp, saved_regs_addr = stack_pointer;
const char *regs_name[] = { "R0 ", "R1 ", "R2 ", "R3 ", "R12", "LR ", "PC ", "PSR" }; const char *regs_name[] = { "R0 ", "R1 ", "R2 ", "R3 ", "R12", "LR ", "PC ", "PSR" };
#ifdef CMB_USING_DUMP_STACK_INFO #ifdef CMB_USING_DUMP_STACK_INFO
@ -629,7 +588,7 @@ void cm_backtrace_fault(uint32_t fault_handler_lr, uint32_t fault_handler_sp) {
saved_regs_addr = stack_pointer = cmb_get_psp(); saved_regs_addr = stack_pointer = cmb_get_psp();
#ifdef CMB_USING_DUMP_STACK_INFO #ifdef CMB_USING_DUMP_STACK_INFO
get_cur_thread_stack_info(&tcb_stack_pointer, &stack_start_addr, &stack_size); get_cur_thread_stack_info(stack_pointer, &stack_start_addr, &stack_size);
#endif /* CMB_USING_DUMP_STACK_INFO */ #endif /* CMB_USING_DUMP_STACK_INFO */
} else { } else {
@ -651,21 +610,14 @@ void cm_backtrace_fault(uint32_t fault_handler_lr, uint32_t fault_handler_sp) {
#ifdef CMB_USING_DUMP_STACK_INFO #ifdef CMB_USING_DUMP_STACK_INFO
/* check stack overflow */ /* check stack overflow */
if (stack_pointer < stack_start_addr || stack_pointer > stack_start_addr + stack_size) { if (stack_pointer < stack_start_addr || stack_pointer > stack_start_addr + stack_size) {
cmb_println("stack_pointer: 0x%08x, stack_start_addr: 0x%08x, stack_end_addr: 0x%08x", stack_pointer, stack_start_addr,
stack_start_addr + stack_size);
stack_is_overflow = true; stack_is_overflow = true;
#if (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT)
if (on_thread_before_fault) {
/* change the stack start adder to TCB->sp when stack is overflow */
stack_pointer = tcb_stack_pointer;
}
#endif
} }
/* dump stack information */ /* dump stack information */
dump_stack(stack_start_addr, stack_size, (uint32_t *) stack_pointer); dump_stack(stack_start_addr, stack_size, (uint32_t *) stack_pointer);
#endif /* CMB_USING_DUMP_STACK_INFO */ #endif /* CMB_USING_DUMP_STACK_INFO */
{ /* the stack frame may be get failed when it is overflow */
if (!stack_is_overflow) {
/* dump register */ /* dump register */
cmb_println(print_info[PRINT_REGS_TITLE]); cmb_println(print_info[PRINT_REGS_TITLE]);

@ -30,17 +30,17 @@
#define _CMB_CFG_H_ #define _CMB_CFG_H_
/* print line, must config by user */ /* print line, must config by user */
#define cmb_println(...) /* e.g., printf(__VA_ARGS__);printf("\r\n") or SEGGER_RTT_printf(0, __VA_ARGS__);SEGGER_RTT_WriteString(0, "\r\n") */ #define cmb_println(...) /* e.g., printf(__VA_ARGS__);printf("\r\n") */
/* enable bare metal(no OS) platform */ /* enable bare metal(no OS) platform */
/* #define CMB_USING_BARE_METAL_PLATFORM */ /* #define CMB_USING_BARE_METAL_PLATFORM */
/* enable OS platform */ /* enable OS platform */
/* #define CMB_USING_OS_PLATFORM */ /* #define CMB_USING_OS_PLATFORM */
/* OS platform type, must config when CMB_USING_OS_PLATFORM is enable */ /* 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 or CMB_OS_PLATFORM_RTX5 */ /* #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_RTT or CMB_OS_PLATFORM_UCOSII or CMB_OS_PLATFORM_UCOSIII or CMB_OS_PLATFORM_FREERTOS */
/* cpu platform type, must config by user */ /* 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 or CMB_CPU_ARM_CORTEX_M33 */ #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 */ /* enable dump stack information */
/* #define CMB_USING_DUMP_STACK_INFO */ /* #define CMB_USING_DUMP_STACK_INFO */
/* language of print information */ /* language of print information */
/* #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH(default) or CMB_PRINT_LANGUAGE_CHINESE or CMB_PRINT_LANGUAGE_CHINESE_UTF8 */ /* #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH(default) or CMB_PRINT_LANGUAGE_CHINESE */
#endif /* _CMB_CFG_H_ */ #endif /* _CMB_CFG_H_ */

@ -34,7 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
/* library software version number */ /* library software version number */
#define CMB_SW_VERSION "1.4.2" #define CMB_SW_VERSION "1.4.1"
#define CMB_CPU_ARM_CORTEX_M0 0 #define CMB_CPU_ARM_CORTEX_M0 0
#define CMB_CPU_ARM_CORTEX_M3 1 #define CMB_CPU_ARM_CORTEX_M3 1
@ -46,12 +46,10 @@
#define CMB_OS_PLATFORM_UCOSII 1 #define CMB_OS_PLATFORM_UCOSII 1
#define CMB_OS_PLATFORM_UCOSIII 2 #define CMB_OS_PLATFORM_UCOSIII 2
#define CMB_OS_PLATFORM_FREERTOS 3 #define CMB_OS_PLATFORM_FREERTOS 3
#define CMB_OS_PLATFORM_RTX5 4
#define CMB_PRINT_LANGUAGE_ENGLISH 0 #define CMB_PRINT_LANGUAGE_ENGLISH 0
#define CMB_PRINT_LANGUAGE_CHINESE 1 #define CMB_PRINT_LANGUAGE_CHINESE 1
#define CMB_PRINT_LANGUAGE_CHINESE_UTF8 2 #define CMB_PRINT_LANGUAGE_CHINESE_UTF8 2
#define CMB_PRINT_LANGUAGE_CUSTOM 0xFF
/* name max length, default size: 32 */ /* name max length, default size: 32 */
#ifndef CMB_NAME_MAX #ifndef CMB_NAME_MAX
@ -103,17 +101,9 @@
#error "not supported compiler" #error "not supported compiler"
#endif #endif
/* supported function call stack max depth, default is 32 */ /* supported function call stack max depth, default is 16 */
#ifndef CMB_CALL_STACK_MAX_DEPTH #ifndef CMB_CALL_STACK_MAX_DEPTH
#define CMB_CALL_STACK_MAX_DEPTH 32 #define CMB_CALL_STACK_MAX_DEPTH 16
#endif
/*
* The maximum print depth in case of exception prevents
* too much stack information from printing and insufficient log space
*/
#ifndef CMB_DUMP_STACK_DEPTH_SIZE
#define CMB_DUMP_STACK_DEPTH_SIZE (16)
#endif #endif
/* system handler control and state register */ /* system handler control and state register */
@ -311,7 +301,7 @@ if (!(EXPR)) \
} }
/* ELF(Executable and Linking Format) file extension name for each compiler */ /* ELF(Executable and Linking Format) file extension name for each compiler */
#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__ARMCC_VERSION) #if defined(__ARMCC_VERSION)
#define CMB_ELF_FILE_EXTENSION_NAME ".axf" #define CMB_ELF_FILE_EXTENSION_NAME ".axf"
#elif defined(__ICCARM__) #elif defined(__ICCARM__)
#define CMB_ELF_FILE_EXTENSION_NAME ".out" #define CMB_ELF_FILE_EXTENSION_NAME ".out"
@ -346,8 +336,6 @@ if (!(EXPR)) \
extern uint32_t *vTaskStackAddr(void);/* need to modify the FreeRTOS/tasks source code */ extern uint32_t *vTaskStackAddr(void);/* need to modify the FreeRTOS/tasks source code */
extern uint32_t vTaskStackSize(void); extern uint32_t vTaskStackSize(void);
extern char * vTaskName(void); extern char * vTaskName(void);
#elif (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTX5)
#include "rtx_os.h"
#else #else
#error "not supported OS type" #error "not supported OS type"
#endif /* (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT) */ #endif /* (CMB_OS_PLATFORM_TYPE == CMB_OS_PLATFORM_RTT) */
@ -367,7 +355,7 @@ if (!(EXPR)) \
mov r0, sp mov r0, sp
bx lr bx lr
} }
#elif defined(__CLANG_ARM) #elif defined(__clang__)
__attribute__( (always_inline) ) static __inline uint32_t cmb_get_msp(void) { __attribute__( (always_inline) ) static __inline uint32_t cmb_get_msp(void) {
uint32_t result; uint32_t result;
__asm volatile ("mrs %0, msp" : "=r" (result) ); __asm volatile ("mrs %0, msp" : "=r" (result) );

@ -38,5 +38,5 @@
/* enable dump stack information */ /* enable dump stack information */
#define CMB_USING_DUMP_STACK_INFO #define CMB_USING_DUMP_STACK_INFO
/* language of print information */ /* language of print information */
#define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH #define CMB_PRINT_LANGUAGE CMB_PRINT_LANUUAGE_ENGLISH
#endif /* _CMB_CFG_H_ */ #endif /* _CMB_CFG_H_ */

@ -40,5 +40,5 @@
/* enable dump stack information */ /* enable dump stack information */
#define CMB_USING_DUMP_STACK_INFO #define CMB_USING_DUMP_STACK_INFO
/* language of print information */ /* language of print information */
#define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH #define CMB_PRINT_LANGUAGE CMB_PRINT_LANUUAGE_ENGLISH
#endif /* _CMB_CFG_H_ */ #endif /* _CMB_CFG_H_ */

@ -41,5 +41,5 @@
/* enable dump stack information */ /* enable dump stack information */
#define CMB_USING_DUMP_STACK_INFO #define CMB_USING_DUMP_STACK_INFO
/* language of print information */ /* language of print information */
#define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH #define CMB_PRINT_LANGUAGE CMB_PRINT_LANUUAGE_ENGLISH
#endif /* _CMB_CFG_H_ */ #endif /* _CMB_CFG_H_ */

@ -40,5 +40,5 @@
/* enable dump stack information */ /* enable dump stack information */
#define CMB_USING_DUMP_STACK_INFO #define CMB_USING_DUMP_STACK_INFO
/* language of print information */ /* language of print information */
#define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH #define CMB_PRINT_LANGUAGE CMB_PRINT_LANUUAGE_ENGLISH
#endif /* _CMB_CFG_H_ */ #endif /* _CMB_CFG_H_ */

Loading…
Cancel
Save