summaryrefslogtreecommitdiff
path: root/avr/debug.c
diff options
context:
space:
mode:
authorLeo C2014-09-01 17:06:58 +0200
committerLeo C2014-09-02 14:01:01 +0200
commit507d25e2cdac7489ca8706f6582e271fd1689816 (patch)
tree24774662d51ff9f6185591fc4c3cc05032a02080 /avr/debug.c
parentf76ca346168afe6cf68127934765a61bd477380e (diff)
downloadz180-stamp-507d25e2cdac7489ca8706f6582e271fd1689816.zip
process_macros: reduce heap usage and fragmentation
Diffstat (limited to 'avr/debug.c')
-rw-r--r--avr/debug.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/avr/debug.c b/avr/debug.c
index 16df702..47b11b0 100644
--- a/avr/debug.c
+++ b/avr/debug.c
@@ -23,7 +23,7 @@ static uint8_t ram_read_byte(const uint8_t *p)
return *p;
}
-void dump_mem(const uint8_t *startaddr, int len,
+void dump_mem(const uint8_t *startaddr, int len,
uint8_t (*readfkt)(const uint8_t *), char *title)
{
uint8_t buf[16];
@@ -33,12 +33,12 @@ void dump_mem(const uint8_t *startaddr, int len,
const uint8_t *addr = (uint8_t *) ((size_t) startaddr & ~0x0f);
len += pre;
uint8_t i;
-
+
if (title && *title) {
printf_P(PSTR("%s\n"),title);
indent = " ";
}
-
+
while (len) {
if (len < 16)
llen = len;
@@ -100,7 +100,7 @@ command_ret_t do_dump_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg
// static const uint8_t *addr;
// static uint16_t length = 128;
uint8_t (*readhow)(const uint8_t *);
-
+
(void) cmdtp; (void) flag;
if (argc < 2)
@@ -108,7 +108,7 @@ command_ret_t do_dump_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg
const uint8_t *addr;
uint16_t length = 128;
-
+
if (strchr(argv[0],'r') != NULL)
readhow = ram_read_byte;
else if (strchr(argv[0],'e') != NULL)
@@ -182,7 +182,7 @@ command_ret_t do_eep_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
/*------------------------------------------------------------------------------*/
-#if 0
+#if 1
struct __freelist {
size_t sz;
@@ -201,6 +201,8 @@ printfreelist(const char * title)
int i;
unsigned int freesum = 0;
+/* TODO: printf_P */
+
if (!__flp) {
printf("%s no free list\n", title ? title : "");
} else {
@@ -215,7 +217,7 @@ printfreelist(const char * title)
freesum += fp1->sz;
}
}
-
+
freesum += (size_t) STACK_POINTER() - __malloc_margin - (size_t) __brkval;
printf("SP: %04x, __brkval: %04x, Total free: %04u\n",