Protected/Kernel Builds: Review us of kmm_addregion vs. kumm_addregsion in other configurations.
This commit is contained in:
parent
69f1399aa7
commit
27cfde9968
@ -52,18 +52,6 @@
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -107,11 +95,12 @@ void up_addregion(void)
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_BOOT_RUNFROMFLASH) && !defined(CONFIG_BOOT_COPYTORAM)
|
||||
# if (CONFIG_RAM_NUTTXENTRY & 0xffff0000) != CONFIG_RAM_VSTART
|
||||
#if (CONFIG_RAM_NUTTXENTRY & 0xffff0000) != CONFIG_RAM_VSTART
|
||||
uint32_t start = CONFIG_RAM_VSTART + 0x1000;
|
||||
uint32_t end = (CONFIG_RAM_NUTTXENTRY & 0xffff0000);
|
||||
|
||||
kmm_addregion((FAR void *)start, end - start);
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Check for any additional memory regions */
|
||||
|
@ -177,14 +177,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -339,25 +331,42 @@ void up_addregion(void)
|
||||
|
||||
/* Yes.. allow user-mode access to the AHB SRAM user heap memory */
|
||||
|
||||
lpc17_mpu_uheap((uintptr_t)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
lpc17_mpu_uheap((uintptr_t)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
|
||||
#endif
|
||||
|
||||
/* Add the AHB SRAM user heap region. */
|
||||
|
||||
kumm_addregion((FAR void *)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
kumm_addregion((FAR void *)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_MM_REGIONS >= 3
|
||||
#if defined(CONFIG_LPC17_EXTDRAM) && defined(CONFIG_LPC17_EXTDRAMHEAP)
|
||||
kmm_addregion((FAR void *)LPC17_EXTDRAM_CS0, CONFIG_LPC17_EXTDRAMSIZE);
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
/* Allow user-mode access to external DRAM heap memory */
|
||||
|
||||
lpc17_mpu_uheap((uintptr_t)LPC17_EXTDRAM_CS0, CONFIG_LPC17_EXTDRAMSIZE);
|
||||
|
||||
#endif
|
||||
/* Add external DRAM heap memory to the user heap */
|
||||
|
||||
kumm_addregion((FAR void *)LPC17_EXTDRAM_CS0, CONFIG_LPC17_EXTDRAMSIZE);
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_LPC17_EXTDRAMHEAP) || (CONFIG_MM_REGIONS >= 4)
|
||||
#if defined(CONFIG_LPC17_EXTSRAM0) && defined(CONFIG_LPC17_EXTSRAM0HEAP)
|
||||
kmm_addregion((FAR void *)LPC17_EXTSRAM_CS0, CONFIG_LPC17_EXTSRAM0SIZE);
|
||||
#endif
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
/* Allow user-mode access to external SRAM heap memory */
|
||||
|
||||
lpc17_mpu_uheap((uintptr_t)LPC17_EXTSRAM_CS0, CONFIG_LPC17_EXTSRAM0SIZE);
|
||||
|
||||
#endif
|
||||
/* Add external SRAM heap memory to the user heap */
|
||||
|
||||
kumm_addregion((FAR void *)LPC17_EXTSRAM_CS0, CONFIG_LPC17_EXTSRAM0SIZE);
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONFIG_MM_REGIONS >= 3 */
|
||||
}
|
||||
#endif
|
||||
|
@ -63,6 +63,27 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ********************************************************/
|
||||
/* Terminology. In the flat build (CONFIG_BUILD_FLAT=y), there is only a
|
||||
* single heap access with the standard allocations (malloc/free). This
|
||||
* heap is referred to as the user heap. In the protected build
|
||||
* (CONFIG_BUILD_PROTECTED=y) where an MPU is used to protect a region of
|
||||
* otherwise flat memory, there will be two allocators: One that allocates
|
||||
* protected (kernel) memory and one that allocates unprotected (user)
|
||||
* memory. These are referred to as the kernel and user heaps,
|
||||
* respectively.
|
||||
*
|
||||
* The ARM has no MPU but does have an MMU. With this MMU, it can support
|
||||
* the kernel build (CONFIG_BUILD_KERNEL=y). In this configuration, there
|
||||
* is one kernel heap but multiple user heaps: One per task group. However,
|
||||
* in this case, we need only be concerned about initializing the single
|
||||
* kernel heap here.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_BUILD_KERNEL)
|
||||
# define MM_ADDREGION kmm_addregion
|
||||
#else
|
||||
# define MM_ADDREGION umm_addregion
|
||||
#endif
|
||||
|
||||
/* Some sanity checking. If external memory regions are defined, verify
|
||||
* that CONFIG_MM_REGIONS is set to match, exactly, the number of external
|
||||
@ -142,14 +163,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -198,15 +211,15 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
void up_addregion(void)
|
||||
{
|
||||
#if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP)
|
||||
kmm_addregion((FAR void *)LPC31_EXTSRAM0_VSECTION, CONFIG_LPC31_EXTSRAM0SIZE);
|
||||
MM_ADDREGION((FAR void *)LPC31_EXTSRAM0_VSECTION, CONFIG_LPC31_EXTSRAM0SIZE);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP)
|
||||
kmm_addregion((FAR void *)LPC31_EXTSRAM1_VSECTION, CONFIG_LPC31_EXTSRAM1SIZE);
|
||||
MM_ADDREGION((FAR void *)LPC31_EXTSRAM1_VSECTION, CONFIG_LPC31_EXTSRAM1SIZE);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
|
||||
kmm_addregion((FAR void *)LPC31_EXTSDRAM_VSECTION, CONFIG_LPC31_EXTDRAMSIZE);
|
||||
MM_ADDREGION((FAR void *)LPC31_EXTSDRAM_VSECTION, CONFIG_LPC31_EXTDRAMSIZE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user