summaryrefslogtreecommitdiff
path: root/nuttx/configs/sam4s-xplained
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-06-26 10:54:12 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-06-26 10:54:12 -0600
commitd6fc7fd30ee2fb16e3e476565e37f9ae0eb87c67 (patch)
treeef2a180885105f33f94731e0a8c2468efe59bc42 /nuttx/configs/sam4s-xplained
parentbbdf7a9ec4b7af902c0036125da19419ded33d08 (diff)
downloadnuttx-d6fc7fd30ee2fb16e3e476565e37f9ae0eb87c67.tar.gz
nuttx-d6fc7fd30ee2fb16e3e476565e37f9ae0eb87c67.tar.bz2
nuttx-d6fc7fd30ee2fb16e3e476565e37f9ae0eb87c67.zip
Fix integration of RAM test into the build and configuration system
Diffstat (limited to 'nuttx/configs/sam4s-xplained')
-rw-r--r--nuttx/configs/sam4s-xplained/README.txt67
-rw-r--r--nuttx/configs/sam4s-xplained/nsh/defconfig16
-rwxr-xr-xnuttx/configs/sam4s-xplained/nsh/setenv.sh14
-rw-r--r--nuttx/configs/sam4s-xplained/ostest/defconfig2
-rw-r--r--nuttx/configs/sam4s-xplained/src/Makefile4
-rw-r--r--nuttx/configs/sam4s-xplained/src/sam4s-xplained.h35
-rw-r--r--nuttx/configs/sam4s-xplained/src/sam_boot.c8
7 files changed, 122 insertions, 24 deletions
diff --git a/nuttx/configs/sam4s-xplained/README.txt b/nuttx/configs/sam4s-xplained/README.txt
index edc7c753c..c07aae4c1 100644
--- a/nuttx/configs/sam4s-xplained/README.txt
+++ b/nuttx/configs/sam4s-xplained/README.txt
@@ -322,9 +322,8 @@ Buttons and LEDs
Serial Consoles
^^^^^^^^^^^^^^^
- USART0
- ------
-
+ UART1
+ -----
If you have a TTL to RS-232 convertor then this is the most convenient
serial console to use. UART1 is the default in all of these
configurations.
@@ -334,6 +333,8 @@ Serial Consoles
GND J1 pin 9 J4 pin 9
Vdd J1 pin 10 J4 pin 10
+ USART1
+ ------
USART1 is another option:
USART1 RXD PA21 J2 pin 6
@@ -341,13 +342,12 @@ Serial Consoles
GND J2 pin 9
Vdd J2 pin 10
+ Virtual COM Port
+ ----------------
Yet another option is to use UART0 and the virtual COM port. This
option may be more convenient for long term development, but was
painful to use during board bring-up.
- Virtual COM Port
- ----------------
-
The SAM4S Xplained contains an Embedded Debugger (EDBG) that can be
used to program and debug the ATSAM4S16C using Serial Wire Debug (SWD).
The Embedded debugger also include a Virtual Com port interface over
@@ -587,5 +587,56 @@ Configuration sub-directories
nsh:
This configuration directory will built the NuttShell. See NOTES above.
- nsh:
- This configuration directory will built the NuttShell. See NOTES above.
+ NOTES:
+ 1. The configuration configuration can be modified to include support
+ for the on-board SRAM (1MB).
+
+ System Type -> External Memory Configuration
+ CONFIG_ARCH_EXTSRAM0=y : Select SRAM on CS0
+ CONFIG_ARCH_EXTSRAM0SIZE=1048576 : Size=1MB
+
+ Now what are you going to do with the SRAM. There are two choices:
+
+ a) To enable the NuttX RAM test that may be used to verify the
+ external SRAM:
+
+ System Type -> External Memory Configuration
+ CONFIG_ARCH_EXTSRAM0HEAP=n : Don't add to heap
+
+ Application Configuration -> System NSH Add-Ons
+ CONFIG_SYSTEM_RAMTEST=y : Enable the RAM test built-in
+
+ In this configuration, the SDRAM is not added to heap and so is
+ not excessible to the applications. So the RAM test can be
+ freely executed against the SRAM memory beginning at address
+ 0x6000:0000 (CS0).
+
+ nsh> ramtest -h
+ Usage: <noname> [-w|h|b] <hex-address> <decimal-size>
+
+ Where:
+ <hex-address> starting address of the test.
+ <decimal-size> number of memory locations (in bytes).
+ -w Sets the width of a memory location to 32-bits.
+ -h Sets the width of a memory location to 16-bits (default).
+ -b Sets the width of a memory location to 8-bits.
+
+ To test the entire external SRAM:
+
+ nsh> ramtest 60000000 1048576
+ RAMTest: Marching ones: 60000000 1048576
+ RAMTest: Marching zeroes: 60000000 1048576
+ RAMTest: Pattern test: 60000000 1048576 55555555 aaaaaaaa
+ RAMTest: Pattern test: 60000000 1048576 66666666 99999999
+ RAMTest: Pattern test: 60000000 1048576 33333333 cccccccc
+ RAMTest: Address-in-address test: 60000000 1048576
+
+ b) To add this RAM to the NuttX heap, you would need to change the
+ configuration as follows:
+
+ System Type -> External Memory Configuration
+ CONFIG_ARCH_EXTSRAM0HEAP=y : Add external RAM to heap
+
+ Memory Management
+ -CONFIG_MM_REGIONS=1 : Only the internal SRAM
+ +CONFIG_MM_REGIONS=2 : Also include external SRAM
diff --git a/nuttx/configs/sam4s-xplained/nsh/defconfig b/nuttx/configs/sam4s-xplained/nsh/defconfig
index f064d3f01..dbe1d14a9 100644
--- a/nuttx/configs/sam4s-xplained/nsh/defconfig
+++ b/nuttx/configs/sam4s-xplained/nsh/defconfig
@@ -92,6 +92,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set
CONFIG_ARMV7M_OABI_TOOLCHAIN=y
+# CONFIG_GPIO_IRQ is not set
#
# AT91SAM3/4 Configuration Options
@@ -162,13 +163,18 @@ CONFIG_SAM34_UART1=y
#
# AT91SAM3/4 GPIO Interrupt Configuration
#
-# CONFIG_GPIOA_IRQ is not set
-# CONFIG_GPIOB_IRQ is not set
-# CONFIG_GPIOC_IRQ is not set
#
# External Memory Configuration
#
+CONFIG_ARCH_HAVE_EXTNAND=y
+CONFIG_ARCH_HAVE_EXTNOR=y
+CONFIG_ARCH_HAVE_EXTSRAM0=y
+CONFIG_ARCH_HAVE_EXTSRAM1=y
+# CONFIG_ARCH_EXTNAND is not set
+# CONFIG_ARCH_EXTNOR is not set
+# CONFIG_ARCH_EXTSRAM0 is not set
+# CONFIG_ARCH_EXTSRAM1 is not set
#
# Architecture Options
@@ -247,7 +253,7 @@ CONFIG_DEV_CONSOLE=y
# CONFIG_FDCLONE_DISABLE is not set
# CONFIG_FDCLONE_STDIO is not set
CONFIG_SDCLONE_DISABLE=y
-# CONFIG_SCHED_WAITPID is not set
+CONFIG_SCHED_WAITPID=y
# CONFIG_SCHED_STARTHOOK is not set
# CONFIG_SCHED_ATEXIT is not set
# CONFIG_SCHED_ONEXIT is not set
@@ -383,7 +389,7 @@ CONFIG_DISABLE_MOUNTPOINT=y
#
# CONFIG_MM_MULTIHEAP is not set
# CONFIG_MM_SMALL is not set
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=1
# CONFIG_GRAN is not set
#
diff --git a/nuttx/configs/sam4s-xplained/nsh/setenv.sh b/nuttx/configs/sam4s-xplained/nsh/setenv.sh
index 493fe18c1..0e97bb38b 100755
--- a/nuttx/configs/sam4s-xplained/nsh/setenv.sh
+++ b/nuttx/configs/sam4s-xplained/nsh/setenv.sh
@@ -31,6 +31,20 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
# This is the Cygwin path to the location where I installed the Atmel GCC
# toolchain under Windows. You will also have to edit this if you install
diff --git a/nuttx/configs/sam4s-xplained/ostest/defconfig b/nuttx/configs/sam4s-xplained/ostest/defconfig
index b26c9c827..eb3ddaf6e 100644
--- a/nuttx/configs/sam4s-xplained/ostest/defconfig
+++ b/nuttx/configs/sam4s-xplained/ostest/defconfig
@@ -379,7 +379,7 @@ CONFIG_DISABLE_MOUNTPOINT=y
#
# CONFIG_MM_MULTIHEAP is not set
# CONFIG_MM_SMALL is not set
-CONFIG_MM_REGIONS=3
+CONFIG_MM_REGIONS=1
# CONFIG_GRAN is not set
#
diff --git a/nuttx/configs/sam4s-xplained/src/Makefile b/nuttx/configs/sam4s-xplained/src/Makefile
index 80d8f4719..4103dd7cf 100644
--- a/nuttx/configs/sam4s-xplained/src/Makefile
+++ b/nuttx/configs/sam4s-xplained/src/Makefile
@@ -42,6 +42,10 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sam_boot.c
+ifeq ($(CONFIG_ARCH_EXTSRAM0),y)
+CSRCS += sam_sram.c
+endif
+
ifeq ($(CONFIG_HAVE_CXX),y)
CSRCS += sam_cxxinitialize.c
endif
diff --git a/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h b/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h
index 1d6877d33..ace4bb186 100644
--- a/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h
+++ b/nuttx/configs/sam4s-xplained/src/sam4s-xplained.h
@@ -87,10 +87,10 @@
*/
-#define GPIO_D9 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
- GPIO_PORT_PIOC | GPIO_PIN10)
-#define GPIO_D10 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
- GPIO_PORT_PIOC | GPIO_PIN17)
+#define GPIO_D9 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
+ GPIO_PORT_PIOC | GPIO_PIN10)
+#define GPIO_D10 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
+ GPIO_PORT_PIOC | GPIO_PIN17)
/* Mechanical buttons:
*
@@ -101,9 +101,14 @@
* PA5 BP2
*/
-#define GPIO_BP2 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
- GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN5)
-#define IRQ_BP2 SAM_IRQ_PA5
+#define GPIO_BP2 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
+ GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN5)
+#define IRQ_BP2 SAM_IRQ_PA5
+
+/* SRAM Enable. EBI_NLB PC16. Active=low; Standby=high */
+
+#define GPIO_EBI_NLB (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
+ GPIO_PORT_PIOC | GPIO_PIN16)
/************************************************************************************
* Public Types
@@ -119,9 +124,21 @@
* Public Functions
************************************************************************************/
-/****************************************************************************
+/************************************************************************************
+ * Name: sam_sram_initialize
+ *
+ * Description:
+ * Configure and enable SRAM on board the SAM4S Xplained
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_EXTSRAM0
+void sam_sram_initialize(void);
+#endif
+
+/************************************************************************************
* Name: up_ledinit
- ****************************************************************************/
+ ************************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void up_ledinit(void);
diff --git a/nuttx/configs/sam4s-xplained/src/sam_boot.c b/nuttx/configs/sam4s-xplained/src/sam_boot.c
index 54d29053e..a302d3efb 100644
--- a/nuttx/configs/sam4s-xplained/src/sam_boot.c
+++ b/nuttx/configs/sam4s-xplained/src/sam_boot.c
@@ -67,9 +67,15 @@
void sam_boardinitialize(void)
{
- /* Configure on-board LEDs if LED support has been selected. */
+#ifdef CONFIG_ARCH_EXTSRAM0
+ /* Configure and enable SRAM on board the SAM4S Xplained */
+
+ sam_sram_initialize();
+#endif
#ifdef CONFIG_ARCH_LEDS
+ /* Configure on-board LEDs if LED support has been selected. */
+
up_ledinit();
#endif
}