From dc0b679332ea6fb19316f961cff60ba9b0acb17e Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 20 Dec 2017 14:22:47 +0700 Subject: [PATCH] print error string instead of hex code --- cores/nRF5/common_func.h | 1 + cores/nRF5/debug.cpp | 3 +-- cores/nRF5/debug.h | 3 ++- cores/nRF5/verify.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cores/nRF5/common_func.h b/cores/nRF5/common_func.h index 10a94583..1052b936 100644 --- a/cores/nRF5/common_func.h +++ b/cores/nRF5/common_func.h @@ -121,6 +121,7 @@ #endif int cprintf(const char * format, ...); +const char* dbg_err_str(uint32_t err_id); // TODO move to other place #if CFG_DEBUG #define LOG_LV1(...) ADALOG(__VA_ARGS__) diff --git a/cores/nRF5/debug.cpp b/cores/nRF5/debug.cpp index 3ffb0ae1..d7adc04b 100644 --- a/cores/nRF5/debug.cpp +++ b/cores/nRF5/debug.cpp @@ -37,8 +37,7 @@ #include #include #include -#include "debug.h" -#include "utility/utilities.h" +#include // defined in linker script extern uint32_t __data_start__[]; diff --git a/cores/nRF5/debug.h b/cores/nRF5/debug.h index 8d15bf51..8b67cf33 100644 --- a/cores/nRF5/debug.h +++ b/cores/nRF5/debug.h @@ -37,10 +37,11 @@ #ifndef _DEBUG_H #define _DEBUG_H -#include +#include "common_inc.h" #if CFG_DEBUG const char* dbg_ble_event_str(uint16_t evt_id); +const char* dbg_err_str(uint32_t err_id); #endif int dbgHeapTotal(void); diff --git a/cores/nRF5/verify.h b/cores/nRF5/verify.h index 171f30b5..945b0435 100644 --- a/cores/nRF5/verify.h +++ b/cores/nRF5/verify.h @@ -65,7 +65,7 @@ extern "C" //--------------------------------------------------------------------+ #if CFG_DEBUG >= 1 // #define VERIFY_MESS(format, ...) cprintf("[%08ld] %s: %d: verify failed\n", get_millis(), __func__, __LINE__) - #define VERIFY_MESS(_status) cprintf("%s: %d: verify failed, status = 0x%04X\n", __PRETTY_FUNCTION__, __LINE__, _status); + #define VERIFY_MESS(_status) cprintf("%s: %d: verify failed, status = %s\n", __PRETTY_FUNCTION__, __LINE__, dbg_err_str(_status)); #else #define VERIFY_MESS(_status) #endif