From 67d516d9d16ef8ccd0573af9f6993e5ceb60cf2c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 3 Sep 2014 09:21:59 -0600 Subject: [PATCH] Fix several compile errors for logic added for CONFIG_BUILD_KERNEL, but which cause problems for other configurations --- include/nuttx/mm.h | 6 +++--- mm/umm_addregion.c | 6 +++--- mm/umm_brkaddr.c | 2 +- mm/umm_calloc.c | 2 +- mm/umm_extend.c | 2 +- mm/umm_free.c | 2 +- mm/umm_initialize.c | 11 ++++++++--- mm/umm_mallinfo.c | 2 +- mm/umm_malloc.c | 2 +- mm/umm_memalign.c | 2 +- mm/umm_realloc.c | 2 +- mm/umm_sbrk.c | 2 +- mm/umm_sem.c | 2 +- mm/umm_zalloc.c | 2 +- 14 files changed, 25 insertions(+), 20 deletions(-) diff --git a/include/nuttx/mm.h b/include/nuttx/mm.h index 6d9d8daa6b..95fe2790cd 100644 --- a/include/nuttx/mm.h +++ b/include/nuttx/mm.h @@ -262,8 +262,8 @@ extern "C" #define EXTERN extern #endif -#if (!defined(CONFIG_ARCH_ADDRENV) || !defined(CONFIG_BUILD_KERNEL)) && \ - (defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__)) +#if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ + (defined(CONFIG_BUILD_DEFINED) && !defined(__KERNEL__)) /* User heap structure: * * - Flat build: In the FLAT build, the user heap structure is a globally @@ -272,7 +272,7 @@ extern "C" * in user space. * - Kernel build: There are multiple heaps, one per process. The heap * structure is associated with the address environment and there is - * no global user heap structure. + * no global user heap structure. */ EXTERN struct mm_heap_s g_mmheap; diff --git a/mm/umm_addregion.c b/mm/umm_addregion.c index 7710f2aa07..22a03cb8a0 100644 --- a/mm/umm_addregion.c +++ b/mm/umm_addregion.c @@ -41,7 +41,7 @@ #include -#ifdef MM_KERNEL_USRHEAP_INTF +#ifdef MM_KERNEL_USRHEAP_INIT /************************************************************************ * Pre-processor definition @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /************************************************************************ @@ -102,4 +102,4 @@ void umm_addregion(FAR void *heap_start, size_t heap_size) mm_addregion(USR_HEAP, heap_start, heap_size); } -#endif /* MM_KERNEL_USRHEAP_INTF */ +#endif /* MM_KERNEL_USRHEAP_INIT */ diff --git a/mm/umm_brkaddr.c b/mm/umm_brkaddr.c index ae1fc1c2f4..6381d368bc 100644 --- a/mm/umm_brkaddr.c +++ b/mm/umm_brkaddr.c @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_calloc.c b/mm/umm_calloc.c index 665720947a..0009b5a1fd 100644 --- a/mm/umm_calloc.c +++ b/mm/umm_calloc.c @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_extend.c b/mm/umm_extend.c index 9e9f2c63ee..f8edc9ef62 100644 --- a/mm/umm_extend.c +++ b/mm/umm_extend.c @@ -59,7 +59,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_free.c b/mm/umm_free.c index 6d1cd6bc6f..d26d7ba11a 100644 --- a/mm/umm_free.c +++ b/mm/umm_free.c @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_initialize.c b/mm/umm_initialize.c index 3fdda2dde7..5b926504d5 100644 --- a/mm/umm_initialize.c +++ b/mm/umm_initialize.c @@ -39,9 +39,11 @@ #include +#include + #include -#ifdef MM_KERNEL_USRHEAP_INTF +#ifdef MM_KERNEL_USRHEAP_INIT /************************************************************************ * Pre-processor definition @@ -70,7 +72,7 @@ /* Otherwise, the user heap data structures are in common .bss */ struct mm_heap_s g_mmheap; -#define USR_HEAP &g_mmheap; +#define USR_HEAP &g_mmheap #endif /************************************************************************ @@ -100,8 +102,11 @@ struct mm_heap_s g_mmheap; void umm_initialize(FAR void *heap_start, size_t heap_size) { +#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) DEBUGASSERT(ARCH_DATA_RESERVE_SIZE >= sizeof(struct addrenv_reserve_s)); +#endif + mm_initialize(USR_HEAP, heap_start, heap_size); } -#endif /* MM_KERNEL_USRHEAP_INTF */ +#endif /* MM_KERNEL_USRHEAP_INIT */ diff --git a/mm/umm_mallinfo.c b/mm/umm_mallinfo.c index 2ccee59731..447269f006 100644 --- a/mm/umm_mallinfo.c +++ b/mm/umm_mallinfo.c @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_malloc.c b/mm/umm_malloc.c index 6d99e75ab6..fd4fe9608d 100644 --- a/mm/umm_malloc.c +++ b/mm/umm_malloc.c @@ -62,7 +62,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_memalign.c b/mm/umm_memalign.c index 4a13bfe91c..51b0f923ca 100644 --- a/mm/umm_memalign.c +++ b/mm/umm_memalign.c @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_realloc.c b/mm/umm_realloc.c index 0652b172aa..344d24d687 100644 --- a/mm/umm_realloc.c +++ b/mm/umm_realloc.c @@ -61,7 +61,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_sbrk.c b/mm/umm_sbrk.c index 3266b09b90..349c61b866 100644 --- a/mm/umm_sbrk.c +++ b/mm/umm_sbrk.c @@ -65,7 +65,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /**************************************************************************** diff --git a/mm/umm_sem.c b/mm/umm_sem.c index 98997f461f..8e899994b6 100644 --- a/mm/umm_sem.c +++ b/mm/umm_sem.c @@ -59,7 +59,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /************************************************************************ diff --git a/mm/umm_zalloc.c b/mm/umm_zalloc.c index ebe232e221..20a37c2e21 100644 --- a/mm/umm_zalloc.c +++ b/mm/umm_zalloc.c @@ -62,7 +62,7 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -# define USR_HEAP &g_mmheap; +# define USR_HEAP &g_mmheap #endif /****************************************************************************