summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2015-01-13 17:47:13 +0100
committerJakob Odersky <jodersky@gmail.com>2015-01-13 17:47:13 +0100
commitf2c417a2af5816b562516d40532498db3d4d12b6 (patch)
tree3d248733264da55c6530a349f0734103ec69363d
parent88c4630e4897e7ffac04ccc6788e06dc62b42069 (diff)
downloadnuttx-f2c417a2af5816b562516d40532498db3d4d12b6.tar.gz
nuttx-f2c417a2af5816b562516d40532498db3d4d12b6.tar.bz2
nuttx-f2c417a2af5816b562516d40532498db3d4d12b6.zip
add teensy31 config
-rw-r--r--nuttx/arch/arm/include/kinetis/irq.h2
-rw-r--r--nuttx/arch/arm/src/kinetis/Kconfig8
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_k20pinmux.h80
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_pinmux.h4
-rwxr-xr-xnuttx/configs/Kconfig12
-rw-r--r--nuttx/configs/teensy31/Kconfig7
-rw-r--r--nuttx/configs/teensy31/README.txt543
-rw-r--r--nuttx/configs/teensy31/include/board.h176
-rw-r--r--nuttx/configs/teensy31/ostest/Make.defs110
-rw-r--r--nuttx/configs/teensy31/ostest/defconfig796
-rwxr-xr-xnuttx/configs/teensy31/ostest/setenv.sh61
-rwxr-xr-xnuttx/configs/teensy31/scripts/ld.script142
-rw-r--r--nuttx/configs/teensy31/src/.gitignore2
-rw-r--r--nuttx/configs/teensy31/src/Makefile103
-rw-r--r--nuttx/configs/teensy31/src/kwikstik-internal.h195
-rw-r--r--nuttx/configs/teensy31/src/up_boot.c91
-rw-r--r--nuttx/configs/teensy31/src/up_buttons.c126
-rw-r--r--nuttx/configs/teensy31/src/up_lcd.c134
-rw-r--r--nuttx/configs/teensy31/src/up_leds.c129
-rw-r--r--nuttx/configs/teensy31/src/up_nsh.c258
-rw-r--r--nuttx/configs/teensy31/src/up_spi.c164
-rw-r--r--nuttx/configs/teensy31/src/up_usbdev.c115
-rw-r--r--nuttx/configs/teensy31/src/up_usbmsc.c118
23 files changed, 3374 insertions, 2 deletions
diff --git a/nuttx/arch/arm/include/kinetis/irq.h b/nuttx/arch/arm/include/kinetis/irq.h
index 11969f492..847ed428b 100644
--- a/nuttx/arch/arm/include/kinetis/irq.h
+++ b/nuttx/arch/arm/include/kinetis/irq.h
@@ -162,7 +162,7 @@
* K40P144M100SF2RM
*/
-#if defined(CONFIG_ARCH_CHIP_MK40X128VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X128VMD100) || \
+#elif defined(CONFIG_ARCH_CHIP_MK40X128VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X128VMD100) || \
defined(CONFIG_ARCH_CHIP_MK40X256VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X256VMD100) || \
defined(CONFIG_ARCH_CHIP_MK40N512VLQ100) || defined(CONFIG_ARCH_CHIP_MK40N512VMD100)
diff --git a/nuttx/arch/arm/src/kinetis/Kconfig b/nuttx/arch/arm/src/kinetis/Kconfig
index 786ab2002..ff1fd735c 100644
--- a/nuttx/arch/arm/src/kinetis/Kconfig
+++ b/nuttx/arch/arm/src/kinetis/Kconfig
@@ -10,6 +10,10 @@ choice
default ARCH_CHIP_MK60N512VMD100
depends on ARCH_CHIP_KINETIS
+config ARCH_CHIP_MK20DX256VLH7
+ bool "MK20DX256VLH7"
+ select ARCH_FAMILY_K20
+
config ARCH_CHIP_MK40N512VLQ100
bool "MK40N512VLQ100"
select ARCH_FAMILY_K40
@@ -62,6 +66,10 @@ endchoice
# Chip families
+config ARCH_FAMILY_K20
+ bool
+ default n
+
config ARCH_FAMILY_K40
bool
default n
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_k20pinmux.h b/nuttx/arch/arm/src/kinetis/kinetis_k20pinmux.h
new file mode 100644
index 000000000..e5592ce6a
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/kinetis_k20pinmux.h
@@ -0,0 +1,80 @@
+/********************************************************************************************
+ * arch/arm/src/kinetis/kinetis_k40pinmux.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_KINETIS_KINETIS_K40PINMUX_H
+#define __ARCH_ARM_SRC_KINETIS_KINETIS_K40PINMUX_H
+
+/********************************************************************************************
+ * Included Files
+ ********************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip.h"
+
+/********************************************************************************************
+ * Pre-processor Definitions
+ ********************************************************************************************/
+/* Reference: Paragraph 10.3.1, p 207, of FreeScale document K20P64M72SF1RM
+ *
+ * In most cases, there are alternative configurations for various pins. Those alternative
+ * pins are labeled with a suffix like _1, _2, etc. in order to distinguish them. Logic in
+ * the board.h file must select the correct pin configuration for the board by defining a pin
+ * configuration (with no suffix) that maps to the correct alternative.
+ */
+
+#if defined(CONFIG_ARCH_CHIP_MK20DX256VLH7)
+
+/* Pin configurations are deferred to board configuration */
+
+#else
+ /* The pin muxing for other K20 parts is defined in other documents */
+
+# error "No pin multiplexing for this Kinetis K20 part"
+#endif
+
+/********************************************************************************************
+ * Public Types
+ ********************************************************************************************/
+
+/********************************************************************************************
+ * Public Data
+ ********************************************************************************************/
+
+/********************************************************************************************
+ * Public Functions
+ ********************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_KINETIS_KINETIS_K40PINMUX_H */
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_pinmux.h b/nuttx/arch/arm/src/kinetis/kinetis_pinmux.h
index 9c791539f..4359728b6 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_pinmux.h
+++ b/nuttx/arch/arm/src/kinetis/kinetis_pinmux.h
@@ -48,7 +48,9 @@
* by the logic in chip.h.
*/
-#if defined(KINETIS_K40)
+#if defined(KINETIS_K20)
+# include "kinetis_k20pinmux.h"
+#elif defined(KINETIS_K40)
# include "kinetis_k40pinmux.h"
#elif defined(KINETIS_K60)
# include "kinetis_k60pinmux.h"
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig
index 91ea7de0a..3caafc7d5 100755
--- a/nuttx/configs/Kconfig
+++ b/nuttx/configs/Kconfig
@@ -808,6 +808,14 @@ config ARCH_BOARD_TEENSY
developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
on an Atmel AT90USB1286 MCU.
+config ARCH_BOARD_TEENSY_3_1
+ bool "PJRC Teensy 3.1 board"
+ depends on ARCH_CHIP_MK20DX256VLH7
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is the port of NuttX to the PJRC Teensy 3.1 board. This board is
+ developed by http://pjrc.com/teensy31/.
+
config ARCH_BOARD_TM4C123G_LAUNCHPAD
bool "Tiva TM4C123G LaunchPad"
depends on ARCH_CHIP_TM4C123GH6PMI
@@ -1085,6 +1093,7 @@ config ARCH_BOARD
default "mikroe-stm32f4" if ARCH_BOARD_MIKROE_STM32F4
default "sure-pic32mx" if ARCH_BOARD_SUREPIC32MX
default "teensy" if ARCH_BOARD_TEENSY
+ default "teensy31" if ARCH_BOARD_TEENSY_3_1
default "tm4c123g-launchpad" if ARCH_BOARD_TM4C123G_LAUNCHPAD
default "cc3200-launchpad" if ARCH_BOARD_CC3200_LAUNCHPAD
default "twr-k60n512" if ARCH_BOARD_TWR_K60N512
@@ -1387,6 +1396,9 @@ endif
if ARCH_BOARD_TEENSY
source "configs/teensy/Kconfig"
endif
+if ARCH_BOARD_TEENSY_3_1
+source "configs/teensy31/Kconfig"
+endif
if ARCH_BOARD_TM4C123G_LAUNCHPAD
source "configs/tm4c123g-launchpad/Kconfig"
endif
diff --git a/nuttx/configs/teensy31/Kconfig b/nuttx/configs/teensy31/Kconfig
new file mode 100644
index 000000000..04737ea15
--- /dev/null
+++ b/nuttx/configs/teensy31/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_TEENSY_3_1
+endif
diff --git a/nuttx/configs/teensy31/README.txt b/nuttx/configs/teensy31/README.txt
new file mode 100644
index 000000000..997d31b8a
--- /dev/null
+++ b/nuttx/configs/teensy31/README.txt
@@ -0,0 +1,543 @@
+README.txt
+==========
+
+This is the README file for the port of NuttX to the Freescale Kinetis
+KwiStick K40. Refer to the Freescale web site for further information
+about this part:
+http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KWIKSTIK-K40
+
+The Kwikstik is used with the FreeScale Tower System (mostly just to
+provide a simple UART connection)
+
+Contents
+========
+
+ o Kinetis KwikStik-K40 Features
+ o Kinetis KwikStik-K60 Pin Configuration
+ - On-Board Connections
+ - Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ - Connections via the Tower Primary Connector Side A
+ - Connections via the Tower Primary Connector Side B
+ - TWR-SER Serial Board Connection
+ o Development Environment
+ o GNU Toolchain Options
+ o IDEs
+ o NuttX EABI "buildroot" Toolchain
+ o NuttX OABI "buildroot" Toolchain
+ o NXFLAT Toolchain
+
+Kinetis KwikStik-K40 Features:
+==============================
+
+ o Kinetis K40 MCU in 144 LQFP
+ - 100 MHz ARM Cortex-M4 core
+ - 256Kb program flash, 256Kb FlexMemory
+ - Full-speed USB 2.0 device
+ - Low-pwer segment LCD controller
+ - SPI, UART, CAN and more
+ o Large segment LCD display with 306 segments
+ o 2.3mm audio output and 2 micro USB connectors
+ o Omnidirectional microphone and a buzzer
+ o On-board Segger J-Link debugger interface
+ o Infrared communication port
+ o microSD card slot
+ o Capacitive touch sensing interface
+ o Freescale Tower System connectivity for UART, timers, CAN, SPI, I2C, and DAC
+ o Freescale Tower plug-in (TWRPI) socket connectivity for ADC, SPI, I2C, and GPIO
+
+Kinetis KwikStik-K40 Pin Configuration
+======================================
+
+On-Board Connections
+------------------- -------------------------- -------- -------------------
+FEATURE CONNECTION PORT/PIN PIN FUNCTION
+------------------- -------------------------- -------- -------------------
+Audio Jack Output Audio Amp On PTE28 PTE28
+ Audio Output DAC1_OUT DAC1_OUT
+ Volume Up PTD10 PTD10
+ Volume Down PTD11 PTD11
+Buzzer Audio Out PTA8 FTM1_CH0
+Microphone Microphone input PTA7 ADC0_SE10
+SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ SD Command PTE3 SDHC0_CMD
+ SD Data0 PTD12 SDHC0_D4
+ SD Data1 PTD13 SDHC0_D5
+ SD Data2 PTD14 SDHC0_D6
+ SD Data3 PTD15 SDHC0_D7
+ SD Card Detect PTE27 PTE27
+ SD Card On PTE6 PTE6
+Infrared Port IR Transmit PTE4 IR_TX
+ IR Receive PTA13 CMP2_IN0
+Touch Pads E1 / Touch PTB0 TSI0_CH0
+ E2 / Touch PTA4 TSI0_CH5
+ E3 / Touch PTA24 PTA24
+ E4 / Touch PTA25 PTA25
+ E5 / Touch PTA26 PTA26
+ E6 / Touch PTA27 PTA27
+
+Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+------------------- -------------------------- -------- -------------------
+FEATURE CONNECTION PORT/PIN PIN FUNCTION
+------------------- -------------------------- -------- -------------------
+General Purpose TWRPI AN0 (J8 Pin 8) ? ADC0_DP0/ADC1_DP3
+TWRPI Socket TWRPI AN1 (J8 Pin 9) ? ADC0_DM0/ADC1_DM3
+ TWRPI AN2 (J8 Pin 12) ? ADC1_DP0/ADC0_DP3
+ TWRPI ID0 (J8 Pin 17) ? ADC0_DP1
+ TWRPI ID1 (J8 Pin 18) ? ADC0_DM1
+ TWRPI I2C SCL (J9 Pin 3) PTC10 I2C1_SCL
+ TWRPI I2C SDA (J9 Pin 4) PTC11 I2C1_SDA
+ TWRPI SPI MISO (J9 Pin 9) PTB23 SPI2_SIN
+ TWRPI SPI MOSI (J9 Pin 10) PTB22 SPI2_SOUT
+ TWRPI SPI SS (J9 Pin 11) PTB20 SPI2_PCS0
+ TWRPI SPI CLK (J9 Pin 12) PTB21 SPI2_SCK
+ TWRPI GPIO0 (J9 Pin 15) PTC12 PTC12
+ TWRPI GPIO1 (J9 Pin 16) PTB9 PTB9
+ TWRPI GPIO2 (J9 Pin 17) PTB10 PTB10
+ TWRPI GPIO3 (J9 Pin 18) PTC5 PTC5
+ TWRPI GPIO4 (J9 Pin 19) PTA5 PTA5
+
+The KwikStik features an expansion card-edge connector that interfaces to the Primary Elevator board in a Tower system (Primary side).
+
+Connections via the Tower Primary Connector Side A
+--- -------------------- --------------------------------
+PIN NAME USAGE
+--- -------------------- --------------------------------
+A9 GPIO9 / CTS1 PTE10/UART_CTS
+A43 RXD1 PTE9/UART_RX
+A44 TXD1 PTE8/UART_TX
+A63 RSTOUT_b PTA9/FTM1_CH1
+
+Connections via the Tower Primary Connector Side B
+--- -------------------- --------------------------------
+PIN NAME USAGE
+--- -------------------- --------------------------------
+B21 GPIO1 / RTS1 PTE7/UART_RTS
+B37 PWM7 PTA8/FTM1_CH0
+B38 PWM6 PTA9/FTM1_CH1
+B41 CANRX0 PTE25/CAN1_RX
+B42 CANTX0 PTE24/CAN1_TX
+B44 SPI0_MISO PTA17/SPI0_SIN
+B45 SPI0_MOSI PTA16/SPI0_SOUT
+B46 SPI0_CS0_b PTA14/SPI0_PCS0
+B48 SPI0_CLK PTA15/SPI0_SCK
+B50 SCL1 PTE1/I2C1_SCL
+B51 SDA1 PTE0/I2C1_SDA
+B52 GPIO5 / SD_CARD_DET PTA16
+
+TWR-SER Serial Board Connection
+===============================
+
+The serial board connects into the tower and then maps to the tower pins to
+yet other functions (see TWR-SER.pdf).
+
+For the serial port, the following jumpers are required:
+
+ J15: 1-2 (default)
+ J17: 1-2 (default)
+ J18: 1-2 (default)
+ J19: 1-2 (default)
+
+The two connections map as follows:
+
+ A41 RXD0 - Not connected
+ A42 TXD0 - Not connected
+ A43 RXD1 - ELE_RXD (connects indirectory to DB-9 connector J8)
+ A44 TXD1 - ELE_TXD (connects indirectory to DB-9 connector J8)
+
+Finally, we can conclude that
+
+ UART5 (PTE8/9) is associated with the DB9 connector
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+=====================
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the CodeSourcery Windows toolchain. To
+ use the devkitARM or the NuttX GNU toolchain, you simply need to change the
+ the following configuration options to your .config (or defconfig) file:
+
+ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM=y : devkitARM under Windows
+ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/k40,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/kinetis/k40_vectors.S.
+
+NuttX EABI "buildroot" Toolchain
+================================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M4 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M4 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/projects/nuttx/files/buildroot/).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ NOTE: The NuttX toolchain may not include optimizations for Cortex-M4 (ARMv7E-M).
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh kwikstik-k40/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-eabi-defconfig-4.6.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ details PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M4 toolchain for Cygwin under Windows.
+
+ NOTE: Unfortunately, the 4.6.3 EABI toolchain is not compatible with the
+ the NXFLAT tools. See the top-level TODO file (under "Binary loaders") for
+ more information about this problem. If you plan to use NXFLAT, please do not
+ use the GCC 4.6.3 EABI toochain; instead use the GCC 4.3.3 OABI toolchain.
+ See instructions below.
+
+NuttX OABI "buildroot" Toolchain
+================================
+
+ The older, OABI buildroot toolchain is also available. To use the OABI
+ toolchain:
+
+ 1. When building the buildroot toolchain, either (1) modify the cortexm3-eabi-defconfig-4.6.3
+ configuration to use EABI (using 'make menuconfig'), or (2) use an exising OABI
+ configuration such as cortexm3-defconfig-4.3.3
+
+ 2. Modify the Make.defs file to use the OABI conventions:
+
+ +CROSSDEV = arm-nuttx-elf-
+ +ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
+ -CROSSDEV = arm-nuttx-eabi-
+ -ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
+
+NXFLAT Toolchain
+================
+
+ If you are *not* using the NuttX buildroot toolchain and you want to use
+ the NXFLAT tools, then you will still have to build a portion of the buildroot
+ tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
+ be downloaded from the NuttX SourceForge download site
+ (https://sourceforge.net/projects/nuttx/files/).
+
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lpcxpresso-lpc1768/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-nxflat .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly builtNXFLAT binaries.
+
+KwikStik-K40-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This sould
+ 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_CORTEXM4=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=k40
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_MK40X256VLQ100
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=kwikstik-k40 (for the KwikStik-K40 development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_KWIKSTIK_K40=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_RAM_SIZE=0x00010000 (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
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_KINETIS_TRACE -- Enable trace clocking on power up.
+ CONFIG_KINETIS_FLEXBUS -- Enable flexbus clocking on power up.
+ CONFIG_KINETIS_UART0 -- Support UART0
+ CONFIG_KINETIS_UART1 -- Support UART1
+ CONFIG_KINETIS_UART2 -- Support UART2
+ CONFIG_KINETIS_UART3 -- Support UART3
+ CONFIG_KINETIS_UART4 -- Support UART4
+ CONFIG_KINETIS_UART5 -- Support UART5
+ CONFIG_KINETIS_ENET -- Support Ethernet (K60 only)
+ CONFIG_KINETIS_RNGB -- Support the random number generator(K60 only)
+ CONFIG_KINETIS_FLEXCAN0 -- Support FlexCAN0
+ CONFIG_KINETIS_FLEXCAN1 -- Support FlexCAN1
+ CONFIG_KINETIS_SPI0 -- Support SPI0
+ CONFIG_KINETIS_SPI1 -- Support SPI1
+ CONFIG_KINETIS_SPI2 -- Support SPI2
+ CONFIG_KINETIS_I2C0 -- Support I2C0
+ CONFIG_KINETIS_I2C1 -- Support I2C1
+ CONFIG_KINETIS_I2S -- Support I2S
+ CONFIG_KINETIS_DAC0 -- Support DAC0
+ CONFIG_KINETIS_DAC1 -- Support DAC1
+ CONFIG_KINETIS_ADC0 -- Support ADC0
+ CONFIG_KINETIS_ADC1 -- Support ADC1
+ CONFIG_KINETIS_CMP -- Support CMP
+ CONFIG_KINETIS_VREF -- Support VREF
+ CONFIG_KINETIS_SDHC -- Support SD host controller
+ CONFIG_KINETIS_FTM0 -- Support FlexTimer 0
+ CONFIG_KINETIS_FTM1 -- Support FlexTimer 1
+ CONFIG_KINETIS_FTM2 -- Support FlexTimer 2
+ CONFIG_KINETIS_LPTIMER -- Support the low power timer
+ CONFIG_KINETIS_RTC -- Support RTC
+ CONFIG_KINETIS_SLCD -- Support the segment LCD (K40 only)
+ CONFIG_KINETIS_EWM -- Support the external watchdog
+ CONFIG_KINETIS_CMT -- Support Carrier Modulator Transmitter
+ CONFIG_KINETIS_USBOTG -- Support USB OTG (see also CONFIG_USBHOST and CONFIG_USBDEV)
+ CONFIG_KINETIS_USBDCD -- Support the USB Device Charger Detection module
+ CONFIG_KINETIS_LLWU -- Support the Low Leakage Wake-Up Unit
+ CONFIG_KINETIS_TSI -- Support the touch screeen interface
+ CONFIG_KINETIS_FTFL -- Support FLASH
+ CONFIG_KINETIS_DMA -- Support DMA
+ CONFIG_KINETIS_CRC -- Support CRC
+ CONFIG_KINETIS_PDB -- Support the Programmable Delay Block
+ CONFIG_KINETIS_PIT -- Support Programmable Interval Timers
+ CONFIG_ARMV7M_MPU -- Support the MPU
+
+ Kinetis interrupt priorities (Default is the mid priority) These should
+ not be set because they can cause unhandled, nested interrupts. All
+ interrupts need to be at the default priority in the current design.
+
+ CONFIG_KINETIS_UART0PRIO
+ CONFIG_KINETIS_UART1PRIO
+ CONFIG_KINETIS_UART2PRIO
+ CONFIG_KINETIS_UART3PRIO
+ CONFIG_KINETIS_UART4PRIO
+ CONFIG_KINETIS_UART5PRIO
+
+ CONFIG_KINETIS_SDHC_PRIO
+
+ PIN Interrupt Support
+
+ CONFIG_GPIO_IRQ -- Enable pin interrtup support. Also needs
+ one or more of the following:
+ CONFIG_KINETIS_PORTAINTS -- Support 32 Port A interrupts
+ CONFIG_KINETIS_PORTBINTS -- Support 32 Port B interrupts
+ CONFIG_KINETIS_PORTCINTS -- Support 32 Port C interrupts
+ CONFIG_KINETIS_PORTDINTS -- Support 32 Port D interrupts
+ CONFIG_KINETIS_PORTEINTS -- Support 32 Port E interrupts
+
+ Kinetis K40 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn (n=0..5) for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART.
+ CONFIG_UARTn_BITS - The number of bits. Must be either 8 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+
+ KwikStik-K40 LCD Hardware Configuration
+
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. Default is this 320x240 "landscape" orientation
+ (this setting is informative only... not used).
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support. In this orientation, the KwikStik-K40's
+ LCD ribbon cable is at the bottom of the display. Default is
+ 320x240 "landscape" orientation.
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support. In this orientation, the
+ KwikStik-K40's LCD ribbon cable is at the top of the display.
+ Default is 320x240 "landscape" orientation.
+ CONFIG_LCD_BACKLIGHT - Define to support an adjustable backlight
+ using timer 1. The granularity of the settings is determined
+ by CONFIG_LCD_MAXPOWER. Requires CONFIG_KINETIS_TIM1.
+
+Configurations
+==============
+
+Each KwikStik-K40 configuration is maintained in a sub-directory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh kwikstik-k40/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+ NOTES:
+
+ 1. This configuration uses the mconf-based configuration tool. To
+ change this configuration using that tool, you should:
+
+ a. Build and install the kconfig-mconf tool. See nuttx/README.txt
+ and misc/tools/
+
+ b. Execute 'make menuconfig' in nuttx/ in order to start the
+ reconfiguration process.
+
+ 2. Default platform/toolchain:
+
+ CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too).
+ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot (arm-nuttx-elf-gcc)
+ CONFIG_ARMV7M_OABI_TOOLCHAIN=y : The older OABI version
+ CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary
diff --git a/nuttx/configs/teensy31/include/board.h b/nuttx/configs/teensy31/include/board.h
new file mode 100644
index 000000000..cc44e5a16
--- /dev/null
+++ b/nuttx/configs/teensy31/include/board.h
@@ -0,0 +1,176 @@
+/************************************************************************************
+ * configs/kwikstik-k40/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* The Kwikstik-K40 has a 4MHz crystal on board */
+
+#define BOARD_EXTCLOCK 1 /* External clock */
+#define BOARD_EXTAL_FREQ 72000000 /* 50MHz Oscillator */
+#define BOARD_XTAL32_FREQ 32768 /* 32KHz RTC Oscillator */
+
+/* PLL Configuration. NOTE: Only even frequency crystals are supported that will
+ * produce a 2MHz reference clock to the PLL.
+ *
+ * PLL Input frequency: PLLIN = REFCLK/PRDIV = 4MHz/2 = 2MHz
+ * PLL Output frequency: PLLOUT = PLLIN*VDIV = 2Mhz*48 = 96MHz
+ * MCG Frequency: PLLOUT = 96MHz
+ */
+
+#define BOARD_PRDIV 25 /* PLL External Reference Divider */
+#define BOARD_VDIV 48 /* PLL VCO Divider (frequency multiplier) */
+
+#define BOARD_PLLIN_FREQ (BOARD_EXTAL_FREQ / BOARD_PRDIV)
+#define BOARD_PLLOUT_FREQ (BOARD_PLLIN_FREQ * BOARD_VDIV)
+#define BOARD_MCG_FREQ BOARD_PLLOUT_FREQ
+
+/* SIM CLKDIV1 dividers */
+
+#define BOARD_OUTDIV1 1 /* Core = MCG, 96MHz */
+#define BOARD_OUTDIV2 2 /* Bus = MCG/2, 48MHz */
+#define BOARD_OUTDIV3 2 /* FlexBus = MCG/2, 48MHz */
+#define BOARD_OUTDIV4 4 /* Flash clock = MCG/4, 24MHz */
+
+#define BOARD_CORECLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV1)
+#define BOARD_BUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV2)
+#define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3)
+#define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4)
+
+/* SIM CLKDIV1 dividers */
+
+#define BOARD_OUTDIV1 1 /* Core = MCG, 96MHz */
+#define BOARD_OUTDIV2 2 /* Bus = MCG/2, 48MHz */
+#define BOARD_OUTDIV3 2 /* FlexBus = MCG/2, 48MHz */
+#define BOARD_OUTDIV4 4 /* Flash clock = MCG/4, 24MHz */
+
+#define BOARD_CORECLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV1)
+#define BOARD_BUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV2)
+#define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3)
+#define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4)
+
+/* LED definitions ******************************************************************/
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Alternative pin resolution *******************************************************/
+
+//Telemetry
+#define PIN_UART0_RX (PIN_PORTB | PIN16 | PIN_ALT3)
+#define PIN_UART0_TX (PIN_PORTB | PIN17 | PIN_ALT3)
+
+//GPS
+#define PIN_UART2_RX (PIN_PORTD | PIN2 | PIN_ALT3)
+#define PIN_UART2_TX (PIN_PORTD | PIN3 | PIN_ALT3)
+
+//AUX0
+#define PIN_FTM0_CH2 (PIN_PORTC | PIN3 | PIN_ALT4)
+
+//AUX1
+#define PIN_FTM0_CH3 (PIN_PORTC | PIN4 | PIN_ALT4)
+
+//M0
+#define PIN_FTM0_CH5 (PIN_PORTD | PIN5 | PIN_ALT4)
+
+//M1
+#define PIN_FTM0_CH6 (PIN_PORTD | PIN6 | PIN_ALT4)
+
+//M2
+#define PIN_FTM0_CH0 (PIN_PORTC | PIN1 | PIN_ALT4)
+
+//M3
+#define PIN_FTM0_CH1 (PIN_PORTC | PIN2 | PIN_ALT4)
+
+//Battery voltage
+#define PIN_ADC0_SE8 (PIN_PORTB | PIN1 | PIN_ANALOG)
+
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All kinetis 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.
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_boardinitialize(void);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/teensy31/ostest/Make.defs b/nuttx/configs/teensy31/ostest/Make.defs
new file mode 100644
index 000000000..6715f309a
--- /dev/null
+++ b/nuttx/configs/teensy31/ostest/Make.defs
@@ -0,0 +1,110 @@
+############################################################################
+# configs/kwikstik-k40/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/copydir.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+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
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-nuttx-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/teensy31/ostest/defconfig b/nuttx/configs/teensy31/ostest/defconfig
new file mode 100644
index 000000000..edca89ba6
--- /dev/null
+++ b/nuttx/configs/teensy31/ostest/defconfig
@@ -0,0 +1,796 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+# CONFIG_DEFAULT_SMALL is not set
+CONFIG_HOST_LINUX=y
+# CONFIG_HOST_OSX is not set
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+
+#
+# Build Configuration
+#
+CONFIG_APPS_DIR="../apps"
+CONFIG_BUILD_FLAT=y
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+CONFIG_INTELHEX_BINARY=y
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+# CONFIG_UBOOT_UIMAGE is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDINT_H is not set
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+CONFIG_ARCH_HAVE_STACKCHECK=y
+# CONFIG_ARCH_HAVE_HEAPCHECK is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+CONFIG_ARCH_HAVE_CUSTOMOPT=y
+# CONFIG_DEBUG_NOOPT is not set
+# CONFIG_DEBUG_CUSTOMOPT is not set
+CONFIG_DEBUG_FULLOPT=y
+
+#
+# System Type
+#
+CONFIG_ARCH_ARM=y
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="arm"
+
+#
+# ARM Options
+#
+# CONFIG_ARCH_CHIP_A1X is not set
+# CONFIG_ARCH_CHIP_C5471 is not set
+# CONFIG_ARCH_CHIP_CALYPSO is not set
+# CONFIG_ARCH_CHIP_DM320 is not set
+# CONFIG_ARCH_CHIP_EFM32 is not set
+# CONFIG_ARCH_CHIP_IMX is not set
+CONFIG_ARCH_CHIP_KINETIS=y
+# CONFIG_ARCH_CHIP_KL is not set
+# CONFIG_ARCH_CHIP_LM is not set
+# CONFIG_ARCH_CHIP_TIVA is not set
+# CONFIG_ARCH_CHIP_LPC17XX is not set
+# CONFIG_ARCH_CHIP_LPC214X is not set
+# CONFIG_ARCH_CHIP_LPC2378 is not set
+# CONFIG_ARCH_CHIP_LPC31XX is not set
+# CONFIG_ARCH_CHIP_LPC43XX is not set
+# CONFIG_ARCH_CHIP_NUC1XX is not set
+# CONFIG_ARCH_CHIP_SAMA5 is not set
+# CONFIG_ARCH_CHIP_SAMD is not set
+# CONFIG_ARCH_CHIP_SAM34 is not set
+# CONFIG_ARCH_CHIP_STM32 is not set
+# CONFIG_ARCH_CHIP_STR71X is not set
+# CONFIG_ARCH_ARM7TDMI is not set
+# CONFIG_ARCH_ARM926EJS is not set
+# CONFIG_ARCH_ARM920T is not set
+# CONFIG_ARCH_CORTEXM0 is not set
+# CONFIG_ARCH_CORTEXM3 is not set
+CONFIG_ARCH_CORTEXM4=y
+# CONFIG_ARCH_CORTEXA5 is not set
+# CONFIG_ARCH_CORTEXA8 is not set
+CONFIG_ARCH_FAMILY="armv7-m"
+CONFIG_ARCH_CHIP="kinetis"
+# CONFIG_ARMV7M_USEBASEPRI is not set
+CONFIG_ARCH_HAVE_FPU=y
+# CONFIG_ARCH_FPU is not set
+# CONFIG_ARMV7M_MPU is not set
+
+#
+# ARMV7M Configuration Options
+#
+# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set
+# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
+# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set
+CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y
+# CONFIG_ARMV7M_ITMSYSLOG is not set
+
+#
+# Kinetis Configuration Options
+#
+CONFIG_ARCH_CHIP_MK20DX256VLH7=y
+# CONFIG_ARCH_CHIP_MK40N512VLQ100 is not set
+# CONFIG_ARCH_CHIP_MK40N512VMD100 is not set
+# CONFIG_ARCH_CHIP_MK40X128VLQ100 is not set
+# CONFIG_ARCH_CHIP_MK40X128VMD100 is not set
+# CONFIG_ARCH_CHIP_MK40X256VLQ100 is not set
+# CONFIG_ARCH_CHIP_MK40X256VMD100 is not set
+# CONFIG_ARCH_CHIP_MK60N256VLQ100 is not set
+# CONFIG_ARCH_CHIP_MK60N256VMD100 is not set
+# CONFIG_ARCH_CHIP_MK60N512VLQ100 is not set
+# CONFIG_ARCH_CHIP_MK60N512VMD100 is not set
+# CONFIG_ARCH_CHIP_MK60X256VLQ100 is not set
+# CONFIG_ARCH_CHIP_MK60X256VMD100 is not set
+CONFIG_ARCH_FAMILY_K20=y
+# CONFIG_ARCH_FAMILY_K40 is not set
+# CONFIG_ARCH_FAMILY_K60 is not set
+
+#
+# Kinetis Peripheral Support
+#
+# CONFIG_KINETIS_TRACE is not set
+# CONFIG_KINETIS_FLEXBUS is not set
+CONFIG_KINETIS_UART0=y
+# CONFIG_KINETIS_UART1 is not set
+# CONFIG_KINETIS_UART2 is not set
+# CONFIG_KINETIS_UART3 is not set
+# CONFIG_KINETIS_UART4 is not set
+# CONFIG_KINETIS_UART5 is not set
+# CONFIG_KINETIS_FLEXCAN0 is not set
+# CONFIG_KINETIS_FLEXCAN1 is not set
+# CONFIG_KINETIS_SPI0 is not set
+# CONFIG_KINETIS_SPI1 is not set
+# CONFIG_KINETIS_SPI2 is not set
+# CONFIG_KINETIS_I2C0 is not set
+# CONFIG_KINETIS_I2C1 is not set
+# CONFIG_KINETIS_I2S is not set
+# CONFIG_KINETIS_DAC0 is not set
+# CONFIG_KINETIS_DAC1 is not set
+# CONFIG_KINETIS_ADC0 is not set
+# CONFIG_KINETIS_ADC1 is not set
+# CONFIG_KINETIS_CMP is not set
+# CONFIG_KINETIS_VREF is not set
+# CONFIG_KINETIS_SDHC is not set
+# CONFIG_KINETIS_FTM0 is not set
+# CONFIG_KINETIS_FTM1 is not set
+# CONFIG_KINETIS_FTM2 is not set
+# CONFIG_KINETIS_LPTIMER is not set
+# CONFIG_KINETIS_RTC is not set
+# CONFIG_KINETIS_EWM is not set
+# CONFIG_KINETIS_CMT is not set
+# CONFIG_KINETIS_USBOTG is not set
+# CONFIG_KINETIS_USBDCD is not set
+# CONFIG_KINETIS_LLWU is not set
+# CONFIG_KINETIS_TSI is not set
+# CONFIG_KINETIS_FTFL is not set
+# CONFIG_KINETIS_DMA is not set
+# CONFIG_KINETIS_CRC is not set
+# CONFIG_KINETIS_PDB is not set
+# CONFIG_KINETIS_PIT is not set
+
+#
+# Kinetis GPIO Interrupt Configuration
+#
+# CONFIG_GPIO_IRQ is not set
+
+#
+# Kinetis UART Configuration
+#
+CONFIG_KINETIS_UARTFIFOS=y
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+CONFIG_ARCH_HAVE_IRQPRIO=y
+# CONFIG_ARCH_L2CACHE is not set
+# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set
+# CONFIG_ARCH_HAVE_ADDRENV is not set
+# CONFIG_ARCH_NEED_ADDRENV_MAPPING is not set
+CONFIG_ARCH_HAVE_VFORK=y
+# CONFIG_ARCH_HAVE_MMU is not set
+CONFIG_ARCH_HAVE_MPU=y
+# CONFIG_ARCH_NAND_HWECC is not set
+# CONFIG_ARCH_HAVE_EXTCLK is not set
+# CONFIG_ARCH_USE_MPU is not set
+CONFIG_ARCH_IRQPRIO=y
+# CONFIG_ARCH_STACKDUMP is not set
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_IDLE_CUSTOM is not set
+CONFIG_ARCH_HAVE_RAMFUNCS=y
+CONFIG_ARCH_RAMFUNCS=y
+CONFIG_ARCH_HAVE_RAMVECTORS=y
+# CONFIG_ARCH_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=9535
+# CONFIG_ARCH_CALIBRATION is not set
+
+#
+# Interrupt options
+#
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_HAVE_HIPRI_INTERRUPT=y
+# CONFIG_ARCH_HIPRI_INTERRUPT is not set
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Boot Memory Configuration
+#
+CONFIG_RAM_START=0x1fff8000
+CONFIG_RAM_SIZE=65536
+# CONFIG_ARCH_HAVE_SDRAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_TEENSY_3_1=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="teensy31"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_POSIX_TIMERS is not set
+# CONFIG_DISABLE_PTHREAD is not set
+# CONFIG_DISABLE_SIGNALS is not set
+# CONFIG_DISABLE_MQUEUE is not set
+CONFIG_DISABLE_ENVIRON=y
+
+#
+# Clocks and Timers
+#
+CONFIG_USEC_PER_TICK=10000
+# CONFIG_SYSTEM_TIME64 is not set
+# CONFIG_CLOCK_MONOTONIC is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2014
+CONFIG_START_MONTH=1
+CONFIG_START_DAY=1
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_WDOG_INTRESERVE=0
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Tasks and Scheduling
+#
+# CONFIG_INIT_NONE is not set
+CONFIG_INIT_ENTRYPOINT=y
+# CONFIG_INIT_FILEPATH is not set
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_RR_INTERVAL=200
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_MAX_TASKS=16
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_SCHED_WAITPID is not set
+
+#
+# Pthread Options
+#
+# CONFIG_MUTEX_TYPES is not set
+CONFIG_NPTHREAD_KEYS=4
+
+#
+# Performance Monitoring
+#
+# CONFIG_SCHED_CPULOAD is not set
+# CONFIG_SCHED_INSTRUMENTATION is not set
+
+#
+# Files and I/O
+#
+CONFIG_DEV_CONSOLE=y
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+# CONFIG_PRIORITY_INHERITANCE is not set
+
+#
+# RTOS hooks
+#
+# CONFIG_BOARD_INITIALIZE is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+
+#
+# Signal Numbers
+#
+CONFIG_SIG_SIGUSR1=1
+CONFIG_SIG_SIGUSR2=2
+CONFIG_SIG_SIGALARM=3
+CONFIG_SIG_SIGCONDTIMEDOUT=16
+
+#
+# POSIX Message Queue Options
+#
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+
+#
+# Work Queue Support
+#
+# CONFIG_SCHED_WORKQUEUE is not set
+# CONFIG_SCHED_HPWORK is not set
+# CONFIG_SCHED_LPWORK is not set
+
+#
+# Stack and heap information
+#
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+# CONFIG_LIB_SYSCALL is not set
+
+#
+# Device Drivers
+#
+CONFIG_DISABLE_POLL=y
+# CONFIG_DEV_NULL is not set
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+
+#
+# Buffering
+#
+# CONFIG_DRVR_WRITEBUFFER is not set
+# CONFIG_DRVR_READAHEAD is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
+CONFIG_PWM=y
+# CONFIG_ARCH_HAVE_I2CRESET is not set
+CONFIG_I2C=y
+# CONFIG_I2C_SLAVE is not set
+# CONFIG_I2C_TRANSFER is not set
+# CONFIG_I2C_WRITEREAD is not set
+# CONFIG_I2C_POLLED is not set
+# CONFIG_I2C_TRACE is not set
+# CONFIG_SPI is not set
+# CONFIG_I2S is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_TIMER is not set
+# CONFIG_ANALOG is not set
+# CONFIG_AUDIO_DEVICES is not set
+# CONFIG_VIDEO_DEVICES is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+# CONFIG_MTD is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+CONFIG_DEV_LOWCONSOLE=y
+# CONFIG_16550_UART is not set
+# CONFIG_ARCH_HAVE_UART is not set
+CONFIG_ARCH_HAVE_UART0=y
+# CONFIG_ARCH_HAVE_UART1 is not set
+# CONFIG_ARCH_HAVE_UART2 is not set
+# CONFIG_ARCH_HAVE_UART3 is not set
+# CONFIG_ARCH_HAVE_UART4 is not set
+# CONFIG_ARCH_HAVE_UART5 is not set
+# CONFIG_ARCH_HAVE_UART6 is not set
+# CONFIG_ARCH_HAVE_UART7 is not set
+# CONFIG_ARCH_HAVE_UART8 is not set
+# CONFIG_ARCH_HAVE_SCI0 is not set
+# CONFIG_ARCH_HAVE_SCI1 is not set
+# CONFIG_ARCH_HAVE_USART0 is not set
+# CONFIG_ARCH_HAVE_USART1 is not set
+# CONFIG_ARCH_HAVE_USART2 is not set
+# CONFIG_ARCH_HAVE_USART3 is not set
+# CONFIG_ARCH_HAVE_USART4 is not set
+# CONFIG_ARCH_HAVE_USART5 is not set
+# CONFIG_ARCH_HAVE_USART6 is not set
+# CONFIG_ARCH_HAVE_USART7 is not set
+# CONFIG_ARCH_HAVE_USART8 is not set
+# CONFIG_ARCH_HAVE_OTHER_UART is not set
+
+#
+# USART Configuration
+#
+CONFIG_MCU_SERIAL=y
+# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set
+CONFIG_UART0_SERIAL_CONSOLE=y
+# CONFIG_OTHER_SERIAL_CONSOLE is not set
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# UART0 Configuration
+#
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART0_2STOP=0
+# CONFIG_UART0_IFLOWCONTROL is not set
+# CONFIG_UART0_OFLOWCONTROL is not set
+# CONFIG_SERIAL_IFLOWCONTROL is not set
+# CONFIG_SERIAL_OFLOWCONTROL is not set
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+# CONFIG_ARCH_HAVE_NET is not set
+# CONFIG_ARCH_HAVE_PHY is not set
+# CONFIG_NET is not set
+
+#
+# Crypto API
+#
+# CONFIG_CRYPTO is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_DISABLE_MOUNTPOINT=y
+# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
+# CONFIG_FS_READABLE is not set
+# CONFIG_FS_WRITABLE is not set
+# CONFIG_FS_NAMED_SEMAPHORES is not set
+CONFIG_FS_MQUEUE_MPATH="/var/mqueue"
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_FS_PROCFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG is not set
+# CONFIG_SYSLOG_TIMESTAMP is not set
+
+#
+# Graphics Support
+#
+# CONFIG_NX is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=1
+# CONFIG_ARCH_HAVE_HEAP2 is not set
+# CONFIG_GRAN is not set
+
+#
+# Audio Support
+#
+# CONFIG_AUDIO is not set
+
+#
+# Binary Loader
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+# CONFIG_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+CONFIG_LIB_RAND_ORDER=1
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_EXECFUNCS is not set
+CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
+CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+
+#
+# Non-standard Library Support
+#
+# CONFIG_LIB_KBDCODEC is not set
+# CONFIG_LIB_SLCDCODEC is not set
+
+#
+# Basic CXX Support
+#
+# CONFIG_C99_BOOL8 is not set
+# CONFIG_HAVE_CXX is not set
+
+#
+# Application Configuration
+#
+
+#
+# Built-In Applications
+#
+
+#
+# Examples
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+# CONFIG_EXAMPLES_CAN is not set
+# CONFIG_EXAMPLES_CONFIGDATA is not set
+# CONFIG_EXAMPLES_CPUHOG is not set
+# CONFIG_EXAMPLES_DHCPD is not set
+# CONFIG_EXAMPLES_ELF is not set
+# CONFIG_EXAMPLES_FTPC is not set
+# CONFIG_EXAMPLES_FTPD is not set
+# CONFIG_EXAMPLES_HELLO is not set
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+# CONFIG_EXAMPLES_NRF24L01TERM is not set
+# CONFIG_EXAMPLES_NSH is not set
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_NXTERM is not set
+# CONFIG_EXAMPLES_NXFFS is not set
+# CONFIG_EXAMPLES_NXFLAT is not set
+# CONFIG_EXAMPLES_NXHELLO is not set
+# CONFIG_EXAMPLES_NXIMAGE is not set
+# CONFIG_EXAMPLES_NXLINES is not set
+# CONFIG_EXAMPLES_NXTEXT is not set
+CONFIG_EXAMPLES_OSTEST=y
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000
+CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERIALBLASTER is not set
+# CONFIG_EXAMPLES_SERIALRX is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_SLCD is not set
+# CONFIG_EXAMPLES_SMART is not set
+# CONFIG_EXAMPLES_TCPECHO is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_WEBSERVER is not set
+CONFIG_EXAMPLES_USBSERIAL=y
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_DHCPD is not set
+# CONFIG_NETUTILS_FTPC is not set
+# CONFIG_NETUTILS_FTPD is not set
+# CONFIG_NETUTILS_JSON is not set
+# CONFIG_NETUTILS_SMTP is not set
+# CONFIG_NETUTILS_TFTPC is not set
+# CONFIG_NETUTILS_THTTPD is not set
+# CONFIG_NETUTILS_NETLIB is not set
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# FreeModBus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# NxWidgets/NxWM
+#
+
+#
+# Platform-specific Support
+#
+# CONFIG_PLATFORM_CONFIGDATA is not set
+
+#
+# System Libraries and NSH Add-Ons
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# EMACS-like Command Line Editor
+#
+# CONFIG_SYSTEM_CLE is not set
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# FLASH Erase-all Command
+#
+
+#
+# Intel HEX to binary conversion
+#
+# CONFIG_SYSTEM_HEX2BIN is not set
+
+#
+# I2C tool
+#
+# CONFIG_SYSTEM_I2CTOOL is not set
+
+#
+# INI File Parser
+#
+# CONFIG_SYSTEM_INIFILE is not set
+
+#
+# NxPlayer media player library / command Line
+#
+
+#
+# RAM test
+#
+# CONFIG_SYSTEM_RAMTEST is not set
+
+#
+# readline()
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# P-Code Support
+#
+
+#
+# PHY Tool
+#
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sudoku
+#
+# CONFIG_SYSTEM_SUDOKU is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# VI Work-Alike Editor
+#
+# CONFIG_SYSTEM_VI is not set
+
+#
+# Stack Monitor
+#
+
+#
+# USB CDC/ACM Device Commands
+#
+
+#
+# USB Composite Device Commands
+#
+
+#
+# USB Mass Storage Device Commands
+#
+
+#
+# USB Monitor
+#
+
+#
+# Zmodem Commands
+#
+# CONFIG_SYSTEM_ZMODEM is not set
diff --git a/nuttx/configs/teensy31/ostest/setenv.sh b/nuttx/configs/teensy31/ostest/setenv.sh
new file mode 100755
index 000000000..f158b7f7c
--- /dev/null
+++ b/nuttx/configs/teensy31/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/kwikstik-k40/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This is the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This is the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/teensy31/scripts/ld.script b/nuttx/configs/teensy31/scripts/ld.script
new file mode 100755
index 000000000..338a028dd
--- /dev/null
+++ b/nuttx/configs/teensy31/scripts/ld.script
@@ -0,0 +1,142 @@
+/****************************************************************************
+ * configs/kwikstik-k40/scripts/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The K40X256VLQ100 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of SRAM beginning at address 0x1800:0000 (SRAM_L) and 0x2000:000
+ * (SRAM_U).
+ *
+ * NOTE: that the first part of the K40 FLASH region is reserved for
+ * interrupt vectflash and, following that, is a region from 0x0000:0400
+ * to 0x0000:040f that is reserved for the FLASH control fields (FCF).
+ *
+ * NOTE: The on-chip RAM is split evenly among SRAM_L and SRAM_U. The RAM is
+ * also implemented such that the SRAM_L and SRAM_U ranges form a
+ * contiguous block in the memory map.
+ */
+
+MEMORY
+{
+ vectflash (rx) : ORIGIN = 0x00000000, LENGTH = 1K - 16
+ cfmprotect (rx) : ORIGIN = 0x00000400, LENGTH = 16
+ progflash (rx) : ORIGIN = 0x00000800, LENGTH = 256K - 2K
+ datasram (rwx) : ORIGIN = 0x1fff8000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+EXTERN(__flashconfigbytes)
+SECTIONS
+{
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectflash
+
+ .cfmprotect : {
+ KEEP(*(.cfmconfig))
+ } > cfmprotect
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > progflash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > progflash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > progflash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > progflash
+ __exidx_end = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _eronly = LOADADDR(.data);
+
+ .ramfunc ALIGN(4): {
+ _sramfuncs = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfuncs = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _framfuncs = LOADADDR(.ramfunc);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > datasram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/teensy31/src/.gitignore b/nuttx/configs/teensy31/src/.gitignore
new file mode 100644
index 000000000..726d936e1
--- /dev/null
+++ b/nuttx/configs/teensy31/src/.gitignore
@@ -0,0 +1,2 @@
+/.depend
+/Make.dep
diff --git a/nuttx/configs/teensy31/src/Makefile b/nuttx/configs/teensy31/src/Makefile
new file mode 100644
index 000000000..e4edfb0c5
--- /dev/null
+++ b/nuttx/configs/teensy31/src/Makefile
@@ -0,0 +1,103 @@
+############################################################################
+# configs/kwikstik-k40/src/Makefile
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_lcd.c up_spi.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBDEV),y)
+CSRCS += up_usbdev.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ $(call ARCHIVE, $@, $(OBJS))
+
+.depend: Makefile $(SRCS)
+ $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
+
+depend: .depend
+clean:
+ $(call DELFILE, libboard$(LIBEXT))
+ $(call CLEAN)
+
+distclean: clean
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+
+-include Make.dep
diff --git a/nuttx/configs/teensy31/src/kwikstik-internal.h b/nuttx/configs/teensy31/src/kwikstik-internal.h
new file mode 100644
index 000000000..0a97471af
--- /dev/null
+++ b/nuttx/configs/teensy31/src/kwikstik-internal.h
@@ -0,0 +1,195 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/kwikstik-internal.h
+ * arch/arm/src/board/kwikstik-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_KWIKSTK_K40_SRC_KWIKSTIK_INTERNAL_H
+#define __CONFIGS_KWIKSTK_K40_SRC_KWIKSTIK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
+ * modules (others may support more -- in such case, the following must be
+ * expanded).
+ */
+
+#if KINETIS_NSPI < 1
+# undef CONFIG_KINETIS_SPI1
+# undef CONFIG_KINETIS_SPI2
+#elif KINETIS_NSPI < 2
+# undef CONFIG_KINETIS_SPI2
+#endif
+
+/* KwikStik-K40 GPIOs ***************************************************************/
+/* On-Board Connections
+ *
+ * ------------------- -------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * ------------------- -------------------------- -------- -------------------
+ * Audio Jack Output Audio Amp On PTE28 PTE28
+ * Audio Output DAC1_OUT DAC1_OUT
+ * Volume Up PTD10 PTD10
+ * Volume Down PTD11 PTD11
+ * Buzzer Audio Out PTA8 FTM1_CH0
+ * Microphone Microphone input PTA7 ADC0_SE10
+ * SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ * SD Command PTE3 SDHC0_CMD
+ * SD Data0 PTD12 SDHC0_D4
+ * SD Data1 PTD13 SDHC0_D5
+ * SD Data2 PTD14 SDHC0_D6
+ * SD Data3 PTD15 SDHC0_D7
+ * SD Card Detect PTE27 PTE27
+ * SD Card On PTE6 PTE6
+ * Infrared Port IR Transmit PTE4 IR_TX
+ * IR Receive PTA13 CMP2_IN0
+ * Touch Pads E1 / Touch PTB0 TSI0_CH0
+ * E2 / Touch PTA4 TSI0_CH5
+ * E3 / Touch PTA24 PTA24
+ * E4 / Touch PTA25 PTA25
+ * E5 / Touch PTA26 PTA26
+ * E6 / Touch PTA27 PTA27
+ */
+
+#define GPIO_SD_CARDDETECT (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTE | PIN27)
+#define GPIO_SD_CARDON (GPIO_HIGHDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTE | PIN6)
+
+/* Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ * ------------------- -------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * ------------------- -------------------------- -------- -------------------
+ * General Purpose TWRPI AN0 (J8 Pin 8) ? ADC0_DP0/ADC1_DP3
+ * TWRPI Socket TWRPI AN1 (J8 Pin 9) ? ADC0_DM0/ADC1_DM3
+ * TWRPI AN2 (J8 Pin 12) ? ADC1_DP0/ADC0_DP3
+ * TWRPI ID0 (J8 Pin 17) ? ADC0_DP1
+ * TWRPI ID1 (J8 Pin 18) ? ADC0_DM1
+ * TWRPI I2C SCL (J9 Pin 3) PTC10 I2C1_SCL
+ * TWRPI I2C SDA (J9 Pin 4) PTC11 I2C1_SDA
+ * TWRPI SPI MISO (J9 Pin 9) PTB23 SPI2_SIN
+ * TWRPI SPI MOSI (J9 Pin 10) PTB22 SPI2_SOUT
+ * TWRPI SPI SS (J9 Pin 11) PTB20 SPI2_PCS0
+ * TWRPI SPI CLK (J9 Pin 12) PTB21 SPI2_SCK
+ * TWRPI GPIO0 (J9 Pin 15) PTC12 PTC12
+ * TWRPI GPIO1 (J9 Pin 16) PTB9 PTB9
+ * TWRPI GPIO2 (J9 Pin 17) PTB10 PTB10
+ * TWRPI GPIO3 (J9 Pin 18) PTC5 PTC5
+ * TWRPI GPIO4 (J9 Pin 19) PTA5 PTA5
+ */
+
+/* Connections via the Tower Primary Connector Side A
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * A9 GPIO9 / CTS1 PTE10/UART_CTS
+ * A43 RXD1 PTE9/UART_RX
+ * A44 TXD1 PTE8/UART_TX
+ * A63 RSTOUT_b PTA9/FTM1_CH1
+ */
+
+/* Connections via the Tower Primary Connector Side B
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * B21 GPIO1 / RTS1 PTE7/UART_RTS
+ * B37 PWM7 PTA8/FTM1_CH0
+ * B38 PWM6 PTA9/FTM1_CH1
+ * B41 CANRX0 PTE25/CAN1_RX
+ * B42 CANTX0 PTE24/CAN1_TX
+ * B44 SPI0_MISO PTA17/SPI0_SIN
+ * B45 SPI0_MOSI PTA16/SPI0_SOUT
+ * B46 SPI0_CS0_b PTA14/SPI0_PCS0
+ * B48 SPI0_CLK PTA15/SPI0_SCK
+ * B50 SCL1 PTE1/I2C1_SCL
+ * B51 SDA1 PTE0/I2C1_SDA
+ * B52 GPIO5 / SD_CARD_DET PTA16
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: board_led_initialize
+ *
+ * Description:
+ * Initialize LED GPIOs so that LEDs can be controlled.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void board_led_initialize(void);
+#endif
+
+/************************************************************************************
+ * Name: kinetis_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function kinetis_spiinitialize(void);
+
+/************************************************************************************
+ * Name: kinetis_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function kinetis_usbinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_KWIKSTK_K40_SRC_KWIKSTIK_INTERNAL_H */
+
diff --git a/nuttx/configs/teensy31/src/up_boot.c b/nuttx/configs/teensy31/src/up_boot.c
new file mode 100644
index 000000000..e95045674
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_boot.c
@@ -0,0 +1,91 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "kwikstik-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All Kinetis 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 kinetis_boardinitialize(void)
+{
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ board_led_initialize();
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function kinetis_usbinitialize() has been brought
+ * into the build.
+ */
+
+//#if defined(CONFIG_USBDEV) && defined(CONFIG_KINETIS_USB)
+// if (kinetis_usbinitialize)
+// {
+// kinetis_usbinitialize();
+// }
+//#endif
+}
diff --git a/nuttx/configs/teensy31/src/up_buttons.c b/nuttx/configs/teensy31/src/up_buttons.c
new file mode 100644
index 000000000..a82d55ca2
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_buttons.c
@@ -0,0 +1,126 @@
+/****************************************************************************
+ * configs/kwikstik-k40/src/board_buttons.c
+ *
+ * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
+
+#include "kwikstik-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_button_initialize
+ *
+ * Description:
+ * board_button_initialize() must be called to initialize button resources.
+ * After that, board_buttons() may be called to collect the current state of
+ * all buttons or board_button_irq() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void board_button_initialize(void)
+{
+ /* The KwikStik-K40 board has no standard GPIO contact buttons */
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint8_t board_buttons(void)
+{
+ /* The KwikStik-K40 board has no standard GPIO contact buttons */
+
+ return 0;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ * board_button_initialize() must be called to initialize button resources.
+ * After that, board_buttons() may be called to collect the current state of
+ * all buttons or board_button_irq() may be called to register button interrupt
+ * handlers.
+ *
+ * After board_button_initialize() has been called, board_buttons() may be
+ * called to collect the state of all buttons. board_buttons() returns an
+ * 8-bit bit set with each bit associated with a button. See the
+ * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
+ * of each bit.
+ *
+ * board_button_irq() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource.
+ * See the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning
+ * of enumeration value. The previous interrupt handler address is
+ * returned (so that it may be restored, if so desired).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t board_button_irq(int id, xcpt_t irqhandler)
+{
+ /* The KwikStik-K40 board has no standard GPIO contact buttons */
+
+ return NULL;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/teensy31/src/up_lcd.c b/nuttx/configs/teensy31/src/up_lcd.c
new file mode 100644
index 000000000..2e28701af
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_lcd.c
@@ -0,0 +1,134 @@
+/**************************************************************************************
+ * configs/kwikstik-k40/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "kwikstik-internal.h"
+
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+
+/* Configuration **********************************************************************/
+
+/* Display/Color Properties ***********************************************************/
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg(format, ...) vdbg(format, ##__VA_ARGS__)
+#else
+# define lcddbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ gvdbg("Initializing\n");
+#warning "Missing logic"
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+#warning "Missing logic"
+ return NULL;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+#warning "Missing logic"
+}
+
diff --git a/nuttx/configs/teensy31/src/up_leds.c b/nuttx/configs/teensy31/src/up_leds.c
new file mode 100644
index 000000000..4b98a0cb4
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_leds.c
@@ -0,0 +1,129 @@
+/****************************************************************************
+ * configs/kwikstik-k40/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
+ * with CONFIG_DEBUG_VERBOSE too)
+ */
+
+#ifdef CONFIG_DEBUG_LEDS
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_led_initialize
+ *
+ * Description:
+ * Initialize LED GPIOs so that LEDs can be controlled.
+ *
+ ****************************************************************************/
+
+#include "kinetis_internal.h"
+
+#define GPIO_LED0 (PIN_PORTC | PIN5 | GPIO_HIGHDRIVE | GPIO_OUTPUT_ONE)
+
+#define PORTC_PCR5 (*(volatile uint32_t *)0x4004B014) // Pin Control Register n
+#define GPIOC_PDOR (*(volatile uint32_t *)0x400FF080) // Port Data Output Register
+#define GPIOC_PSOR (*(volatile uint32_t *)0x400FF084) // Port Set Output Register
+#define GPIOC_PCOR (*(volatile uint32_t *)0x400FF088) // Port Clear Output Register
+#define GPIOC_PTOR (*(volatile uint32_t *)0x400FF08C) // Port Toggle Output Register
+#define GPIOC_PDIR (*(volatile uint32_t *)0x400FF090) // Port Data Input Register
+#define GPIOC_PDDR (*(volatile uint32_t *)0x400FF094) // Port Data Direction Register
+
+ #define PORT_PCR_SRE ((uint32_t)0x00000004) // Slew Rate Enable
+ #define PORT_PCR_DSE ((uint32_t)0x00000040) // Drive Strength Enable
+ #define PORT_PCR_MUX(n) ((uint32_t)(((n) & 7) << 8)) // Pin Mux Control
+
+#ifdef CONFIG_ARCH_LEDS
+void board_led_initialize(void)
+{
+ //kinetis_pinconfig(GPIO_LED0);
+ //kinetis_gpiowrite(GPIO_LED0, true);
+
+
+ //kinetis_pinconfig(PIN_PORTC | PIN5 | GPIO_OUTPUT | GPIO_HIGHDRIVE);
+ PORTC_PCR5 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); // set to gpio
+ GPIOC_PDDR |= (1 << 5); // set to output
+ GPIOC_PSOR |= (1 << 5); // set high
+}
+
+/****************************************************************************
+ * Name: board_led_on
+ ****************************************************************************/
+
+void board_led_on(int led)
+{
+ //kinetis_gpiowrite(GPIO_LED0, true);
+}
+
+/****************************************************************************
+ * Name: board_led_off
+ ****************************************************************************/
+
+void board_led_off(int led)
+{
+ //kinetis_gpiowrite(GPIO_LED0, true);
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/teensy31/src/up_nsh.c b/nuttx/configs/teensy31/src/up_nsh.c
new file mode 100644
index 000000000..1e52c931e
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_nsh.c
@@ -0,0 +1,258 @@
+/****************************************************************************
+ * config/kwikstik-k40/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_KINETIS_SDHC
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "kinetis_internal.h"
+#include "kwikstik-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_KWIKSTIK_K40
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot, slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new Kinetis boards here */
+# error "Unrecognized Kinetis board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDHC support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* We expect to receive GPIO interrupts for card insertion events */
+
+#ifndef CONFIG_GPIO_IRQ
+# error "CONFIG_GPIO_IRQ required for card detect interrupt"
+#endif
+
+#ifndef CONFIG_KINETIS_PORTEINTS
+# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lowsyslog(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lowsyslog
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* This structure encapsulates the global variable used in this file and
+ * reduces the probability of name collistions.
+ */
+
+#ifdef NSH_HAVEMMCSD
+struct kinetis_nsh_s
+{
+ FAR struct sdio_dev_s *sdhc; /* SDIO driver handle */
+ bool inserted; /* True: card is inserted */
+};
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static struct kinetis_nsh_s g_nsh;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: kinetis_mediachange
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static void kinetis_mediachange(void)
+{
+ bool inserted;
+
+ /* Get the current value of the card detect pin. This pin is pulled up on
+ * board. So low means that a card is present.
+ */
+
+ inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
+
+ /* Has the pin changed state? */
+
+ if (inserted != g_nsh.inserted)
+ {
+ /* Yes.. perform the appropriate action (this might need some debounce). */
+
+ g_nsh.inserted = inserted;
+ sdhc_mediachange(g_nsh.sdhc, inserted);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: kinetis_cdinterrupt
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int kinetis_cdinterrupt(int irq, FAR void *context)
+{
+ /* All of the work is done by kinetis_mediachange() */
+
+ kinetis_mediachange();
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ int ret;
+
+ /* Configure GPIO pins.
+ *
+ * First CD power. The initial state will provide SD power.
+ */
+
+ kinetis_pinconfig(GPIO_SD_CARDON); /* Applies power to the card */
+
+ /* Attached the card detect interrupt (but don't enable it yet) */
+
+ kinetis_pinconfig(GPIO_SD_CARDDETECT);
+ kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt);
+
+ /* Mount the SDHC-based MMC/SD block driver */
+ /* First, get an instance of the SDHC interface */
+
+ message("nsh_archinitialize: Initializing SDHC slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+
+ g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!g_nsh.sdhc)
+ {
+ message("nsh_archinitialize: Failed to initialize SDHC slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDHC interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDHC to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDHC to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDHC to the MMC/SD driver\n");
+
+ /* Handle the initial card state */
+
+ kinetis_mediachange();
+
+ /* Enable CD interrupts to handle subsequent media changes */
+
+ kinetis_pinirqenable(GPIO_SD_CARDDETECT);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/teensy31/src/up_spi.c b/nuttx/configs/teensy31/src/up_spi.c
new file mode 100644
index 000000000..acb1ca1c9
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_spi.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "kinetis_internal.h"
+#include "kwikstik-internal.h"
+
+#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#ifdef CONFIG_DEBUG_SPI
+# define spidbg lldbg
+# ifdef CONFIG_DEBUG_SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+void weak_function kinetis_spiinitialize(void)
+{
+# warning "Missing logic"
+}
+
+/****************************************************************************
+ * Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
+ *
+ * Description:
+ * The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common Kinetis logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_SPI1
+void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_KINETIS_SPI2
+void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_KINETIS_SPI3
+void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
diff --git a/nuttx/configs/teensy31/src/up_usbdev.c b/nuttx/configs/teensy31/src/up_usbdev.c
new file mode 100644
index 000000000..38e3413c7
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_usbdev.c
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "kinetis_internal.h"
+#include "kwikstik-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+void kinetis_usbinitialize(void)
+{
+# warning "Missing logic"
+}
+
+/************************************************************************************
+ * Name: kinetis_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide kinetis_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int kinetis_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+# warning "Missing logic"
+ return OK;
+}
+
+/************************************************************************************
+ * Name: kinetis_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the kinetis_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void kinetis_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+#warning "Missing logic"
+}
+
diff --git a/nuttx/configs/teensy31/src/up_usbmsc.c b/nuttx/configs/teensy31/src/up_usbmsc.c
new file mode 100644
index 000000000..53bdbb402
--- /dev/null
+++ b/nuttx/configs/teensy31/src/up_usbmsc.c
@@ -0,0 +1,118 @@
+/****************************************************************************
+ * configs/kwikstik-k40/src/up_usbmsc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the Kinetis MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "kinetis_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
+# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_KWIKSTIK_K40
+# undef KINETIS_MMCSDSLOTNO
+# define KINETIS_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new Kinetis boards here */
+# error "Unrecognized Kinetis board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lowsyslog(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lowsyslog
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If system/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_NSH_BUILTIN_APPS
+# warning "Missing logic"
+#endif /* CONFIG_NSH_BUILTIN_APPS */
+
+ return OK;
+}