#include #include void uart_putc(unsigned char byte); void uart_puts(const char* str); void memdump(void* start,uint32_t len,int raw) { for (uint32_t i=0; i=32 && c<=128) { printf("%c",c); } else { printf("."); } } printf("\r\n"); i+=16; } printf("\r\n\r\n"); } void printhex(uint32_t num) { char buf[9]; buf[8] = 0; for (int i=7; i>=0; i--) { int d = num&0xf; if (d<10) buf[i]='0'+d; else buf[i]='a'+d-10; num=num>>4; } uart_puts(buf); } void printhex_signed(int32_t num) { char buf[9]; buf[8] = 0; if (num<0) { uart_putc('-'); num=-num; } for (int i=7; i>=0; i--) { int d = num&0xf; if (d<10) buf[i]='0'+d; else buf[i]='a'+d-10; num=num/16; } uart_puts(buf); }