summaryrefslogtreecommitdiff
path: root/nuttx/configs/sam4l-xplained
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/configs/sam4l-xplained')
-rw-r--r--nuttx/configs/sam4l-xplained/README.txt183
-rw-r--r--nuttx/configs/sam4l-xplained/include/board.h179
-rw-r--r--nuttx/configs/sam4l-xplained/nsh/Make.defs109
-rw-r--r--nuttx/configs/sam4l-xplained/nsh/defconfig693
-rwxr-xr-xnuttx/configs/sam4l-xplained/nsh/setenv.sh63
-rw-r--r--nuttx/configs/sam4l-xplained/ostest/defconfig93
-rwxr-xr-xnuttx/configs/sam4l-xplained/scripts/ld.script36
-rw-r--r--nuttx/configs/sam4l-xplained/src/Makefile4
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam4l-xplained.h12
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_autoleds.c36
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_cxxinitialize.c154
11 files changed, 1424 insertions, 138 deletions
diff --git a/nuttx/configs/sam4l-xplained/README.txt b/nuttx/configs/sam4l-xplained/README.txt
index ea97942f7..6057223ec 100644
--- a/nuttx/configs/sam4l-xplained/README.txt
+++ b/nuttx/configs/sam4l-xplained/README.txt
@@ -15,7 +15,7 @@ Contents
- NuttX OABI "buildroot" Toolchain
- NXFLAT Toolchain
- LEDs
- - Virtual COM Port
+ - Serial Consoles
- SAM4L Xplained Pro-specific Configuration Options
- Configurations
@@ -243,8 +243,27 @@ LEDs
apparently, running normmally. If LED0 is flashing at approximately
2Hz, then a fatal error has been detected and the system has halted.
-Virtual COM Port
-^^^^^^^^^^^^^^^^
+Serial Consoles
+^^^^^^^^^^^^^^^
+
+ USART0
+ ------
+
+ USART is available on connectors EXT1 and EXT4
+
+ EXT1 TXT4 GPIO Function
+ ---- ---- ------ -----------
+ 13 13 PB00 USART0_RXD
+ 14 14 PB01 USART0_TXD
+ 19 19 GND
+ 20 20 VCC
+
+ If you have a TTL to RS-232 convertor then this is the most convenient
+ serial console to use. It is the default in all of these configurations.
+ An option is to use the virtual COM port.
+
+ Virtual COM Port
+ ----------------
The SAM4L Xplained Pro contains an Embedded Debugger (EDBG) that can be
used to program and debug the ATSAM4LC4C using Serial Wire Debug (SWD).
@@ -268,7 +287,7 @@ SAM4L Xplained Pro-specific Configuration Options
CONFIG_ARCH_architecture - For use in C code:
- CONFIG_ARCH_CORTEXM3=y
+ CONFIG_ARCH_CORTEXM4=y
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
@@ -278,8 +297,8 @@ SAM4L Xplained Pro-specific Configuration Options
chip:
CONFIG_ARCH_CHIP_SAM34
- CONFIG_ARCH_CHIP_SAM3U
- CONFIG_ARCH_CHIP_AT91SAM3U4
+ CONFIG_ARCH_CHIP_SAM4L
+ CONFIG_ARCH_CHIP_ATSAM4LC4C
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
hence, the board that supports the particular chip or SoC.
@@ -298,7 +317,7 @@ SAM4L Xplained Pro-specific Configuration Options
CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
- CONFIG_DRAM_SIZE=0x0000c000 (48Kb)
+ CONFIG_DRAM_SIZE=0x00008000 (32Kb)
CONFIG_DRAM_START - The start address of installed DRAM
@@ -329,15 +348,61 @@ SAM4L Xplained Pro-specific Configuration Options
Individual subsystems can be enabled:
- CONFIG_SAM34_DMA
- CONFIG_SAM34_HSMCI
- CONFIG_SAM34_NAND
+ CPU
+ ---
+ CONFIG_SAM34_OCD
+
+ HSB
+ ---
+ CONFIG_SAM34_APBA
+ CONFIG_SAM34_AESA
+
+ PBA
+ ---
+ CONFIG_SAM34_IISC
CONFIG_SAM34_SPI
- CONFIG_SAM34_UART
+ CONFIG_SAM34_TC0
+ CONFIG_SAM34_TC1
+ CONFIG_SAM34_TWIM0
+ CONFIG_SAM34_TWIS0
+ CONFIG_SAM34_TWIM1
+ CONFIG_SAM34_TWIS1
CONFIG_SAM34_USART0
CONFIG_SAM34_USART1
CONFIG_SAM34_USART2
CONFIG_SAM34_USART3
+ CONFIG_SAM34_ADC12B
+ CONFIG_SAM34_DACC
+ CONFIG_SAM34_ACC
+ CONFIG_SAM34_GLOC
+ CONFIG_SAM34_ABDACB
+ CONFIG_SAM34_TRNG
+ CONFIG_SAM34_PARC
+ CONFIG_SAM34_CATB
+ CONFIG_SAM34_TWIM2
+ CONFIG_SAM34_TWIM3
+ CONFIG_SAM34_LCDCA
+
+ PBB
+ ---
+ CONFIG_SAM34_HRAMC1
+ CONFIG_SAM34_HMATRIX
+ CONFIG_SAM34_PDCA
+ CONFIG_SAM34_CRCCU
+ CONFIG_SAM34_USBC
+ CONFIG_SAM34_PEVC
+
+ PBC
+ ---
+ CONFIG_SAM34_CHIPID
+ CONFIG_SAM34_FREQM
+
+ PBD
+ ---
+ CONFIG_SAM34_AST
+ CONFIG_SAM34_WDT
+ CONFIG_SAM34_EIC
+ CONFIG_SAM34_PICOUART
Some subsystems can be configured to operate in different ways. The drivers
need to know how to configure the subsystem.
@@ -350,7 +415,7 @@ SAM4L Xplained Pro-specific Configuration Options
CONFIG_USART2_ISUART
CONFIG_USART3_ISUART
- AT91SAM3U specific device driver settings
+ ST91SAM4L 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).
@@ -363,36 +428,96 @@ SAM4L Xplained Pro-specific Configuration Options
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:
+ 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.
+ 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.
+ 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:
+ The <subdir> that is provided above as an argument to the tools/configure.sh
+ must be is one of the following.
+
+ NOTE: These configurations use the mconf-based configuration tool. To
+ change any of these configurations using that tool, you should:
+
+ a. Build and install the kconfig-mconf tool. See nuttx/README.txt
+ and misc/tools/
+
+ b. Execute 'make menuconfig' in nuttx/ in order to start the
+ reconfiguration process.
+
+Configuration sub-directories
+-----------------------------
ostest:
- This configuration directory, performs a simple OS test using
+ This configuration directory performs a simple OS test using
examples/ostest.
+
+ NOTES:
+
+ 1. This configuration provides test output on USART0 which is available
+ on EXT1 or EXT4 (see the section "Serial Consoles" above). The
+ virtual COM port could be used, instead, by reconfiguring to use
+ USART1 instead of USART0:
+
+ System Type -> AT91SAM3/4 Peripheral Support
+ CONFIG_SAM_USART0=y
+ CONFIG_SAM_USART1=n
+
+ Device Drivers -> Serial Driver Support -> Serial Console
+ CONFIG_USART0_SERIAL_CONSOLE=y
+
+ Device Drivers -> Serial Driver Support -> USART0 Configuration
+ CONFIG_USART0_2STOP=0
+ CONFIG_USART0_BAUD=115200
+ CONFIG_USART0_BITS=8
+ CONFIG_USART0_PARITY=0
+ CONFIG_USART0_RXBUFSIZE=256
+ CONFIG_USART0_TXBUFSIZE=256
+
+ 2. This configuration is set up to use the NuttX OABI toolchain (see
+ above). Of course this can be reconfigured if you prefer a different
+ toolchain.
+
+ nsh:
+ This configuration directory will built the NuttShell.
+
+ NOTES:
+
+ 1. This configuration provides test output on USART0 which is available
+ on EXT1 or EXT4 (see the section "Serial Consoles" above). The
+ virtual COM port could be used, instead, by reconfiguring to use
+ USART1 instead of USART0:
+
+ System Type -> AT91SAM3/4 Peripheral Support
+ CONFIG_SAM_USART0=y
+ CONFIG_SAM_USART1=n
+
+ Device Drivers -> Serial Driver Support -> Serial Console
+ CONFIG_USART0_SERIAL_CONSOLE=y
+
+ Device Drivers -> Serial Driver Support -> USART0 Configuration
+ CONFIG_USART0_2STOP=0
+ CONFIG_USART0_BAUD=115200
+ CONFIG_USART0_BITS=8
+ CONFIG_USART0_PARITY=0
+ CONFIG_USART0_RXBUFSIZE=256
+ CONFIG_USART0_TXBUFSIZE=256
+
+ 2. This configuration is set up to use the NuttX OABI toolchain (see
+ above). Of course this can be reconfigured if you prefer a different
+ toolchain.
diff --git a/nuttx/configs/sam4l-xplained/include/board.h b/nuttx/configs/sam4l-xplained/include/board.h
index 4aaefd3fb..de175a484 100644
--- a/nuttx/configs/sam4l-xplained/include/board.h
+++ b/nuttx/configs/sam4l-xplained/include/board.h
@@ -54,66 +54,144 @@
************************************************************************************/
/* 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 */
+/* Select the DFLL as the source of the system clock.
+ *
+ * Options (define one):
+ * BOARD_SYSCLK_SOURCE_RCSYS - System RC oscillator
+ * BOARD_SYSCLK_SOURCE_OSC0 - Oscillator 0
+ * BOARD_SYSCLK_SOURCE_PLL0 - Phase Locked Loop 0
+ * BOARD_SYSCLK_SOURCE_DFLL0 - Digital Frequency Locked Loop
+ * BOARD_SYSCLK_SOURCE_RC80M - 80 MHz RC oscillator
+ * BOARD_SYSCLK_SOURCE_FCFAST12M - 12 MHz RC oscillator
+ * BOARD_SYSCLK_SOURCE_FCFAST8M - 8 MHz RC oscillator
+ * BOARD_SYSCLK_SOURCE_FCFAST4M - 4 MHz RC oscillator
+ * BOARD_SYSCLK_SOURCE_RC1M - 1 MHz RC oscillator
+ */
-#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
+#define BOARD_SYSCLK_SOURCE_DFLL0 1
-/* PMC master clock register settings */
+/* Nominal frequencies in on-chip RC oscillators. These are *not* configurable
+ * but appear here for use in frequency calculations. NOTE: These may frequencies
+ * may vary with temperature changes.
+ */
-#define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLA
-#define BOARD_PMC_MCKR_PRES PMC_MCKR_PRES_DIV2
+#define BOARD_RCSYS_FREQUENCY 115000 /* Nominal frequency of RCSYS (Hz) */
+#define BOARD_RC32K_FREQUENCY 32768 /* Nominal frequency of RC32K (Hz) */
+#define BOARD_RC80M_FREQUENCY 80000000 /* Nominal frequency of RC80M (Hz) */
+#define BOARD_RCFAST4M_FREQUENCY 4000000 /* Nominal frequency of RCFAST4M (Hz) */
+#define BOARD_RCFAST8M_FREQUENCY 8000000 /* Nominal frequency of RCFAST8M (Hz) */
+#define BOARD_RCFAST12M_FREQUENCY 12000000 /* Nominal frequency of RCFAST12M (Hz) */
+#define BOARD_RC1M_FREQUENCY 1000000 /* Nominal frequency of RC1M (Hz) */
+
+/* The SAM4L Xplained Pro has two on-board crystals:
+ * XC100 12MHz OSC0
+ * XC101 32.768KHz OSC32
+ */
-/* USB UTMI PLL start-up time */
+/* OSC0 Configuration */
-#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << CKGR_UCKR_UPLLCOUNT_SHIFT)
+#define BOARD_OSC0_FREQUENCY 12000000 /* 12MHz XTAL */
-/* System clock dividers: Fbus = Fsys / (2 ^ BUS_div) */
+/* OSC32 Configuration */
-#define BOARD_SYSCLK_CPU_DIV 0
-#define BOARD_SYSCLK_PBA_DIV 0
-#define BOARD_SYSCLK_PBB_DIV 0
-#define BOARD_SYSCLK_PBC_DIV 0
-#define BOARD_SYSCLK_PBD_DIV 0
+#define BOARD_OSC32_FREQUENCY 32768 /* 32.768KHz XTAL */
+#define BOARD_OSC32_STARTUP_US 6100
+#define BOARD_OSC32_SELCURR BSCIF_OSCCTRL32_SELCURR_300
+#define BOARD_OSC32_ISXTAL 1 /* OSC32 is a crystal */
-/* Resulting frequencies */
+/* Digital Frequency Locked Loop configuration
+ * Fdfll = (Fclk * DFLLmul) / DFLLdiv
+ * = 32768 * (48000000/32768) / 1 = 48MHz
+ *
+ * The actual frequency is 47.97MHz due to truncation of the multiplier.
+ * The 48MHz target value is treated as "not-to-exceed" value). Use OSC0
+ * if you need more accuracy (12MHz with a multiplier of 4).
+ *
+ * DFLL0 source options (select one):
+ * BOARD_DFLL0_SOURCE_RCSYS - System RC oscillator
+ * BOARD_DFLL0_SOURCE_OSC32K - 32.768KHz oscillator
+ * BOARD_DFLL0_SOURCE_OSC0 - Oscillator 0
+ * BOARD_DFLL0_SOURCE_RC80M - 80 MHz RC oscillator
+ * BOARD_DFLL0_SOURCE_RC32K - 32 kHz RC oscillator
+ *
+ * NOTE: Nothing must be defined if the DFPLL is not used
+ */
-#define SAM_MAINOSC_FREQUENCY (12000000)
-#define SAM_MCK_FREQUENCY (48000000)
-#define SAM_PLLA_FREQUENCY (96000000)
-#define SAM_CPU_FREQUENCY (48000000)
+#define BOARD_DFLL0_SOURCE_OSC32K 1
+#define BOARD_DFLL0_TARGET 48000000
+#define BOARD_DFLL0_MUL (BOARD_DFLL0_TARGET / BOARD_OSC32_FREQUENCY)
+#define BOARD_DFLL0_DIV 1
+#define BOARD_DFLL0_FREQUENCY (BOARD_OSC32_FREQUENCY * BOARD_DFLL0_MUL / BOARD_DFLL0_DIV)
-/* HSMCI clocking
+/* Phase Locked Loop configuration
+ * Fdfll = (Fclk * PLLmul) / PLLdiv
*
- * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
- * divided by (2*(CLKDIV+1)).
+ * PLL0 source options (select one):
+ * BOARD_PLL0_SOURCE_OSC0 - Oscillator 0
+ * BOARD_PLL0_SOURCE_GCLK9 - General clock 9
*
- * MCI_SPEED = MCK / (2*(CLKDIV+1))
- * CLKDIV = MCI / MCI_SPEED / 2 - 1
+ * BOARD_GLCK9_SOURCE_RCSYS - System RC oscillator
+ * BOARD_GLCK9_SOURCE_OSC32K - Output from OSC32K
+ * BOARD_GLCK9_SOURCE_DFLL0 - Output from DFLL0
+ * BOARD_GLCK9_SOURCE_OSC0 - Output from Oscillator0
+ * BOARD_GLCK9_SOURCE_RC80M - Output from 80MHz RCOSC
+ * BOARD_GLCK9_SOURCE_RCFAST - Output from 4,8,12MHz RCFAST
+ * BOARD_GLCK9_SOURCE_RC1M - Output from 1MHz RC1M
+ * BOARD_GLCK9_SOURCE_CPUCLK - The CPU clock
+ * BOARD_GLCK9_SOURCE_HSBCLK - High Speed Bus clock
+ * BOARD_GLCK9_SOURCE_PBACLK - Peripheral Bus A clock
+ * BOARD_GLCK9_SOURCE_PBBCLK - Peripheral Bus B clock
+ * BOARD_GLCK9_SOURCE_PBCCLK - Peripheral Bus C clock
+ * BOARD_GLCK9_SOURCE_PBDCLK - Peripheral Bus D clock
+ * BOARD_GLCK9_SOURCE_RC32K - Output from 32kHz RCOSC
+ *
+ * NOTE: Nothing must be defined if the PLL0 is not used
*/
-/* MCK = 48MHz, CLKDIV = 59, MCI_SPEED = 48MHz / 2 * (59+1) = 400 KHz */
+/* System clock dividers: Fbus = Fmck >> BUSshift */
-#define HSMCI_INIT_CLKDIV (59 << HSMCI_MR_CLKDIV_SHIFT)
+#define BOARD_CPU_SHIFT 0 /* Fcpu = Fmck = 48MHz */
+#define BOARD_PBA_SHIFT 0 /* Fpba = Fmck = 48MHz */
+#define BOARD_PBB_SHIFT 0 /* Fpbb = Fmck = 48MHz */
+#define BOARD_PBC_SHIFT 0 /* Fpbc = Fmck = 48MHz */
+#define BOARD_PBD_SHIFT 0 /* Fpbd = Fmck = 48MHz */
-/* MCK = 48MHz, CLKDIV = 1, MCI_SPEED = 48MHz / 2 * (1+1) = 12 MHz */
+/* Resulting frequencies */
-#define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
+#define BOARD_MCK_FREQUENCY (BOARD_DFLL0_FREQUENCY)
+#define BOARD_CPU_FREQUENCY (BOARD_MCK_FREQUENCY >> BOARD_CPU_SHIFT)
+#define BOARD_PBA_FREQUENCY (BOARD_MCK_FREQUENCY >> BOARD_PBA_SHIFT)
+#define BOARD_PBB_FREQUENCY (BOARD_MCK_FREQUENCY >> BOARD_PBB_SHIFT)
+#define BOARD_PBC_FREQUENCY (BOARD_MCK_FREQUENCY >> BOARD_PBC_SHIFT)
+#define BOARD_PBD_FREQUENCY (BOARD_MCK_FREQUENCY >> BOARD_PBD_SHIFT)
-/* MCK = 48MHz, CLKDIV = 0, MCI_SPEED = 48MHz / 2 * (0+1) = 24 MHz */
+/* USBC.
+ *
+ * "The USBC has two bus clocks connected: One High Speed Bus clock
+ * (CLK_USBC_AHB) and one Peripheral Bus clock (CLK_USBC_APB). These clocks
+ * are generated by the Power Manager. Both clocks are enabled at reset
+ * and can be disabled by the Power Manager. It is recommended to disable
+ * the USBC before disabling the clocks, to avoid freezing the USBC in
+ * an undefined state.
+ *
+ * "To follow the usb data rate at 12Mbit/s in full-speed mode, the
+ * CLK_USBC_AHB clock should be at minimum 12MHz.
+ *
+ * "The 48MHz USB clock is generated by a dedicated generic clock from
+ * the SCIF module. Before using the USB, the user must ensure that the
+ * USB generic clock (GCLK_USBC) is enabled at 48MHz in the SCIF module."
+ *
+ * USB Generic Clock 7 (GCLK_USBC) source selection (one only)
+ *
+ * BOARD_USBC_SRC_OSC0
+ * BOARD_USBC_SRC_PLL0
+ * BOARD_USBC_SRC_DFLL
+ * BOARD_USBC_SRC_GCLKIN0
+ */
-#define HSMCI_SDXFR_CLKDIV (0 << HSMCI_MR_CLKDIV_SHIFT)
-#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
+#define BOARD_USBC_SRC_DFLL 1 /* Source DFLL0 at 48MHz */
+#define BOARD_USBC_GCLK_DIV 1 /* Fusb = Fdfll / 1 = 48MHz */
/* LED definitions ******************************************************************/
/* There are three LEDs on board the SAM4L Xplained Pro board: The EDBG
@@ -135,7 +213,7 @@
#define BOARD_LED0_BIT (1 << BOARD_LED0)
/* 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
+ * control LED0 as defined below. Thus if 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.
@@ -175,10 +253,21 @@
#define BUTTON_SW0_BIT (1 << BUTTON_SW0)
/* Alternate Function Disambiguation ************************************************/
-/* The SAM4L Xplained Pro contains an Embedded Debugger (EDBG) that can be
- * used to program and debug the ATSAM4LC4C using Serial Wire Debug (SWD).
- * The Embedded debugger also include a Virtual Com port interface over
- * USART1. Virtual COM port connections:
+/* USART0 is also available on connectors EXT1 and EXT4:
+ *
+ * EXT1 TXT4 GPIO Function
+ * ---- ---- ------ -----------
+ * 13 13 PB00 USART0_RXD
+ * 14 14 PB01 USART0_TXD
+ */
+
+#define GPIO_USART0_RXD GPIO_USART0_RXD_4
+#define GPIO_USART0_TXD GPIO_USART0_TXD_4
+
+/* The SAM4L Xplained Pro contains an Embedded Debugger (EDBG) that can be used to
+ * program and debug the ATSAM4LC4C using Serial Wire Debug (SWD). The Embedded
+ * debugger also include a Virtual Com port interface over USART1. Virtual COM
+ * port connections:
*
* PC26 USART1 RXD
* PC27 USART1 TXD
diff --git a/nuttx/configs/sam4l-xplained/nsh/Make.defs b/nuttx/configs/sam4l-xplained/nsh/Make.defs
new file mode 100644
index 000000000..25cdee290
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/nsh/Make.defs
@@ -0,0 +1,109 @@
+############################################################################
+# configs/sam4l-xplained/nsh/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/nsh/defconfig b/nuttx/configs/sam4l-xplained/nsh/defconfig
new file mode 100644
index 000000000..a2c2551f7
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/nsh/defconfig
@@ -0,0 +1,693 @@
+#
+# 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_FPU 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/4 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/4 Peripheral Support
+#
+CONFIG_SAM_PICOCACHE=y
+# CONFIG_SAM34_OCD is not set
+# CONFIG_SAM34_APBA is not set
+# CONFIG_SAM34_AESA is not set
+# CONFIG_SAM34_IISC is not set
+# CONFIG_SAM34_SPI is not set
+# CONFIG_SAM34_TC0 is not set
+# CONFIG_SAM34_TC1 is not set
+# CONFIG_SAM34_TWIM0 is not set
+# CONFIG_SAM34_TWIS0 is not set
+# CONFIG_SAM34_TWIM1 is not set
+# CONFIG_SAM34_TWIS1 is not set
+# CONFIG_SAM34_TWIM2 is not set
+# CONFIG_SAM34_TWIM3 is not set
+# CONFIG_SAM34_PICOUART is not set
+CONFIG_SAM34_USART0=y
+# CONFIG_SAM34_USART1 is not set
+# CONFIG_SAM34_USART2 is not set
+# CONFIG_SAM34_USART3 is not set
+# CONFIG_SAM34_ADCIFE is not set
+# CONFIG_SAM34_DACC is not set
+# CONFIG_SAM34_ACIFC is not set
+# CONFIG_SAM34_GLOC is not set
+# CONFIG_SAM34_ABDACB is not set
+# CONFIG_SAM34_TRNG is not set
+# CONFIG_SAM34_PARC is not set
+# CONFIG_SAM34_CATB is not set
+# CONFIG_SAM34_LCDCA is not set
+# CONFIG_SAM34_HRAMC1 is not set
+# CONFIG_SAM34_HMATRIX is not set
+# CONFIG_SAM34_PDCA is not set
+# CONFIG_SAM34_CRCCU is not set
+# CONFIG_SAM34_USBC is not set
+# CONFIG_SAM34_PEVC is not set
+# CONFIG_SAM34_CHIPID is not set
+# CONFIG_SAM34_FREQM is not set
+# CONFIG_SAM34_AST is not set
+# CONFIG_SAM34_WDT is not set
+# CONFIG_SAM34_EIC is not set
+# CONFIG_SAM32_RESET_PERIPHCLKS is not set
+
+#
+# AT91SAM3/4 USART Configuration
+#
+CONFIG_USART0_ISUART=y
+
+#
+# AT91SAM3/4 GPIO Interrupt Configuration
+#
+# CONFIG_GPIOA_IRQ is not set
+# CONFIG_GPIOB_IRQ is not set
+# CONFIG_GPIOC_IRQ is not set
+
+#
+# External Memory Configuration
+#
+
+#
+# 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=y
+CONFIG_ARCH_RAMFUNCS=y
+CONFIG_ARCH_HAVE_RAMVECTORS=y
+# CONFIG_ARCH_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=3410
+# 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
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# 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=9
+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="nsh_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=1536
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1536
+
+#
+# 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 is not set
+# CONFIG_16550_UART is not set
+CONFIG_ARCH_HAVE_USART0=y
+CONFIG_MCU_SERIAL=y
+CONFIG_STANDARD_SERIAL=y
+CONFIG_USART0_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART0 Configuration
+#
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART0_BAUD=115200
+CONFIG_USART0_BITS=8
+CONFIG_USART0_PARITY=0
+CONFIG_USART0_2STOP=0
+# CONFIG_USART0_IFLOWCONTROL is not set
+# CONFIG_USART0_OFLOWCONTROL is not set
+# CONFIG_SERIAL_IFLOWCONTROL is not set
+# CONFIG_SERIAL_OFLOWCONTROL is not set
+# 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 is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_FS_FAT is not set
+# CONFIG_FS_NXFFS is not set
+# CONFIG_FS_ROMFS is not set
+# CONFIG_FS_SMARTFS is not set
+# CONFIG_FS_BINFS 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=y
+# 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=1536
+# 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=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_CXX_NEWLONG=y
+
+#
+# uClibc++ Standard C++ Library
+#
+# CONFIG_UCLIBCXX is not set
+
+#
+# Application Configuration
+#
+
+#
+# Built-In Applications
+#
+CONFIG_BUILTIN_PROXY_STACKSIZE=1024
+
+#
+# Examples
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+# CONFIG_EXAMPLES_CAN is not set
+# CONFIG_EXAMPLES_COMPOSITE is not set
+# CONFIG_EXAMPLES_CXXTEST 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=y
+# 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 is not set
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE 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_TEST 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=y
+CONFIG_NSH_BUILTIN_APPS=y
+
+#
+# Disable Individual commands
+#
+# CONFIG_NSH_DISABLE_CAT is not set
+# CONFIG_NSH_DISABLE_CD is not set
+# CONFIG_NSH_DISABLE_CP is not set
+# CONFIG_NSH_DISABLE_DD is not set
+# CONFIG_NSH_DISABLE_ECHO is not set
+# CONFIG_NSH_DISABLE_EXEC is not set
+# CONFIG_NSH_DISABLE_EXIT is not set
+# CONFIG_NSH_DISABLE_FREE is not set
+# CONFIG_NSH_DISABLE_GET is not set
+# CONFIG_NSH_DISABLE_HELP is not set
+# CONFIG_NSH_DISABLE_HEXDUMP is not set
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_KILL is not set
+# CONFIG_NSH_DISABLE_LOSETUP is not set
+# CONFIG_NSH_DISABLE_LS is not set
+# CONFIG_NSH_DISABLE_MB is not set
+# CONFIG_NSH_DISABLE_MKDIR is not set
+# CONFIG_NSH_DISABLE_MKFATFS is not set
+# CONFIG_NSH_DISABLE_MKFIFO is not set
+# CONFIG_NSH_DISABLE_MKRD is not set
+# CONFIG_NSH_DISABLE_MH is not set
+# CONFIG_NSH_DISABLE_MOUNT is not set
+# CONFIG_NSH_DISABLE_MW is not set
+# CONFIG_NSH_DISABLE_NSFMOUNT is not set
+# CONFIG_NSH_DISABLE_PS is not set
+# CONFIG_NSH_DISABLE_PING is not set
+# CONFIG_NSH_DISABLE_PUT is not set
+# CONFIG_NSH_DISABLE_PWD is not set
+# CONFIG_NSH_DISABLE_RM is not set
+# CONFIG_NSH_DISABLE_RMDIR is not set
+# CONFIG_NSH_DISABLE_SET is not set
+# CONFIG_NSH_DISABLE_SH is not set
+# CONFIG_NSH_DISABLE_SLEEP is not set
+# CONFIG_NSH_DISABLE_TEST is not set
+# CONFIG_NSH_DISABLE_UMOUNT is not set
+# CONFIG_NSH_DISABLE_UNSET is not set
+# CONFIG_NSH_DISABLE_USLEEP is not set
+# CONFIG_NSH_DISABLE_WGET is not set
+# CONFIG_NSH_DISABLE_XD is not set
+
+#
+# Configure Command Options
+#
+# CONFIG_NSH_CMDOPT_DF_H is not set
+CONFIG_NSH_CODECS_BUFSIZE=128
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_MAXARGUMENTS=6
+CONFIG_NSH_NESTDEPTH=3
+# CONFIG_NSH_DISABLESCRIPT is not set
+# CONFIG_NSH_DISABLEBG is not set
+CONFIG_NSH_CONSOLE=y
+
+#
+# USB Trace Support
+#
+# CONFIG_NSH_CONDEV is not set
+# CONFIG_NSH_ARCHINIT 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=y
+CONFIG_READLINE_ECHO=y
+
+#
+# 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/nsh/setenv.sh b/nuttx/configs/sam4l-xplained/nsh/setenv.sh
new file mode 100755
index 000000000..f83126fdf
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/nsh/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/sam4l-xplained/nsh/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/ostest/defconfig b/nuttx/configs/sam4l-xplained/ostest/defconfig
index 3cab5109b..3d674f455 100644
--- a/nuttx/configs/sam4l-xplained/ostest/defconfig
+++ b/nuttx/configs/sam4l-xplained/ostest/defconfig
@@ -94,7 +94,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
CONFIG_ARMV7M_OABI_TOOLCHAIN=y
#
-# AT91SAM3/SAM4 Configuration Options
+# AT91SAM3/4 Configuration Options
#
# CONFIG_ARCH_CHIP_AT91SAM3U4E is not set
# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
@@ -124,25 +124,56 @@ CONFIG_ARCH_CHIP_SAM4L=y
# CONFIG_ARCH_CHIP_SAM4S is not set
#
-# AT91SAM3 Peripheral Support
+# AT91SAM3/4 Peripheral Support
#
-# CONFIG_SAM34_DMA is not set
-# CONFIG_SAM34_NAND is not set
-# CONFIG_SAM34_HSMCI is not set
-# CONFIG_SAM34_UART is not set
-# CONFIG_SAM34_USART0 is not set
-CONFIG_SAM34_USART1=y
+CONFIG_SAM_PICOCACHE=y
+# CONFIG_SAM34_OCD is not set
+# CONFIG_SAM34_APBA is not set
+# CONFIG_SAM34_AESA is not set
+# CONFIG_SAM34_IISC is not set
+# CONFIG_SAM34_SPI is not set
+# CONFIG_SAM34_TC0 is not set
+# CONFIG_SAM34_TC1 is not set
+# CONFIG_SAM34_TWIM0 is not set
+# CONFIG_SAM34_TWIS0 is not set
+# CONFIG_SAM34_TWIM1 is not set
+# CONFIG_SAM34_TWIS1 is not set
+# CONFIG_SAM34_TWIM2 is not set
+# CONFIG_SAM34_TWIM3 is not set
+# CONFIG_SAM34_PICOUART is not set
+CONFIG_SAM34_USART0=y
+# 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
-#
-CONFIG_USART1_ISUART=y
-
-#
-# AT91SAM3 GPIO Interrupt Configuration
+# CONFIG_SAM34_ADCIFE is not set
+# CONFIG_SAM34_DACC is not set
+# CONFIG_SAM34_ACIFC is not set
+# CONFIG_SAM34_GLOC is not set
+# CONFIG_SAM34_ABDACB is not set
+# CONFIG_SAM34_TRNG is not set
+# CONFIG_SAM34_PARC is not set
+# CONFIG_SAM34_CATB is not set
+# CONFIG_SAM34_LCDCA is not set
+# CONFIG_SAM34_HRAMC1 is not set
+# CONFIG_SAM34_HMATRIX is not set
+# CONFIG_SAM34_PDCA is not set
+# CONFIG_SAM34_CRCCU is not set
+# CONFIG_SAM34_USBC is not set
+# CONFIG_SAM34_PEVC is not set
+# CONFIG_SAM34_CHIPID is not set
+# CONFIG_SAM34_FREQM is not set
+# CONFIG_SAM34_AST is not set
+# CONFIG_SAM34_WDT is not set
+# CONFIG_SAM34_EIC is not set
+# CONFIG_SAM32_RESET_PERIPHCLKS is not set
+
+#
+# AT91SAM3/4 USART Configuration
+#
+CONFIG_USART0_ISUART=y
+
+#
+# AT91SAM3/4 GPIO Interrupt Configuration
#
# CONFIG_GPIOA_IRQ is not set
# CONFIG_GPIOB_IRQ is not set
@@ -164,14 +195,15 @@ CONFIG_ARCH_IRQPRIO=y
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_RAMFUNCS=y
+CONFIG_ARCH_RAMFUNCS=y
CONFIG_ARCH_HAVE_RAMVECTORS=y
# CONFIG_ARCH_RAMVECTORS is not set
#
# Board Settings
#
-CONFIG_BOARD_LOOPSPERMSEC=4768
+CONFIG_BOARD_LOOPSPERMSEC=3410
# CONFIG_ARCH_CALIBRATION is not set
CONFIG_DRAM_START=0x20000000
CONFIG_DRAM_SIZE=32768
@@ -299,20 +331,24 @@ CONFIG_DEV_NULL=y
CONFIG_SERIAL=y
CONFIG_DEV_LOWCONSOLE=y
# CONFIG_16550_UART is not set
-CONFIG_ARCH_HAVE_USART1=y
+CONFIG_ARCH_HAVE_USART0=y
CONFIG_MCU_SERIAL=y
-CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART0_SERIAL_CONSOLE=y
# CONFIG_NO_SERIAL_CONSOLE is not set
#
-# USART1 Configuration
+# USART0 Configuration
#
-CONFIG_USART1_RXBUFSIZE=256
-CONFIG_USART1_TXBUFSIZE=256
-CONFIG_USART1_BAUD=115200
-CONFIG_USART1_BITS=8
-CONFIG_USART1_PARITY=0
-CONFIG_USART1_2STOP=0
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART0_BAUD=115200
+CONFIG_USART0_BITS=8
+CONFIG_USART0_PARITY=0
+CONFIG_USART0_2STOP=0
+# CONFIG_USART0_IFLOWCONTROL is not set
+# CONFIG_USART0_OFLOWCONTROL is not set
+# CONFIG_SERIAL_IFLOWCONTROL is not set
+# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set
@@ -456,7 +492,6 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
# 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
diff --git a/nuttx/configs/sam4l-xplained/scripts/ld.script b/nuttx/configs/sam4l-xplained/scripts/ld.script
index 751ab0299..7a225b999 100755
--- a/nuttx/configs/sam4l-xplained/scripts/ld.script
+++ b/nuttx/configs/sam4l-xplained/scripts/ld.script
@@ -33,8 +33,8 @@
*
****************************************************************************/
-/* The ATSAM4LC4C has 256Kb of FLASH beginning at address 0x0000:0000 and
- * 32Kb of SRAM beginning at address 0x2000:0000
+/* The ATSAM4LC4C has 256KB of FLASH beginning at address 0x0000:0000 and
+ * 32KB of SRAM beginning at address 0x2000:0000
*/
MEMORY
@@ -63,7 +63,21 @@ SECTIONS
_etext = ABSOLUTE(.);
} > flash
- _eronly = ABSOLUTE(.);
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >flash
+ __exidx_end = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
@@ -73,15 +87,15 @@ SECTIONS
_edata = ABSOLUTE(.);
} > sram AT > flash
- .ARM.extab : {
- *(.ARM.extab*)
- } >sram
+ _eronly = LOADADDR(.data);
- .ARM.exidx : {
- __exidx_start = ABSOLUTE(.);
- *(.ARM.exidx*)
- __exidx_end = ABSOLUTE(.);
- } >sram
+ .ramfunc ALIGN(4): {
+ _sramfuncs = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfuncs = ABSOLUTE(.);
+ } > sram AT > flash
+
+ _framfuncs = LOADADDR(.ramfunc);
.bss : {
_sbss = ABSOLUTE(.);
diff --git a/nuttx/configs/sam4l-xplained/src/Makefile b/nuttx/configs/sam4l-xplained/src/Makefile
index 15b5ff67e..01813faf4 100644
--- a/nuttx/configs/sam4l-xplained/src/Makefile
+++ b/nuttx/configs/sam4l-xplained/src/Makefile
@@ -42,6 +42,10 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sam_boot.c sam_spi.c
+ifeq ($(CONFIG_HAVE_CXX),y)
+CSRCS += sam_cxxinitialize.c
+endif
+
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += sam_autoleds.c
else
diff --git a/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h b/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h
index e9efe88fe..ba6978a82 100644
--- a/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h
+++ b/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h
@@ -1,7 +1,7 @@
/************************************************************************************
- * configs/sam3uek_eval/src/sam4l-xplained.h
+ * configs/sam4l-xplained/src/sam4l-xplained.h
*
- * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
+ * 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
@@ -80,8 +80,8 @@
* 2Hz, then a fatal error has been detected and the system has halted.
*/
-#define GPIO_LED0 (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_PORTC | \
- GPIO_OUTPUT_SET | GPIO_PIN7)
+#define GPIO_LED0 (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
+ GPIO_PORTC | GPIO_PIN7)
/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. The connection
* to the SAM4L is:
@@ -99,8 +99,8 @@
* PC24 SW0
*/
-#define GPIO_SW0 (GPIO_INPUT | GPIO_PULL_UP | GPIO_GLITCH_FILTER | GPIO_PORTC | \
- GPIO_PIN24)
+#define GPIO_SW0 (GPIO_INPUT | GPIO_PULL_UP | GPIO_GLITCH_FILTER | \
+ GPIO_PORTC | GPIO_PIN24)
#define IRQ_SW0 SAM_IRQ_PC24
/************************************************************************************
diff --git a/nuttx/configs/sam4l-xplained/src/sam_autoleds.c b/nuttx/configs/sam4l-xplained/src/sam_autoleds.c
index 09b673a96..06d647b63 100644
--- a/nuttx/configs/sam4l-xplained/src/sam_autoleds.c
+++ b/nuttx/configs/sam4l-xplained/src/sam_autoleds.c
@@ -123,19 +123,19 @@ void up_ledon(int led)
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 */
+ case 0: /* LED_STARTED: NuttX has been started LED0=OFF */
+ /* LED_HEAPALLOCATE: Heap has been allocated LED0=OFF */
+ /* 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 2: /* LED_INIRQ: In an interrupt LED0=N/C */
+ /* LED_SIGNAL: In a signal handler LED0=N/C */
+ /* LED_ASSERTION: An assertion failed LED0=N/C */
+ return; /* Return to leave LED0 unchanged */
- case LED_PANIC: /* The system has crashed LED0=FLASH */
- case LED_STACKCREATED: /* Idle stack created LED0=ON */
+ case 3: /* LED_PANIC: The system has crashed LED0=FLASH */
+ case 1: /* LED_STACKCREATED: Idle stack created LED0=ON */
ledstate = false; /* Set ledstate == false to turn ON */
break;
}
@@ -154,21 +154,21 @@ void up_ledoff(int 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 */
+ case 0: /* LED_STARTED: NuttX has been started LED0=OFF */
+ /* LED_HEAPALLOCATE: Heap has been allocated LED0=OFF */
+ /* LED_IRQSENABLED: Interrupts enabled LED0=OFF */
+ case 1: /* 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;
+ case 2: /* LED_INIRQ: In an interrupt LED0=N/C */
+ /* LED_SIGNAL: In a signal handler LED0=N/C */
+ /* LED_ASSERTION: An assertion failed LED0=N/C */
+ return; /* Return to leave LED0 unchanged */
/* Turn LED0 off set driving the output high */
- case LED_PANIC: /* The system has crashed LED0=FLASH */
+ case 3: /* LED_PANIC: The system has crashed LED0=FLASH */
sam_gpiowrite(GPIO_LED0, true);
break;
}
diff --git a/nuttx/configs/sam4l-xplained/src/sam_cxxinitialize.c b/nuttx/configs/sam4l-xplained/src/sam_cxxinitialize.c
new file mode 100644
index 000000000..1958e0918
--- /dev/null
+++ b/nuttx/configs/sam4l-xplained/src/sam_cxxinitialize.c
@@ -0,0 +1,154 @@
+/************************************************************************************
+ * configs/sam4l-xplained/src/sam_cxxinitialize.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 <nuttx/arch.h>
+
+#include <arch/sam34/chip.h>
+#include "chip.h"
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Debug ****************************************************************************/
+/* Non-standard debug that may be enabled just for testing the static constructors */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_CXX
+#endif
+
+#ifdef CONFIG_DEBUG_CXX
+# define cxxdbg dbg
+# define cxxlldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define cxxvdbg vdbg
+# define cxxllvdbg llvdbg
+# else
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+# endif
+#else
+# define cxxdbg(x...)
+# define cxxlldbg(x...)
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This type defines one entry in initialization array */
+
+typedef void (*initializer_t)(void);
+
+/************************************************************************************
+ * External references
+ ************************************************************************************/
+/* _sinit and _einit are symbols exported by the linker script that mark the
+ * beginning and the end of the C++ initialization section.
+ */
+
+extern initializer_t _sinit;
+extern initializer_t _einit;
+
+/* _stext and _etext are symbols exported by the linker script that mark the
+ * beginning and the end of text.
+ */
+
+extern uint32_t _stext;
+extern uint32_t _etext;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_cxxinitialize
+ *
+ * Description:
+ * If C++ and C++ static constructors are supported, then this function
+ * must be provided by board-specific logic in order to perform
+ * initialization of the static C++ class instances.
+ *
+ * This function should then be called in the application-specific
+ * user_start logic in order to perform the C++ initialization. NOTE
+ * that no component of the core NuttX RTOS logic is involved; This
+ * function defintion only provides the 'contract' between application
+ * specific C++ code and platform-specific toolchain support
+ *
+ ***************************************************************************/
+
+void up_cxxinitialize(void)
+{
+ initializer_t *initp;
+
+ cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
+ &_sinit, &_einit, &_stext, &_etext);
+
+ /* Visit each entry in the initialzation table */
+
+ for (initp = &_sinit; initp != &_einit; initp++)
+ {
+ initializer_t initializer = *initp;
+ cxxdbg("initp: %p initializer: %p\n", initp, initializer);
+
+ /* Make sure that the address is non-NULL and lies in the text region
+ * defined by the linker script. Some toolchains may put NULL values
+ * or counts in the initialization table
+ */
+
+ if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
+ {
+ cxxdbg("Calling %p\n", initializer);
+ initializer();
+ }
+ }
+}
+
+#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
+