diff --git a/cores/nRF5/common_func.h b/cores/nRF5/common_func.h index 7a5f84ad..058bfa28 100644 --- a/cores/nRF5/common_func.h +++ b/cores/nRF5/common_func.h @@ -172,7 +172,7 @@ const char* dbg_err_str(uint32_t err_id); // TODO move to other place #define ADALOG_BUFFER(_tag, _buf, _n) \ do {\ - if ( _tag ) cprintf("[%-6s]\n", _tag);\ + if ( _tag ) cprintf("%-6s: len = %d\n", _tag, _n);\ dbgDumpMemory(_buf, 1, _n, true);\ }while(0) diff --git a/cores/nRF5/nrf52_flash.c b/cores/nRF5/nrf52_flash.c index d303a5c2..a3170689 100644 --- a/cores/nRF5/nrf52_flash.c +++ b/cores/nRF5/nrf52_flash.c @@ -126,6 +126,8 @@ int nrf52_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_addres static int write_and_wait(uint32_t addr, uint32_t const * const data, uint32_t size) { + if ( size == 0 ) return 0; + uint32_t err; #if CFG_DEBUG_NFFS diff --git a/cores/nRF5/utility/debug.cpp b/cores/nRF5/utility/debug.cpp index 074ee75a..62626fe5 100644 --- a/cores/nRF5/utility/debug.cpp +++ b/cores/nRF5/utility/debug.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // defined in linker script extern uint32_t __data_start__[]; @@ -170,6 +171,16 @@ void dbgPrintVersion(void) cprintf("\n"); } +static void dump_str_line(uint8_t const* buf, uint16_t count) +{ + // each line is 16 bytes + for(int i=0; i UINT16_MAX ) offset_fmt[2] = '8'; - else if ( count*size > UINT8_MAX ) offset_fmt[2] = '4'; - - const uint8_t item_per_line = 16 / size; + const uint8_t item_per_line = 16 / size; for(int i=0; i