On the LPC1769 there are two 16 KiB AHB SRAM blocks, which are mapped back to

back at physical address 0x2007C000 and 0x20080000 (i.e. right below and right
above a 512 KiB boundary).  Memory from those two blocks is considered
continuous when assigned to a heap.

In the protected build mode, when the memory protection unit is used, though,
it must be split into two MPU regions.  This is because MPU regions must be
naturally aligned, and the 32KiB continuous address space of the two 16KiB AHB
SRAM blocks does not start at an address divisible by 32KiB.

The only other configurations that use protected build mode on lpc17xx are
currently open1788/knsh and open1788/knxterm.  The LPC1788 has the AHB SRAM
blocks mapped more sanely (from an MPU region point of view), which is
probably why no problems emerged here.  Both still compile with my change and
other than wasting an MPU region (which would otherwise remain unused) should
work fine.  That said, I have no hardware to confirm.
This commit is contained in:
Michael Jung 2019-07-09 07:23:10 -06:00 committed by Gregory Nutt
parent 721c33695f
commit d5ec2ab9bc

View File

@ -369,10 +369,16 @@ 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);
#if defined(LPC17_BANK0_HEAPBASE) && defined(LPC17_BANK0_HEAPSIZE)
lpc17_mpu_uheap((uintptr_t)LPC17_BANK0_HEAPBASE, LPC17_BANK0_HEAPSIZE);
#endif
#if defined(LPC17_BANK1_HEAPBASE) && defined(LPC17_BANK1_HEAPSIZE)
lpc17_mpu_uheap((uintptr_t)LPC17_BANK1_HEAPBASE, LPC17_BANK1_HEAPSIZE);
#endif
#endif /* CONFIG_BUILD_PROTECTED && CONFIG_MM_KERNEL_HEAP */
/* Add the AHB SRAM user heap region. */
kumm_addregion((FAR void *)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);