diff --git a/Documentation/README.html b/Documentation/README.html
index eb701831650..43bfe481069 100644
--- a/Documentation/README.html
+++ b/Documentation/README.html
@@ -8,7 +8,7 @@
NuttX README Files
- Last Updated: December 16, 2017
+ Last Updated: January 6, 2018
|
@@ -103,6 +103,8 @@ nuttx/
| | `- README.txt
| |- fire-stm32v2/
| | `- README.txt
+ | |- flipnclick-sam3x/
+ | | `- README.txt
| |- freedom-k64f/
| | `- README.txt
| |- freedom-k66f/
diff --git a/README.txt b/README.txt
index b2220e8d9fc..c0b2544ee7b 100644
--- a/README.txt
+++ b/README.txt
@@ -1647,6 +1647,8 @@ nuttx/
| | `- README.txt
| |- fire-stm32v2/
| | `- README.txt
+ | |-configs/flipnclick-sam3x/
+ | | `- README.txt
| |- freedom-k64f/
| | `- README.txt
| |- freedom-k66f/
diff --git a/configs/Kconfig b/configs/Kconfig
index 76015987096..2ef309cba4a 100644
--- a/configs/Kconfig
+++ b/configs/Kconfig
@@ -196,6 +196,16 @@ config ARCH_BOARD_FIRE_STM32
and 3 of the boards are supported but only version 2 has been
tested.
+config ARCH_BOARD_FLIPNCLICK_SAM3X
+ bool "Mikroe Flip&Click SAM3X"
+ depends on ARCH_CHIP_ATSAM3X8E
+ select ARCH_HAVE_LEDS
+ ---help---
+ This options selects the Mikroe Flip&Click STM32X board. This board
+ is an Arduino-Due work-alike with four Mikroe Click bus interfaces.
+ Like the Arduino DUE, this board features the Atmel ATSAM3X8E MCU
+ running at 84 MHz.
+
config ARCH_BOARD_FREEDOM_K64F
bool "NXP Freedom-k64f development board"
depends on ARCH_CHIP_MK64FN1M0VLL12
@@ -1609,6 +1619,7 @@ config ARCH_BOARD
default "ez80f910200kitg" if ARCH_BOARD_EZ80F910200KITG
default "ez80f910200zco" if ARCH_BOARD_EZ80F910200ZCO
default "fire-stm32v2" if ARCH_BOARD_FIRE_STM32
+ default "flipnclick-sam3x" if ARCH_BOARD_FLIPNCLICK_SAM3X
default "freedom-k64f" if ARCH_BOARD_FREEDOM_K64F
default "freedom-k66f" if ARCH_BOARD_FREEDOM_K66F
default "freedom-kl25z" if ARCH_BOARD_FREEDOM_KL25Z
@@ -1833,6 +1844,9 @@ endif
if ARCH_BOARD_FIRE_STM32
source "configs/fire-stm32v2/Kconfig"
endif
+if ARCH_BOARD_FLIPNCLICK_SAM3X
+source "configs/flipnclick-sam3x/Kconfig"
+endif
if ARCH_BOARD_FREEDOM_K64F
source "configs/freedom-k64f/Kconfig"
endif
diff --git a/configs/README.txt b/configs/README.txt
index afbf1c97ac8..1b1e32350ea 100644
--- a/configs/README.txt
+++ b/configs/README.txt
@@ -260,6 +260,12 @@ configs/fire-stm32v2
STM32F103VET6 chip. See http://firestm32.taobao.com . Version 2 and 3 of
the boards are supported but only version 2 has been tested.
+configs/flipnclick-sam3x
+ Board support for the Mikroe Flip&Click STM32X board. This board is an
+ Arduino-Due work-alike with four Mikroe Click bus interfaces. Like the
+ Arduino DUE, this board features the Atmel ATSAM3X8E MCU running at 84
+ MHz.
+
configs/freedom-k64f
This port uses the NXP/FreeScale FREEDOM-K64F development board. This board
uses the Kinetis K64 MK64FN1M0VLL12 Cortex-M4 MCU.
diff --git a/configs/arduino-due/README.txt b/configs/arduino-due/README.txt
index 6aaa13177ce..7a75207f563 100644
--- a/configs/arduino-due/README.txt
+++ b/configs/arduino-due/README.txt
@@ -1,5 +1,5 @@
README
-^^^^^^
+======
This README discusses issues unique to NuttX configurations for the
Arduino DUE board featuring the Atmel ATSAM3X8E MCU running at 84 MHz.
@@ -17,7 +17,7 @@ README
- ITEAD 2.4" TFT with Touch, Arduino Shield 1.0
Contents
-^^^^^^^^
+========
- PIO Pin Usage
- Rev 2 vs. Rev 3
@@ -25,11 +25,11 @@ Contents
- Buttons and LEDs
- Serial Consoles
- Loading Code
- - SAM4S Xplained-specific Configuration Options
+ - Arduino Due-specific Configuration Options
- Configurations
PIO Pin Usage
-^^^^^^^^^^^^^
+=============
PORTA PORTB PORTC
------------------------------ ------------------------------ --------------------------------
@@ -108,7 +108,7 @@ PIO Pin Usage
----- ---------- ---- -------- ----- ------------ ---- ------ ----- ----------- ---- ---------
Rev 2 vs. Rev 3
-^^^^^^^^^^^^^^^
+===============
This port was performed on the Arduino Due Rev 2 board. NuttX users
have reported issues with the serial port on his Arduino Due Rev 3 board.
@@ -119,7 +119,7 @@ Rev 2 vs. Rev 3
CONFIG_ARDUINO_DUE_REV3=y
ITEAD 2.4" TFT with Touch
-^^^^^^^^^^^^^^^^^^^^^^^^^
+=========================
The Arduino 2.4" TFT Touch Shield is designed for all the Arduino
compatible boards. It works in 3.3V voltage level. It can be directly
@@ -245,7 +245,7 @@ ITEAD 2.4" TFT with Touch
- /CS is connected to ground (XPT2046 is always selected)
Buttons and LEDs
-^^^^^^^^^^^^^^^^
+================
Buttons
-------
@@ -291,7 +291,7 @@ Buttons and LEDs
has halted.
Serial Consoles
-^^^^^^^^^^^^^^^
+===============
The SAM3X has a UART and 4 USARTS. The Programming port uses a USB-to-
serial chip connected to the first UART0 of the MCU (RX0 and TX0). The
@@ -328,7 +328,7 @@ Serial Consoles
USB virual COM port in the case of UART0).
Loading Code
-^^^^^^^^^^^^
+============
Installing the Arduino USB Driver under Windows:
------------------------------------------------
@@ -512,7 +512,7 @@ Loading Code
have been unable to get the get the SAM-ICE to communicate with the Due.
Arduino DUE-specific Configuration Options
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+==========================================
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
be set to:
@@ -550,12 +550,9 @@ Arduino DUE-specific Configuration Options
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
of delay loops
- CONFIG_ENDIAN_BIG - define if big endian (default is little
- endian)
-
CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
- CONFIG_RAM_SIZE=0x00008000 (32Kb)
+ CONFIG_RAM_SIZE=65536 (64Kb)
CONFIG_RAM_START - The start address of installed DRAM
@@ -564,37 +561,20 @@ Arduino DUE-specific Configuration Options
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 calibrate
- 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_ADC12B - 12-bit Analog To Digital Converter
+ CONFIG_SAM34_CAN0 - CAN Controller 0
+ CONFIG_SAM34_CAN1 - CAN Controller 1
+ CONFIG_SAM34_DACC - Digital To Analog Converter
+ CONFIG_SAM34_DMAC0 - DMA Controller
+ CONFIG_SAM34_EMAC - Ethernet MAC
+ CONFIG_SAM34_HSMCI - High Speed Multimedia Card Interface
+ CONFIG_SAM34_PWM - Pulse Width Modulation
CONFIG_SAM34_RTC - Real Time Clock
CONFIG_SAM34_RTT - Real Time Timer
- CONFIG_SAM34_WDT - Watchdog Timer
- CONFIG_SAM34_UART0 - UART 0
- CONFIG_SAM34_SMC - Static Memory Controller
CONFIG_SAM34_SDRAMC - SDRAM Controller
- CONFIG_SAM34_USART0 - USART 0
- CONFIG_SAM34_USART1 - USART 1
- CONFIG_SAM34_USART2 - USART 2
- CONFIG_SAM34_USART3 - USART 3
- CONFIG_SAM34_HSMCI - High Speed Multimedia Card Interface
- CONFIG_SAM34_TWI0 - Two-Wire Interface 0 (master/slave)
- CONFIG_SAM34_TWI1 - Two-Wire Interface 1 (master/slave)
+ CONFIG_SAM34_SMC - Static Memory Controller
CONFIG_SAM34_SPI0 - Serial Peripheral Interface 0
CONFIG_SAM34_SPI1 - Serial Peripheral Interface 1
CONFIG_SAM34_SSC - Synchronous Serial Controller
@@ -607,15 +587,16 @@ Arduino DUE-specific Configuration Options
CONFIG_SAM34_TC6 - Timer Counter 6
CONFIG_SAM34_TC7 - Timer Counter 7
CONFIG_SAM34_TC8 - Timer Counter 8
- CONFIG_SAM34_PWM - Pulse Width Modulation
- CONFIG_SAM34_ADC12B - 12-bit Analog To Digital Converter
- CONFIG_SAM34_DACC - Digital To Analog Converter
- CONFIG_SAM34_DMAC0 - DMA Controller
- CONFIG_SAM34_UOTGHS - USB OTG High Speed
CONFIG_SAM34_TRNG - True Random Number Generator
- CONFIG_SAM34_EMAC - Ethernet MAC
- CONFIG_SAM34_CAN0 - CAN Controller 0
- CONFIG_SAM34_CAN1 - CAN Controller 1
+ CONFIG_SAM34_TWIM/S0 - Two-Wire Interface 0 (master/slave)
+ CONFIG_SAM34_TWIM/S1 - Two-Wire Interface 1 (master/slave)
+ CONFIG_SAM34_UART0 - UART 0
+ CONFIG_SAM34_UOTGHS - USB OTG High Speed
+ CONFIG_SAM34_USART0 - USART 0
+ CONFIG_SAM34_USART1 - USART 1
+ CONFIG_SAM34_USART2 - USART 2
+ CONFIG_SAM34_USART3 - USART 3
+ CONFIG_SAM34_WDT - Watchdog Timer
Some subsystems can be configured to operate in different ways. The drivers
need to know how to configure the subsystem.
@@ -626,33 +607,18 @@ Arduino DUE-specific Configuration Options
CONFIG_SAM34_GPIOD_IRQ
CONFIG_SAM34_GPIOE_IRQ
CONFIG_SAM34_GPIOF_IRQ
- CONFIG_USART0_SERIALDRIVER
- CONFIG_USART1_SERIALDRIVER
- CONFIG_USART2_SERIALDRIVER
- CONFIG_USART3_SERIALDRIVER
-
- ST91SAM4S 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
Configurations
-^^^^^^^^^^^^^^
+==============
- Each SAM4S Xplained configuration is maintained in a sub-directory and
+ Each Arduino Due configuration is maintained in a sub-directory and
can be selected as follow:
- cd tools
- ./configure.sh arduino-due/
- cd -
+ tools/configure.sh [OPTIONS] arduino-due/
+
+ Where typical options are -l to configure to build on Linux or -c to
+ configure for Cygwin under Linux. 'tools/configure.sh -h' will show
+ you all of the options.
Before building, make sure the PATH environment variable includes the
correct path to the directory than holds your toolchain binaries.
@@ -734,14 +700,11 @@ Configurations
Atmel tools. Try 'which arm-none-eabi-gcc' to make sure that you
are selecting the right tool.
- See also the "NOTE about Windows native toolchains" in the section call
- "GNU Toolchain Options" above.
-
Configuration sub-directories
-----------------------------
nsh:
- This configuration directory will built the NuttShell. See NOTES above.
+ This configuration directory will build the NuttShell. See NOTES above.
NOTES:
1. NSH built-in applications are supported. However, there are
@@ -750,7 +713,7 @@ Configuration sub-directories
Binary Formats:
CONFIG_BUILTIN=y : Enable support for built-in programs
- Applicaton Configuration:
+ Application Configuration:
CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
2. By default, this configuration uses UART0 and has support LEDs
@@ -865,7 +828,7 @@ Configuration sub-directories
Library Support:
CONFIG_SCHED_WORKQUEUE=y : Work queue support required
- Applicaton Configuration:
+ Application Configuration:
CONFIG_EXAMPLES_TOUCHSCREEN=y : Enable the touchscreen built-int test
Defaults should be okay for related touchscreen settings. Touchscreen
diff --git a/configs/arduino-due/nsh/defconfig b/configs/arduino-due/nsh/defconfig
index 99ba4a71d91..447c98a7cab 100644
--- a/configs/arduino-due/nsh/defconfig
+++ b/configs/arduino-due/nsh/defconfig
@@ -1,5 +1,4 @@
# CONFIG_ARCH_RAMFUNCS is not set
-# CONFIG_NSH_CMDOPT_DF_H is not set
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH_BOARD_ARDUINO_DUE=y
diff --git a/configs/arduino-due/src/.gitignore b/configs/arduino-due/src/.gitignore
new file mode 100644
index 00000000000..726d936e1e3
--- /dev/null
+++ b/configs/arduino-due/src/.gitignore
@@ -0,0 +1,2 @@
+/.depend
+/Make.dep
diff --git a/configs/arduino-due/src/Makefile b/configs/arduino-due/src/Makefile
index e26901a09a1..2d4df9e6d35 100644
--- a/configs/arduino-due/src/Makefile
+++ b/configs/arduino-due/src/Makefile
@@ -1,7 +1,7 @@
############################################################################
# configs/arduino-due/src/Makefile
#
-# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt
#
# Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@
-include $(TOPDIR)/Make.defs
ASRCS =
-CSRCS = sam_boot.c
+CSRCS = sam_boot.c sam_bringup.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += sam_autoleds.c
diff --git a/configs/arduino-due/src/arduino-due.h b/configs/arduino-due/src/arduino-due.h
index 68be762271e..0e2b6736b34 100644
--- a/configs/arduino-due/src/arduino-due.h
+++ b/configs/arduino-due/src/arduino-due.h
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/arduino-due/src/arduino-due.h
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -308,17 +308,21 @@
* Public Functions
************************************************************************************/
-/************************************************************************************
- * Name: sam_sram_initialize
+/****************************************************************************
+ * Name: sam_bringup
*
* Description:
- * Configure and enable SRAM on board the SAM4S Xplained
+ * Perform architecture-specific initialization
*
- ************************************************************************************/
+ * CONFIG_BOARD_INITIALIZE=y :
+ * Called from board_initialize().
+ *
+ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
-#ifdef CONFIG_SAM34_EXTSRAM0
-void sam_sram_initialize(void);
-#endif
+int sam_bringup(void);
/****************************************************************************
* Name: sam_sdinitialize
diff --git a/configs/arduino-due/src/sam_appinit.c b/configs/arduino-due/src/sam_appinit.c
index 78587bcce73..91e9391daf4 100644
--- a/configs/arduino-due/src/sam_appinit.c
+++ b/configs/arduino-due/src/sam_appinit.c
@@ -1,7 +1,7 @@
/****************************************************************************
* config/arduino-due/src/sam_appinit.c
*
- * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2016, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -39,9 +39,6 @@
#include
-#include
-#include
-
#include
#include "arduino-due.h"
@@ -50,22 +47,8 @@
* Pre-processor Definitions
****************************************************************************/
-#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
- defined(CONFIG_MMCSD_SPI)
-/* Support for the SD card slot on the ITEAD TFT shield */
-/* Verify NSH PORT and SLOT settings */
-
-# define SAM34_MMCSDSLOTNO 0 /* There is only one slot */
-
-# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAM34_MMCSDSLOTNO
-# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO)
-# endif
-
-/* Default MMC/SD minor number */
-
-# ifndef CONFIG_NSH_MMCSDMINOR
-# define CONFIG_NSH_MMCSDMINOR 0
-# endif
+#ifndef OK
+# define OK 0
#endif
/****************************************************************************
@@ -84,7 +67,7 @@
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
- * between the board-specific initalization logic and the
+ * between the board-specific initialization logic and the
* matching application logic. The value cold be such things as a
* mode enumeration value, a set of DIP switch switch settings, a
* pointer to configuration data read from a file or serial FLASH,
@@ -99,21 +82,13 @@
int board_app_initialize(uintptr_t arg)
{
-#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
- defined(CONFIG_MMCSD_SPI)
- /* Initialize the SPI-based MMC/SD slot */
-
- {
- int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR);
- if (ret < 0)
- {
- syslog(LOG_ERR,
- "board_app_initialize: Failed to initialize MMC/SD slot: %d\n",
- ret);
- return ret;
- }
- }
-#endif
+#ifdef CONFIG_BOARD_INITIALIZE
+ /* Board initialization already performed by board_initialize() */
return OK;
+#else
+ /* Perform board-specific initialization */
+
+ return sam_bringup();
+#endif
}
diff --git a/configs/arduino-due/src/sam_boot.c b/configs/arduino-due/src/sam_boot.c
index f720fcddb1e..0d226bc13a6 100644
--- a/configs/arduino-due/src/sam_boot.c
+++ b/configs/arduino-due/src/sam_boot.c
@@ -1,7 +1,7 @@
-/************************************************************************************
+/****************************************************************************
* configs/arduino-due/src/sam_boot.c
*
- * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2015, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************************************/
+ ****************************************************************************/
-/************************************************************************************
+/****************************************************************************
* Included Files
- ************************************************************************************/
+ ****************************************************************************/
#include
@@ -45,27 +45,20 @@
#include "arduino-due.h"
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Private Functions
- ************************************************************************************/
-
-/************************************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************************************/
+ ****************************************************************************/
-/************************************************************************************
+/****************************************************************************
* Name: sam_boardinitialize
*
* Description:
- * All SAM3X 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.
+ * All SAM3/4 architectures must provide the following entry point. This
+ * entry point is called early in the initialization -- after all memory
+ * has been configured and mapped but before any devices have been
+ * initialized.
*
- ************************************************************************************/
+ ****************************************************************************/
void sam_boardinitialize(void)
{
@@ -75,3 +68,25 @@ void sam_boardinitialize(void)
board_autoled_initialize();
#endif
}
+
+/****************************************************************************
+ * Name: board_initialize
+ *
+ * Description:
+ * If CONFIG_BOARD_INITIALIZE is selected, then an additional
+ * initialization call will be performed in the boot-up sequence to a
+ * function called board_initialize(). board_initialize() will be
+ * called immediately after up_initialize() is called and just before the
+ * initial application is started. This additional initialization phase
+ * may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_INITIALIZE
+void board_initialize(void)
+{
+ /* Perform board-specific initialization */
+
+ (void)sam_bringup();
+}
+#endif
diff --git a/configs/arduino-due/src/sam_bringup.c b/configs/arduino-due/src/sam_bringup.c
new file mode 100644
index 00000000000..fc431f24deb
--- /dev/null
+++ b/configs/arduino-due/src/sam_bringup.c
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * config/arduino-due/src/sam_bringup.c
+ *
+ * Copyright (C) 2013, 2016, 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+#include
+
+#include
+
+#include "arduino-due.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
+ defined(CONFIG_MMCSD_SPI)
+/* Support for the SD card slot on the ITEAD TFT shield */
+/* Verify NSH PORT and SLOT settings */
+
+# define SAM34_MMCSDSLOTNO 0 /* There is only one slot */
+
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAM34_MMCSDSLOTNO
+# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO)
+# endif
+
+/* Default MMC/SD minor number */
+
+# ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sam_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_INITIALIZE=y :
+ * Called from board_initialize().
+ *
+ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int sam_bringup(void)
+{
+#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
+ defined(CONFIG_MMCSD_SPI)
+ /* Initialize the SPI-based MMC/SD slot */
+
+ {
+ int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR,
+ "board_app_initialize: Failed to initialize MMC/SD slot: %d\n",
+ ret);
+ return ret;
+ }
+ }
+#endif
+
+ return OK;
+}
diff --git a/configs/flipnclick-sam3x/Kconfig b/configs/flipnclick-sam3x/Kconfig
new file mode 100644
index 00000000000..166b712c2a9
--- /dev/null
+++ b/configs/flipnclick-sam3x/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_BOARD_FLIPNCLICK_SAM3X
+endif
diff --git a/configs/flipnclick-sam3x/README.txt b/configs/flipnclick-sam3x/README.txt
new file mode 100644
index 00000000000..1dcddb5829e
--- /dev/null
+++ b/configs/flipnclick-sam3x/README.txt
@@ -0,0 +1,455 @@
+README
+======
+
+ This README discusses issues unique to NuttX configurations for the
+ Mikroe Flip&Click STM32X board. This board is an Arduino-Due work-alike
+ with four Mikroe Click bus interfaces. Like the Arduino DUE, this board
+ features the Atmel ATSAM3X8E MCU running at 84 MHz.
+
+Contents
+========
+
+ - Buttons and LEDs
+ - Serial Consoles
+ - Loading Code
+ - Arduino Due-specific Configuration Options
+ - Configurations
+
+Buttons and LEDs
+================
+
+ Buttons
+ -------
+ There are no buttons on the Arduino Due board.
+
+ LEDs
+ ----
+ There are four LEDs on the top, blue side of the board. Only
+ one can be controlled by software:
+
+ LED L - PB27 (PWM13)
+
+ There are also four LEDs on the back, white side of the board:
+
+ LED A - PC6
+ LED B - PC5
+ LED C - PC7
+ LED D - PC8
+
+ A high output value illuminates the LEDs.
+
+ These LEDs are available to the application and are all available to the
+ application unless CONFIG_ARCH_LEDS is defined. In that case, the usage
+ by the board port is defined in include/board.h and src/sam_autoleds.c.
+ The LEDs are used to encode OS-related events as follows:
+
+ SYMBOL MEANING LED STATE
+ L A B C D
+ ---------------- ----------------------- --- --- --- --- ---
+ LED_STARTED NuttX has been started OFF ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled OFF OFF OFF ON OFF
+ LED_STACKCREATED Idle stack created OFF OFF OFF OFF ON
+ LED_INIRQ In an interrupt GLO N/C N/C N/C N/C
+ LED_SIGNAL In a signal handler GLO N/C N/C N/C N/C
+ LED_ASSERTION An assertion failed GLO N/C N/C N/C N/C
+ LED_PANIC The system has crashed 2Hz N/C N/C N/C N/C
+ LED_IDLE MCU is is sleep mode ---- Not used -----
+
+ Thus if LED L is glowing on and all other LEDs are off (except LED D which
+ was left on but is no longer controlled by NuttX and so may be in any
+ state), NuttX has successfully booted and is, apparently, running normally
+ and taking interrupts. If any of LEDs A-D are statically set, then NuttX
+ failed to boot and the LED indicates the initialization phase where the
+ failure occurred. If LED L is flashing at approximately 2Hz, then a fatal
+ error has been detected and the system has halted.
+
+ NOTE: After booting, LEDs A-D are no longer used by the system and may
+ be controlled the application.
+
+Serial Consoles
+===============
+
+ The SAM3X has a UART and 4 USARTS. The Programming port uses a USB-to-
+ serial chip connected to the first of the MCU (RX0 and TX0 on PA8 and PA9,
+ respectively). The output from that port is visible using the Arduino tool.
+
+ Any of UART and USART0-3 may be used as a serial console. By default,
+ UART0 is used as the serial console in all configurations. But that is
+ easily changed by modifying the configuration as described under
+ "Configurations" below.
+
+ Other convenient U[S]ARTs that may be used as the Serial console include:
+
+ 1) An Arduino Serial Shield. The RX and TX pins are available on the
+ Arduino connector D0 and D1 pins, respectively. These are connected
+ to USART0, RXD0 and TXD0 which are PA10 and PA11, respectively.
+
+ 2) Mikroe Click Serial Shield. There are four Click bus connectors with
+ serial ports available as follows:
+
+ Click A: USART0 RXD0 and TXD0 which are, again, PD10 and PD11.
+ Click B: USART1 RXD1 and TXD1 which are PA12 and PA13, respectively.
+ Click C: USART3 RXD3 and TXD3 which are PD5 and PD4, respectively.
+ Click D: USART3 RXD3 and TXD3 which are, again, PD5 and PD4.
+
+ Other serial ports are probably available on the Arduino connector. I
+ will leave that as an exercise for the interested reader.
+
+ The outputs from these pins is 3.3V. You will need to connect RS232
+ transceiver to get the signals to RS232 levels (or connect to the
+ USB virtual COM port in the case of UART0).
+
+Loading Code
+============
+
+ Installing the Arduino USB Driver under Windows:
+ ------------------------------------------------
+ 1. Download the Windows version of the Arduino software, not the 1.0.x
+ release but the latest 1.5.x that supports the Due. When the download
+ finishes, unzip the downloaded file.
+ 2. Connect the Due to your computer with a USB cable via the Programming port.
+ 3. The Windows driver installation should fail.
+ 4. Open the Device Manger
+ 5. Look for the listing named "Ports (COM & LPT)". You should see an open
+ port named "Arduino Due Prog. Port".
+ 6 Select the "Browse my computer for Driver software" option.
+ 7. Right click on the "Arduino Due Prog. Port" and choose "Update Driver
+ Software".
+ 8. Navigate to the folder with the Arduino IDE you downloaded and unzipped
+ earlier. Locate and select the "Drivers" folder in the main Arduino folder
+ (not the "FTDI USB Drivers" sub-directory).
+
+ Uploading NuttX to the Due Using Bossa:
+ ---------------------------------------
+ I don't think this can be done because the Arduino software is so dedicated
+ to "sketches". However, Arduino uses BOSSA under the hood to load code and
+ you can use BOSSA outside of Arduino.
+
+ Uploading NuttX to the Due Using Bossa:
+ ---------------------------------------
+ Where do you get it?
+ Generic BOSSA installation files are available here:
+ http://sourceforge.net/projects/b-o-s-s-a/?source=dlp
+
+ However, DUE uses a patched version of BOSSA available as source code here:
+ https://github.com/shumatech/BOSSA/tree/arduino
+
+ But, fortunately, since you already installed Arduino, you already have
+ BOSSA installed. In my installation, it is here:
+
+ C:\Program Files (x86)\Arduino\arduino-1.5.2\hardware\tools\bossac.exe
+
+ General Procedure
+ -----------------
+
+ 1) Erase the FLASH and put the Due in bootloader mode
+ 2) Write the file to FLASH
+ 3) Configure to boot from FLASH
+ 4) Reset the DUE
+
+ Erase FLASH and Put the Due in Bootloader Mode
+ ----------------------------------------------
+ This is accomplished by simply configuring the programming port in 1200
+ baud and sending something on the programming port. Here is some sample
+ output from a Windows CMD.exe shell. NOTE that my Arduino programming
+ port shows up as COM26. It may be different on your system.
+
+ To enter boot mode, set the baud to 1200 and send anything to the
+ programming port:
+
+ C:\Program Files (x86)\Arduino\arduino-1.5.2\hardware\tools>mode com26:1200,n,8,1
+
+ Status for device COM26:
+ ------------------------
+ Baud: 1200
+ Parity: None
+ Data Bits: 8
+ Stop Bits: 1
+ Timeout: ON
+ XON/XOFF: OFF
+ CTS handshaking: OFF
+ DSR handshaking: OFF
+ DSR sensitivity: OFF
+ DTR circuit: ON
+ RTS circuit: ON
+
+ C:\Program Files (x86)\Arduino\arduino-1.5.2\hardware\tools>bossac.exe --port=COM26 -U false -i
+ Device : ATSAM3X8
+ Chip ID : 285e0a60
+ Version : v1.1 Dec 15 2010 19:25:04
+ Address : 524288
+ Pages : 2048
+ Page Size : 256 bytes
+ Total Size : 512KB
+ Planes : 2
+ Lock Regions : 32
+ Locked : none
+ Security : false
+ Boot Flash : false
+
+ Writing FLASH and Setting FLASH Boot Mode
+ -----------------------------------------
+ In a Cygwin BaSH shell:
+
+ export PATH="/cygdrive/c/Program Files (x86)/Arduino/arduino-1.5.2/hardware/tools":$PATH
+
+ Erasing, writing, and verifying FLASH with bossac:
+
+ $ bossac.exe --port=COM26 -U false -e -w -v -b nuttx.bin -R
+ Erase flash
+ Write 86588 bytes to flash
+ [==============================] 100% (339/339 pages)
+ Verify 86588 bytes of flash
+ [==============================] 100% (339/339 pages)
+ Verify successful
+ Set boot flash true
+ CPU reset.
+
+ Some things that can go wrong:
+
+ $ bossac.exe --port=COM26 -U false -e -w -v -b nuttx.bin -R
+ No device found on COM26
+
+ This error means that there is code running on the Due already so the
+ bootloader cannot connect. Pressing reset and trying again
+
+ $ bossac.exe --port=COM26 -U false -e -w -v -b nuttx.bin -R
+ No device found on COM26
+
+ Sill No connection because Duo does not jump to bootloader after reset.
+ Press ERASE button and try again
+
+ $ bossac.exe --port=COM26 -U false -e -w -v -b nuttx.bin -R
+ Erase flash
+ Write 86588 bytes to flash
+ [==============================] 100% (339/339 pages)
+ Verify 86588 bytes of flash
+ [==============================] 100% (339/339 pages)
+ Verify successful
+ Set boot flash true
+ CPU reset.
+
+ Other useful bossac things operations.
+ -------------------------------------
+ a) Write code to FLASH don't change boot mode and don't reset. This lets
+ you examine the FLASH contents that you just loaded while the bootloader
+ is still active.
+
+ $ bossac.exe --port=COM26 -U false -e -w -v --boot=0 nuttx.bin
+ Write 64628 bytes to flash
+ [==============================] 100% (253/253 pages)
+ Verify 64628 bytes of flash
+ [==============================] 100% (253/253 pages)
+ Verify successful
+
+ b) Verify the FLASH contents (the bootloader must be running)
+
+ $ bossac.exe --port=COM26 -U false -v nuttx.bin
+ Verify 64628 bytes of flash
+ [==============================] 100% (253/253 pages)
+ Verify successful
+
+ c) Read from FLASH to a file (the bootloader must be running):
+
+ $ bossac.exe --port=COM26 -U false --read=4096 nuttx.dump
+ Read 4096 bytes from flash
+ [==============================] 100% (16/16 pages)
+
+ d) Change to boot from FLASH
+
+ $ bossac.exe --port=COM26 -U false --boot=1
+ Set boot flash true
+
+ Uploading NuttX to the Due Using JTAG:
+ -------------------------------------
+
+ The JTAG/SWD signals are brought out to a 10-pin header JTAG connector:
+
+ PIN SIGNAL JTAG STANDARD NOTES
+ --- -------------- ----------------- --------------------------------
+ 1 3.3V VTref
+ 2 JTAG_TMS SWDIO/TMS SAM3X pin 31, Pulled up on board
+ 3 GND GND
+ 4 JTAG_TCK SWDCLK/TCK SAM3X pin 28, Pulled up on board
+ 5 GND GND
+ 6 JTAG_TDO SWO/EXta/TRACECTL SAM3X pin 30, ulled up on board
+ 7 N/C Key
+ 8 JTAG_TDI NC/EXTb/TDI SAM3X pin 29, Pulled up on board
+ 9 GND GNDDetect
+ 10 MASTER-RESET nReset
+
+ You should be able to use a 10- to 20-pin adapter to connect a SAM-ICE
+ debugger to the Arduino Due. I have this Olimex adapter:
+ https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ . But so far I
+ have been unable to get the get the SAM-ICE to communicate with the Due.
+
+Arduino DUE-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_SAM3X
+ CONFIG_ARCH_CHIP_ATSAM3X8E
+
+ CONFIG_ARCH_BOARD - Identifies the configs/ subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=flipnclick-sam3x (for the Arduino Due development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_FLIPNCLICK_SAM3X=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_RAM_SIZE=65536 (64Kb)
+
+ CONFIG_RAM_START - The start address of installed DRAM
+
+ CONFIG_RAM_START=0x20000000
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ Individual subsystems can be enabled:
+
+ CONFIG_SAM34_ADC12B - 12-bit Analog To Digital Converter
+ CONFIG_SAM34_CAN0 - CAN Controller 0
+ CONFIG_SAM34_CAN1 - CAN Controller 1
+ CONFIG_SAM34_DACC - Digital To Analog Converter
+ CONFIG_SAM34_DMAC0 - DMA Controller
+ CONFIG_SAM34_EMAC - Ethernet MAC
+ CONFIG_SAM34_HSMCI - High Speed Multimedia Card Interface
+ CONFIG_SAM34_PWM - Pulse Width Modulation
+ CONFIG_SAM34_RTC - Real Time Clock
+ CONFIG_SAM34_RTT - Real Time Timer
+ CONFIG_SAM34_SDRAMC - SDRAM Controller
+ CONFIG_SAM34_SMC - Static Memory Controller
+ CONFIG_SAM34_SPI0 - Serial Peripheral Interface 0
+ CONFIG_SAM34_SPI1 - Serial Peripheral Interface 1
+ CONFIG_SAM34_SSC - Synchronous Serial Controller
+ CONFIG_SAM34_TC0 - Timer Counter 0
+ CONFIG_SAM34_TC1 - Timer Counter 1
+ CONFIG_SAM34_TC2 - Timer Counter 2
+ CONFIG_SAM34_TC3 - Timer Counter 3
+ CONFIG_SAM34_TC4 - Timer Counter 4
+ CONFIG_SAM34_TC5 - Timer Counter 5
+ CONFIG_SAM34_TC6 - Timer Counter 6
+ CONFIG_SAM34_TC7 - Timer Counter 7
+ CONFIG_SAM34_TC8 - Timer Counter 8
+ CONFIG_SAM34_TRNG - True Random Number Generator
+ CONFIG_SAM34_TWIM/S0 - Two-Wire Interface 0 (master/slave)
+ CONFIG_SAM34_TWIM/S1 - Two-Wire Interface 1 (master/slave)
+ CONFIG_SAM34_UART0 - UART 0
+ CONFIG_SAM34_UOTGHS - USB OTG High Speed
+ CONFIG_SAM34_USART0 - USART 0
+ CONFIG_SAM34_USART1 - USART 1
+ CONFIG_SAM34_USART2 - USART 2
+ CONFIG_SAM34_USART3 - USART 3
+ CONFIG_SAM34_WDT - Watchdog Timer
+
+ Some subsystems can be configured to operate in different ways. The drivers
+ need to know how to configure the subsystem.
+
+ CONFIG_SAM34_GPIOA_IRQ
+ CONFIG_SAM34_GPIOB_IRQ
+ CONFIG_SAM34_GPIOC_IRQ
+ CONFIG_SAM34_GPIOD_IRQ
+ CONFIG_SAM34_GPIOE_IRQ
+ CONFIG_SAM34_GPIOF_IRQ
+
+Configurations
+^^^^^^^^^^^^^^
+
+ Each Arduino Due configuration is maintained in a sub-directory and
+ can be selected as follow:
+
+ tools/configure.sh [OPTIONS] flipnclick-sam3x/
+
+ Where typical options are -l to configure to build on Linux or -c to
+ configure for Cygwin under Linux. 'tools/configure.sh -h' will show
+ you all of the options.
+
+ Before building, make sure the PATH environment variable includes 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 that is provided above as an argument to the tools/configure.sh
+ must be is one of the following.
+
+ NOTES:
+
+ 1. 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
+ see additional README.txt files in the NuttX tools repository.
+
+ b. Execute 'make menuconfig' in nuttx/ in order to start the
+ reconfiguration process.
+
+ 2. Unless stated otherwise, all configurations generate console
+ output on UART0 which is available both on the USB virtual COM port
+ and on the PWML connector (see the section "Serial Consoles" above).
+
+ 3. Unless otherwise stated, the configurations are setup for
+ Cygwin under Windows:
+
+ Build Setup:
+ CONFIG_HOST_WINDOWS=y : Microsoft Windows
+ CONFIG_WINDIWS_CYGWIN=y : Cygwin under Windoes
+
+ 3. All of these configurations are set up to build under Windows using the
+ "GNU Tools for ARM Embedded Processors" that is maintained by ARM
+ (unless stated otherwise in the description of the configuration).
+
+ https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
+
+ That toolchain selection can easily be reconfigured using
+ 'make menuconfig'. Here are the relevant current settings:
+
+ System Type -> Toolchain:
+ CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU ARM EABI toolchain for Windows
+
+Configuration sub-directories
+-----------------------------
+
+ nsh:
+ This configuration directory will build the NuttShell. See NOTES above.
+
+ NOTES:
+ 1. NSH built-in applications are supported. However, there are
+ no built-in applications built with the default configuration.
+
+ Binary Formats:
+ CONFIG_BUILTIN=y : Enable support for built-in programs
+
+ Applicaton Configuration:
+ CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
diff --git a/configs/flipnclick-sam3x/include/board.h b/configs/flipnclick-sam3x/include/board.h
new file mode 100644
index 00000000000..4e3652609a4
--- /dev/null
+++ b/configs/flipnclick-sam3x/include/board.h
@@ -0,0 +1,241 @@
+/************************************************************************************
+ * configs/flipnclick-sam3x/include/board.h
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H
+#define __CONFIGS_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#ifndef __ASSEMBLY__
+# include
+# include
+# ifdef CONFIG_SAM34_GPIO_IRQ
+# include
+# endif
+#endif
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. These
+ * definitions will configure clocking
+ *
+ * MAINOSC: Frequency = 12MHz (crystal)
+ * PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz
+ * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz
+ * CPU clock: 84MHz
+ */
+
+#define BOARD_32KOSC_FREQUENCY (32768)
+#define BOARD_SCLK_FREQUENCY (BOARD_32KOSC_FREQUENCY)
+#define BOARD_MAINOSC_FREQUENCY (12000000) /* MAINOSC: 12MHz crystal on-board */
+
+/* Main oscillator register settings.
+ *
+ * The start up time should be should be:
+ * Start Up Time = 8 * MOSCXTST / SLCK = 56 Slow Clock Cycles.
+ */
+
+#define BOARD_CKGR_MOR_MOSCXTST (62 << PMC_CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */
+
+/* PLLA configuration.
+ *
+ * Divider = 1
+ * Multipler = 14
+ */
+
+#define BOARD_CKGR_PLLAR_MUL (13 << PMC_CKGR_PLLAR_MUL_SHIFT)
+#define BOARD_CKGR_PLLAR_COUNT (63 << PMC_CKGR_PLLAR_COUNT_SHIFT)
+#define BOARD_CKGR_PLLAR_DIV PMC_CKGR_PLLAR_DIV_BYPASS
+
+/* PMC master clock register settings.
+ *
+ * Source = PLLA
+ * Divider = 2
+ */
+
+#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 << PMC_CKGR_UCKR_UPLLCOUNT_SHIFT)
+
+/* Resulting frequencies */
+
+#define BOARD_PLLA_FREQUENCY (168000000) /* PLLACK: 14 * 12Mhz / 1 */
+#define BOARD_MCK_FREQUENCY (84000000) /* MCK: PLLACK / 2 */
+#define BOARD_CPU_FREQUENCY (84000000) /* CPU: MCK */
+
+/* HSMCI clocking
+ *
+ * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
+ * divided by (2*(CLKDIV+1)).
+ *
+ * MCI_SPEED = MCCK / (2*(CLKDIV+1))
+ * CLKDIV = MCCK / MCI_SPEED / 2 - 1
+ *
+ * Where CLKDIV has a range of 0-255.
+ */
+
+/* MCK = 84MHz, CLKDIV = 104, MCI_SPEED = 84MHz / 2 * (104+1) = 400 KHz */
+
+#define HSMCI_INIT_CLKDIV (104 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 84MHz, CLKDIV = 2, MCI_SPEED = 84MHz / 2 * (2+1) = 14 MHz */
+
+#define HSMCI_MMCXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 84MHz, CLKDIV = 1, MCI_SPEED = 84MHz / 2 * (1+1) = 21 MHz */
+
+#define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
+#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
+
+/* FLASH wait states
+ *
+ * FWS MAX FREQUENCY
+ * 1.62V 1.8V
+ * --- ----- ------
+ * 0 17MHz 19MHz
+ * 1 45MHz 50MHz
+ * 2 58MHz 64MHz
+ * 3 70MHz 80MHz
+ * 4 78MHz 90MHz
+ */
+
+#define BOARD_FWS 4
+
+/* LED definitions ******************************************************************/
+/* There are four LEDs on the top, blue side of the board. Only one can be
+ * controlled by software:
+ *
+ * LED L - PB27 (PWM13)
+ *
+ * There are also four LEDs on the back, white side of the board:
+ *
+ * LED A - PC6
+ * LED B - PC5
+ * LED C - PC7
+ * LED D - PC8
+ *
+ * A high output value illuminates the LEDs.
+ *
+ * LED index values for use with board_userled():
+ */
+
+#define BOARD_LED_L 0
+#define BOARD_LED_A 1
+#define BOARD_LED_B 2
+#define BOARD_LED_C 3
+#define BOARD_LED_D 4
+#define BOARD_NLEDS 5
+
+/* LED bits for use with board_userled_all() */
+
+#define BOARD_LED_L_BIT (1 << BOARD_LED_L)
+#define BOARD_LED_A_BIT (1 << BOARD_LED_A)
+#define BOARD_LED_B_BIT (1 << BOARD_LED_B)
+#define BOARD_LED_C_BIT (1 << BOARD_LED_C)
+#define BOARD_LED_D_BIT (1 << BOARD_LED_D)
+
+/* These LEDs are available to the application and are all available to the
+ * application unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the
+ * board port is defined in include/board.h and src/sam_autoleds.c. The LEDs are
+ * used to encode OS-related events as follows:
+ *
+ * SYMBOL MEANING LED STATE
+ * L A B C D
+ * ---------------- ----------------------- --- --- --- --- ---*/
+#define LED_STARTED 0 /* NuttX has been started OFF ON OFF OFF OFF */
+#define LED_HEAPALLOCATE 1 /* Heap has been allocated OFF OFF ON OFF OFF */
+#define LED_IRQSENABLED 2 /* Interrupts enabled OFF OFF OFF ON OFF */
+#define LED_STACKCREATED 3 /* Idle stack created OFF OFF OFF OFF ON */
+#define LED_INIRQ 4 /* In an interrupt GLO N/C N/C N/C N/C */
+#define LED_SIGNAL 4 /* In a signal handler GLO N/C N/C N/C N/C */
+#define LED_ASSERTION 4 /* An assertion failed GLO N/C N/C N/C N/C */
+#define LED_PANIC 4 /* The system has crashed 2Hz N/C N/C N/C N/C */
+#undef LED_IDLE /* MCU is is sleep mode ---- Not used ----- */
+
+/* Thus if LED L is glowing on and all other LEDs are off (except LED D which
+ * was left on but is no longer controlled by NuttX and so may be in any state),
+ * NuttX has successfully booted and is, apparently, running normally and taking
+ * interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot
+ * and the LED indicates the initialization phase where the failure occurred. If
+ * LED L is flashing at approximately 2Hz, then a fatal error has been detected and
+ * the system has halted.
+ *
+ * NOTE: After booting, LEDs A-D are no longer used by the system and may be
+ * controlled the application.
+ */
+
+/* Button definitions ***************************************************************/
+/* There are no buttons on the Arduino Due board. */
+
+/* GPIO pin configurations **********************************************************/
+/* Universal Asynchronous Receiver Transceiver (UART)
+ *
+ * The SAM3X has a UART and 4 USARTS. The Programming port uses a USB-to-
+ * serial chip connected to the first of the MCU (RX0 and TX0 on PA8 and PA9,
+ * respectively). The output from that port is visible using the Arduino tool.
+ *
+ * Any of UART and USART0-3 may be used as a serial console. By default,
+ * UART0 is used as the serial console in all configurations.
+ *
+ * There are no alternatives for these pins.
+ */
+
+/* Universal Synchronous Asynchronous Receiver Transmitter (USART)
+ *
+ * The RX and TX pins are available on the Arduino connector D0 and D1 pins,
+ * respectively. These are connected to USART0, RXD0 and TXD0 which are PA10
+ * and PA11, respectively.
+ *
+ * There are four Click bus connectors with serial ports available as follows:
+ *
+ * Click A: USART0 RXD0 and TXD0 which are, again, PD10 and PD11.
+ * Click B: USART1 RXD1 and TXD1 which are PA12 and PA13, respectively.
+ * Click C: USART3 RXD3 and TXD3 which are PD5 and PD4, respectively.
+ * Click D: USART3 RXD3 and TXD3 which are, again, PD5 and PD4.
+ *
+ * There are no alternatives for these pins.
+ */
+
+#endif /* __CONFIGS_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H */
diff --git a/configs/flipnclick-sam3x/nsh/defconfig b/configs/flipnclick-sam3x/nsh/defconfig
new file mode 100644
index 00000000000..10fa31c2046
--- /dev/null
+++ b/configs/flipnclick-sam3x/nsh/defconfig
@@ -0,0 +1,44 @@
+# CONFIG_ARCH_RAMFUNCS is not set
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_PS is not set
+CONFIG_ARCH_BOARD_FLIPNCLICK_SAM3X=y
+CONFIG_ARCH_BOARD="flipnclick-sam3x"
+CONFIG_ARCH_CHIP_ATSAM3X8E=y
+CONFIG_ARCH_CHIP_SAM34=y
+CONFIG_ARCH_CHIP_SAM3X=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH="arm"
+CONFIG_BOARD_LOOPSPERMSEC=6965
+CONFIG_BUILTIN=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_POLL=y
+CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
+CONFIG_EXAMPLES_NSH=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_HOST_WINDOWS=y
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_MM_REGIONS=3
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_RAM_SIZE=65536
+CONFIG_RAM_START=0x20000000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_START_DAY=28
+CONFIG_START_MONTH=6
+CONFIG_START_YEAR=2013
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_WDOG_INTRESERVE=0
diff --git a/configs/flipnclick-sam3x/scripts/Make.defs b/configs/flipnclick-sam3x/scripts/Make.defs
new file mode 100644
index 00000000000..d012d9e51e6
--- /dev/null
+++ b/configs/flipnclick-sam3x/scripts/Make.defs
@@ -0,0 +1,109 @@
+############################################################################
+# configs/flipnclick-sam3x/scripts/Make.defs
+#
+# Copyright (C) 2018 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt
+#
+# 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/mkwindeps.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/flash.ld}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld
+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
+endif
+
+ifneq ($(CONFIG_DEBUG_NOOPT),y)
+ ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
+ARCHWARNINGSXX = -Wall -Wshadow -Wundef
+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
+
+ASMEXT = .S
+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 -Wundef -g -pipe
+HOSTLDFLAGS =
diff --git a/configs/flipnclick-sam3x/scripts/flash.ld b/configs/flipnclick-sam3x/scripts/flash.ld
new file mode 100644
index 00000000000..96d44ded1ca
--- /dev/null
+++ b/configs/flipnclick-sam3x/scripts/flash.ld
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * configs/flipnclick-sam3x/scripts/flash.ld
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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 ATSAM3X8E has 1024KB of FLASH beginning at address 0x0008:0000 and
+ * up to 64KB SRAM in three memory regions.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00080000, LENGTH = 1024K
+ sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+ sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 32K
+ nfcram (rwx) : ORIGIN = 0x20100000, LENGTH = 4K
+}
+
+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
+
+ .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(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram0 AT > flash
+
+ _eronly = LOADADDR(.data);
+
+ .ramfunc ALIGN(4):
+ {
+ _sramfuncs = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfuncs = ABSOLUTE(.);
+ } > sram0 AT > flash
+
+ _framfuncs = LOADADDR(.ramfunc);
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram0
+
+ /* 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/configs/flipnclick-sam3x/src/.gitignore b/configs/flipnclick-sam3x/src/.gitignore
new file mode 100644
index 00000000000..726d936e1e3
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/.gitignore
@@ -0,0 +1,2 @@
+/.depend
+/Make.dep
diff --git a/configs/flipnclick-sam3x/src/Makefile b/configs/flipnclick-sam3x/src/Makefile
new file mode 100644
index 00000000000..b2e781f6a9d
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/Makefile
@@ -0,0 +1,51 @@
+############################################################################
+# configs/flipnclick-sam3x/src/Makefile
+#
+# Copyright (C) 2018 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt
+#
+# 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
+
+ASRCS =
+CSRCS = sam_boot.c sam_bringup.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += sam_autoleds.c
+else
+CSRCS += sam_userleds.c
+endif
+
+ifeq ($(CONFIG_LIB_BOARDCTL),y)
+CSRCS += sam_appinit.c
+endif
+
+include $(TOPDIR)/configs/Board.mk
diff --git a/configs/flipnclick-sam3x/src/flipnclick-sam3x.h b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h
new file mode 100644
index 00000000000..e35dacbe6d1
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/flipnclick-sam3x.h
@@ -0,0 +1,114 @@
+/************************************************************************************
+ * configs/flipnclick-sam3x/src/flipnclick-sam3x.h
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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_FLIPNCLICK_SAM3X_SRC_ARDUNO_DUE_H
+#define __CONFIGS_FLIPNCLICK_SAM3X_SRC_ARDUNO_DUE_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+#include
+
+#include
+
+#include
+#include
+
+#include "chip/sam_pinmap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* There are four LEDs on the top, blue side of the board. Only one can be
+ * controlled by software:
+ *
+ * LED L - PB27 (PWM13)
+ *
+ * There are also four LEDs on the back, white side of the board:
+ *
+ * LED A - PC6
+ * LED B - PC5
+ * LED C - PC7
+ * LED D - PC8
+ *
+ * A high output value illuminates the LEDs.
+ */
+
+#define GPIO_LED_L (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
+ GPIO_PORT_PIOB | GPIO_PIN27)
+#define GPIO_LED_A (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
+ GPIO_PORT_PIOC | GPIO_PIN6)
+#define GPIO_LED_B (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
+ GPIO_PORT_PIOC | GPIO_PIN5)
+#define GPIO_LED_C (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
+ GPIO_PORT_PIOC | GPIO_PIN7)
+#define GPIO_LED_D (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
+ GPIO_PORT_PIOC | GPIO_PIN8)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: sam_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_INITIALIZE=y :
+ * Called from board_initialize().
+ *
+ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int sam_bringup(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_FLIPNCLICK_SAM3X_SRC_ARDUNO_DUE_H */
+
diff --git a/configs/flipnclick-sam3x/src/sam_appinit.c b/configs/flipnclick-sam3x/src/sam_appinit.c
new file mode 100644
index 00000000000..55499d73e5d
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/sam_appinit.c
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * config/flipnclick-sam3x/src/sam_appinit.c
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+
+#include "flipnclick-sam3x.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef OK
+# define OK 0
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_app_initialize
+ *
+ * Description:
+ * Perform application specific initialization. This function is never
+ * called directly from application code, but only indirectly via the
+ * (non-standard) boardctl() interface using the command BOARDIOC_INIT.
+ *
+ * Input Parameters:
+ * arg - The boardctl() argument is passed to the board_app_initialize()
+ * implementation without modification. The argument has no
+ * meaning to NuttX; the meaning of the argument is a contract
+ * between the board-specific initialization logic and the
+ * matching application logic. The value cold be such things as a
+ * mode enumeration value, a set of DIP switch switch settings, a
+ * pointer to configuration data read from a file or serial FLASH,
+ * or whatever you would like to do with it. Every implementation
+ * should accept zero/NULL as a default configuration.
+ *
+ * Returned Value:
+ * Zero (OK) is returned on success; a negated errno value is returned on
+ * any failure to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int board_app_initialize(uintptr_t arg)
+{
+#ifdef CONFIG_BOARD_INITIALIZE
+ /* Board initialization already performed by board_initialize() */
+
+ return OK;
+#else
+ /* Perform board-specific initialization */
+
+ return sam_bringup();
+#endif
+}
diff --git a/configs/flipnclick-sam3x/src/sam_autoleds.c b/configs/flipnclick-sam3x/src/sam_autoleds.c
new file mode 100644
index 00000000000..2a81232fd00
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/sam_autoleds.c
@@ -0,0 +1,220 @@
+/****************************************************************************
+ * configs/flipnclick-sam3x/src/sam_autoleds.c
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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 four LEDs on the top, blue side of the board. Only one can be
+ * controlled by software:
+ *
+ * LED L - PB27 (PWM13)
+ *
+ * There are also four LEDs on the back, white side of the board:
+ *
+ * LED A - PC6
+ * LED B - PC5
+ * LED C - PC7
+ * LED D - PC8
+ *
+ * A high output value illuminates the LEDs.
+ *
+ * These LEDs are available to the application and are all available to the
+ * application unless CONFIG_ARCH_LEDS is defined. In that case, the usage
+ * by the board port is defined in include/board.h and src/sam_autoleds.c.
+ * The LEDs are used to encode OS-related events as follows:
+ *
+ * SYMBOL MEANING LED STATE
+ * L A B C D
+ * ---------------- ----------------------- --- --- --- --- ---
+ * LED_STARTED NuttX has been started OFF ON OFF OFF OFF
+ * LED_HEAPALLOCATE Heap has been allocated OFF OFF ON OFF OFF
+ * LED_IRQSENABLED Interrupts enabled OFF OFF OFF ON OFF
+ * LED_STACKCREATED Idle stack created OFF OFF OFF OFF ON
+ * LED_INIRQ In an interrupt GLO N/C N/C N/C N/C
+ * LED_SIGNAL In a signal handler GLO N/C N/C N/C N/C
+ * LED_ASSERTION An assertion failed GLO N/C N/C N/C N/C
+ * LED_PANIC The system has crashed 2Hz N/C N/C N/C N/C
+ * LED_IDLE MCU is is sleep mode ---- Not used -----
+ *
+ * Thus if LED L is glowing on and all other LEDs are off (except LED D
+ * which was left on but is no longer controlled by NuttX and so may be in
+ * any state), NuttX has successfully booted and is, apparently, running
+ * normally and taking interrupts. If any of LEDs A-D are statically set,
+ * then NuttX failed to boot and the LED indicates the initialization phase
+ * where the failure occurred. If LED L is flashing at approximately 2Hz,
+ * then a fatal error has been detected and the system has halted.
+ *
+ * NOTE: After booting, LEDs A-D are no longer used by the system and may
+ * be controlled the application.
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include "chip.h"
+#include "sam_gpio.h"
+#include "flipnclick-sam3x.h"
+
+/* The board.h file may override pin configurations defined in sam_pinmap.h */
+
+#include
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_autoled_initialize
+ ****************************************************************************/
+
+void board_autoled_initialize(void)
+{
+ /* Configure LED GPIOs for output */
+
+ sam_configgpio(GPIO_LED_L);
+ sam_configgpio(GPIO_LED_A);
+ sam_configgpio(GPIO_LED_B);
+ sam_configgpio(GPIO_LED_C);
+ sam_configgpio(GPIO_LED_D);
+}
+
+/****************************************************************************
+ * Name: board_autoled_on
+ ****************************************************************************/
+
+void board_autoled_on(int led)
+{
+ /* SYMBOL MEANING LED STATE
+ * L A B C D
+ * ------------------- ----------------------- --- --- --- --- ---
+ * LED_STARTED 0 NuttX has been started OFF ON OFF OFF OFF
+ * LED_HEAPALLOCATE 1 Heap has been allocated OFF OFF ON OFF OFF
+ * LED_IRQSENABLED 2 Interrupts enabled OFF OFF OFF ON OFF
+ * LED_STACKCREATED 3 Idle stack created OFF OFF OFF OFF ON
+ * LED_INIRQ 4 In an interrupt GLO N/C N/C N/C N/C
+ * LED_SIGNAL 4 In a signal handler GLO N/C N/C N/C N/C
+ * LED_ASSERTION 4 An assertion failed GLO N/C N/C N/C N/C
+ * LED_PANIC 4 The system has crashed 2Hz N/C N/C N/C N/C
+ */
+
+ switch (led)
+ {
+ default:
+ case 0:
+ sam_gpiowrite(GPIO_LED_L, false);
+ sam_gpiowrite(GPIO_LED_A, true);
+ sam_gpiowrite(GPIO_LED_B, false);
+ sam_gpiowrite(GPIO_LED_C, false);
+ sam_gpiowrite(GPIO_LED_D, false);
+ break;
+
+ case 1:
+ sam_gpiowrite(GPIO_LED_L, false);
+ sam_gpiowrite(GPIO_LED_A, false);
+ sam_gpiowrite(GPIO_LED_B, true);
+ sam_gpiowrite(GPIO_LED_C, false);
+ sam_gpiowrite(GPIO_LED_D, false);
+ break;
+
+ case 2:
+ sam_gpiowrite(GPIO_LED_L, false);
+ sam_gpiowrite(GPIO_LED_A, false);
+ sam_gpiowrite(GPIO_LED_B, false);
+ sam_gpiowrite(GPIO_LED_C, true);
+ sam_gpiowrite(GPIO_LED_D, false);
+ break;
+
+ case 3:
+ sam_gpiowrite(GPIO_LED_L, false);
+ sam_gpiowrite(GPIO_LED_A, false);
+ sam_gpiowrite(GPIO_LED_B, false);
+ sam_gpiowrite(GPIO_LED_C, false);
+ sam_gpiowrite(GPIO_LED_D, true);
+ break;
+
+ case 4:
+ sam_gpiowrite(GPIO_LED_L, true);
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: board_autoled_off
+ ****************************************************************************/
+
+void board_autoled_off(int led)
+{
+ switch (led)
+ {
+ /* SYMBOL MEANING LED STATE
+ * L A B C D
+ * ------------------- ----------------------- --- --- --- --- ---
+ * LED_STARTED 0 NuttX has been started OFF ON OFF OFF OFF
+ * LED_HEAPALLOCATE 1 Heap has been allocated OFF OFF ON OFF OFF
+ * LED_IRQSENABLED 2 Interrupts enabled OFF OFF OFF ON OFF
+ * LED_STACKCREATED 3 Idle stack created OFF OFF OFF OFF ON
+ * LED_INIRQ 4 In an interrupt GLO N/C N/C N/C N/C
+ * LED_SIGNAL 4 In a signal handler GLO N/C N/C N/C N/C
+ * LED_ASSERTION 4 An assertion failed GLO N/C N/C N/C N/C
+ * LED_PANIC 4 The system has crashed 2Hz N/C N/C N/C N/C
+ */
+
+ switch (led)
+ {
+ default:
+ sam_gpiowrite(GPIO_LED_L, false);
+ sam_gpiowrite(GPIO_LED_A, false);
+ sam_gpiowrite(GPIO_LED_B, false);
+ sam_gpiowrite(GPIO_LED_C, false);
+ sam_gpiowrite(GPIO_LED_D, false);
+ break;
+
+ case 4:
+ sam_gpiowrite(GPIO_LED_L, false);
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/configs/flipnclick-sam3x/src/sam_boot.c b/configs/flipnclick-sam3x/src/sam_boot.c
new file mode 100644
index 00000000000..3762c8f944f
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/sam_boot.c
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * configs/flipnclick-sam3x/src/sam_boot.c
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+
+#include
+
+#include "flipnclick-sam3x.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sam_boardinitialize
+ *
+ * Description:
+ * All SAM3/4 architectures must provide the following entry point. This
+ * entry point is called early in the initialization -- after all memory
+ * has been configured and mapped but before any devices have been
+ * initialized.
+ *
+ ****************************************************************************/
+
+void sam_boardinitialize(void)
+{
+#ifdef CONFIG_ARCH_LEDS
+ /* Configure on-board LEDs if LED support has been selected. */
+
+ board_autoled_initialize();
+#endif
+}
+
+/****************************************************************************
+ * Name: board_initialize
+ *
+ * Description:
+ * If CONFIG_BOARD_INITIALIZE is selected, then an additional
+ * initialization call will be performed in the boot-up sequence to a
+ * function called board_initialize(). board_initialize() will be
+ * called immediately after up_initialize() is called and just before the
+ * initial application is started. This additional initialization phase
+ * may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_INITIALIZE
+void board_initialize(void)
+{
+ /* Perform board-specific initialization */
+
+ (void)sam_bringup();
+}
+#endif
diff --git a/configs/flipnclick-sam3x/src/sam_bringup.c b/configs/flipnclick-sam3x/src/sam_bringup.c
new file mode 100644
index 00000000000..5259eccfa0d
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/sam_bringup.c
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * config/flipnclick-sam3x/src/sam_bringup.c
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+#include
+
+#include
+
+#include "flipnclick-sam3x.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sam_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_INITIALIZE=y :
+ * Called from board_initialize().
+ *
+ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int sam_bringup(void)
+{
+ return OK;
+}
diff --git a/configs/flipnclick-sam3x/src/sam_userleds.c b/configs/flipnclick-sam3x/src/sam_userleds.c
new file mode 100644
index 00000000000..f4fc7ef155d
--- /dev/null
+++ b/configs/flipnclick-sam3x/src/sam_userleds.c
@@ -0,0 +1,150 @@
+/****************************************************************************
+ * configs/flipnclick-sam3x/src/sam_userleds.c
+ *
+ * Copyright (C) 2018 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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 four LEDs on the top, blue side of the board. Only one can be
+ * controlled by software:
+ *
+ * LED L - PB27 (PWM13)
+ *
+ * There are also four LEDs on the back, white side of the board:
+ *
+ * LED A - PC6
+ * LED B - PC5
+ * LED C - PC7
+ * LED D - PC8
+ *
+ * A high output value illuminates the LEDs.
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include "chip.h"
+#include "sam_gpio.h"
+#include "flipnclick-sam3x.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_userled_initialize
+ ****************************************************************************/
+
+void board_userled_initialize(void)
+{
+#ifndef CONFIG_ARCH_LEDS
+ /* Configure LED GPIOs for output */
+
+ sam_configgpio(GPIO_LED_L);
+ sam_configgpio(GPIO_LED_A);
+ sam_configgpio(GPIO_LED_B);
+ sam_configgpio(GPIO_LED_C);
+ sam_configgpio(GPIO_LED_D);
+#endif
+}
+
+/****************************************************************************
+ * Name: board_userled
+ ****************************************************************************/
+
+void board_userled(int led, bool ledon)
+{
+ uint32_t ledcfg;
+
+ switch (led)
+ {
+ case BOARD_LED_L:
+ ledcfg = GPIO_LED_L;
+ break;
+
+ case BOARD_LED_A:
+ ledcfg = GPIO_LED_A;
+ break;
+
+ case BOARD_LED_B:
+ ledcfg = GPIO_LED_B;
+ break;
+
+ case BOARD_LED_C:
+ ledcfg = GPIO_LED_C;
+ break;
+
+ case BOARD_LED_D:
+ ledcfg = GPIO_LED_D;
+ break;
+
+ default:
+ return;
+ }
+
+ sam_gpiowrite(ledcfg, ledon);
+}
+
+/****************************************************************************
+ * Name: board_userled_all
+ ****************************************************************************/
+
+void board_userled_all(uint8_t ledset)
+{
+ bool ledon;
+
+ ledon = ((ledset & BOARD_LED_L_BIT) != 0);
+ sam_gpiowrite(GPIO_LED_L, ledon);
+
+ ledon = ((ledset & BOARD_LED_A_BIT) != 0);
+ sam_gpiowrite(GPIO_LED_A, ledon);
+
+ ledon = ((ledset & BOARD_LED_B_BIT) != 0);
+ sam_gpiowrite(GPIO_LED_B, ledon);
+
+ ledon = ((ledset & BOARD_LED_C_BIT) != 0);
+ sam_gpiowrite(GPIO_LED_C, ledon);
+
+ ledon = ((ledset & BOARD_LED_D_BIT) != 0);
+ sam_gpiowrite(GPIO_LED_D, ledon);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/configs/stm32f4discovery/src/stm32_boot.c b/configs/stm32f4discovery/src/stm32_boot.c
index 9db063bdcda..dff5e62ca2a 100644
--- a/configs/stm32f4discovery/src/stm32_boot.c
+++ b/configs/stm32f4discovery/src/stm32_boot.c
@@ -1,4 +1,4 @@
-/************************************************************************************
+/****************************************************************************
* configs/stm32f4discovery/src/stm32_boot.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************************************/
+ ****************************************************************************/
-/************************************************************************************
+/****************************************************************************
* Included Files
- ************************************************************************************/
+ ****************************************************************************/
#include
@@ -49,25 +49,26 @@
#include "stm32.h"
#include "stm32f4discovery.h"
-/************************************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************************************/
+ ****************************************************************************/
-/************************************************************************************
+/****************************************************************************
* Name: stm32_boardinitialize
*
* Description:
- * All STM32 architectures must provide the following entry point. This entry point
- * is called early in the initialization -- after all memory has been configured
- * and mapped but before any devices have been initialized.
+ * All STM32 architectures must provide the following entry point. This
+ * entry point is called early in the initialization -- after all memory
+ * has been configured and mapped but before any devices have been
+ * initialized.
*
- ************************************************************************************/
+ ****************************************************************************/
void stm32_boardinitialize(void)
{
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
- /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
- * stm32_spidev_initialize() has been brought into the link.
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak
+ * function stm32_spidev_initialize() has been brought into the link.
*/
if (stm32_spidev_initialize)
diff --git a/configs/stm32f4discovery/src/stm32f4discovery.h b/configs/stm32f4discovery/src/stm32f4discovery.h
index ef4cae05947..51936d9485a 100644
--- a/configs/stm32f4discovery/src/stm32f4discovery.h
+++ b/configs/stm32f4discovery/src/stm32f4discovery.h
@@ -392,6 +392,22 @@
* Public Functions
****************************************************************************/
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_INITIALIZE=y :
+ * Called from board_initialize().
+ *
+ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void);
+
/****************************************************************************
* Name: stm32_spidev_initialize
*
@@ -465,22 +481,6 @@ int stm32_lis3dshinitialize(FAR const char *devpath);
int nunchuck_initialize(FAR char *devname);
#endif
-/****************************************************************************
- * Name: stm32_bringup
- *
- * Description:
- * Perform architecture-specific initialization
- *
- * CONFIG_BOARD_INITIALIZE=y :
- * Called from board_initialize().
- *
- * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
- * Called from the NSH library
- *
- ****************************************************************************/
-
-int stm32_bringup(void);
-
/****************************************************************************
* Name: stm32_usbinitialize
*
diff --git a/fs/nxffs/README.txt b/fs/nxffs/README.txt
index e7d38e4e634..60e06219fe7 100644
--- a/fs/nxffs/README.txt
+++ b/fs/nxffs/README.txt
@@ -177,4 +177,9 @@ Things to Do
a good but empty state... all ready for file system re-organization.
- And worse, when NXFSS reorganization the FLASH a power cycle can
damage the file system content if it happens at the wrong time.
+- The current design does not permit re-opening of files for write access
+ unless the file is truncated to zero length. This effectively prohibits
+ implementation of a proper turncate() method which should alter the
+ size of a previously written file. There is some fragmentray logic in
+ place but even this is conditioned out with __NO_TRUNCATE_SUPPORT__.