]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/debug.c
process_macros: reduce heap usage and fragmentation
[z180-stamp.git] / avr / debug.c
index 16df702d0a0949a47bd6c058ca4e844374fa3f0f..47b11b097cc5b51130f460eb760e5d4fd6564231 100644 (file)
@@ -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",