aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/common/oslib/include/chheap.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/os/common/oslib/include/chheap.h b/os/common/oslib/include/chheap.h
index 9a0bc083e..64840a0c7 100644
--- a/os/common/oslib/include/chheap.h
+++ b/os/common/oslib/include/chheap.h
@@ -36,8 +36,15 @@
/**
* @brief Minimum alignment used for heap.
+ * @note Cannot use the sizeof operator in this macro.
*/
-#define CH_HEAP_ALIGNMENT sizeof (heap_header_t)
+#if (SIZEOF_PTR == 4) || defined(__DOXYGEN__)
+#define CH_HEAP_ALIGNMENT 8
+#elif (SIZEOF_PTR == 2)
+#define CH_HEAP_ALIGNMENT 4
+#else
+#error "unsupported pointer size"
+#endif
/*===========================================================================*/
/* Module pre-compile time settings. */