Skip to content

Commit

Permalink
add hexdump function for easy debugging.
Browse files Browse the repository at this point in the history
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
....
  • Loading branch information
Links2004 committed May 13, 2015
1 parent 748b600 commit 386b2cf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hardware/esp8266com/esp8266/cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ long random(long, long);
void randomSeed(unsigned int);
long map(long, long, long, long, long);

// Debugging functions
void hexdump(uint8_t *mem, uint32_t len, uint8_t cols = 16);

#endif

#include "pins_arduino.h"
Expand Down
21 changes: 21 additions & 0 deletions hardware/esp8266com/esp8266/cores/esp8266/debug.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* debug.c
*
* Created on: 13.05.2015
* Author: Markus Sattler
*/

#include "Arduino.h"

void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) {
os_printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", mem, len, len);
for(uint32_t i = 0; i < len; i++) {
if(i % cols == 0) {
os_printf("\n[0x%08X] 0x%08X: ", mem, i);
}
os_printf("%02X ", *mem);
mem++;
}
os_printf("\n");
}

0 comments on commit 386b2cf

Please sign in to comment.