diff options
Diffstat (limited to 'nuttx/mm/umm_initialize.c')
-rw-r--r-- | nuttx/mm/umm_initialize.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/nuttx/mm/umm_initialize.c b/nuttx/mm/umm_initialize.c index be5e74f9d..9deaf61fa 100644 --- a/nuttx/mm/umm_initialize.c +++ b/nuttx/mm/umm_initialize.c @@ -41,7 +41,7 @@ #include <nuttx/mm.h> -#ifdef CONFIG_MM_USER_HEAP +#ifdef MM_KERNEL_USRHEAP_INTF /************************************************************************ * Pre-processor definition @@ -55,9 +55,23 @@ * Public Data ************************************************************************/ -/* This is the user heap */ +#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) +/* In the kernel build, there a multiple user heaps; one for each task + * group. In this build configuration, the user heap structure lies + * in a reserved region at the beginning of the .bss/.data address + * space (CONFIG_ARCH_DATA_VBASE). The size of that region is given by + * ARCH_DATA_RESERVE + */ + +# include <nuttx/addrenv.h> +# define USR_HEAP ((FAR struct mm_heap_s *)CONFIG_ARCH_DATA_VBASE) + +#else +/* Otherwise, the user heap data structures are in common .bss */ struct mm_heap_s g_mmheap; +#define USR_HEAP &g_mmheap; +#endif /************************************************************************ * Private Functions @@ -86,7 +100,8 @@ struct mm_heap_s g_mmheap; void umm_initialize(FAR void *heap_start, size_t heap_size) { - mm_initialize(&g_mmheap, heap_start, heap_size); + DEBUGASSERT(ARCH_DATA_RESERVE >= sizeof(struct mm_heap_s)); + mm_initialize(USR_HEAP, heap_start, heap_size); } -#endif /* CONFIG_MM_USER_HEAP */ +#endif /* MM_KERNEL_USRHEAP_INTF */ |