summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc31xx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-07-24 10:08:32 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-07-24 10:08:32 -0600
commitba377ddfd3168092de8cc00f18eae604479b4e6b (patch)
treecd0526d21820885af5857b6e9edac85c00465b23 /nuttx/arch/arm/src/lpc31xx
parentb271c255cd69f1c879bba5af37d62c54f8278fd8 (diff)
downloadnuttx-ba377ddfd3168092de8cc00f18eae604479b4e6b.tar.gz
nuttx-ba377ddfd3168092de8cc00f18eae604479b4e6b.tar.bz2
nuttx-ba377ddfd3168092de8cc00f18eae604479b4e6b.zip
Revamp the way external memory regions are configured; Add logic to add SAMA5 external memory regions to the heap
Diffstat (limited to 'nuttx/arch/arm/src/lpc31xx')
-rw-r--r--nuttx/arch/arm/src/lpc31xx/Kconfig135
-rw-r--r--nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c32
-rw-r--r--nuttx/arch/arm/src/lpc31xx/lpc31_boot.c6
-rw-r--r--nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h8
4 files changed, 150 insertions, 31 deletions
diff --git a/nuttx/arch/arm/src/lpc31xx/Kconfig b/nuttx/arch/arm/src/lpc31xx/Kconfig
index 1022cfe60..c2447cb7f 100644
--- a/nuttx/arch/arm/src/lpc31xx/Kconfig
+++ b/nuttx/arch/arm/src/lpc31xx/Kconfig
@@ -38,7 +38,7 @@ config ARCH_CHIP_LPC3154
select ARCH_HAVE_EXTSRAM1
select ARCH_HAVE_EXTDRAM
-endchoice
+endchoice # LPC31xx Configuration Options
choice
prompt "Toolchain Selection"
@@ -62,11 +62,11 @@ config LPC31_BUILDROOT
bool "Buildroot"
depends on !WINDOWS_NATIVE
-endchoice
+endchoice # Toolchain Selection
config LPC31_SDRAMHCLK
int "External SDRAM HCLK"
- depends on ARCH_EXTSDRAM
+ depends on LPC31_EXTSDRAM
---help---
The SDRAM HCLK may be specified here (if not, it will be calculated).
@@ -89,7 +89,127 @@ config LPC31_MCI
bool "MCI"
default n
-endmenu
+endmenu # LPC31xx Peripheral Support
+
+menu "External Memory Configuration"
+
+config ARCH_HAVE_EXTNAND
+ bool
+
+config ARCH_HAVE_EXTDRAM
+ bool
+
+config ARCH_HAVE_EXTSRAM0
+ bool
+
+config ARCH_HAVE_EXTSRAM1
+ bool
+
+config LPC31_EXTNAND
+ bool "Configure external NAND"
+ default n
+ depends on ARCH_HAVE_EXTNAND
+ ---help---
+ Configure external NAND memory and, if applicable, map then external
+ NAND into the memory map.
+
+if LPC31_EXTNAND
+
+config LPC31_EXTNANDSIZE
+ int "External NAND size"
+ default 0
+ ---help---
+ Size of the external NAND in bytes.
+
+endif # LPC31_EXTNAND
+
+config LPC31_EXTDRAM
+ bool "Configure external DRAM"
+ default n
+ depends on ARCH_HAVE_EXTDRAM
+ ---help---
+ Configure external DRAM memory and, if applicable, map then external
+ DRAM into the memory map.
+
+if LPC31_EXTDRAM
+
+config LPC31_EXTDRAMSIZE
+ int "External SDRAM size"
+ default 0
+ ---help---
+ Size of the external SDRAM in bytes.
+
+choice
+ prompt "SDRAM Width Selection"
+ default LPC31_SDRAM_16BIT
+
+config LPC31_SDRAM_8BIT
+ bool "8-bit"
+
+config LPC31_SDRAM_16BIT
+ bool "16-bit"
+
+config LPC31_SDRAM_32BIT
+ bool "32-bit"
+
+endchoice # SDRAM Width Selection
+
+config LPC31_EXTDRAMHEAP
+ bool "Add external SDRAM to the heap"
+ default y
+ ---help---
+ Add the external SDRAM into the heap.
+
+endif # LPC31_EXTDRAM
+
+config LPC31_EXTSRAM0
+ bool "Configure external SRAM (Bank 0)"
+ default n
+ depends on ARCH_HAVE_EXTSRAM0
+ ---help---
+ Configure external SRAM Bank 0 memory and, if applicable, map then
+ external SRAM Bank 0 into the memory map.
+
+if LPC31_EXTSRAM0
+
+config LPC31_EXTSRAM0SIZE
+ int "External SRAM size"
+ default 0
+ ---help---
+ Size of the external SRAM Bank 0 in bytes.
+
+config LPC31_EXTSRAM0HEAP
+ bool "Add external SRAM (Bank 0) to the heap"
+ default y
+ ---help---
+ Add external SRAM Bank 0 into the heap.
+
+endif # LPC31_EXTSRAM0
+
+config LPC31_EXTSRAM1
+ bool "Configure external SRAM (Bank 1)"
+ default n
+ depends on ARCH_HAVE_EXTSRAM1
+ ---help---
+ Configure external SRAM Bank 1 memory and, if applicable, map then
+ external SRAM Bank 1 into the memory map.
+
+if LPC31_EXTSRAM1
+
+config LPC31_EXTSRAM1SIZE
+ int "External SRAM1 size"
+ default 0
+ ---help---
+ Size of the external SRAM Bank 1 in bytes.
+
+config LPC31_EXTSRAM1HEAP
+ bool "Add external SRAM (Bank 1) to the heap"
+ default y
+ ---help---
+ Add external SRAM Bank 1 into the heap.
+
+endif # LPC31_EXTSRAM1
+endmenu # External Memory Configuration
menu "LPC31xx UART Configuration"
depends on LPC31_UART
@@ -109,7 +229,7 @@ config LPC31_UART_MULVAL
---help---
BAUD multiplier
-endmenu
+endmenu # LPC31xx UART Configuration
menu "USB device driver options"
@@ -143,7 +263,7 @@ config LPC31_USBDEV_REGDEBUG
---help---
Output detailed register-level USB device debug information. Requires also DEBUG.
-endmenu
+endmenu # USB device driver options
menu "SPI device driver options"
@@ -154,5 +274,4 @@ config LPC31_SPI_REGDEBUG
---help---
Output detailed register-level SPI device debug information. Requires also DEBUG.
-endmenu
-
+endmenu # SPI device driver options
diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c b/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c
index 7c2c8696a..5a935a548 100644
--- a/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c
+++ b/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c
@@ -68,31 +68,31 @@
* memory regions that we have been asked to add to the heap.
*/
-#if defined(CONFIG_ARCH_EXTSRAM0) && defined(CONFIG_ARCH_EXTSRAM0HEAP)
-# if defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP)
-# if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP)
+#if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP)
+# if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP)
+# if defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
# /* SRAM+EXTSRAM0+EXTSRAM1+EXTSDRAM */
# define LPC31_NEXT_REGIONS 4
# else
# /* SRAM+EXTSRAM0+EXTSRAM1 */
# define LPC31_NEXT_REGIONS 3
# endif
-# elif defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP)
+# elif defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
# /* SRAM+EXTSRAM0+EXTSDRAM */
# define LPC31_NEXT_REGIONS 3
# else
# /* SRAM+EXTSRAM0 */
# define LPC31_NEXT_REGIONS 2
# endif
-#elif defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP)
-# if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP)
+#elif defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP)
+# if defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
# /* SRAM+EXTSRAM1+EXTSDRAM */
# define LPC31_NEXT_REGIONS 3
# else
# /* SRAM+EXTSRAM1 */
# define LPC31_NEXT_REGIONS 2
# endif
-#elif defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP)
+#elif defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
# /* SRAM+EXTSDRAM */
# define LPC31_NEXT_REGIONS 2
#else
@@ -106,13 +106,13 @@
# else
# error "CONFIG_MM_REGIONS is too large for the selected memory regions"
# endif
-# if defined(CONFIG_ARCH_EXTSRAM0) && defined(CONFIG_ARCH_EXTSRAM0HEAP)
+# if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP)
# error "External SRAM0 is selected for heap"
# endif
-# if defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP)
+# if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP)
# error "External SRAM1 is selected for heap"
# endif
-# if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP)
+# if defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
# error "External SRAM1 is selected for heap"
# endif
#endif
@@ -196,16 +196,16 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
#if CONFIG_MM_REGIONS > 1
void up_addregion(void)
{
-#if defined(CONFIG_ARCH_EXTSRAM0) && defined(CONFIG_ARCH_EXTSRAM0HEAP)
- kmm_addregion((FAR void*)LPC31_EXTSRAM0_VSECTION, CONFIG_ARCH_EXTSRAM0SIZE);
+#if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP)
+ kmm_addregion((FAR void*)LPC31_EXTSRAM0_VSECTION, CONFIG_LPC31_EXTSRAM0SIZE);
#endif
-#if defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP)
- kmm_addregion((FAR void*)LPC31_EXTSRAM1_VSECTION, CONFIG_ARCH_EXTSRAM1SIZE);
+#if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP)
+ kmm_addregion((FAR void*)LPC31_EXTSRAM1_VSECTION, CONFIG_LPC31_EXTSRAM1SIZE);
#endif
-#if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP)
- kmm_addregion((FAR void*)LPC31_EXTSDRAM_VSECTION, CONFIG_ARCH_EXTDRAMSIZE);
+#if defined(CONFIG_LPC31_EXTDRAM) && defined(CONFIG_LPC31_EXTDRAMHEAP)
+ kmm_addregion((FAR void*)LPC31_EXTSDRAM_VSECTION, CONFIG_LPC31_EXTDRAMSIZE);
#endif
}
#endif
diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c b/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c
index a7c1acdc8..24beb87fa 100644
--- a/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c
+++ b/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c
@@ -112,17 +112,17 @@ static const struct section_mapping_s section_mapping[] =
LPC31_MCI_MMUFLAGS, LPC31_MCI_NSECTIONS},
{ LPC31_USBOTG_PSECTION, LPC31_USBOTG_VSECTION,
LPC31_USBOTG_MMUFLAGS, LPC31_USBOTG_NSECTIONS},
-#if defined(CONFIG_ARCH_EXTSRAM0) && CONFIG_ARCH_EXTSRAM0SIZE > 0
+#if defined(CONFIG_LPC31_EXTSRAM0) && CONFIG_LPC31_EXTSRAM0SIZE > 0
{ LPC31_EXTSRAM_PSECTION, LPC31_EXTSRAM_VSECTION,
LPC31_EXTSDRAM_MMUFLAGS, LPC31_EXTSRAM_NSECTIONS},
#endif
-#if defined(CONFIG_ARCH_EXTDRAM) && CONFIG_ARCH_EXTDRAMSIZE > 0
+#if defined(CONFIG_LPC31_EXTDRAM) && CONFIG_LPC31_EXTDRAMSIZE > 0
{ LPC31_EXTSDRAM0_PSECTION, LPC31_EXTSDRAM0_VSECTION,
LPC31_EXTSDRAM_MMUFLAGS, LPC31_EXTSDRAM0_NSECTIONS},
#endif
{ LPC31_INTC_PSECTION, LPC31_INTC_VSECTION,
LPC31_INTC_MMUFLAGS, LPC31_INTC_NSECTIONS},
-#ifdef CONFIG_ARCH_EXTNAND
+#ifdef CONFIG_LPC31_EXTNAND
{ LPC31_NAND_PSECTION, LPC31_NAND_VSECTION
LPC31_NAND_MMUFLAGS, LPC31_NAND_NSECTIONS},
#endif
diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h b/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h
index 6337f9e83..dfe2bc16d 100644
--- a/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h
+++ b/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h
@@ -81,7 +81,7 @@
/* 0x60001000-0x6fffffff: Reserved */
#define LPC31_NAND_PSECTION 0x70000000 /* 0x70000000-0x700007ff: NANDFLASH Ctrl 2Kb */
/* 0x70000800-0xffffffff: Reserved */
-#ifdef CONFIG_ARCH_EXTNAND /* End of the physical address space */
+#ifdef CONFIG_LPC31_EXTNAND /* End of the physical address space */
# define LPC31_LAST_PSECTION (LPC31_NAND_PSECTION + (1 << 20))
#else
# define LPC31_LAST_PSECTION (LPC31_INTC_PSECTION + (1 << 20))
@@ -176,8 +176,8 @@
* the size of the SDRAM installed.
*/
-#if defined(CONFIG_ARCH_EXTDRAM) && CONFIG_ARCH_EXTDRAMSIZE > 0
-# define LPC31_EXTSDRAM0_NSECTIONS _NSECTIONS(CONFIG_ARCH_EXTDRAMSIZE)
+#if defined(CONFIG_LPC31_EXTDRAM) && CONFIG_LPC31_EXTDRAMSIZE > 0
+# define LPC31_EXTSDRAM0_NSECTIONS _NSECTIONS(CONFIG_LPC31_EXTDRAMSIZE)
#endif
/* Section MMU Flags */
@@ -233,7 +233,7 @@
# define LPC31_INTC_VSECTION 0x60000000 /* 0x60000000-0x60000fff: Interrupt controller 4Kb */
# define LPC31_NAND_VSECTION 0x70000000 /* 0x70000000-0x700007ff: NANDFLASH Ctrl 2Kb */
#
-# ifdef CONFIG_ARCH_EXTNAND /* End of the virtual address space */
+# ifdef CONFIG_LPC31_EXTNAND /* End of the virtual address space */
# define LPC31_LAST_VSECTION (LPC31_NAND_VSECTION + (1 << 20))
# else
# define LPC31_LAST_VSECTION (LPC31_INTC_VSECTION + (1 << 20))