Skip to content

Commit 386b2cf

Browse files
committed
add hexdump function for easy debugging.
Output: [HEXDUMP] Address: 0x3FFF5188 len: 0x200 (512) [0x3FFF5188] 0x00000000: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 [0x3FFF5198] 0x00000010: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 [0x3FFF51A8] 0x00000020: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 [0x3FFF51B8] 0x00000030: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 [0x3FFF51C8] 0x00000040: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 [0x3FFF51D8] 0x00000050: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 [0x3FFF51E8] 0x00000060: E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 E6 D1 ....
1 parent 748b600 commit 386b2cf

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

hardware/esp8266com/esp8266/cores/esp8266/Arduino.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ long random(long, long);
229229
void randomSeed(unsigned int);
230230
long map(long, long, long, long, long);
231231

232+
// Debugging functions
233+
void hexdump(uint8_t *mem, uint32_t len, uint8_t cols = 16);
234+
232235
#endif
233236

234237
#include "pins_arduino.h"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* debug.c
3+
*
4+
* Created on: 13.05.2015
5+
* Author: Markus Sattler
6+
*/
7+
8+
#include "Arduino.h"
9+
10+
void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) {
11+
os_printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", mem, len, len);
12+
for(uint32_t i = 0; i < len; i++) {
13+
if(i % cols == 0) {
14+
os_printf("\n[0x%08X] 0x%08X: ", mem, i);
15+
}
16+
os_printf("%02X ", *mem);
17+
mem++;
18+
}
19+
os_printf("\n");
20+
}
21+

0 commit comments

Comments
 (0)