From cb3de08d3ee9d010152f27cf4cef0381b53c615b Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Sat, 6 Jul 2019 18:55:05 +0200
Subject: [PATCH] feat(epicardium): Switch to malloc heap

Signed-off-by: Rahix <rahix@rahix.de>
---
 epicardium/FreeRTOSConfig.h         | 6 ++++--
 epicardium/meson.build              | 1 +
 hw-tests/hello-freertos/meson.build | 1 +
 lib/FreeRTOS/meson.build            | 7 +++++++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/epicardium/FreeRTOSConfig.h b/epicardium/FreeRTOSConfig.h
index 95ddf835..ba19e15a 100644
--- a/epicardium/FreeRTOSConfig.h
+++ b/epicardium/FreeRTOSConfig.h
@@ -12,8 +12,10 @@
 /* TODO: Adjust this for tickless idle */
 #define configTICK_RATE_HZ          ((portTickType)1000)
 
-/* Memory */
-#define configTOTAL_HEAP_SIZE       ((size_t)(26 * 1024))
+/* Memory
+ *
+ * Heap is managed by libc (heap_3.c).
+ */
 #define configMINIMAL_STACK_SIZE    ((unsigned short)128)
 
 #define configMAX_PRIORITIES        5
diff --git a/epicardium/meson.build b/epicardium/meson.build
index ea43d08b..30510169 100644
--- a/epicardium/meson.build
+++ b/epicardium/meson.build
@@ -48,6 +48,7 @@ api_dispatcher_lib = static_library(
 freertos = static_library(
   'freertos',
   freertos_sources,
+  freertos_heap3,
   dependencies: periphdriver,
   include_directories: [
     freertos_includes,
diff --git a/hw-tests/hello-freertos/meson.build b/hw-tests/hello-freertos/meson.build
index c24b5786..a7c15469 100644
--- a/hw-tests/hello-freertos/meson.build
+++ b/hw-tests/hello-freertos/meson.build
@@ -3,6 +3,7 @@ name = 'hello-freertos'
 freertos = static_library(
   'freertos',
   freertos_sources,
+  freertos_heap2,
   freertos_cli_sources,
   dependencies: periphdriver,
   include_directories: [
diff --git a/lib/FreeRTOS/meson.build b/lib/FreeRTOS/meson.build
index 1a390f6d..03b5e157 100644
--- a/lib/FreeRTOS/meson.build
+++ b/lib/FreeRTOS/meson.build
@@ -13,5 +13,12 @@ freertos_sources = files(
   './Source/timers.c',
 
   './Source/portable/GCC/ARM_CM4F/port.c',
+)
+
+freertos_heap2 = files(
   './Source/portable/MemMang/heap_2.c',
 )
+
+freertos_heap3 = files(
+  './Source/portable/MemMang/heap_3.c',
+)
-- 
GitLab