#include "def.h" #include "cmbcallback.h" #ifndef __ghs__ #include "cm_backtrace.h" #endif #define HARDWARE_VERSION "V1.0.0" #define SOFTWARE_VERSION "V0.1.0" static void fault_test_by_div0(void) { volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR int x, y, z; *SCB_CCR |= (1 << 4); /* bit4: DIV_0_TRP. */ x = 10; y = 0; z = x / y; //printf("z:%d\n", z); } /*//perhaps KEIL startup file have a proble about copy*/ static int bssj __attribute__((used)); static int datai __attribute__((used)) = 4; void InitCmb(void) { #ifndef __ghs__ #if EN_CMBTRACE cm_backtrace_init("CmBacktrace", HARDWARE_VERSION, SOFTWARE_VERSION); printf("Hello world!\r\n"); printf("i=%d!\r\n",datai); printf("j=%d!\r\n",bssj); //fault_test_by_div0(); #endif #endif }