1
0
mirror of https://github.com/armink/CmBacktrace.git synced 2025-01-25 00:22:53 +08:00

1、【修改】DIVBYZERO 为 DIVBYZERO0 ,避免 Keil 下与 signal.h 中的宏重名。

Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
armink 2017-11-25 20:47:49 +08:00
parent 8363ccb913
commit 5349ab2f15
2 changed files with 7 additions and 7 deletions

View File

@ -91,7 +91,7 @@ enum {
PRINT_UFSR_INVPC,
PRINT_UFSR_NOCP,
PRINT_UFSR_UNALIGNED,
PRINT_UFSR_DIVBYZERO,
PRINT_UFSR_DIVBYZERO0,
PRINT_DFSR_HALTED,
PRINT_DFSR_BKPT,
PRINT_DFSR_DWTTRAP,
@ -132,7 +132,7 @@ static const char *print_info[] = {
[PRINT_UFSR_INVPC] = "Usage fault is caused by attempts to do an exception with a bad value in the EXC_RETURN number",
[PRINT_UFSR_NOCP] = "Usage fault is caused by attempts to execute a coprocessor instruction",
[PRINT_UFSR_UNALIGNED] = "Usage fault is caused by indicates that an unaligned access fault has taken place",
[PRINT_UFSR_DIVBYZERO] = "Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)",
[PRINT_UFSR_DIVBYZERO0] = "Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)",
[PRINT_DFSR_HALTED] = "Debug fault is caused by halt requested in NVIC",
[PRINT_DFSR_BKPT] = "Debug fault is caused by BKPT instruction executed",
[PRINT_DFSR_DWTTRAP] = "Debug fault is caused by DWT match occurred",
@ -170,7 +170,7 @@ static const char *print_info[] = {
[PRINT_UFSR_INVPC] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
[PRINT_UFSR_NOCP] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼִ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>",
[PRINT_UFSR_UNALIGNED] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼִ<EFBFBD>зǶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
[PRINT_UFSR_DIVBYZERO] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼִ<EFBFBD>г<EFBFBD> 0 <20><><EFBFBD><EFBFBD>",
[PRINT_UFSR_DIVBYZERO0] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼִ<EFBFBD>г<EFBFBD> 0 <20><><EFBFBD><EFBFBD>",
[PRINT_DFSR_HALTED] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>NVIC ͣ<><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
[PRINT_DFSR_BKPT] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD> BKPT ָ<><D6B8>",
[PRINT_DFSR_DWTTRAP] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>",
@ -540,8 +540,8 @@ static void fault_diagnosis(void) {
if (regs.ufsr.bits.UNALIGNED) {
cmb_println(print_info[PRINT_UFSR_UNALIGNED]);
}
if (regs.ufsr.bits.DIVBYZERO) {
cmb_println(print_info[PRINT_UFSR_DIVBYZERO]);
if (regs.ufsr.bits.DIVBYZERO0) {
cmb_println(print_info[PRINT_UFSR_DIVBYZERO0]);
}
}
}

View File

@ -34,7 +34,7 @@
#include <stdlib.h>
/* library software version number */
#define CMB_SW_VERSION "1.1.0"
#define CMB_SW_VERSION "1.1.1"
#define CMB_CPU_ARM_CORTEX_M0 0
#define CMB_CPU_ARM_CORTEX_M3 1
@ -233,7 +233,7 @@ struct cmb_hard_fault_regs{
unsigned short NOCP : 1; // Attempts to execute a coprocessor instruction
unsigned short UnusedBits : 4;
unsigned short UNALIGNED : 1; // Indicates that an unaligned access fault has taken place
unsigned short DIVBYZERO : 1; // Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)
unsigned short DIVBYZERO0 : 1; // Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)
} bits;
} ufsr; // Usage Fault Status Register (0xE000ED2A)