MPFS: Use linker symbols for heap allocation
This commit is contained in:
parent
13fd93ed2a
commit
ade848b60a
@ -37,7 +37,19 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define KRAM_END CONFIG_RAM_END
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
#define KRAM_END ((uintptr_t)&__ksram_end)
|
||||
#else
|
||||
#define KRAM_END CONFIG_RAM_END
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
extern uintptr_t __ksram_end;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -75,8 +87,12 @@
|
||||
* Kernel heap Size determined by CONFIG_MM_KERNEL_HEAPSIZE
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef CONFIG_BUILD_KERNEL
|
||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
|
||||
#else
|
||||
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
#endif /* CONFIG_BUILD_KERNEL */
|
||||
{
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
/* Get the size and position of the user-space heap.
|
||||
@ -102,7 +118,6 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
*heap_size = KRAM_END - g_idle_topstack;
|
||||
#endif /* CONFIG_BUILD_PROTECTED && CONFIG_MM_KERNEL_HEAP */
|
||||
}
|
||||
#endif /* CONFIG_BUILD_KERNEL */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_kheap
|
||||
@ -114,7 +129,8 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) && \
|
||||
defined(__KERNEL__)
|
||||
void up_allocate_kheap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
/* Return the kernel heap settings. */
|
||||
@ -122,7 +138,7 @@ void up_allocate_kheap(void **heap_start, size_t *heap_size)
|
||||
*heap_start = (void *)g_idle_topstack;
|
||||
*heap_size = KRAM_END - g_idle_topstack;
|
||||
}
|
||||
#endif /* !CONFIG_BUILD_FLAT && CONFIG_MM_KERNEL_HEAP */
|
||||
#endif /* CONFIG_BUILD_PROTECTED && CONFIG_MM_KERNEL_HEAP */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_addregion
|
||||
|
Loading…
Reference in New Issue
Block a user