aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/oslib
diff options
context:
space:
mode:
Diffstat (limited to 'os/common/oslib')
-rw-r--r--os/common/oslib/include/chmemcore.h2
-rw-r--r--os/common/oslib/src/chmemcore.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/os/common/oslib/include/chmemcore.h b/os/common/oslib/include/chmemcore.h
index 014af50d6..539d71ecf 100644
--- a/os/common/oslib/include/chmemcore.h
+++ b/os/common/oslib/include/chmemcore.h
@@ -49,7 +49,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE.
*/
+#if !defined(CH_CFG_MEMCORE_SIZE) || defined(__DOXYGEN__)
#define CH_CFG_MEMCORE_SIZE 0
+#endif
/*===========================================================================*/
/* Derived constants and error checks. */
diff --git a/os/common/oslib/src/chmemcore.c b/os/common/oslib/src/chmemcore.c
index af733f395..d72bf73bb 100644
--- a/os/common/oslib/src/chmemcore.c
+++ b/os/common/oslib/src/chmemcore.c
@@ -86,12 +86,11 @@ void _core_init(void) {
endmem = (uint8_t *)MEM_ALIGN_PREV(__heap_end__, PORT_NATURAL_ALIGN);
/*lint restore*/
#else
- static stkalign_t buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE) /
- PORT_NATURAL_ALIGN];
+ static uint8_t default_heap[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE,
+ PORT_NATURAL_ALIGN)];
- nextmem = (uint8_t *)&buffer[0];
- endmem = (uint8_t *)&buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE) /
- PORT_NATURAL_ALIGN];
+ nextmem = (uint8_t *)MEM_ALIGN_NEXT(default_heap, PORT_NATURAL_ALIGN);
+ endmem = (uint8_t *)MEM_ALIGN_PREV(default_heap, PORT_NATURAL_ALIGN);
#endif
}