I think I've finally got malloc working right.
[riscv-tests.git] / debug / programs / debug.c
index 2010eaa898a6c7ccbd272a99f942ea9c62608be1..20b1cdcf29f18d6e042884f18c3f86ad915dde5a 100644 (file)
@@ -1,11 +1,10 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+#include <stdlib.h>
 
 unsigned int crc32a(uint8_t *message, unsigned int size);
 
-char __malloc_start[512];
-
 void rot13(char *buf)
 {
     while (*buf) {
@@ -28,8 +27,12 @@ size_t strlen(const char *buf)
     return len;
 }
 
+extern void *__malloc_freelist;
+
 int main()
 {
+    __malloc_freelist = 0;
+
     volatile int i = 0;
     int j = 0;
     char *fox = "The quick brown fox jumps of the lazy dog.";