Overview of CmBacktrace
masterCmBacktrace (Cortex Microcontroller Backtrace) is an open-source library designed for ARM Cortex-M series MCUs to automatically track, locate, and analyze error codes. It helps developers move beyond manual register analysis by providing automated diagnostics and call stack reconstruction.
Key Features:
- Supported Errors: Automatically handles
assertfailures and various hardware faults includingHard Fault,Memory Management Fault,Bus Fault,Usage Fault, andDebug Fault. - Automated Diagnosis: Analyzes fault causes and locates the offending code position without requiring manual register inspection.
- Call Stack Reconstruction: Outputs the function call stack at the time of error (requires
addr2linefor precise symbol mapping). It can also be used in normal operation to retrieve the current call stack. - Stack Support: Outputs either the thread stack (for RTOS) or the C main stack based on the error context.
- Multi-language Support: Diagnostic information is available in Simplified Chinese and English.
- Hardware & Toolchain Compatibility:
- MCUs: Cortex-M0, M3, M4, M7.
- Compilers: IAR, Keil, GCC.
- Platforms: Bare-metal, RT-Thread, UCOS, and FreeRTOS (FreeRTOS requires source code modification).