I am working with Esspresif ESP32 WROOM board. I have tried to analyse the error I get with GDB Hardware Debugger, but I only receive the line where the error occurs, no error description.
Here's my small program:
typedef unsigned char u08;
void app_main() {
static char *mac_str = "00:00:00:00:00:00";
static u08 mac_addr[6] = {0x1a, 0x11, 0xaf, 0xa0, 0x47, 0x11};
net_dump_mac(mac_addr);
}
void net_dump_mac(const u08 *in) {
int pos = 0;
for (int i=0; i<6; i++) {
byte_to_hex(in[i], (u08 *)(mac_str+pos));
pos += 3;
}
uart_send(mac_str);
}
void byte_to_hex(u08 in, u08 *out) {
out[0] = nibble_to_hex(in >> 4); // <= crash occurs here !
out[1] = nibble_to_hex(in & 0xf);
}
u08 nibble_to_hex(u08 in) {
if (in < 10)
return '0' + in;
else
return 'A' + in - 10;
}
Some idea what am I doing wrong here?