summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorjeditekunum <jeditekunum@gmail.com>2015-01-24 14:31:35 -0600
committerjeditekunum <jeditekunum@gmail.com>2015-01-24 14:31:35 -0600
commit0ae43cf0dae5e57a91dc2ea61cd7a3d0e4dc7f3a (patch)
tree280b7a81988eacfea7545d9e46bd4fca6e4e6ded /nuttx/configs
parentf304e6d9f59548e4fbc483dda5793045ada5fac1 (diff)
downloadnuttx-0ae43cf0dae5e57a91dc2ea61cd7a3d0e4dc7f3a.tar.gz
nuttx-0ae43cf0dae5e57a91dc2ea61cd7a3d0e4dc7f3a.tar.bz2
nuttx-0ae43cf0dae5e57a91dc2ea61cd7a3d0e4dc7f3a.zip
First step at porting to MoteinoMEGA. LED shows assert failure at boot. Appears to be short double blink, short off (~1sec), followed by 250ms toggle cycles. Most of it derived from amber board.
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/Kconfig13
-rw-r--r--nuttx/configs/moteino-mega/Kconfig4
-rw-r--r--nuttx/configs/moteino-mega/README.txt491
-rw-r--r--nuttx/configs/moteino-mega/hello/Make.defs98
-rw-r--r--nuttx/configs/moteino-mega/hello/defconfig580
-rw-r--r--nuttx/configs/moteino-mega/hello/ld.script211
-rwxr-xr-xnuttx/configs/moteino-mega/hello/setenv.sh63
-rw-r--r--nuttx/configs/moteino-mega/include/board.h97
-rw-r--r--nuttx/configs/moteino-mega/nsh/Make.defs98
-rw-r--r--nuttx/configs/moteino-mega/nsh/defconfig651
-rw-r--r--nuttx/configs/moteino-mega/nsh/ld.script211
-rwxr-xr-xnuttx/configs/moteino-mega/nsh/setenv.sh63
-rw-r--r--nuttx/configs/moteino-mega/src/.gitignore2
-rw-r--r--nuttx/configs/moteino-mega/src/Makefile96
-rw-r--r--nuttx/configs/moteino-mega/src/moteino_mega_internal.h101
-rw-r--r--nuttx/configs/moteino-mega/src/up_boot.c92
-rw-r--r--nuttx/configs/moteino-mega/src/up_leds.c189
17 files changed, 3060 insertions, 0 deletions
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig
index de745686d..dddbabfec 100644
--- a/nuttx/configs/Kconfig
+++ b/nuttx/configs/Kconfig
@@ -318,6 +318,15 @@ config ARCH_BOARD_MICROPENDOUS3
be populated with either an AVR AT90USB646, 647, 1286, or 1287 MCU.
Support is configured for the AT90USB647.
+config ARCH_BOARD_MOTEINO_MEGA
+ bool "LowPowerLab MoteinoMEGA"
+ depends on ARCH_CHIP_ATMEGA1284P
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is placeholder for the LowPowerLab MoteinoMEGA that is based
+ on the Atmel AVR ATMega1284P MCU. There is not much there yet and what is
+ there is untested due to tool-related issues.
+
config ARCH_BOARD_MX1ADS
bool "Motorola MX1ADS development board"
depends on ARCH_CHIP_IMX1
@@ -1065,6 +1074,7 @@ config ARCH_BOARD
default "mcu123-lpc214x" if ARCH_BOARD_MCU123_LPC214X
default "micropendous3" if ARCH_BOARD_MICROPENDOUS3
default "mirtoo" if ARCH_BOARD_MIRTOO
+ default "moteino-mega" if ARCH_BOARD_MOTEINO_MEGA
default "mx1ads" if ARCH_BOARD_MX1ADS
default "ne64badge" if ARCH_BOARD_NE64BADGE
default "ntosd-dm320" if ARCH_BOARD_NTOSD_DM320
@@ -1288,6 +1298,9 @@ endif
if ARCH_BOARD_MIRTOO
source "configs/mirtoo/Kconfig"
endif
+if ARCH_BOARD_MOTEINO_MEGA
+source "configs/moteino-mega/Kconfig"
+endif
if ARCH_BOARD_MX1ADS
source "configs/mx1ads/Kconfig"
endif
diff --git a/nuttx/configs/moteino-mega/Kconfig b/nuttx/configs/moteino-mega/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/moteino-mega/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/moteino-mega/README.txt b/nuttx/configs/moteino-mega/README.txt
new file mode 100644
index 000000000..97b1e08dc
--- /dev/null
+++ b/nuttx/configs/moteino-mega/README.txt
@@ -0,0 +1,491 @@
+README
+^^^^^^
+
+**********************************************************************
+**** PRELIMINARY - Port in progress ****
+**********************************************************************
+
+This is the README file for the port of NuttX to the MoteinoMEGA from
+LowPowerLab (http://www.lowpowerlab.com). The MoteinoMEGA is based
+on an Atmel ATMega1284P. As of this writing, documentation for the
+MoteinoMEGA board is available here:
+
+https://lowpowerlab.com/shop/index.php?_route_=Moteino/moteinomega
+
+Contents
+^^^^^^^^
+
+ o MoteinoMEGA Features
+ o Pin Connections
+ o DualOptiboot Bootloader
+ o Toolchains
+ o Windows Native Toolchains
+ o NuttX buildroot Toolchain
+ o avr-libc
+ o MoteinoMEGA Configuration Options
+ o Configurations
+
+MoteinoMEGA Features
+^^^^^^^^^^^^^^^^^^^^
+
+ o 16MHz ATmega1284P Atmel 8bit AVR RISC Processor
+ o 128Kbyte Flash
+ o 16Kbyte RAM
+ o 4Kbyte EEPROM
+ o 2 High Speed Serial Ports
+ o 8Ch 10bit Analog Input port
+
+Pin Connections (PCB Rev ?)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ -------------------- -----------------------------
+ ATMega1284P Pinout MoteinoMEGA board connection
+ -------------------- -----------------------------
+**********************************************************************
+**** INVALID - Port in progress ****
+**********************************************************************
+ (left)
+ 1 PEN Pulled-up
+ 2 PE0 (RXD0/PDI) MAX202ECWED T1IN or J7-1, ISP-PDI (via 74HC5053), J5-26
+ 3 PE1 (TXD0/PDO) MAX202ECWED A1OUT or J7-9, ISP-PDO (via 74HC5053), J5-25
+ 4 PE2 (XCK0/AIN0) MAX202ECWED T2IN, J5-24
+ 5 PE3 (OC3A/AIN1) MAX202ECWED A2OUT, J5-23
+ 6 PE4 (OC3B/INT4) J5-22
+ 7 PE5 (OC3C/INT5) J5-21, RTL8019AS INT 0, TP5 PE5
+ 8 PE6 (T3/INT6) J5-20
+ 9 PE7 (ICP3/INT7) J5-19
+ 10 PB0 (SS) Pull up of SS SPI master
+ 11 PB1 (SCK) J7-7, ISP_SCK (via 74HC4053) and AT45D011 SCK, J5-17
+ 12 PB2 (MOSI) AT45D011 SI. J5-16
+ 13 PB3 (MISO) AT45D011 SO, J5-15
+ 14 PB4 (OC0) AT45D011 CS\, J5-14
+ 15 PB5 (OC1A) J5-13
+ 16 PB6 (OC1B) J5-12
+ (bottom)
+ 17 PB7 (OC2/OC1C) J5-11
+ 18 PG3/TOSC2 32.768KHz XTAL
+ 19 PG4/TOSC1 32.768KHz XTAL
+ 20 RESET RESET
+ 21 VCC
+ 22 GND GND
+ 23 XTAL2 14.7456MHz XTAL
+ 24 XTAL1 14.7456MHz XTAL
+ 25 PD0 (SCL/INT0) J5-10
+ 26 PD1 (SDA/INT1) J5-9
+ 27 PD2 (RXD1/INT2) J5-8, MAX488CSA RO (RS-485)
+ 28 PD3 (TXD1/INT3) J5-7, MAX488CSA DI (RS-485)
+ 29 PD4 (ICP1) J5-6
+ 30 PD5 (XCK1) J5-5
+ 31 PD6 (T1) J5-4
+ 32 PD7 (T2) J5-3
+ (left)
+ 48 PA3 (AD3) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 47 PA4 (AD4) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 46 PA5 (AD5) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 45 PA6 (AD6) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 44 PA7 (AD7) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 43 PG2 (ALE) J5-1, 74HC5730, 62246DLP-7, RTL8019AS
+ 42 PC7 (A15) TP4 A15, J5-27, 74HC5730
+ 41 PC6 (A14) J5-28, 74HC5730, 62246DLP-7, RTL8019AS
+ 40 PC5 (A13) J5-29, 74HC5730, 62246DLP-7, RTL8019AS
+ 39 PC4 (A12) J5-30, 74HC5730, 62246DLP-7, RTL8019AS
+ 38 PC3 (A11) J5-31, 74HC5730, 62246DLP-7, RTL8019AS
+ 37 PC2 (A10) J5-32, 74HC5730, 62246DLP-7, RTL8019AS
+ 36 PC1 (A9) J5-33, 74HC5730, 62246DLP-7, RTL8019AS
+ 35 PC0 (A8) J5-34, 74HC5730, 62246DLP-7, RTL8019AS
+ 34 PG1 (RD) TP2 RD\, J5-52, 62246DLP-7, RTL8019AS
+ 33 PG0 (WR) TP3 WR\, J5-51, 62246DLP-7, RTL8019AS
+ (top)
+ 64 AVCC
+ 63 GND GND
+ 62 AREF (analog supply)
+ 61 PF0 (ADC0) J6-5, PDV-P9 Light Sensor
+ 60 PF1 (ADC1) J6-7, Thermister
+ 59 PF2 (ADC2) J6-9, MXA2500GL Dual Axis Accesserometer, AOUTX
+ 58 PF3 (ADC3) J6-11, MXA2500GL Dual Axis Accesserometer, AOUTY
+ 57 PF4 (ADC4/TCK) J6-13, MXA2500GL Dual Axis Accesserometer, TOUT
+ 56 PF5 (ADC5/TMS) J6-15
+ 55 PF6 (ADC6/TDO) J6-17
+ 54 PF7 (ADC7/TDI) J6-19
+ 53 GND GND
+ 52 VCC
+ 51 PA0 (AD0) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 50 PA1 (AD1) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 49 PA2 (AD2) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+
+DualOptiboot Bootloader
+^^^^^^^^^^^^^^^^^^^^^^^
+
+o FTDI (or similar) USB-To-Serial converter with compatible connector
+ configured for DTR (AdaFruit, SparkFun, etc)
+o Obtain ard-reset-arduino Python script
+ (one source: https://github.com/mikaelpatel/Cosa/blob/master/build/Arduino-Makefile/bin/ard-reset-arduino)
+ This script triggers the DTR pin to enter bootloader mode.
+o Obtain avrdude for your platform.
+
+Bootloader operates at 115200 baud. It would be useful to create a short script
+that invokes ard-reset-arduino and then avrdude to load program. This script
+could then also, optionally, invoke miniterm.py or some other serial interface
+program for console.
+
+Example:
+
+APP=nuttx
+CPU=atmega1284p
+BAUD=115200
+PORT=/dev/tty.usbserial-A703X8PQ
+avr-size --mcu=$CPU -C --format=avr $APP
+ard-reset-arduino --verbose $PORT
+avrdude -q -V -p $CPU -C {location-of-avrdude.conf} -D -c arduino -b $BAUD \
+ -P $PORT -U flash:w:${APP}.hex:i
+miniterm.py --port=$PORT --baud=$BAUD -q --lf
+
+Toolchains
+^^^^^^^^^^
+
+The toolchain may be selected using the kconfig-mconf tool (via 'make menuconfig'),
+by editing the existing configuration file (defconfig), or by overriding
+the toolchain on the make commandline with CONFIG_AVR_TOOLCHAIN=<toolchain>.
+
+The valid values for <toolchain> are BUILDROOT, CROSSPACK, LINUXGCC and WINAVR.
+
+Buildroot:
+
+ There is a DIY buildroot version for the AVR boards here:
+ http://sourceforge.net/projects/nuttx/files/buildroot/. See the
+ following section for details on building this toolchain.
+
+ It is assumed in some places that buildroot toolchain is available
+ at ../misc/buildroot/build_avr. Edit the setenv.sh file if
+ this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT=y is set in your
+ .config file.
+
+WinAVR:
+
+ For Cygwin development environment on Windows machines, you can use
+ WinAVR: http://sourceforge.net/projects/winavr/files/
+
+ It is assumed in some places that WinAVR is installed at C:/WinAVR. Edit the
+ setenv.sh file if this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_WINAVR=y is set in your
+ .config file.
+
+ WARNING: There is an incompatible version of cygwin.dll in the WinAVR/bin
+ directory! Make sure that the path to the correct cygwin.dll file precedes
+ the path to the WinAVR binaries!
+
+Linux:
+
+ For Linux, there are widely available avr-gcc packages. On Ubuntu, use:
+ sudo apt-get install gcc-avr gdb-avr avr-libc
+
+ After configuring NuttX, make sure that CONFIG_AVR_LINUXGCC=y is set in your
+ .config file.
+
+Mac OS X:
+
+ For Mac OS X, the CrossPack for AVR toolchain is available from:
+
+ http://www.obdev.at/products/crosspack/index.html
+
+ This toolchain is functionally equivalent to the Linux GCC toolchain.
+
+Windows Native Toolchains
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ The WinAVR toolchain is a Windows native toolchain. There are several
+ limitations to using a Windows native 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
+
+ An additional issue with the WinAVR toolchain, in particular, is that it
+ contains an incompatible version of the Cygwin DLL in its bin/ directory.
+ You must take care that the correct Cygwin DLL is used.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ If NuttX buildroot toolchain source tarball cne 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 amber/<sub-dir>
+
+ NOTE: you also must copy avr-libc header files into the NuttX include
+ directory with command perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+ 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/avr-defconfig-4.5.2 .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
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a toolchain for Cygwin under Windows.
+
+avr-libc
+^^^^^^^^
+
+Header Files
+
+ In any case, header files from avr-libc are required: http://www.nongnu.org/avr-libc/.
+ A snapshot of avr-lib is included in the WinAVR installation. For Linux
+ development platforms, avr-libc package is readily available (and would
+ be installed in the apt-get command shown above). But if you are using
+ the NuttX buildroot configuration on Cygwin, then you will have to build
+ get avr-libc from binaries.
+
+Header File Installation
+
+ The NuttX build will required that the AVR header files be available via
+ the NuttX include directory. This can be accomplished by either copying
+ the avr-libc header files into the NuttX include directory:
+
+ cp -a <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+ Or simply using a symbolic link:
+
+ ln -s <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+Build Notes:
+
+ It may not necessary to have a built version of avr-lib; only header files
+ are required. Bu if you choose to use the optimized libraru functions of
+ the flowing point library, then you may have to build avr-lib from sources.
+ Below are instructions for building avr-lib from fresh sources:
+
+ 1. Download the avr-libc package from:
+
+ http://savannah.nongnu.org/projects/avr-libc/
+
+ I am using avr-lib-1.7.1.tar.bz2
+
+ 2. Upack the tarball and cd into the
+
+ tar jxf avr-lib-1.7.1.tar.bz2
+ cd avr-lib-1.7.1
+
+ 3. Configure avr-lib. Assuming that WinAVR is installed at the following
+ loction:
+
+ export PATH=/cygdrive/c/WinAVR/bin:$PATH
+ ./configure --build=`./config.guess` --host=avr
+
+ This takes a *long* time.
+
+ 4. Make avr-lib.
+
+ make
+
+ This also takes a long time because it generates variants for nearly
+ all AVR chips.
+
+ 5. Install avr-lib.
+
+ make install
+
+MoteinoMEGA Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=avr
+
+ CONFIG_ARCH_FAMILY - For use in C code:
+
+ CONFIG_ARCH_FAMILY=avr
+
+ CONFIG_ARCH_FAMILY_family - For use in C code:
+
+ CONFIG_ARCH_FAMILY_AVR=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=atmega
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_ATMEGA1284P=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=moteino-mega
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_MOTEINO_MEGA=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. One of:
+
+ CONFIG_RAM_SIZE=(16*1024) - (16Kb)
+
+ CONFIG_RAM_START - The start address of installed SRAM
+
+ CONFIG_RAM_START=0x800100
+
+ 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_AVR_INT0=n
+ CONFIG_AVR_INT1=n
+ CONFIG_AVR_INT2=n
+ CONFIG_AVR_INT3=n
+ CONFIG_AVR_INT4=n
+ CONFIG_AVR_INT5=n
+ CONFIG_AVR_INT6=n
+ CONFIG_AVR_INT7=n
+ CONFIG_AVR_WDT=n
+ CONFIG_AVR_TIMER0=n
+ CONFIG_AVR_TIMER1=n
+ CONFIG_AVR_TIMER2=n
+ CONFIG_AVR_TIMER3=n
+ CONFIG_AVR_SPI=n
+ CONFIG_AVR_USART0=y
+ CONFIG_AVR_USART1=n
+ CONFIG_AVR_ADC=n
+ CONFIG_AVR_ANACOMP=n
+ CONFIG_AVR_TWI=n
+
+ If the watchdog is enabled, this specifies the initial timeout. Default
+ is maximum supported value.
+
+ CONFIG_WDTO_15MS
+ CONFIG_WDTO_30MS
+ CONFIG_WDTO_60MS
+ CONFIG_WDTO_120MS
+ CONFIG_WDTO_1250MS
+ CONFIG_WDTO_500MS
+ CONFIG_WDTO_1S
+ CONFIG_WDTO_2S
+ CONFIG_WDTO_4S
+ CONFIG_WDTO_8S
+
+ ATMEGA specific device driver settings
+
+ CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
+ console and ttys0 (default is the USART0).
+ CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
+ CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_USARTn_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Common Configuration Notes
+--------------------------
+
+ 1. Each MoteinoMEGA configuration is maintained in a sub-directory and
+ can be selected as follow:
+
+ cd tools
+ ./configure.sh moteino-mega/<subdir>
+ cd -
+ . ./setenv.sh
+
+ Where <subdir> is one of the configuration sub-directories described in
+ the following paragraph.
+
+ NOTE: You must also copy avr-libc header files, perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+ 2. These configurations use the mconf-based configuration tool. To
+ change a configurations using that tool, you should:
+
+ a. Build and install the kconfig-mconf tool. See nuttx/README.txt
+ and misc/tools/
+
+ b. Execute 'make menuconfig' in nuttx/ in order to start the
+ reconfiguration process.
+
+ 3. By default, all configurations assume the NuttX Buildroot toolchain
+ under Cygwin with Windows. This is easily reconfigured:
+
+ CONFIG_HOST_WINDOWS=y
+ CONFIG_WINDOWS_CYGWIN=y
+ CONFIG_AVR_BUILDROOT=y
+
+Configuration Sub-Directories
+-----------------------------
+
+ hello:
+ The simple apps/examples/hello "Hello, World!" example.
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interfaces.
diff --git a/nuttx/configs/moteino-mega/hello/Make.defs b/nuttx/configs/moteino-mega/hello/Make.defs
new file mode 100644
index 000000000..bc2cbaaf4
--- /dev/null
+++ b/nuttx/configs/moteino-mega/hello/Make.defs
@@ -0,0 +1,98 @@
+############################################################################
+# configs/moteino-mega/hello/Make.defs
+#
+# Copyright (C) 2015 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/avr/src/avr/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 = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/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
+
+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 =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+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-gotoff.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/moteino-mega/hello/defconfig b/nuttx/configs/moteino-mega/hello/defconfig
new file mode 100644
index 000000000..ce5e990bf
--- /dev/null
+++ b/nuttx/configs/moteino-mega/hello/defconfig
@@ -0,0 +1,580 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_DEFAULT_SMALL=y
+# CONFIG_HOST_LINUX is not set
+CONFIG_HOST_OSX=y
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+# CONFIG_WINDOWS_NATIVE is not set
+# CONFIG_WINDOWS_CYGWIN is not set
+# CONFIG_WINDOWS_MSYS is not set
+# CONFIG_WINDOWS_OTHER is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+CONFIG_INTELHEX_BINARY=y
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+CONFIG_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 is not set
+CONFIG_ARCH_AVR=y
+# 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="avr"
+CONFIG_ARCH_FAMILY="avr"
+CONFIG_ARCH_CHIP="atmega"
+# CONFIG_ARCH_CHIP_ATMEGA128 is not set
+CONFIG_ARCH_CHIP_ATMEGA1284P=y
+# CONFIG_ARCH_CHIP_AT90USB646 is not set
+# CONFIG_ARCH_CHIP_AT90USB647 is not set
+# CONFIG_ARCH_CHIP_AT90USB1286 is not set
+# CONFIG_ARCH_CHIP_AT90USB1287 is not set
+# CONFIG_ARCH_CHIP_AT32UC3B0256 is not set
+CONFIG_ARCH_FAMILY_AVR=y
+CONFIG_ARCH_CHIP_ATMEGA=y
+
+#
+# AVR Configuration Options
+#
+# CONFIG_AVR_WINAVR is not set
+CONFIG_AVR_BUILDROOT=y
+# CONFIG_AVR_USART1 is not set
+
+#
+# ATMega Configuration Options
+#
+CONFIG_AVR_USART0=y
+
+#
+# Architecture Options
+#
+CONFIG_ARCH_NOINTC=y
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+# CONFIG_ARCH_HAVE_IRQPRIO is not set
+# CONFIG_ARCH_ADDRENV is not set
+# CONFIG_ARCH_HAVE_VFORK is not set
+# CONFIG_ARCH_HAVE_MMU is not set
+# CONFIG_ARCH_NAND_HWECC is not set
+CONFIG_ARCH_STACKDUMP=y
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_IDLE_CUSTOM is not set
+# CONFIG_ARCH_HAVE_RAMFUNCS is not set
+# CONFIG_ARCH_HAVE_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=864
+# CONFIG_ARCH_CALIBRATION is not set
+
+#
+# Interrupt options
+#
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+# CONFIG_ARCH_HAVE_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=0x800100
+CONFIG_RAM_SIZE=16384
+# CONFIG_ARCH_HAVE_SDRAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_MOTEINO_MEGA=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="moteino-mega"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_USEC_PER_TICK=10000
+# CONFIG_SYSTEM_TIME64 is not set
+CONFIG_RR_INTERVAL=0
+# CONFIG_SCHED_CPULOAD is not set
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2015
+CONFIG_START_MONTH=1
+CONFIG_START_DAY=21
+CONFIG_DEV_CONSOLE=y
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WAITPID is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="hello_main"
+CONFIG_DISABLE_OS_API=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_ENVIRON=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=4
+CONFIG_NFILE_STREAMS=4
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_WDOG_INTRESERVE=0
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Stack and heap information
+#
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+
+#
+# Device Drivers
+#
+CONFIG_DISABLE_POLL=y
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
+# CONFIG_PWM is not set
+# CONFIG_ARCH_HAVE_I2CRESET is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_I2S is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_AUDIO_DEVICES is not set
+# CONFIG_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_USART0=y
+
+#
+# USART Configuration
+#
+CONFIG_USART0_ISUART=y
+CONFIG_MCU_SERIAL=y
+CONFIG_USART0_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART0 Configuration
+#
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART0_BAUD=115200
+CONFIG_USART0_BITS=8
+CONFIG_USART0_PARITY=0
+CONFIG_USART0_2STOP=0
+# CONFIG_USART0_IFLOWCONTROL is not set
+# CONFIG_USART0_OFLOWCONTROL is not set
+# CONFIG_SERIAL_IFLOWCONTROL is not set
+# CONFIG_SERIAL_OFLOWCONTROL is not set
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+# CONFIG_ARCH_HAVE_NET is not set
+# CONFIG_ARCH_HAVE_PHY is not set
+# CONFIG_NET is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
+# CONFIG_FS_READABLE is not set
+# CONFIG_FS_WRITABLE is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_FS_PROCFS is not set
+
+#
+# System Logging
+#
+
+# CONFIG_SYSLOG 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 Formats
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+# 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_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=y
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_LCDRW is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+# CONFIG_EXAMPLES_NRF24L01TERM is not set
+# CONFIG_EXAMPLES_NSH is not set
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_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 is not set
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_SLCD is not set
+# CONFIG_EXAMPLES_SMART is not set
+# CONFIG_EXAMPLES_TCPECHO is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_WEBSERVER is not set
+# CONFIG_EXAMPLES_USBSERIAL is not set
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_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
+#
+
+#
+# USB CDC/ACM Device Commands
+#
+
+#
+# USB Composite Device Commands
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# INI File Parser
+#
+# CONFIG_SYSTEM_INIFILE is not set
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# FLASH Erase-all Command
+#
+
+#
+# NxPlayer media player library / command Line
+#
+# CONFIG_SYSTEM_NXPLAYER is not set
+
+#
+# RAM test
+#
+# CONFIG_SYSTEM_RAMTEST is not set
+
+#
+# readline()
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# USB Monitor
+#
+
+#
+# EMACS-like Command Line Editor
+#
+# CONFIG_SYSTEM_CLE is not set
+
+#
+# VI Work-Alike Editor
+#
+# CONFIG_SYSTEM_VI is not set
+
+#
+# Stack Monitor
+#
+
+#
+# USB Mass Storage Device Commands
+#
+
+#
+# Zmodem Commands
+#
+# CONFIG_SYSTEM_ZMODEM is not set
diff --git a/nuttx/configs/moteino-mega/hello/ld.script b/nuttx/configs/moteino-mega/hello/ld.script
new file mode 100644
index 000000000..3ea9da807
--- /dev/null
+++ b/nuttx/configs/moteino-mega/hello/ld.script
@@ -0,0 +1,211 @@
+/**************************************************************************************
+ * configs/moteino-mega/hello/ld.script
+ *
+ * Copyright (C) 2015 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.
+ *
+ **************************************************************************************/
+
+/* Memory Regions *********************************************************************/
+/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * ATMEGA1284P 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 16Kb| 0x0000 4Kb
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * *Memory configuration A
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 16K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* 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) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/moteino-mega/hello/setenv.sh b/nuttx/configs/moteino-mega/hello/setenv.sh
new file mode 100755
index 000000000..42f7ca44b
--- /dev/null
+++ b/nuttx/configs/moteino-mega/hello/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/moteino-mega/hello/setenv.sh
+#
+# Copyright (C) 2015 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 WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This is the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/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/moteino-mega/include/board.h b/nuttx/configs/moteino-mega/include/board.h
new file mode 100644
index 000000000..2d73363b5
--- /dev/null
+++ b/nuttx/configs/moteino-mega/include/board.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+ * configs/moteino-mega/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2015 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_MOTEINO_MEGA_INCLUDE_BOARD_H
+#define __CONFIGS_MOTEINO_MEGA_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */
+
+#define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */
+#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */
+
+/* LED definitions **********************************************************/
+
+/* The MoteinoMEGA has a single on-board LED connected to PortD, Pin 7 */
+
+#define LED_STARTED 0 /* OFF ON (never happens) */
+#define LED_HEAPALLOCATE 0 /* OFF ON (never happens) */
+#define LED_IRQSENABLED 0 /* OFF ON (never happens) */
+#define LED_STACKCREATED 1 /* ON ON (never happens) */
+#define LED_INIRQ 2 /* OFF NC (momentary) */
+#define LED_SIGNAL 2 /* OFF NC (momentary) */
+#define LED_ASSERTION 2 /* OFF NC (momentary) */
+#define LED_PANIC 0 /* OFF ON (1Hz flashing) */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MOTEINO_MEGA_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/moteino-mega/nsh/Make.defs b/nuttx/configs/moteino-mega/nsh/Make.defs
new file mode 100644
index 000000000..5556b1b12
--- /dev/null
+++ b/nuttx/configs/moteino-mega/nsh/Make.defs
@@ -0,0 +1,98 @@
+############################################################################
+# configs/moteino-mega/nsh/Make.defs
+#
+# Copyright (C) 2015 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/avr/src/avr/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 = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/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
+
+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 =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+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-gotoff.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/moteino-mega/nsh/defconfig b/nuttx/configs/moteino-mega/nsh/defconfig
new file mode 100644
index 000000000..c2e352625
--- /dev/null
+++ b/nuttx/configs/moteino-mega/nsh/defconfig
@@ -0,0 +1,651 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_DEFAULT_SMALL=y
+# CONFIG_HOST_LINUX is not set
+CONFIG_HOST_OSX=y
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+# CONFIG_WINDOWS_NATIVE is not set
+# CONFIG_WINDOWS_CYGWIN is not set
+# CONFIG_WINDOWS_MSYS is not set
+# CONFIG_WINDOWS_OTHER is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+CONFIG_INTELHEX_BINARY=y
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+CONFIG_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 is not set
+CONFIG_ARCH_AVR=y
+# 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="avr"
+CONFIG_ARCH_FAMILY="avr"
+CONFIG_ARCH_CHIP="atmega"
+# CONFIG_ARCH_CHIP_ATMEGA128 is not set
+CONFIG_ARCH_CHIP_ATMEGA1284P=y
+# CONFIG_ARCH_CHIP_AT90USB646 is not set
+# CONFIG_ARCH_CHIP_AT90USB647 is not set
+# CONFIG_ARCH_CHIP_AT90USB1286 is not set
+# CONFIG_ARCH_CHIP_AT90USB1287 is not set
+# CONFIG_ARCH_CHIP_AT32UC3B0256 is not set
+CONFIG_ARCH_FAMILY_AVR=y
+CONFIG_ARCH_CHIP_ATMEGA=y
+
+#
+# AVR Configuration Options
+#
+# CONFIG_AVR_WINAVR is not set
+CONFIG_AVR_BUILDROOT=y
+# CONFIG_AVR_USART1 is not set
+
+#
+# ATMega Configuration Options
+#
+CONFIG_AVR_USART0=y
+
+#
+# Architecture Options
+#
+CONFIG_ARCH_NOINTC=y
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+# CONFIG_ARCH_HAVE_IRQPRIO is not set
+# CONFIG_ARCH_ADDRENV is not set
+# CONFIG_ARCH_HAVE_VFORK is not set
+# CONFIG_ARCH_HAVE_MMU is not set
+# CONFIG_ARCH_NAND_HWECC is not set
+CONFIG_ARCH_STACKDUMP=y
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_IDLE_CUSTOM is not set
+# CONFIG_ARCH_HAVE_RAMFUNCS is not set
+# CONFIG_ARCH_HAVE_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=864
+# CONFIG_ARCH_CALIBRATION is not set
+
+#
+# Interrupt options
+#
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+# CONFIG_ARCH_HAVE_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=0x800100
+CONFIG_RAM_SIZE=16384
+# CONFIG_ARCH_HAVE_SDRAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_MOTEINO_MEGA=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="moteino-mega"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_USEC_PER_TICK=10000
+# CONFIG_SYSTEM_TIME64 is not set
+CONFIG_RR_INTERVAL=200
+# CONFIG_SCHED_CPULOAD is not set
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2015
+CONFIG_START_MONTH=1
+CONFIG_START_DAY=21
+CONFIG_DEV_CONSOLE=y
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WAITPID is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DISABLE_OS_API=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+# CONFIG_DISABLE_SIGNALS is not set
+CONFIG_DISABLE_MQUEUE=y
+# CONFIG_DISABLE_ENVIRON is not set
+
+#
+# Signal Numbers
+#
+CONFIG_SIG_SIGUSR1=1
+CONFIG_SIG_SIGUSR2=2
+CONFIG_SIG_SIGALARM=3
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_WDOG_INTRESERVE=0
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Stack and heap information
+#
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=512
+
+#
+# Device Drivers
+#
+CONFIG_DISABLE_POLL=y
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
+# CONFIG_PWM is not set
+# CONFIG_ARCH_HAVE_I2CRESET is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_I2S is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_AUDIO_DEVICES is not set
+# CONFIG_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_USART0=y
+
+#
+# USART Configuration
+#
+CONFIG_USART0_ISUART=y
+CONFIG_MCU_SERIAL=y
+CONFIG_STANDARD_SERIAL=y
+CONFIG_USART0_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART0 Configuration
+#
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART0_BAUD=115200
+CONFIG_USART0_BITS=8
+CONFIG_USART0_PARITY=0
+CONFIG_USART0_2STOP=0
+# CONFIG_USART0_IFLOWCONTROL is not set
+# CONFIG_USART0_OFLOWCONTROL is not set
+# CONFIG_SERIAL_IFLOWCONTROL is not set
+# CONFIG_SERIAL_OFLOWCONTROL is not set
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+# CONFIG_ARCH_HAVE_NET is not set
+# CONFIG_ARCH_HAVE_PHY is not set
+# CONFIG_NET is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
+# CONFIG_FS_READABLE is not set
+# CONFIG_FS_WRITABLE is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_FS_PROCFS is not set
+
+#
+# System Logging
+#
+
+# CONFIG_SYSLOG 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 Formats
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_LIBM is not set
+CONFIG_NOPRINTF_FIELDWIDTH=y
+# 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_DHCPD is not set
+# CONFIG_EXAMPLES_ELF is not set
+# CONFIG_EXAMPLES_FTPC is not set
+# CONFIG_EXAMPLES_FTPD is not set
+# CONFIG_EXAMPLES_HELLO is not set
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_LCDRW is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+# CONFIG_EXAMPLES_NRF24L01TERM is not set
+CONFIG_EXAMPLES_NSH=y
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_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 is not set
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_SLCD is not set
+# CONFIG_EXAMPLES_SMART is not set
+# CONFIG_EXAMPLES_TCPECHO is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_WEBSERVER is not set
+# CONFIG_EXAMPLES_USBSERIAL is not set
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_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=y
+CONFIG_NSH_READLINE=y
+# CONFIG_NSH_CLE is not set
+
+#
+# Disable Individual commands
+#
+CONFIG_NSH_DISABLE_ADDROUTE=y
+# CONFIG_NSH_DISABLE_CAT is not set
+# CONFIG_NSH_DISABLE_CD is not set
+# CONFIG_NSH_DISABLE_CP is not set
+CONFIG_NSH_DISABLE_CMP=y
+CONFIG_NSH_DISABLE_DD=y
+CONFIG_NSH_DISABLE_DF=y
+CONFIG_NSH_DISABLE_DELROUTE=y
+# CONFIG_NSH_DISABLE_ECHO is not set
+CONFIG_NSH_DISABLE_EXEC=y
+CONFIG_NSH_DISABLE_EXIT=y
+# CONFIG_NSH_DISABLE_FREE is not set
+CONFIG_NSH_DISABLE_GET=y
+# CONFIG_NSH_DISABLE_HELP is not set
+CONFIG_NSH_DISABLE_HEXDUMP=y
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_KILL is not set
+CONFIG_NSH_DISABLE_LOSETUP=y
+# CONFIG_NSH_DISABLE_LS is not set
+# CONFIG_NSH_DISABLE_MB is not set
+# CONFIG_NSH_DISABLE_MKDIR is not set
+CONFIG_NSH_DISABLE_MKFIFO=y
+CONFIG_NSH_DISABLE_MKRD=y
+# CONFIG_NSH_DISABLE_MH is not set
+# CONFIG_NSH_DISABLE_MOUNT is not set
+# CONFIG_NSH_DISABLE_MW is not set
+# CONFIG_NSH_DISABLE_PS is not set
+CONFIG_NSH_DISABLE_PUT=y
+# CONFIG_NSH_DISABLE_PWD is not set
+# CONFIG_NSH_DISABLE_RM is not set
+# CONFIG_NSH_DISABLE_RMDIR is not set
+# CONFIG_NSH_DISABLE_SET is not set
+# CONFIG_NSH_DISABLE_SH is not set
+# CONFIG_NSH_DISABLE_SLEEP is not set
+# CONFIG_NSH_DISABLE_TEST is not set
+# CONFIG_NSH_DISABLE_UMOUNT is not set
+# CONFIG_NSH_DISABLE_UNSET is not set
+# CONFIG_NSH_DISABLE_USLEEP is not set
+CONFIG_NSH_DISABLE_WGET=y
+CONFIG_NSH_DISABLE_XD=y
+
+#
+# Configure Command Options
+#
+CONFIG_NSH_CODECS_BUFSIZE=128
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_DISABLE_SEMICOLON=y
+CONFIG_NSH_MAXARGUMENTS=6
+# CONFIG_NSH_ARGCAT is not set
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=y
+# CONFIG_NSH_DISABLEBG is not set
+CONFIG_NSH_CONSOLE=y
+
+#
+# NxWidgets/NxWM
+#
+
+#
+# Platform-specific Support
+#
+# CONFIG_PLATFORM_CONFIGDATA is not set
+
+#
+# System Libraries and NSH Add-Ons
+#
+
+#
+# USB CDC/ACM Device Commands
+#
+
+#
+# USB Composite Device Commands
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# INI File Parser
+#
+# CONFIG_SYSTEM_INIFILE is not set
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# FLASH Erase-all Command
+#
+
+#
+# NxPlayer media player library / command Line
+#
+# CONFIG_SYSTEM_NXPLAYER is not set
+
+#
+# RAM test
+#
+# CONFIG_SYSTEM_RAMTEST is not set
+
+#
+# readline()
+#
+CONFIG_SYSTEM_READLINE=y
+CONFIG_READLINE_ECHO=y
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# USB Monitor
+#
+
+#
+# EMACS-like Command Line Editor
+#
+# CONFIG_SYSTEM_CLE is not set
+
+#
+# VI Work-Alike Editor
+#
+# CONFIG_SYSTEM_VI is not set
+
+#
+# Stack Monitor
+#
+
+#
+# USB Mass Storage Device Commands
+#
+
+#
+# Zmodem Commands
+#
+# CONFIG_SYSTEM_ZMODEM is not set
diff --git a/nuttx/configs/moteino-mega/nsh/ld.script b/nuttx/configs/moteino-mega/nsh/ld.script
new file mode 100644
index 000000000..d613030d3
--- /dev/null
+++ b/nuttx/configs/moteino-mega/nsh/ld.script
@@ -0,0 +1,211 @@
+/**************************************************************************************
+ * configs/moteino-mega/nsh/ld.script
+ *
+ * Copyright (C) 2015 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.
+ *
+ **************************************************************************************/
+
+/* Memory Regions *********************************************************************/
+/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * ATMEGA1284P 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 16Kb| 0x0000 4Kb
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * *Memory configuration A
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 16K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* 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) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/moteino-mega/nsh/setenv.sh b/nuttx/configs/moteino-mega/nsh/setenv.sh
new file mode 100755
index 000000000..ee47389b9
--- /dev/null
+++ b/nuttx/configs/moteino-mega/nsh/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/moteino-mega/nsh/setenv.sh
+#
+# Copyright (C) 2015 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 WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This is the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/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/moteino-mega/src/.gitignore b/nuttx/configs/moteino-mega/src/.gitignore
new file mode 100644
index 000000000..726d936e1
--- /dev/null
+++ b/nuttx/configs/moteino-mega/src/.gitignore
@@ -0,0 +1,2 @@
+/.depend
+/Make.dep
diff --git a/nuttx/configs/moteino-mega/src/Makefile b/nuttx/configs/moteino-mega/src/Makefile
new file mode 100644
index 000000000..b9b8dae97
--- /dev/null
+++ b/nuttx/configs/moteino-mega/src/Makefile
@@ -0,0 +1,96 @@
+############################################################################
+# configs/moteino-mega/src/Makefile
+#
+# Copyright (C) 2015 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
+
+ASRCS =
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(CONFIG_ARCH_FAMILY_AVR32),y)
+ARCH_SUBDIR = avr32
+endif
+ifeq ($(CONFIG_ARCH_FAMILY_AVR),y)
+ARCH_SUBDIR = avr
+endif
+
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(TOPDIR)/sched}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
+else
+ CFLAGS += -I "$(TOPDIR)/sched"
+ CFLAGS += -I "$(ARCH_SRCDIR)/chip"
+ CFLAGS += -I "$(ARCH_SRCDIR)/common"
+ CFLAGS += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
+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/moteino-mega/src/moteino_mega_internal.h b/nuttx/configs/moteino-mega/src/moteino_mega_internal.h
new file mode 100644
index 000000000..078242e33
--- /dev/null
+++ b/nuttx/configs/moteino-mega/src/moteino_mega_internal.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/moteino-mega/src/moteino-mega-internal.h
+ *
+ * Copyright (C) 2015 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_MOTEINO_MEGA_SRC_MOTEINO_MEGA_INTERNAL_H
+#define __CONFIGS_MOTEINO_MEGA_SRC_MOTEINO_MEGA_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: atmega_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Amber Web Server.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
+EXTERN void weak_function atmega_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: atmega_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void atmega_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MOTEINO_MEGA_SRC_MOTEINO_MEGA_INTERNAL_H */
diff --git a/nuttx/configs/moteino-mega/src/up_boot.c b/nuttx/configs/moteino-mega/src/up_boot.c
new file mode 100644
index 000000000..80233bb89
--- /dev/null
+++ b/nuttx/configs/moteino-mega/src/up_boot.c
@@ -0,0 +1,92 @@
+/************************************************************************************
+ * configs/moteino-mega/src/up_boot.c
+ *
+ * Copyright (C) 2015 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 "up_internal.h"
+
+#include "atmega_internal.h"
+#include "moteino_mega_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All ATMega architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void up_boardinitialize(void)
+{
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function atmega_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
+ if (atmega_spiinitialize)
+ {
+ atmega_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ atmega_ledinit();
+#endif
+}
diff --git a/nuttx/configs/moteino-mega/src/up_leds.c b/nuttx/configs/moteino-mega/src/up_leds.c
new file mode 100644
index 000000000..bc436aa5b
--- /dev/null
+++ b/nuttx/configs/moteino-mega/src/up_leds.c
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * configs/moteino-mega/src/up_leds.c
+ *
+ * Copyright (C) 2015 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>
+#include <avr/io.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "atmega_internal.h"
+#include "moteino_mega_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * 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
+# ifdef CONFIG_DEBUG_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static bool g_ncoff;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: atmega_ledinit
+ ****************************************************************************/
+
+void atmega_ledinit(void)
+{
+ /* The MoteinoMEGA's single LED is on Port D, Pin 7. Configure this pin as an
+ * output and turn it OFF. The "other" side of the LED is onnected to
+ * ground through a resistor. Therefore, a logic value of 0 should turn
+ * the LED off.
+ */
+
+ DDRD |= (1 << 7);
+ PORTD &= ~(1 << 7);
+ g_ncoff = true;
+}
+
+/****************************************************************************
+ * Name: board_led_on
+ ****************************************************************************/
+
+void board_led_on(int led)
+{
+ /* ON OFF
+ * LED_STARTED 0 OFF ON (never happens)
+ * LED_HEAPALLOCATE 0 OFF ON (never happens)
+ * LED_IRQSENABLED 0 OFF ON (never happens)
+ * LED_STACKCREATED 1 ON ON (never happens)
+ * LED_INIRQ 2 OFF NC (momentary)
+ * LED_SIGNAL 2 OFF NC (momentary)
+ * LED_ASSERTION 2 OFF NC (momentary)
+ * LED_PANIC 0 OFF ON (1Hz flashing)
+ */
+
+ switch (led)
+ {
+ case 0:
+ /* The steady state is OFF */
+
+ g_ncoff = true;
+
+ case 2:
+ /* Turn the LED off */
+
+ PORTD &= ~(1 << 7);
+ break;
+
+ case 1:
+ /* The steady state is ON */
+
+ PORTD |= (1 << 7);
+ g_ncoff = false;
+ break;
+
+ default:
+ return;
+ }
+}
+
+/****************************************************************************
+ * Name: board_led_off
+ ****************************************************************************/
+
+void board_led_off(int led)
+{
+ /* ON OFF
+ * LED_STARTED 0 OFF ON (never happens)
+ * LED_HEAPALLOCATE 0 OFF ON (never happens)
+ * LED_IRQSENABLED 0 OFF ON (never happens)
+ * LED_STACKCREATED 1 ON ON (never happens)
+ * LED_INIRQ 2 OFF NC (momentary)
+ * LED_SIGNAL 2 OFF NC (momentary)
+ * LED_ASSERTION 2 OFF NC (momentary)
+ * LED_PANIC 0 OFF ON (1Hz flashing)
+ */
+
+ switch (led)
+ {
+ case 2:
+ /* If the "no-change" state is OFF, then turn the LED off */
+
+ if (g_ncoff)
+ {
+ PORTD &= ~(1 << 7);
+ break;
+ }
+
+ /* Otherwise, fall through to turn the LED ON */
+
+ case 0:
+ case 1:
+ /* Turn the LED on */
+
+ PORTD |= (1 << 7);
+ break;
+
+ default:
+ return;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */