summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/ChangeLog2
-rw-r--r--nuttx/Documentation/README.html2
-rw-r--r--nuttx/README.txt2
-rw-r--r--nuttx/arch/arm/Kconfig8
-rw-r--r--nuttx/arch/arm/include/sam34/chip.h51
-rw-r--r--nuttx/arch/arm/src/lm/Kconfig1
-rw-r--r--nuttx/arch/arm/src/sam34/Kconfig119
-rw-r--r--nuttx/arch/arm/src/sam34/chip/sam_chipid.h35
-rw-r--r--nuttx/arch/arm/src/stm32/Kconfig24
-rw-r--r--nuttx/configs/Kconfig13
-rw-r--r--nuttx/configs/README.txt3
-rw-r--r--nuttx/configs/sam4l-xplained/Kconfig7
-rw-r--r--nuttx/configs/sam4l-xplained/README.txt386
-rw-r--r--nuttx/configs/sam4l-xplained/include/board.h236
-rw-r--r--nuttx/configs/sam4l-xplained/ostest/Make.defs109
-rw-r--r--nuttx/configs/sam4l-xplained/ostest/defconfig581
-rwxr-xr-xnuttx/configs/sam4l-xplained/ostest/setenv.sh63
-rwxr-xr-xnuttx/configs/sam4l-xplained/scripts/ld.script107
-rw-r--r--nuttx/configs/sam4l-xplained/src/.gitignore2
-rw-r--r--nuttx/configs/sam4l-xplained/src/Makefile86
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam4l-xplained.h140
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_autoleds.c182
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_boot.c86
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_buttons.c155
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_spi.c239
-rw-r--r--nuttx/configs/stm32f4discovery/include/board.h16
26 files changed, 2638 insertions, 17 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 0ee3d7495..5057d41df 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -4877,3 +4877,5 @@
Add interrupt vector support for the SAM4L family (2013-6-3).
* arch/include/sam34/chip.h: Add chip definitions for the SAM4L
family (2013-6-3).
+ * configs/sam4l-xplained: A partial configuration that will (eventually)
+ support the SAM4L Xplained Pro developement board (2013-6-3).
diff --git a/nuttx/Documentation/README.html b/nuttx/Documentation/README.html
index e82dd2210..7161abf07 100644
--- a/nuttx/Documentation/README.html
+++ b/nuttx/Documentation/README.html
@@ -184,6 +184,8 @@
| | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/rgmp/README.txt"><b><i>README.txt</i></b></a>></a>
| | |- sam3u-ek/
| | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/sam3u-ek/README.txt"><b><i>README.txt</i></b></a>
+ | | |- sam4l-xplained/
+ | | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/sam4l-xplained/README.txt"><b><i>README.txt</i></b></a>
| | |- shenzhou/
| | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/shenzhou/README.txt"><b><i>README.txt</i></b></a>
| | |- sim/
diff --git a/nuttx/README.txt b/nuttx/README.txt
index 4b0c742c6..142ca872a 100644
--- a/nuttx/README.txt
+++ b/nuttx/README.txt
@@ -1112,6 +1112,8 @@ nuttx
| | `- README.txt
| |- sam3u-ek/
| | `- README.txt
+ | |- sam4l-xplained/
+ | | `- README.txt
| |- sim/
| | |- include/README.txt
| | |- src/README.txt
diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig
index fdd120779..92a4275ce 100644
--- a/nuttx/arch/arm/Kconfig
+++ b/nuttx/arch/arm/Kconfig
@@ -46,6 +46,7 @@ config ARCH_CHIP_KINETIS
bool "Freescale Kinetis"
select ARCH_CORTEXM4
select ARCH_HAVE_MPU
+ select ARCH_HAVE_FPU
select ARCH_HAVE_RAMFUNCS
select ARCH_RAMFUNCS
---help---
@@ -100,6 +101,7 @@ config ARCH_CHIP_LPC43XX
select ARCH_HAVE_CMNVECTOR
select ARMV7M_CMNVECTOR
select ARCH_HAVE_MPU
+ select ARCH_HAVE_FPU
---help---
NPX LPC43XX architectures (ARM Cortex-M4).
@@ -205,10 +207,14 @@ config ARMV7M_CMNVECTOR
logic or the common vector logic. This applies only to ARMv7-M
architectures.
+config ARCH_HAVE_FPU
+ bool
+ default n
+
config ARCH_FPU
bool "FPU support"
default y
- depends on ARCH_CORTEXM4
+ depends on ARCH_HAVE_FPU
---help---
Build in support for the ARM Cortex-M4 Floating Point Unit (FPU).
Check your chip specifications first; not all Cortex-M4 chips support the FPU.
diff --git a/nuttx/arch/arm/include/sam34/chip.h b/nuttx/arch/arm/include/sam34/chip.h
index ce56fd41e..e5c5fa674 100644
--- a/nuttx/arch/arm/include/sam34/chip.h
+++ b/nuttx/arch/arm/include/sam34/chip.h
@@ -118,7 +118,8 @@
* Packages TQFP/VFBGA TQFP/QFN TQFP/QFN
*/
-#elif defined(CONFIG_ARCH_CHIP_AT91SAM4LC2)
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4LC2C) || defined (CONFIG_ARCH_CHIP_ATSAM4LC2B) || \
+ defined(CONFIG_ARCH_CHIP_ATSAM4LC2A)
/* Internal memory */
@@ -137,7 +138,8 @@
# define SAM32_NUDPFS 1 /* 1 USB full speed device */
# define SAM32_NUHPFS 1 /* 1 USB full speed embedded host */
-#elif defined(CONFIG_ARCH_CHIP_AT91SAM4LC4)
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4LC4C) || defined (CONFIG_ARCH_CHIP_ATSAM4LC4B) || \
+ defined(CONFIG_ARCH_CHIP_ATSAM4LC4A)
/* Internal memory */
@@ -156,7 +158,8 @@
# define SAM32_NUDPFS 1 /* 1 USB full speed device */
# define SAM32_NUHPFS 1 /* 1 USB full speed embedded host */
-#elif defined(CONFIG_ARCH_CHIP_AT91SAM4LS2)
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4LS2C) || defined (CONFIG_ARCH_CHIP_ATSAM4LS2B) || \
+ defined(CONFIG_ARCH_CHIP_ATSAM4LS2A)
/* Internal memory */
@@ -175,7 +178,8 @@
# define SAM32_NUDPFS 1 /* 1 USB full speed device */
# define SAM32_NUHPFS 0 /* No USB full speed embedded host */
-#elif defined(CONFIG_ARCH_CHIP_AT91SAM4LS4)
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4LS4C) || defined (CONFIG_ARCH_CHIP_ATSAM4LS4B) || \
+ defined(CONFIG_ARCH_CHIP_ATSAM4LS4A)
/* Internal memory */
@@ -194,6 +198,45 @@
# define SAM32_NUDPFS 1 /* 1 USB full speed device */
# define SAM32_NUHPFS 0 /* No USB full speed embedded host */
+/* AT91SAM4S Family *****************************************************************/
+/*
+ * FEATURE SAM4SD32C SAM4SD32B SAM4SD16C SAM4SD16B SAM4SA16C SAM4SA16B SAM4S16C SAM4S16B SAM4S8C SAM4S8B
+ * Flash 2x1MB 2x1MB 2x512KB 1x1MB 1x1MB 1x1MB 1x1MB 1x1MB 1x512KB 1x512KB
+ * SRAM 160KB 160KB 160KB 160KB 160KB 160KB 128KB 128KB 128KB 128KB
+ * HCACHE 2KB 2KB 2KB 2KB 2KB 2KB - - - -
+ * Pins 100 64 100 64 100 64 100 64 100 64
+ * No. PIOs 79 47 79 47 79 47 79 47 79 47
+ * Ext. BUS Yes No Yes No Yes No Yes No Yes No
+ * 12-bit ADC 16 ch 11 ch 16 ch 11 ch 16 ch 11 ch 16 ch 11 ch 16 ch 11 ch
+ * 12-bit DAC 2 ch 2 ch 2 ch 2 ch 2 ch 2 ch 2 ch 2 ch 2 ch 2 ch
+ * Timer Counter 6 ch 3 ch 6 ch 3 ch 6 ch 3 ch 6 ch 3 ch 6 ch 3 ch
+ * PDC 22 ch 22 ch 22 ch 22 ch 22 ch 22 ch 22 ch 22 ch 22 ch 22 ch
+ * USART 2 2 2 2 2 2 2 2 2 2
+ * UART 2 2 2 2 2 2 2 2 2 2
+ * HSMCI Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
+ */
+
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4SD32C)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4SD32B)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4SD16C)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4SD16B)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4SA16C)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4SA16B)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4S16C)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4S16B)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4S8C)
+# error To be provided
+#elif defined(CONFIG_ARCH_CHIP_ATSAM4S8B)
+# error To be provided
+
#else
# error "Unknown SAM3/4 chip type"
#endif
diff --git a/nuttx/arch/arm/src/lm/Kconfig b/nuttx/arch/arm/src/lm/Kconfig
index 061fab52a..c1266c473 100644
--- a/nuttx/arch/arm/src/lm/Kconfig
+++ b/nuttx/arch/arm/src/lm/Kconfig
@@ -40,6 +40,7 @@ config ARCH_CHIP_LM4F120
bool "LM4F120"
select ARCH_CORTEXM4
select ARCH_CHIP_LM4F
+ select ARCH_HAVE_FPU
endchoice
diff --git a/nuttx/arch/arm/src/sam34/Kconfig b/nuttx/arch/arm/src/sam34/Kconfig
index 9cd9a019a..3991798a7 100644
--- a/nuttx/arch/arm/src/sam34/Kconfig
+++ b/nuttx/arch/arm/src/sam34/Kconfig
@@ -15,10 +15,129 @@ config ARCH_CHIP_AT91SAM3U4E
select ARCH_CORTEXM3
select ARCH_CHIP_SAM3U
+config ARCH_CHIP_SAM34_NDMACHANC2C
+ bool "ATSAM4LC2C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LC2B
+ bool "ATSAM4LC2B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LC2A
+ bool "ATSAM4LC2A"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LC4C
+ bool "ATSAM4LC4C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LC4B
+ bool "ATSAM4LC4B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LC4A
+ bool "ATSAM4LC4A"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LS2C
+ bool "ATSAM4LS2C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LS2B
+ bool "ATSAM4LS2B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LS2A
+ bool "ATSAM4LS2A"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LS4C
+ bool "ATSAM4LS4C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LS4B
+ bool "ATSAM4LS4B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config ARCH_CHIP_ATSAM4LS4A
+ bool "ATSAM4LS4A"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4L
+
+config CONFIG_ARCH_CHIP_ATSAM4SD32C
+ bool "ATSAM4SD32C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4SD32B
+ bool "ATSAM4SD32B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4SD16C
+ bool "ATSAM4SD16C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4SD16B
+ bool "ATSAM4SD16B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4SA16C
+ bool "ATSAM4SA16C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4SA16B
+ bool "ATSAM4SA16B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4S16C
+ bool "ATSAM4S16C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4S16B
+ bool "ATSAM4S16B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4S8C
+ bool "ATSAM4S8C"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
+config CONFIG_ARCH_CHIP_ATSAM4S8B
+ bool "ATSAM4S8B"
+ select ARCH_CORTEXM4
+ select ARCH_CHIP_SAM4S
+
endchoice
config ARCH_CHIP_SAM3U
bool
+ default n
+
+config ARCH_CHIP_SAM4L
+ bool
+ default n
+
+config ARCH_CHIP_SAM4S
+ bool
+ default n
menu "AT91SAM3 Peripheral Support"
diff --git a/nuttx/arch/arm/src/sam34/chip/sam_chipid.h b/nuttx/arch/arm/src/sam34/chip/sam_chipid.h
index 1c1e972b7..c98130efe 100644
--- a/nuttx/arch/arm/src/sam34/chip/sam_chipid.h
+++ b/nuttx/arch/arm/src/sam34/chip/sam_chipid.h
@@ -51,13 +51,13 @@
/* CHIPID register offsets **************************************************************/
-#define SAM_CHIPID_CIDR 0x00 /* Chip ID Register */
-#define SAM_CHIPID_EXID 0x04 /* Chip ID Extension Register */
+#define SAM_CHIPID_CIDR 0x00 /* Chip ID Register */
+#define SAM_CHIPID_EXID 0x04 /* Chip ID Extension Register */
/* CHIPID register adresses *************************************************************/
-#define SAM_CHIPID_CIDR (SAM_CHIPID_BASE+SAM_CHIPID_CIDR)
-#define SAM_CHIPID_EXID (SAM_CHIPID_BASE+SAM_CHIPID_EXID)
+#define SAM_CHIPID_CIDR (SAM_CHIPID_BASE+SAM_CHIPID_CIDR)
+#define SAM_CHIPID_EXID (SAM_CHIPID_BASE+SAM_CHIPID_EXID)
/* CHIPID register bit definitions ******************************************************/
@@ -70,6 +70,8 @@
# define CHIPID_CIDR_EPROC_CORTEXM3 (3 << CHIPID_CIDR_EPROC_SHIFT) /* Cortex-M3 */
# define CHIPID_CIDR_EPROC_ARM920T (4 << CHIPID_CIDR_EPROC_SHIFT) /* ARM920T */
# define CHIPID_CIDR_EPROC_ARM926EJS (5 << CHIPID_CIDR_EPROC_SHIFT) /* ARM926EJ-S */
+# define CHIPID_CIDR_EPROC_CORTEXA5 (6 << CHIPID_CIDR_EPROC_SHIFT) /* Cortex-A5 */
+# define CHIPID_CIDR_EPROC_CORTEXM4 (7 << CHIPID_CIDR_EPROC_SHIFT) /* Cortex-M4 */
#define CHIPID_CIDR_NVPSIZ_SHIFT (8) /* Bits 8-11: Nonvolatile Program Memory Size */
#define CHIPID_CIDR_NVPSIZ_MASK (15 << CHIPID_CIDR_NVPSIZ_SHIFT)
# define CHIPID_CIDR_NVPSIZ_NONE (0 << CHIPID_CIDR_NVPSIZ_SHIFT) /* None */
@@ -101,6 +103,7 @@
# define CHIPID_CIDR_SRAMSIZ_2KB (2 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 2K bytes */
# define CHIPID_CIDR_SRAMSIZ_6KB (3 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 6K bytes */
# define CHIPID_CIDR_SRAMSIZ_112KB (4 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 112K bytes */
+# define CHIPID_CIDR_SRAMSIZ_24KB (4 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 24K bytes */
# define CHIPID_CIDR_SRAMSIZ_4KB (5 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 4K bytes */
# define CHIPID_CIDR_SRAMSIZ_80KB (6 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 80K bytes */
# define CHIPID_CIDR_SRAMSIZ_160KB (7 << CHIPID_CIDR_SRAMSIZ_SHIFT) /* 160K bytes */
@@ -142,6 +145,13 @@
# define CHIPID_CIDR_ARCH_SAM3SXB (0x89 << CHIPID_CIDR_ARCH_SHIFT) /* SAM3SxB Series (64-pin version) */
# define CHIPID_CIDR_ARCH_SAM3SXC (0x8a << CHIPID_CIDR_ARCH_SHIFT) /* SAM3SxC Series (100-pin version) */
# define CHIPID_CIDR_ARCH_AT91X92 (0x92 << CHIPID_CIDR_ARCH_SHIFT) /* AT91x92 Series */
+# define CHIPID_CIDR_ARCH_SAM3NXA (0x93 << CHIPID_CIDR_ARCH_SHIFT) /* SAM3NxA Series (48-pin version) */
+# define CHIPID_CIDR_ARCH_SAM3NXB (0x94 << CHIPID_CIDR_ARCH_SHIFT) /* SAM3NxB Series (64-pin version) */
+# define CHIPID_CIDR_ARCH_SAM3NxC (0x95 << CHIPID_CIDR_ARCH_SHIFT) /* SAM3NxC Series (100-pin version) */
+# define CHIPID_CIDR_ARCH_SAM3NXC (0x99 << CHIPID_CIDR_ARCH_SHIFT) /* SAM3SDxB SAM3SDxB Series (64-pin version) */
+# define CHIPID_CIDR_ARCH_SAM3SDXC (0x9a << CHIPID_CIDR_ARCH_SHIFT) /* SAM3SDxC Series (100-pin version) */
+# define CHIPID_CIDR_ARCH_SAM5A (0xa5 << CHIPID_CIDR_ARCH_SHIFT) /* SAM5A */
+# define CHIPID_CIDR_ARCH_SAM4L (0xb0 << CHIPID_CIDR_ARCH_SHIFT) /* SAM4Lxx Series */
# define CHIPID_CIDR_ARCH_AT75CXX (0xf0 << CHIPID_CIDR_ARCH_SHIFT) /* AT75Cxx Series */
#define CHIPID_CIDR_NVPTYP_SHIFT (28) /* Bits 28-30: Nonvolatile Program Memory Type */
#define CHIPID_CIDR_NVPTYP_MASK (7 << CHIPID_CIDR_NVPTYP_SHIFT)
@@ -152,6 +162,23 @@
# define CHIPID_CIDR_NVPTYP REFLASH (3 << CHIPID_CIDR_NVPTYP_SHIFT) /* ROM and Embedded Flash Memory */
#define CHIPID_CIDR_EXT (1 << 31) /* Bit 31: Extension Flag */
+/* Chip ID Extension Register */
+
+#ifdef CONFIG_ARCH_CHIP_SAM4L
+# define CHIPID_EXID_AES (1 << 0) /* Bit 0: AES Option */
+# define CHIPID_EXID_USB (1 << 1) /* Bit 1: USB Configuration */
+# define CHIPID_EXID_USBFULL (1 << 2) /* Bit 2: USB Option */
+# define CHIPID_EXID_LCD (1 << 3) /* Bit 3: LCD Option */
+# define CHIPID_EXID_PACKAGE_SHIFT (24) /* Bits 24-26: Package Type */
+# define CHIPID_EXID_PACKAGE_MASK (7 << CHIPID_EXID_PACKAGE_SHIFT)
+# define CHIPID_EXID_PACKAGE_24PIN (0 << CHIPID_EXID_PACKAGE_SHIFT) /* 24-pin package */
+# define CHIPID_EXID_PACKAGE_32PIN (1 << CHIPID_EXID_PACKAGE_SHIFT) /* 32-pin package */
+# define CHIPID_EXID_PACKAGE_48PIN (2 << CHIPID_EXID_PACKAGE_SHIFT) /* 48-pin package */
+# define CHIPID_EXID_PACKAGE_64PIN (3 << CHIPID_EXID_PACKAGE_SHIFT) /* 64-pin package */
+# define CHIPID_EXID_PACKAGE_100PIN (4 << CHIPID_EXID_PACKAGE_SHIFT) /* 100-pin package */
+# define CHIPID_EXID_PACKAGE_144PIN (5 << CHIPID_EXID_PACKAGE_SHIFT) /* 144-pin package */
+#endif
+
/****************************************************************************************
* Public Types
****************************************************************************************/
diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig
index 5eee354b9..458190745 100644
--- a/nuttx/arch/arm/src/stm32/Kconfig
+++ b/nuttx/arch/arm/src/stm32/Kconfig
@@ -304,124 +304,148 @@ config ARCH_CHIP_STM32F302CB
bool "STM32F302CB"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F302CC
bool "STM32F302CC"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F302RB
bool "STM32F302RB"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F302RC
bool "STM32F302RC"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F302VB
bool "STM32F302VB"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F302VC
bool "STM32F302VC"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F303CB
bool "STM32F303CB"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F303CC
bool "STM32F303CC"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F303RB
bool "STM32F303RB"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F303RC
bool "STM32F303RC"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F303VB
bool "STM32F303VB"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F303VC
bool "STM32F303VC"
select ARCH_CORTEXM4
select STM32_STM32F30XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F405RG
bool "STM32F405RG"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F405VG
bool "STM32F405VG"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F405ZG
bool "STM32F405ZG"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F407VE
bool "STM32F407VE"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F407VG
bool "STM32F407VG"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F407ZE
bool "STM32F407ZE"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F407ZG
bool "STM32F407ZG"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F407IE
bool "STM32F407IE"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F407IG
bool "STM32F407IG"
select ARCH_CORTEXM4
select STM32_STM32F40XX
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F427V
bool "STM32F427V"
select ARCH_CORTEXM4
select STM32_STM32F40XX
select STM32_STM32F427
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F427Z
bool "STM32F427Z"
select ARCH_CORTEXM4
select STM32_STM32F40XX
select STM32_STM32F427
+ select ARCH_HAVE_FPU
config ARCH_CHIP_STM32F427I
bool "STM32F427I"
select ARCH_CORTEXM4
select STM32_STM32F40XX
select STM32_STM32F427
+ select ARCH_HAVE_FPU
endchoice
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig
index f7ee6d9c0..e500819bc 100644
--- a/nuttx/configs/Kconfig
+++ b/nuttx/configs/Kconfig
@@ -473,6 +473,15 @@ config ARCH_BOARD_SAM3UEK
---help---
The port of NuttX to the Atmel SAM3U-EK development board.
+config ARCH_BOARD_SAM4L_XPLAINED
+ bool "Atmel SAM4L-Xplained Pro development board"
+ depends on ARCH_CHIP_ATSAM4LC4C
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ The port of NuttX to the Atmel SAM4L-Xplained Pro development board.
+
config ARCH_BOARD_SHENZHOU
bool "Shenzhou STM32F107 board"
depends on ARCH_CHIP_STM32F107VC
@@ -772,6 +781,7 @@ config ARCH_BOARD
default "qemu-i486" if ARCH_BOARD_QEMU_I486
default "rgmp" if ARCH_BOARD_RGMP
default "sam3u-ek" if ARCH_BOARD_SAM3UEK
+ default "sam4l-xplained" if ARCH_BOARD_SAM4L_XPLAINED
default "shenzhou" if ARCH_BOARD_SHENZHOU
default "skp16c26" if ARCH_BOARD_SKP16C26
default "stm32_tiny" if ARCH_BOARD_STM32_TINY
@@ -992,6 +1002,9 @@ endif
if ARCH_BOARD_SAM3UEK
source "configs/sam3u-ek/Kconfig"
endif
+if ARCH_BOARD_SAM4L_XPLAINED
+source "configs/sam4l-xplained/Kconfig"
+endif
if ARCH_BOARD_SHENZHOU
source "configs/shenzhou/Kconfig"
endif
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index af50535b8..33b6c217b 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -1962,6 +1962,9 @@ configs/rgmp
configs/sam3u-ek
The port of NuttX to the Atmel SAM3U-EK development board.
+configs/sam4l-xplained
+ The port of NuttX to the Atmel SAM4L-Xplained development board.
+
configs/sim
A user-mode port of NuttX to the x86 Linux platform is available.
The purpose of this port is primarily to support OS feature development.
diff --git a/nuttx/configs/sam4l-xplained/Kconfig b/nuttx/configs/sam4l-xplained/Kconfig
new file mode 100644
index 000000000..daae10472
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_SAM4L_XPLAINED
+endif
diff --git a/nuttx/configs/sam4l-xplained/README.txt b/nuttx/configs/sam4l-xplained/README.txt
new file mode 100644
index 000000000..ca5ecf2f9
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/README.txt
@@ -0,0 +1,386 @@
+README
+^^^^^^
+
+This README discusses issues unique to NuttX configurations for the
+Atmel SAM4L Xplained Pro development board. This board features the
+ATSAM4LC4C MCU
+
+Contents
+^^^^^^^^
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX EABI "buildroot" Toolchain
+ - NuttX OABI "buildroot" Toolchain
+ - NXFLAT Toolchain
+ - LEDs
+ - SAM4L Xplained Pro-specific Configuration Options
+ - Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain, ok
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_SAM34_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_SAM34_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_SAM34_DEVKITARM=y : devkitARM under Windows
+ CONFIG_SAM34_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_SAM34_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/sam34,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/sam34/sam_vectors.S. You may need to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX EABI "buildroot" Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/projects/nuttx/files/buildroot/).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.shsam4l-xplained/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-eabi-defconfig-4.6.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ details PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: Unfortunately, the 4.6.3 EABI toolchain is not compatible with the
+ the NXFLAT tools. See the top-level TODO file (under "Binary loaders") for
+ more information about this problem. If you plan to use NXFLAT, please do not
+ use the GCC 4.6.3 EABI toochain; instead use the GCC 4.3.3 OABI toolchain.
+ See instructions below.
+
+NuttX OABI "buildroot" Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ The older, OABI buildroot toolchain is also available. To use the OABI
+ toolchain:
+
+ 1. When building the buildroot toolchain, either (1) modify the cortexm3-eabi-defconfig-4.6.3
+ configuration to use EABI (using 'make menuconfig'), or (2) use an exising OABI
+ configuration such as cortexm3-defconfig-4.3.3
+
+ 2. Modify the Make.defs file to use the OABI conventions:
+
+ +CROSSDEV = arm-nuttx-elf-
+ +ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
+ -CROSSDEV = arm-nuttx-eabi-
+ -ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
+
+NXFLAT Toolchain
+^^^^^^^^^^^^^^^^
+
+ If you are *not* using the NuttX buildroot toolchain and you want to use
+ the NXFLAT tools, then you will still have to build a portion of the buildroot
+ tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
+ be downloaded from the NuttX SourceForge download site
+ (https://sourceforge.net/projects/nuttx/files/).
+
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lpcxpresso-lpc1768/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-nxflat .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly builtNXFLAT binaries.
+
+LEDs
+^^^^
+ There are three LEDs on board the SAM4L Xplained Pro board: The EDBG
+ controls two of the LEDs, a power LED and a status LED. There is only
+ one user controllable LED, a yellow LED labeled LED0 near the SAM4L USB
+ connector.
+
+ This LED is controlled by PC07 and LED0 can be activated by driving the
+ PC07 to GND.
+
+ When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
+ control LED0 as follows:
+
+ SYMBOL Meaning LED0
+ ------------------- ----------------------- ------
+ LED_STARTED NuttX has been started OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF
+ LED_IRQSENABLED Interrupts enabled OFF
+ LED_STACKCREATED Idle stack created ON
+ LED_INIRQ In an interrupt N/C
+ LED_SIGNAL In a signal handler N/C
+ LED_ASSERTION An assertion failed N/C
+ LED_PANIC The system has crashed FLASH
+
+ Thus is LED0 is statically on, NuttX has successfully booted and is,
+ apparently, running normmally. If LED0 is flashing at approximately
+ 2Hz, then a fatal error has been detected and the system has halted.
+
+SAM4L Xplained Pro-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP="sam34"
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_SAM34
+ CONFIG_ARCH_CHIP_SAM3U
+ CONFIG_ARCH_CHIP_AT91SAM3U4
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=sam4l-xplained (for the SAM4L Xplained Pro development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_SAM4L_XPLAINED=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x0000c000 (48Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The SAM3UF103Z supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_SAM34_DMA
+ CONFIG_SAM34_HSMCI
+ CONFIG_SAM34_NAND
+ CONFIG_SAM34_SPI
+ CONFIG_SAM34_UART
+ CONFIG_SAM34_USART0
+ CONFIG_SAM34_USART1
+ CONFIG_SAM34_USART2
+ CONFIG_SAM34_USART3
+
+ Some subsystems can be configured to operate in different ways. The drivers
+ need to know how to configure the subsystem.
+
+ CONFIG_GPIOA_IRQ
+ CONFIG_GPIOB_IRQ
+ CONFIG_GPIOC_IRQ
+ CONFIG_USART0_ISUART
+ CONFIG_USART1_ISUART
+ CONFIG_USART2_ISUART
+ CONFIG_USART3_ISUART
+
+ AT91SAM3U specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ LCD Options. Other than the standard LCD configuration options
+ (see configs/README.txt), the SAM4L Xplained Pro driver also supports:
+
+ CONFIG_LCD_PORTRAIT - Present the display in the standard 240x320
+ "Portrait" orientation. Default: The display is rotated to
+ support a 320x240 "Landscape" orientation.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each SAM4L Xplained Pro configuration is maintained in a sub-directory and
+can be selected as follow:
+
+ cd tools
+ ./configure.shsam4l-xplained/<subdir>
+ cd -
+ . ./setenv.sh
+
+Before sourcing the setenv.sh file above, you should examine it and perform
+edits as necessary so that BUILDROOT_BIN is the correct path to the directory
+than holds your toolchain binaries.
+
+And then build NuttX by simply typing the following. At the conclusion of
+the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
+
+ make
+
+The <subdir> that is provided above as an argument to the tools/configure.sh
+must be is one of the following:
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
diff --git a/nuttx/configs/sam4l-xplained/include/board.h b/nuttx/configs/sam4l-xplained/include/board.h
new file mode 100644
index 000000000..3c8cb82e3
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/include/board.h
@@ -0,0 +1,236 @@
+/************************************************************************************
+ * configs/sam4l-xplained/include/board.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_SAM4L_XPLAINED_INCLUDE_BOARD_H
+#define __CONFIGS_SAM4L_XPLAINED_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+# ifdef CONFIG_GPIO_IRQ
+# include <arch/irq.h>
+# endif
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* After power-on reset, the sam3u device is running on a 4MHz internal RC. These
+ * definitions will configure clocking with MCK = 48MHz, PLLA = 96, and CPU=48MHz.
+ */
+
+/* Main oscillator register settings */
+
+#define BOARD_CKGR_MOR_MOSCXTST (63 << CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */
+
+/* PLLA configuration */
+
+#define BOARD_CKGR_PLLAR_MULA (7 << CKGR_PLLAR_MULA_SHIFT)
+#define BOARD_CKGR_PLLAR_STMODE CKGR_PLLAR_STMODE_FAST
+#define BOARD_CKGR_PLLAR_PLLACOUNT (63 << CKGR_PLLAR_PLLACOUNT_SHIFT)
+#define BOARD_CKGR_PLLAR_DIVA CKGR_PLLAR_DIVA_BYPASS
+
+/* PMC master clock register settings */
+
+#define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLA
+#define BOARD_PMC_MCKR_PRES PMC_MCKR_PRES_DIV2
+
+/* USB UTMI PLL start-up time */
+
+#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << CKGR_UCKR_UPLLCOUNT_SHIFT)
+
+/* Resulting frequencies */
+
+#define SAM_MAINOSC_FREQUENCY (12000000)
+#define SAM_MCK_FREQUENCY (48000000)
+#define SAM_PLLA_FREQUENCY (96000000)
+#define SAM_CPU_FREQUENCY (48000000)
+
+/* HSMCI clocking
+ *
+ * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
+ * divided by (2*(CLKDIV+1)).
+ *
+ * MCI_SPEED = MCK / (2*(CLKDIV+1))
+ * CLKDIV = MCI / MCI_SPEED / 2 - 1
+ */
+
+/* MCK = 48MHz, CLKDIV = 59, MCI_SPEED = 48MHz / 2 * (59+1) = 400 KHz */
+
+#define HSMCI_INIT_CLKDIV (59 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 48MHz, CLKDIV = 1, MCI_SPEED = 48MHz / 2 * (1+1) = 12 MHz */
+
+#define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 48MHz, CLKDIV = 0, MCI_SPEED = 48MHz / 2 * (0+1) = 24 MHz */
+
+#define HSMCI_SDXFR_CLKDIV (0 << HSMCI_MR_CLKDIV_SHIFT)
+#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
+
+/* LED definitions ******************************************************************/
+/* There are three LEDs on board the SAM4L Xplained Pro board: The EDBG
+ * controls two of the LEDs, a power LED and a status LED. There is only
+ * one user controllable LED, a yellow LED labeled LED0 near the SAM4L USB
+ * connector.
+ *
+ * This LED is controlled by PC07 and LED0 can be activated by driving the
+ * PC07 to GND.
+ *
+ * When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
+ * control LED0 as defined below. Thus is LED0 is statically on, NuttX has
+ * successfully booted and is, apparently, running normmally. If LED0 is
+ * flashing at approximately 2Hz, then a fatal error has been detected and the
+ * system has halted.
+ */
+
+#define LED_STARTED 0 /* LED0=OFF */
+#define LED_HEAPALLOCATE 0 /* LED0=OFF */
+#define LED_IRQSENABLED 0 /* LED0=OFF */
+#define LED_STACKCREATED 1 /* LED0=ON */
+#define LED_INIRQ 2 /* LED0=no change */
+#define LED_SIGNAL 2 /* LED0=no change */
+#define LED_ASSERTION 2 /* LED0=no change */
+#define LED_PANIC 3 /* LED0=flashing */
+
+/* Button definitions ***************************************************************/
+/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. The connection
+ * to the SAM4L is:
+ *
+ * PC13 CATB_SENSE15
+ * PC14 CATB_DIS
+ */
+
+/* Mechanical buttons:
+ *
+ * The SAM4L Xplained Pro contains two mechanical buttons. One button is the
+ * RESET button connected to the SAM4L reset line and the other is a generic user
+ * configurable button. When a button is pressed it will drive the I/O line to GND.
+ *
+ * PC24 SW0
+ */
+
+/* The STM32F4 Discovery supports one button: */
+
+#define BUTTON_SW0 0
+#define NUM_BUTTONS 1
+
+#define BUTTON_SW0_BIT (1 << BUTTON_SW0)
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: sam_boardinitialize
+ *
+ * Description:
+ * All SAM3U architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void sam_boardinitialize(void);
+
+/************************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the current state of all buttons or
+ * up_irqbutton() may be called to register button interrupt handlers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+void up_buttoninit(void);
+
+/************************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * After up_buttoninit() has been called, up_buttons() may be called to collect
+ * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit
+ * associated with a button. See the BUTTON* definitions above for the meaning of
+ * each bit in the returned value.
+ *
+ ************************************************************************************/
+
+uint8_t up_buttons(void);
+
+/************************************************************************************
+ * Name: up_irqbutton
+ *
+ * Description:
+ * This function may be called to register an interrupt handler that will be
+ * called when a button is depressed or released. The ID value is one of the
+ * BUTTON* definitions provided above. The previous interrupt handler address is
+ * returned (so that it may restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_GPIOA_IRQ
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SAM4L_XPLAINED_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/sam4l-xplained/ostest/Make.defs b/nuttx/configs/sam4l-xplained/ostest/Make.defs
new file mode 100644
index 000000000..ac828cabb
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/ostest/Make.defs
@@ -0,0 +1,109 @@
+############################################################################
+# configs/sam4l-xplained/ostest/Make.defs
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/copydir.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-nuttx-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sam4l-xplained/ostest/defconfig b/nuttx/configs/sam4l-xplained/ostest/defconfig
new file mode 100644
index 000000000..e10037477
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/ostest/defconfig
@@ -0,0 +1,581 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_HOST_LINUX=y
+# CONFIG_HOST_OSX is not set
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+# CONFIG_INTELHEX_BINARY is not set
+# CONFIG_MOTOROLA_SREC is not set
+CONFIG_RAW_BINARY=y
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+CONFIG_ARCH_ARM=y
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="arm"
+
+#
+# ARM Options
+#
+# CONFIG_ARCH_CHIP_C5471 is not set
+# CONFIG_ARCH_CHIP_CALYPSO is not set
+# CONFIG_ARCH_CHIP_DM320 is not set
+# CONFIG_ARCH_CHIP_IMX is not set
+# CONFIG_ARCH_CHIP_KINETIS is not set
+# CONFIG_ARCH_CHIP_KL is not set
+# CONFIG_ARCH_CHIP_LM is not set
+# CONFIG_ARCH_CHIP_LPC17XX is not set
+# CONFIG_ARCH_CHIP_LPC214X is not set
+# CONFIG_ARCH_CHIP_LPC2378 is not set
+# CONFIG_ARCH_CHIP_LPC31XX is not set
+# CONFIG_ARCH_CHIP_LPC43XX is not set
+# CONFIG_ARCH_CHIP_NUC1XX is not set
+CONFIG_ARCH_CHIP_SAM34=y
+# CONFIG_ARCH_CHIP_STM32 is not set
+# CONFIG_ARCH_CHIP_STR71X is not set
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_FAMILY="armv7-m"
+CONFIG_ARCH_CHIP="sam34"
+# CONFIG_ARMV7M_USEBASEPRI is not set
+CONFIG_ARCH_HAVE_MPU=y
+# CONFIG_ARMV7M_MPU is not set
+
+#
+# ARMV7M Configuration Options
+#
+CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
+# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
+# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set
+# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set
+CONFIG_ARMV7M_OABI_TOOLCHAIN=y
+
+#
+# AT91SAM3/SAM4 Configuration Options
+#
+# CONFIG_ARCH_CHIP_AT91SAM3U4E is not set
+# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
+# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
+# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
+CONFIG_ARCH_CHIP_ATSAM4LC4C=y
+# CONFIG_ARCH_CHIP_ATSAM4LC4B is not set
+# CONFIG_ARCH_CHIP_ATSAM4LC4A is not set
+# CONFIG_ARCH_CHIP_ATSAM4LS2C is not set
+# CONFIG_ARCH_CHIP_ATSAM4LS2B is not set
+# CONFIG_ARCH_CHIP_ATSAM4LS2A is not set
+# CONFIG_ARCH_CHIP_ATSAM4LS4C is not set
+# CONFIG_ARCH_CHIP_ATSAM4LS4B is not set
+# CONFIG_ARCH_CHIP_ATSAM4LS4A is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4SD32C is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4SD32B is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4SD16C is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4SD16B is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4SA16C is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4SA16B is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4S16C is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4S16B is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4S8C is not set
+# CONFIG_CONFIG_ARCH_CHIP_ATSAM4S8B is not set
+# CONFIG_ARCH_CHIP_SAM3U is not set
+CONFIG_ARCH_CHIP_SAM4L=y
+# CONFIG_ARCH_CHIP_SAM4S is not set
+
+#
+# AT91SAM3 Peripheral Support
+#
+# CONFIG_SAM34_DMA is not set
+# CONFIG_SAM34_NAND is not set
+# CONFIG_SAM34_HSMCI is not set
+CONFIG_SAM34_UART=y
+# CONFIG_SAM34_USART0 is not set
+# CONFIG_SAM34_USART1 is not set
+# CONFIG_SAM34_USART2 is not set
+# CONFIG_SAM34_USART3 is not set
+# CONFIG_SAM34_SPI is not set
+
+#
+# AT91SAM3 UART Configuration
+#
+
+#
+# AT91SAM3 GPIO Interrupt Configuration
+#
+# CONFIG_GPIOA_IRQ is not set
+# CONFIG_GPIOB_IRQ is not set
+# CONFIG_GPIOC_IRQ is not set
+
+#
+# External Memory Configuration
+#
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+CONFIG_ARCH_IRQPRIO=y
+# CONFIG_CUSTOM_STACK is not set
+# CONFIG_ADDRENV is not set
+CONFIG_ARCH_HAVE_VFORK=y
+CONFIG_ARCH_STACKDUMP=y
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_HAVE_RAMFUNCS is not set
+CONFIG_ARCH_HAVE_RAMVECTORS=y
+# CONFIG_ARCH_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=4768
+# CONFIG_ARCH_CALIBRATION is not set
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=32768
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_SAM4L_XPLAINED=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="sam4l-xplained"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_HAVE_BUTTONS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_HAVE_IRQBUTTONS=y
+# CONFIG_ARCH_IRQBUTTONS is not set
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=200
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2013
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=3
+CONFIG_DEV_CONSOLE=y
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WAITPID is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_CLOCK is not set
+# CONFIG_DISABLE_POSIX_TIMERS is not set
+# CONFIG_DISABLE_PTHREAD is not set
+# CONFIG_DISABLE_SIGNALS is not set
+# CONFIG_DISABLE_MQUEUE is not set
+CONFIG_DISABLE_ENVIRON=y
+
+#
+# Signal Numbers
+#
+CONFIG_SIG_SIGUSR1=1
+CONFIG_SIG_SIGUSR2=2
+CONFIG_SIG_SIGALARM=3
+CONFIG_SIG_SIGCONDTIMEDOUT=16
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Stack and heap information
+#
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+
+#
+# Device Drivers
+#
+CONFIG_DISABLE_POLL=y
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_AUDIO_DEVICES is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+# CONFIG_MTD is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+CONFIG_SERIAL=y
+CONFIG_DEV_LOWCONSOLE=y
+# CONFIG_16550_UART is not set
+CONFIG_ARCH_HAVE_UART=y
+CONFIG_MCU_SERIAL=y
+CONFIG_UART_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# UART Configuration
+#
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+# CONFIG_NET is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_DISABLE_MOUNTPOINT=y
+# CONFIG_FS_RAMMAP is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG_ENABLE is not set
+# CONFIG_SYSLOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_NX is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_MULTIHEAP is not set
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=3
+# CONFIG_GRAN is not set
+
+#
+# Audio Support
+#
+# CONFIG_AUDIO is not set
+
+#
+# Binary Formats
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+# CONFIG_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+CONFIG_LIB_RAND_ORDER=1
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_EXECFUNCS is not set
+CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
+CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+
+#
+# Non-standard Library Support
+#
+# CONFIG_SCHED_WORKQUEUE is not set
+# CONFIG_LIB_KBDCODEC is not set
+# CONFIG_LIB_SLCDCODEC is not set
+
+#
+# Basic CXX Support
+#
+# CONFIG_C99_BOOL8 is not set
+# CONFIG_HAVE_CXX is not set
+
+#
+# Application Configuration
+#
+
+#
+# Built-In Applications
+#
+
+#
+# Examples
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+# CONFIG_EXAMPLES_CAN is not set
+# CONFIG_EXAMPLES_COMPOSITE is not set
+# CONFIG_EXAMPLES_DHCPD is not set
+# CONFIG_EXAMPLES_ELF is not set
+# CONFIG_EXAMPLES_FTPC is not set
+# CONFIG_EXAMPLES_FTPD is not set
+# CONFIG_EXAMPLES_HELLO is not set
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_LCDRW is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+# CONFIG_EXAMPLES_NRF24L01TERM is not set
+# CONFIG_EXAMPLES_NSH is not set
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+# CONFIG_EXAMPLES_NXFFS is not set
+# CONFIG_EXAMPLES_NXFLAT is not set
+# CONFIG_EXAMPLES_NXHELLO is not set
+# CONFIG_EXAMPLES_NXIMAGE is not set
+# CONFIG_EXAMPLES_NXLINES is not set
+# CONFIG_EXAMPLES_NXTEXT is not set
+CONFIG_EXAMPLES_OSTEST=y
+# CONFIG_EXAMPLES_OSTEST_BUILTIN is not set
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000
+CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_SLCD is not set
+# CONFIG_EXAMPLES_SMART is not set
+# CONFIG_EXAMPLES_TCPECHO is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_UIP is not set
+# CONFIG_EXAMPLES_USBSERIAL is not set
+# CONFIG_EXAMPLES_USBMSC is not set
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_DHCPC is not set
+# CONFIG_NETUTILS_DHCPD is not set
+# CONFIG_NETUTILS_FTPC is not set
+# CONFIG_NETUTILS_FTPD is not set
+# CONFIG_NETUTILS_JSON is not set
+# CONFIG_NETUTILS_RESOLV is not set
+# CONFIG_NETUTILS_SMTP is not set
+# CONFIG_NETUTILS_TELNETD is not set
+# CONFIG_NETUTILS_TFTPC is not set
+# CONFIG_NETUTILS_THTTPD is not set
+# CONFIG_NETUTILS_UIPLIB is not set
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# FreeModBus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# NxWidgets/NxWM
+#
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# FLASH Erase-all Command
+#
+
+#
+# readline()
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# USB Monitor
+#
diff --git a/nuttx/configs/sam4l-xplained/ostest/setenv.sh b/nuttx/configs/sam4l-xplained/ostest/setenv.sh
new file mode 100755
index 000000000..bf503b833
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/ostest/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/sam4l-xplained/ostest/setenv.sh
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# 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 CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This is the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sam4l-xplained/scripts/ld.script b/nuttx/configs/sam4l-xplained/scripts/ld.script
new file mode 100755
index 000000000..751ab0299
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/scripts/ld.script
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/sam3u-ek/scripts/ld.script
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The ATSAM4LC4C has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 32Kb of SRAM beginning at address 0x2000:0000
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam4l-xplained/src/.gitignore b/nuttx/configs/sam4l-xplained/src/.gitignore
new file mode 100644
index 000000000..726d936e1
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/.gitignore
@@ -0,0 +1,2 @@
+/.depend
+/Make.dep
diff --git a/nuttx/configs/sam4l-xplained/src/Makefile b/nuttx/configs/sam4l-xplained/src/Makefile
new file mode 100644
index 000000000..4b1efd0ce
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/Makefile
@@ -0,0 +1,86 @@
+############################################################################
+# configs/sam4l-xplained/src/Makefile
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = sam_boot.c sam_autoleds.c sam_buttons.c sam_spi.c
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip
+ CFLAGS += -I$(ARCH_SRCDIR)/common
+ CFLAGS += -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ $(call ARCHIVE, $@, $(OBJS))
+
+.depend: Makefile $(SRCS)
+ $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
+
+depend: .depend
+
+clean:
+ $(call DELFILE, libboard$(LIBEXT))
+ $(call CLEAN)
+
+distclean: clean
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+
+-include Make.dep
diff --git a/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h b/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h
new file mode 100644
index 000000000..edeb24fe1
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h
@@ -0,0 +1,140 @@
+/************************************************************************************
+ * configs/sam3uek_eval/src/sam4l-xplained.h
+ *
+ * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H
+#define __CONFIGS_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include <stdint.h>
+
+#include <arch/irq.h>
+#include <nuttx/irq.h>
+
+#include "chip/sam_pinmap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* LEDs: There are three LEDs on board the SAM4L Xplained Pro board: The EDBG
+ * controls two of the LEDs, a power LED and a status LED. There is only
+ * one user controllable LED, a yellow LED labeled LED0 near the SAM4L USB
+ * connector.
+ *
+ * This LED is controlled by PC07 and LED0 can be activated by driving the
+ * PC07 to GND.
+ *
+ * When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
+ * control LED0 as follows:
+ *
+ * SYMBOL Meaning LED0
+ * ------------------- ----------------------- ------
+ * LED_STARTED NuttX has been started OFF
+ * LED_HEAPALLOCATE Heap has been allocated OFF
+ * LED_IRQSENABLED Interrupts enabled OFF
+ * LED_STACKCREATED Idle stack created ON
+ * LED_INIRQ In an interrupt N/C
+ * LED_SIGNAL In a signal handler N/C
+ * LED_ASSERTION An assertion failed N/C
+ * LED_PANIC The system has crashed FLASH
+ *
+ * Thus is LED0 is statically on, NuttX has successfully booted and is,
+ * apparently, running normmally. If LED0 is flashing at approximately
+ * 2Hz, then a fatal error has been detected and the system has halted.
+ */
+
+#define GPIO_LED0 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOC | \
+ GPIO_OUTPUT_SET | GPIO_PIN7)
+
+/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. The connection
+ * to the SAM4L is:
+ *
+ * PC13 CATB_SENSE15
+ * PC14 CATB_DIS
+ */
+
+/* Mechanical buttons:
+ *
+ * The SAM4L Xplained Pro contains two mechanical buttons. One button is the
+ * RESET button connected to the SAM4L reset line and the other is a generic user
+ * configurable button. When a button is pressed it will drive the I/O line to GND.
+ *
+ * PC24 SW0
+ */
+
+#define GPIO_SW0 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
+ GPIO_PORT_PIOC | GPIO_PIN24)
+#define IRQ_SW0 SAM_IRQ_PC24
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the SAM3U-EK board.
+ *
+ ************************************************************************************/
+
+void weak_function sam_spiinitialize(void);
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H */
+
diff --git a/nuttx/configs/sam4l-xplained/src/sam_autoleds.c b/nuttx/configs/sam4l-xplained/src/sam_autoleds.c
new file mode 100644
index 000000000..1ea1afbe4
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/sam_autoleds.c
@@ -0,0 +1,182 @@
+/****************************************************************************
+ * configs/sam4l-xplained/src/sam_autoleds.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* There are three LEDs on board the SAM4L Xplained Pro board: The EDBG
+ * controls two of the LEDs, a power LED and a status LED. There is only
+ * one user controllable LED, a yellow LED labeled LED0 near the SAM4L USB
+ * connector.
+ *
+ * This LED is controlled by PC07 and LED0 can be activated by driving the
+ * PC07 to GND.
+ *
+ * When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
+ * control LED0 as follows:
+ *
+ * SYMBOL Meaning LED0
+ * ------------------- ----------------------- ------
+ * LED_STARTED NuttX has been started OFF
+ * LED_HEAPALLOCATE Heap has been allocated OFF
+ * LED_IRQSENABLED Interrupts enabled OFF
+ * LED_STACKCREATED Idle stack created ON
+ * LED_INIRQ In an interrupt** N/C
+ * LED_SIGNAL In a signal handler*** N/C
+ * LED_ASSERTION An assertion failed N/C
+ * LED_PANIC The system has crashed FLASH
+ *
+ * Thus is LED0 is statically on, NuttX has successfully booted and is,
+ * apparently, running normmally. If LED0 is flashing at approximately
+ * 2Hz, then a fatal error has been detected and the system has halted.
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "sam_gpio.h"
+#include "sam4l-xplained.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
+ * with CONFIG_DEBUG_VERBOSE too)
+ */
+
+#ifdef CONFIG_DEBUG_LEDS
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+#define LED_OFF 0
+#define LED_ON 1
+#define LED_NOCHANGE 2
+#define LED_MASK 3
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ (void)sam_configgpio(GPIO_LED0);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ bool ledstate = true;
+
+ switch (led)
+ {
+ case LED_STARTED : /* NuttX has been started LED0=OFF */
+ case LED_HEAPALLOCATE: /* Heap has been allocated LED0=OFF */
+ case LED_IRQSENABLED: /* Interrupts enabled LED0=OFF */
+ break; /* Leave ledstate == true to turn OFF */
+
+ default:
+ case LED_INIRQ: /* In an interrupt LED0=N/C */
+ case LED_SIGNAL: /* In a signal handler LED0=N/C */
+ case LED_ASSERTION: /* An assertion failed LED0=N/C */
+ return;
+
+ case LED_PANIC: /* The system has crashed LED0=FLASH */
+ case LED_STACKCREATED: /* Idle stack created LED0=ON */
+ ledstate = false; /* Set ledstate == false to turn ON */
+ break;
+ }
+
+ sam_gpiowrite(GPIO_LED0, ledstate);
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ /* These should not happen and are ignored */
+
+ default:
+ case LED_STARTED : /* NuttX has been started LED0=OFF */
+ case LED_HEAPALLOCATE: /* Heap has been allocated LED0=OFF */
+ case LED_IRQSENABLED: /* Interrupts enabled LED0=OFF */
+ case LED_STACKCREATED: /* Idle stack created LED0=ON */
+
+ /* These result in no-change */
+
+ case LED_INIRQ: /* In an interrupt LED0=N/C */
+ case LED_SIGNAL: /* In a signal handler LED0=N/C */
+ case LED_ASSERTION: /* An assertion failed LED0=N/C */
+ return;
+
+ /* Turn LED0 off set driving the output high */
+
+ case LED_PANIC: /* The system has crashed LED0=FLASH */
+ sam_gpiowrite(GPIO_LED0, true);
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/sam4l-xplained/src/sam_boot.c b/nuttx/configs/sam4l-xplained/src/sam_boot.c
new file mode 100644
index 000000000..09123c506
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/sam_boot.c
@@ -0,0 +1,86 @@
+/************************************************************************************
+ * configs/sam4l-xplained/src/sam_boot.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "sam4l-xplained.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam_boardinitialize
+ *
+ * Description:
+ * All SAM3U architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void sam_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * sam_spiinitialize() has been brought into the link.
+ */
+
+#ifdef CONFIG_SAM34_SPI
+ if (sam_spiinitialize)
+ {
+ sam_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/sam4l-xplained/src/sam_buttons.c b/nuttx/configs/sam4l-xplained/src/sam_buttons.c
new file mode 100644
index 000000000..2a5081a44
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/sam_buttons.c
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * configs/sam4l-xplained/src/sam_buttons.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <nuttx/irq.h>
+
+#include <arch/irq.h>
+#include <arch/board/board.h>
+
+#include "sam_gpio.h"
+#include "sam4l-xplained.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static xcpt_t g_irqsw0;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ (void)sam_configgpio(GPIO_SW0);
+}
+
+/************************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * After up_buttoninit() has been called, up_buttons() may be called to collect
+ * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit
+ * associated with a button. See the BUTTON* definitions above for the meaning of
+ * each bit in the returned value.
+ *
+ ************************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
+}
+
+/****************************************************************************
+ * Name: up_irqbutton
+ *
+ * Description:
+ * This function may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is one
+ * of the BUTTON* definitions provided above. The previous interrupt
+ * handler address isreturned (so that it may restored, if so desired).
+ *
+ * Configuration Notes:
+ * Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
+ * overall GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
+ * CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
+ * interrupts on. For button support, bits 2 and 3 must be set in
+ * CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3).
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ if (id == BUTTON_SW0)
+ {
+ irqstate_t flags;
+
+ /* Disable interrupts until we are done. This guarantees that the
+ * following operations are atomic.
+ */
+
+ flags = irqsave();
+
+ /* Get the old button interrupt handler and save the new one */
+
+ oldhandler = *g_irqsw0;
+ *g_irqsw0 = irqhandler;
+
+ /* Configure the interrupt */
+
+ sam_gpioirq(IRQ_SW0);
+ (void)irq_attach(IRQ_SW0, irqhandler);
+ sam_gpioirqenable(IRQ_SW0);
+ }
+
+ /* Return the old button handler (so that it can be restored) */
+
+ return oldhandler;
+}
+#endif
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/sam4l-xplained/src/sam_spi.c b/nuttx/configs/sam4l-xplained/src/sam_spi.c
new file mode 100644
index 000000000..0bd7df9bb
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/sam_spi.c
@@ -0,0 +1,239 @@
+/************************************************************************************
+ * configs/sam4l-xplained/src/sam_spi.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+
+#include "sam_gpio.h"
+#include "sam_spi.h"
+#include "sam4l-xplained.h"
+
+#ifdef CONFIG_SAM34_SPI
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the SAM3U10E-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function sam_spiinitialize(void)
+{
+ /* The ZigBee module connects used NPCS0. However, there is not yet any
+ * ZigBee support.
+ */
+
+ /* The touchscreen connects using NPCS2 (PC14). */
+
+#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
+ sam_configgpio(GPIO_TSC_NPCS2);
+#endif
+}
+
+/****************************************************************************
+ * Name: sam_spicsnumber, sam_spiselect, sam_spistatus, and sam_spicmddata
+ *
+ * Description:
+ * These external functions must be provided by board-specific logic. They
+ * include:
+ *
+ * o sam_spicsnumber and sam_spiselect which are helper functions to
+ * manage the board-specific aspects of the unique SAM3U chip select
+ * architecture.
+ * o sam_spistatus and sam_spicmddata: Implementations of the status
+ * and cmddata methods of the SPI interface defined by struct spi_ops_
+ * (see include/nuttx/spi.h). All other methods including
+ * up_spiinitialize()) are provided by common SAM3U logic.
+ *
+ * To use this common SPI logic on your board:
+ *
+ * 1. Provide logic in sam_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide sam_spicsnumber(), sam_spiselect() and sam_spistatus()
+ * functions in your board-specific logic. These functions will perform
+ * chip selection and status operations using GPIOs in the way your board
+ * is configured.
+ * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
+ * sam_spicmddata() functions in your board-specific logic. This
+ * function will perform cmd/data selection operations using GPIOs in
+ * the way your board is configured.
+ * 3. Add a call to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sam_spicsnumber
+ *
+ * Description:
+ * The SAM3U has 4 CS registers for controlling device features. This
+ * function must be provided by board-specific code. Given a logical device
+ * ID, this function returns a number from 0 to 3 that identifies one of
+ * these SAM3U CS resources.
+ *
+ * Input Parameters:
+ * devid - Identifies the (logical) device
+ *
+ * Returned Values:
+ * On success, a CS number from 0 to 3 is returned; A negated errno may
+ * be returned on a failure.
+ *
+ ****************************************************************************/
+
+int sam_spicsnumber(enum spi_dev_e devid)
+{
+ int cs = -EINVAL;
+
+#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
+ if (devid == SPIDEV_TOUCHSCREEN)
+ {
+ /* Assert the CS pin to the OLED display */
+
+ cs = 2;
+ }
+#endif
+
+ spidbg("devid: %d CS: %d\n", (int)devid, cs);
+ return cs;
+}
+
+/****************************************************************************
+ * Name: sam_spiselect
+ *
+ * Description:
+ * PIO chip select pins may be programmed by the board specific logic in
+ * one of two different ways. First, the pins may be programmed as SPI
+ * peripherals. In that case, the pins are completely controlled by the
+ * SPI driver. This method still needs to be provided, but it may be only
+ * a stub.
+ *
+ * An alternative way to program the PIO chip select pins is as a normal
+ * GPIO output. In that case, the automatic control of the CS pins is
+ * bypassed and this function must provide control of the chip select.
+ * NOTE: In this case, the GPIO output pin does *not* have to be the
+ * same as the NPCS pin normal associated with the chip select number.
+ *
+ * Input Parameters:
+ * devid - Identifies the (logical) device
+ * selected - TRUE:Select the device, FALSE:De-select the device
+ *
+ * Returned Values:
+ * None
+ *
+ ****************************************************************************/
+
+void sam_spiselect(enum spi_dev_e devid, bool selected)
+{
+ /* The touchscreen chip select is implemented as a GPIO OUTPUT that must
+ * be controlled by this function. This is because the ADS7843E driver
+ * must be able to sample the device BUSY GPIO input between SPI transfers.
+ * However, the AD7843E will tri-state the BUSY input whenever the chip
+ * select is de-asserted. So the only option is to control the chip select
+ * manually and hold it low throughout the SPI transfer.
+ */
+
+#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
+ if (devid == SPIDEV_TOUCHSCREEN)
+ {
+ sam_gpiowrite(GPIO_TSC_NPCS2, !selected);
+ }
+#endif
+}
+
+/****************************************************************************
+ * Name: sam_spistatus
+ *
+ * Description:
+ * Return status information associated with the SPI device.
+ *
+ * Input Parameters:
+ * devid - Identifies the (logical) device
+ *
+ * Returned Values:
+ * Bit-encoded SPI status (see include/nuttx/spi.h.
+ *
+ ****************************************************************************/
+
+uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return 0;
+}
+
+#endif /* CONFIG_SAM34_SPI */
diff --git a/nuttx/configs/stm32f4discovery/include/board.h b/nuttx/configs/stm32f4discovery/include/board.h
index 793592b0b..de829f19e 100644
--- a/nuttx/configs/stm32f4discovery/include/board.h
+++ b/nuttx/configs/stm32f4discovery/include/board.h
@@ -265,22 +265,22 @@ extern "C" {
*
************************************************************************************/
-EXTERN void stm32_boardinitialize(void);
+void stm32_boardinitialize(void);
/************************************************************************************
* Name: stm32_ledinit, stm32_setled, and stm32_setleds
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
- * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * CONFIG_ARCH_LEDS is not defined, then the following interfaces are available to
* control the LEDs from user applications.
*
************************************************************************************/
#ifndef CONFIG_ARCH_LEDS
-EXTERN void stm32_ledinit(void);
-EXTERN void stm32_setled(int led, bool ledon);
-EXTERN void stm32_setleds(uint8_t ledset);
+void stm32_ledinit(void);
+void stm32_setled(int led, bool ledon);
+void stm32_setleds(uint8_t ledset);
#endif
/************************************************************************************
@@ -307,10 +307,10 @@ EXTERN void stm32_setleds(uint8_t ledset);
************************************************************************************/
#ifdef CONFIG_ARCH_BUTTONS
-EXTERN void up_buttoninit(void);
-EXTERN uint8_t up_buttons(void);
+void up_buttoninit(void);
+uint8_t up_buttons(void);
#ifdef CONFIG_ARCH_IRQBUTTONS
-EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
#endif
#endif