aboutsummaryrefslogtreecommitdiff
path: root/shared/memory.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-01-07 22:07:57 +0100
committerlonkaars <loek@pipeframe.xyz>2023-01-07 22:07:57 +0100
commit456efce00c0ed85061352a38edddc0a3f39c7804 (patch)
treed2d7c0a821b5c9e07d4ca24dd34f48b4038d3ca2 /shared/memory.h
parentaacaa86e621b18103f5ebf0bfe56f302d258c0e8 (diff)
change malloc and free to use macro's
Diffstat (limited to 'shared/memory.h')
-rw-r--r--shared/memory.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/shared/memory.h b/shared/memory.h
new file mode 100644
index 0000000..236f68e
--- /dev/null
+++ b/shared/memory.h
@@ -0,0 +1,21 @@
+#pragma once
+
+/**
+ * @file memory.h macro's for malloc() and free()
+ *
+ * these are usually defined in clib's stdlib.h, but zephyr requires the use of
+ * the k_malloc and k_free functions for memory management, thus this file is
+ * used to set aliases for each respecive platform's native memory management
+ * functions as they have the same function signature. these macro's should be
+ * defined using a compiler flag
+ */
+
+#ifndef CD_MALLOC
+#warning CD_MALLOC is not defined, please update build flags to add -DCD_MALLOC <implementation>
+#define CD_MALLOC(n) 0
+#endif
+
+#ifndef CD_FREE
+#warning CD_FREE is not defined, please update build flags to add -DCD_FREE <implementation>
+#define CD_FREE(n) ((void)(0))
+#endif