6626 集成第三方 cmBacktrace ,方便HardFault错误现场分析。 1-添加初始化 cm_backtrace_init(firm_name_s, hw_version_s, sw_version_s); const char *firm_name_s = "om6626_test"; const char *hw_version_s = "6626B v2.1"; const char *sw_version_s = "20240311"; extern void ob_smp_config_allroles(void); #define Adv_Auto_Start (1) // extern const int Image$$ER_TEXT$$Base; int main(void) { uint32_t address, length; uint16_t crc16; struct ob_stack_param param = { .max_connection = OB_LE_HOST_CONNECTION_NB, .max_ext_adv_set = OB_LE_HOST_ADV_SET_NUM, .max_att_mtu = OB_LE_HOST_ATT_MTU, .max_gatt_serv_num = OB_LE_HOST_MAX_GATT_SERV_NUM, .max_gatt_write_cache = OB_LE_HOST_ATT_WRITE_CACHE_SIZE, .smp_sc_support = OB_LE_HOST_SC_PAIRING, }; pmu_pin_iol3_reset_mode_enable(0);//0-使能GPIO13复位功能 ...... nvds_init(0); mbr_read_part(PART_TYPE_APP, &address, &length, &crc16); OM_LOG_DEBUG("\nrunning(%d): 0x%08X, len: %d, crc: 0x%04X", drv_pmu_reboot_reason(), address, length, crc16); // OM_LOG_DEBUG("\nImage$$ER_TEXT$$Base = 0x%08x", (uint32_t) Image$$ER_TEXT$$Base); void cm_backtrace_init(const char *firmware_name, const char *hardware_ver, const char *software_ver); cm_backtrace_init(firm_name_s, hw_version_s, sw_version_s); #if 0 //打开测试代码,可以触发一个错误,看看是否能正常响应。 /**测试cm-backtrace*/ evt_timer_callback_t callback1; callback1 = 0x00001; callback1(0, 0);//测试正常应该会触发中断 OM_LOG_DEBUG("\ncm backtrace test fail!shoule not run to here."); while (1) ; #endif 2-工程中加入相关代码 3- 文件夹位置 4- 运行错误提示 5- 依据提示用addr2line 进一步分析,如 如上例在Shell中输入命令 addr2line -e om626. axf -afpiC 042b506 0042b4b4 0040a99a 0040f5c2 0043130e 043fe8 (堆栈地址会变) 下面举其中一例,查看死机现场的堆栈情况。 6 附件内容 |