1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

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
....
This commit is contained in:
Markus Sattler 2015-05-13 22:54:09 +02:00
parent e0c1b47937
commit a17aded8d6
2 changed files with 24 additions and 0 deletions

View File

@ -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"

21
cores/esp8266/debug.cpp Normal file
View File

@ -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");
}