From 6a35834269e6cd5d0c89f2777d3a692582d8e2d1 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Sat, 6 Jul 2019 17:36:01 +0200
Subject: [PATCH] feat(pycardium): Implement proper heap
Closes #15.
Signed-off-by: Rahix <rahix@rahix.de>
---
pycardium/main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pycardium/main.c b/pycardium/main.c
index 712fd65a..a7fcad81 100644
--- a/pycardium/main.c
+++ b/pycardium/main.c
@@ -6,9 +6,9 @@
#include "max32665.h"
-static char heap[4096];
-
-extern int __StackTop, __StackLimit;
+/* Defined in linker script */
+extern void *__StackTop, *__StackLimit;
+extern void *__HeapBase, *__HeapLimit;
int main(void)
{
@@ -21,7 +21,7 @@ int main(void)
NVIC_EnableIRQ(TMR5_IRQn);
while (1) {
- gc_init(heap, heap + sizeof(heap));
+ gc_init(&__HeapBase, &__HeapLimit);
mp_init();
pyexec_friendly_repl();
--
GitLab