modify nuttx bug of lack of files

This commit is contained in:
TangYiwen123
2021-06-11 11:25:07 +08:00
parent 4a7f51a5e9
commit 6d0f2ca39a
6752 changed files with 1528133 additions and 0 deletions
@@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
@@ -0,0 +1,541 @@
README
^^^^^
This is the README file for the port of NuttX to the Micropendous 3 board.
This board is develepmend by http://code.google.com/p/opendous/. The
Micropendous 3 is based on an Atmel AT90USB646, 647, 1286 or 1287 MCU.
NuttX was ported using the AT90USB647 version. As of this writing,
documentation for the Micropendous board is available here:
http://code.google.com/p/micropendous/wiki/Micropendous3
Contents
^^^^^^^^
o Micropendous3 Features
o Pin Usage
o Atmel AVRISP mkII Connection
o DFU Bootloader
o Serial Console
o Toolchains
o Windows Native Toolchains
o NuttX buildroot Toolchain
o avr-libc
o Micropendous3 Configuration Options
o Configurations
Micropendous3 Features
^^^^^^^^^^^^^^^^^^^^^^
o Based on the 64-pin USB AVR Microcontrollers: AT90USB646, AT90USB647,
AT90USB1286, or AT90USB1287.
o USB Full Speed (12Mbit/s)
o USB Device Mode (Host mode supported with AT90USBxx7 devices)
o 60kb (AT90USB64) or 120kb (AT90USB128) of available FLASH memory for
your programs (4kb(AT90USB64)/8kb(AT90USB128) used by USB bootloader -
stock Atmel or LUFA)
o 4 kbytes SRAM and 2 kbytes of EEPROM (AT90USB64) or 8 kbytes SRAM and 4
kbytes of EEPROM (AT90USB128)
o External SRAM is possible. Layout for CY7C1019D 1-Mbit SRAM (unpopulated)
o USB powered
o 16MHz crystal
o 48 General Purpose IO Pins (47 with external SRAM)
o Vcc=VBUS jumper selects whether USB VBUS or an external supply is used
to power the board
o RESET and HWB buttons to enable firmware loading over USB (no external
programmer required)
o HWB can be used as a user button
o USB-A Plug
o JTAG header
o Size LxWxH (including headers): 3.15" x 0.8" x 0.6" =~ 8cm x 2cm x 1.5cm
o Completely OpenHardware Design
Pin Usage
^^^^^^^^^
AT90USB90128/64 TQFP64
-- ------------------------ ---------------------------------------------
PIN SIGNAL BOARD CONNECTION
-- ------------------------ ---------------------------------------------
(left)
1 (INT.6/AIN.0) PE6 J3-25 E6, CY7C1019D ^CE (Unpopulated)
2 (INT.7/AIN.1/UVcon) PE7 J3-26 E7, CY7C1019D A16 (Unpopulated)
3 UVcc
4 D- USB DP
5 D+ USB DM
6 UGnd GND
7 UCap GND (via cap)
8 VBus USB VBUS
9 (IUID) PE3 J3-22 E3
10 (SS/PCINT0) PB0 J3-28 B0
11 (PCINT1/SCLK) PB1 J3-29 B1
12 (PDI/PCINT2/MOSI) PB2 J3-30 B2
13 (PDO/PCINT3/MISO) PB3 J3-31 B3
14 (PCINT4/OC.2A) PB4 J3-32 B4
15 (PCINT5/OC.1A) PB5 J3-33 B5
16 (PCINT6/OC.1B) PB6 J3-34 B6
(bottom)
17 (PCINT7/OC.0A/OC.1C) PB7 J3-35 B7
18 (INT4/TOSC1) PE4 J3-23 E4
19 (INT.5/TOSC2) PE5 J3-24 E5
20 RESET SW1
21 VCC VCC
22 GND GND
23 XTAL2 X1
24 XTAL1 X1
25 (OC0B/SCL/INT0) PD0 J3-36 D0
26 (OC2B/SDA/INT1) PD1 J3-37 D1
27 (RXD1/INT2) PD2 J3-38 D2
28 (TXD1/INT3) PD3 J3-39 D3
29 (ICP1) PD4 J3-40 D4
30 (XCK1) PD5 J3-41 D5
31 (T1) PD6 J3-42 D6
32 (T0) PD7 J3-43 D7
(right)
48 PA3 (AD3) J3-14 A3, 74AHC573 D3, CY7C1019D |O3 (Unpopulated)
47 PA4 (AD4) J3-15 A4, 74AHC573 D4, CY7C1019D |O4 (Unpopulated)
46 PA5 (AD5) J3-16 A5, 74AHC573 D5, CY7C1019D |O5 (Unpopulated)
45 PA6 (AD6) J3-17 A6, 74AHC573 D6, CY7C1019D |O6 (Unpopulated)
44 PA7 (AD7) J3-18 A7, 74AHC573 D7, CY7C1019D |O7 (Unpopulated)
43 PE2 (ALE/HWB) SW-2 (pulled-up), J3-21 E2, 74AHC573 Cp
42 PC7 (A15/IC.3/CLKO) J3-51 C7, CY7C1019D A15 (Unpopulated)
41 PC6 (A14/OC.3A) J3-50 C6, CY7C1019D A14 (Unpopulated)
40 PC5 (A13/OC.3B) J3-49 C5, CY7C1019D A13 (Unpopulated)
39 PC4 (A12/OC.3C) J3-48 C4, CY7C1019D A12 (Unpopulated)
38 PC3 (A11/T.3) J3-47 C3, CY7C1019D A11 (Unpopulated)
37 PC2 (A10) J3-46 C2, CY7C1019D A10 (Unpopulated)
36 PC1 (A9) J3-45 C1, CY7C1019D A9 (Unpopulated)
35 PC0 (A8) J3-44 C0, CY7C1019D A8 (Unpopulated)
34 PE1 (RD) J3-20 E1, CY7C1019D ^OE (Unpopulated)
33 PE0 (WR) J3-19 E0, CY7C1019D ^WE (Unpopulated)
(top)
64 AVCC (Power circuitry)
63 GND GND
62 AREF J3-2 AREF, (Power circuitry)
61 PF0 (ADC0) J3-3 F0
60 PF1 (ADC1) J3-4 F1
59 PF2 (ADC2) J3-5 F2
58 PF3 (ADC3) J3-6 F3
57 PF4 (ADC4/TCK) J3-7 F4, JTAG TCK
56 PF5 (ADC5/TMS) J3-8 F5, JTAG TMS
55 PF6 (ADC6/TDO) J3-9 F6, JTAG TD0
54 PF7 (ADC7/TDI) J3-20 F7, JTAG TDI
53 GND GND
52 VCC VCC
51 PA0 (AD0) J3-11 A0, 74AHC573 D0, CY7C1019D |O0 (Unpopulated)
50 PA1 (AD1) J3-12 A1, 74AHC573 D1, CY7C1019D |O1 (Unpopulated)
49 PA2 (AD2) J3-13 A2, 74AHC573 D2, CY7C1019D |O2 (Unpopulated)
Atmel AVRISP mkII Connection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ISP6PIN Header
--------------
1 2
MISO o o VCC
SCK o o MOSI
RESET o o GND
Micropendous 3 JTAG (JTAG10PIN Connector)
------------------- ---------------------
1 2 1 2
TCK o o GND TCK o o GND
TDO o o VCC TDO o o VTref
TMS o o RESET TMS o o nSRST
VCC o o N/C o o (nTRST)
TDI o o GND TDI o o GND
JTAGICE mkII Connection to 10-pin Header
------------------------------------------
10PIN Header 6PIN Header
-------------------- ---------------------
Pin 1 TCK Pin 3 SCK
Pin 2 GND Pin 6 GND
Pin 3 TDO Pin 1 MISO
Pin 4 VTref Pin 2 Vcc
Pin 6 nSRT Pin 5 Reset
Pin 9 TDI Pin 4 MOSI
DFU Bootloader
^^^^^^^^^^^^^^
There is also an DFU bootloader that resides in the upper 8Kb of FLASH
(unless you ERASE the flash with ICE). You can enter this bootloader
(if it is in FLASH) by:
Holding both the SW1 (RESET) and SW2, then releasing SW1 while continuing
to hold SW2. SW2 connects to the PE2/HWB signal and causes a reset into
the bootloader memory region.
Then you can use FLIP to load code into FLASH (available at the Atmel Web
Site). The DFU USB driver for the DFU bootload is available in the usb
subdirectory in the FLIP installation location.
Serial Console
^^^^^^^^^^^^^^
A serial console is supported on an external MAX232/MAX3232 Connected
on PD2 and PD3:
Port D, Bit 2: RXD1, Receive Data (Data input pin for the USART1). When
the USART1 receiver is enabled this pin is configured as an input
regardless of the value of DDD2. When the USART forces this pin to
be an input, the pull-up can still be controlled by the PORTD2 bit.
Port D, Bit 3: TXD1, Transmit Data (Data output pin for the USART1).
When the USART1 Transmitter is enabled, this pin is configured as
an output regardless of the value of DDD3.
AT90USB90128/64 TQFP64
-- ------------------------ ---------------------------------------------
PIN SIGNAL BOARD CONNECTION
-- ------------------------ ---------------------------------------------
27 (RXD1/INT2) PD2 J3-38 D2
28 (TXD1/INT3) PD3 J3-39 D3
Toolchains
^^^^^^^^^^
There are several toolchain options. However, testing has been performed
using *only* the NuttX buildroot toolchain described below. Therefore,
the NuttX buildroot toolchain is the recommended choice.
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://bitbucket.org/nuttx/buildroot/downloads/. See the
following section for details on building this toolchain.
Before building, make sure that the path to the new toolchain is included
in your PATH environment variable.
After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT_TOOLCHAIN=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/
Before building, make sure that the path to the new toolchain is included
in your PATH environment variable.
After configuring NuttX, make sure that CONFIG_AVR_WINAVR_TOOLCHAIN=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_TOOLCHAIN=y is set in your
.config file.
macOS:
For macOS, 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.
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 Bitbucket download site (https://bitbucket.org/nuttx/nuttx/downloads/).
This GNU toolchain builds and executes in the Linux or Cygwin environment.
1. You must have already configured NuttX in <some-dir>/nuttx.
tools/configure.sh micropendous3:<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 boards/avr-defconfig-4.5.2 .config
6. make oldconfig
7. make
8. Make sure that the PATH variable includes the path to the newly built
binaries.
See the file boards/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
location:
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
Micropendous3 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_AVR=y
CONFIG_ARCH_architecture - For use in C code:
CONFIG_ARCH_CHIP_AT90USB=y
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
CONFIG_ARCH_CHIP=at90usb
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
chip. This should be exactly one of
CONFIG_ARCH_CHIP_AT90USB646=y
CONFIG_ARCH_CHIP_AT90USB647=y
CONFIG_ARCH_CHIP_AT90USB1286=y
CONFIG_ARCH_CHIP_AT90USB1287=y
Depending on which Micropendous3 version you have.
CONFIG_ARCH_BOARD - Identifies the boards/ subdirectory and
hence, the board that supports the particular chip or SoC.
CONFIG_ARCH_BOARD=micropendous3
CONFIG_ARCH_BOARD_name - For use in C code
CONFIG_ARCH_BOARD_MICROPENOUS3=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=(4*1024) - (4Kb)
CONFIG_RAM_SIZE=(8*1024) - (8Kb)
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.
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_USBHOST=n
CONFIG_AVR_USBDEV=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_USART1=y
CONFIG_AVR_ANACOMP=n
CONFIG_AVR_ADC=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
AT90USB specific device driver settings
CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
console and ttys0 (default is no serial console).
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 Micropendous3 configuration is maintained in a sub-directory and
can be selected as follow:
tools/configure.sh micropendous3:<subdir>
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
see additional README.txt files in the NuttX tools repository.
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_TOOLCHAIN=y
Configuration Sub-Directories
-----------------------------
hello:
The simple apps/examples/hello "Hello, World!" example.
FLASH/SRAM Requirements (as of 6/16/2011):
$ avr-nuttx-elf-size nuttx
text data bss dec hex filename
24816 978 308 26102 65f6 nuttx
Strings are in SRAM.
@@ -0,0 +1,43 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ARCH="avr"
CONFIG_ARCH_AVR=y
CONFIG_ARCH_BOARD="micropendous3"
CONFIG_ARCH_BOARD_MICROPENDOUS3=y
CONFIG_ARCH_CHIP="at90usb"
CONFIG_ARCH_CHIP_AT90USB647=y
CONFIG_ARCH_CHIP_AT90USB=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_AVR_LINUXGCC_TOOLCHAIN=y
CONFIG_AVR_USART1=y
CONFIG_BOARD_LOOPSPERMSEC=864
CONFIG_CONSOLE_SYSLOG=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_IDLETHREAD_STACKSIZE=512
CONFIG_INTELHEX_BINARY=y
CONFIG_MAX_TASKS=4
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=4
CONFIG_NUNGET_CHARS=0
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_STACK_DEFAULT=1024
CONFIG_RAM_SIZE=4096
CONFIG_RAM_START=0x800100
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=16
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2011
CONFIG_STDIO_DISABLE_BUFFERING=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_BAUD=38400
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USERMAIN_STACKSIZE=512
CONFIG_USER_ENTRYPOINT="hello_main"
@@ -0,0 +1,90 @@
/****************************************************************************
* boards/avr/at90usb/micropendous3/include/board.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_AVR_AT90USB_MICROPENDOUS3_INCLUDE_BOARD_H
#define __BOARDS_AVR_AT90USB_MICROPENDOUS3_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 Micropendous 3 has no on-board LEDs */
#define LED_STARTED 0
#define LED_HEAPALLOCATE 1
#define LED_IRQSENABLED 2
#define LED_STACKCREATED 3
#define LED_INIRQ 4
#define LED_SIGNAL 5
#define LED_ASSERTION 6
#define LED_PANIC 7
/* Button definitions *******************************************************/
/* SW1 = Connects to AT90USBxx RESET pin and is not available to software.
* SW2 = Connects (via a pull-up) to PE-2
*/
/****************************************************************************
* 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 /* __BOARDS_AVR_AT90USB_MICROPENDOUS3_INCLUDE_BOARD_H */
@@ -0,0 +1,52 @@
############################################################################
# boards/avr/at90usb/micropendous3/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/avr/src/avr/Toolchain.defs
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)micropendous3.ld"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)micropendous3.ld
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
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
@@ -0,0 +1,194 @@
/****************************************************************************
* boards/avr/at90usb/micropendous3/scripts/micropendous3.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* Memory Regions ***********************************************************/
/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
* | REGISTERS REGISTERS |
* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* AT90USB646/7 0x0000 64Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 4Kb | 0x0000 2Kb
* AT90USB1286/7 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 8Kb | 0x0000 4Kb
* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
*/
MEMORY
{
flash (rx) : ORIGIN = 0, LENGTH = 128K
sram (rw!x) : ORIGIN = 0x800100, LENGTH = 8K
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
}
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) }
}
@@ -0,0 +1,29 @@
############################################################################
# boards/avr/at90usb/micropendous3/src/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/Make.defs
CSRCS = at90usb_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += at90usb_leds.c
endif
include $(TOPDIR)/boards/Board.mk
@@ -0,0 +1,79 @@
/****************************************************************************
* boards/avr/at90usb/micropendous3/src/at90usb_boot.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "at90usb.h"
#include "micropendous3.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: at90usb_boardinitialize
*
* Description:
* All AT90USB architectures must provide the following entry point.
* This entry point is called early in the initialization - after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
****************************************************************************/
void at90usb_boardinitialize(void)
{
/* Configure SSP chip selects if 1) at least one SSP is enabled, and 2)
* the weak function at90usb_spidev_initialize() has been brought into
* the link.
*/
#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
if (at90usb_spidev_initialize)
{
at90usb_spidev_initialize();
}
#endif
/* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
at90usb_led_initialize();
#endif
}
@@ -0,0 +1,89 @@
/****************************************************************************
* boards/avr/at90usb/micropendous3/src/micropendous3.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_AVR_AT90USB_MICROPENDOUS3_SRC_MICROPENDOUS3_H
#define __BOARDS_AVR_AT90USB_MICROPENDOUS3_SRC_MICROPENDOUS3_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: at90usb_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the Micropendous3
* board.
*
****************************************************************************/
#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
EXTERN void weak_function at90usb_spidev_initialize(void);
#endif
/****************************************************************************
* Name: at90usb_led_initialize
*
* Description:
* Configure on-board LEDs if LED support has been selected.
*
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
EXTERN void at90usb_led_initialize(void);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_AVR_AT90USB_MICROPENDOUS3_SRC_MICROPENDOUS3_H */
@@ -0,0 +1,7 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_TEENSY_20
endif
@@ -0,0 +1,568 @@
README
^^^^^
This is the README file for the port of NuttX to the PJRC Teensy++ 2.0 board.
This board is developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
on an Atmel AT90USB1286 MCU.
Contents
^^^^^^^^
o Teensy++ 2.0 Features
o Pin Usage
o Halfkey Bootloader
o Serial Console
o SD Connection
o Toolchains
o Windows Native Toolchains
o NuttX buildroot Toolchain
o avr-libc
o Teensy++ Configuration Options
o Configurations
Teensy++ 2.0 Features
^^^^^^^^^^^^^^^^^^^^^
o Based on the 64-pin USB AVR Microcontroller AT90USB1286.
o USB Full Speed (12Mbit/s)
o USB Device Mode
o 120kbof available FLASH memory for programs.
o 8 kbytes SRAM and 4 kbytes of EEPROM
o USB powered
o 16MHz crystal
o 48 General Purpose IO Pins
Pin Usage
^^^^^^^^^
AT90USB1286 TQFP64
-- ------------------------ ---------------------------------------------
PIN SIGNAL BOARD CONNECTION
-- ------------------------ ---------------------------------------------
(left)
1 (INT.6/AIN.0) PE6 Pad E6
2 (INT.7/AIN.1/UVcon) PE7 Pad E7
3 UVcc (Voltage circutry)
4 D- USB DP
5 D+ USB DM
6 UGnd GND
7 UCap GND (via cap)
8 VBus USB VBUS
9 (IUID) PE3 N/C
10 (SS/PCINT0) PB0 Pad B0
11 (PCINT1/SCLK) PB1 Pad B1
12 (PDI/PCINT2/MOSI) PB2 Pad B2
13 (PDO/PCINT3/MISO) PB3 Pad B3
14 (PCINT4/OC.2A) PB4 Pad B4
15 (PCINT5/OC.1A) PB5 Pad B5
16 (PCINT6/OC.1B) PB6 Pad B6
(bottom)
17 (PCINT7/OC.0A/OC.1C) PB7 Pad B7
18 (INT4/TOSC1) PE4 Pad E4
19 (INT.5/TOSC2) PE5 Pad E5
20 RESET Switch pulls to ground
21 VCC VCC
22 GND GND
23 XTAL2 XTAL (16MHz)
24 XTAL1 XTAL (16MHz)
25 (OC0B/SCL/INT0) PD0 Pad D0
26 (OC2B/SDA/INT1) PD1 Pad D1
27 (RXD1/INT2) PD2 Pad D2
28 (TXD1/INT3) PD3 Pad D3
29 (ICP1) PD4 Pad D4
30 (XCK1) PD5 Pad D5
31 (T1) PD6 Pad D6, LED
32 (T0) PD7 Pad D7
(right)
48 PA3 (AD3) Pad A3
47 PA4 (AD4) Pad A4
46 PA5 (AD5) Pad A5
45 PA6 (AD6) Pad A6
44 PA7 (AD7) Pad A7
43 PE2 (ALE/HWB) Pad ALE (Pulled down)
42 PC7 (A15/IC.3/CLKO) Pad C7
41 PC6 (A14/OC.3A) Pad C6
40 PC5 (A13/OC.3B) Pad C5
39 PC4 (A12/OC.3C) Pad C4
38 PC3 (A11/T.3) Pad C3
37 PC2 (A10) Pad C2
36 PC1 (A9) Pad C1
35 PC0 (A8) Pad C0
34 PE1 (RD) Pad E1
33 PE0 (WR) Pad E0
(top)
64 AVCC VCC
63 GND GND
62 AREF Pad Ref (Capacitor to ground)
61 PF0 (ADC0) Pad F0
60 PF1 (ADC1) Pad F1
59 PF2 (ADC2) Pad F2
58 PF3 (ADC3) Pad F3
57 PF4 (ADC4/TCK) Pad F4
56 PF5 (ADC5/TMS) Pad F5
55 PF6 (ADC6/TDO) Pad F6
54 PF7 (ADC7/TDI) Pad F7
53 GND GND
52 VCC VCC
51 PA0 (AD0) Pad A0
50 PA1 (AD1) Pad A1
49 PA2 (AD2) Pad A2
Halfkey Bootloader
^^^^^^^^^^^^^^^^^^
o Download the Teensy application from http://pjrc.com/teensy/loader.html
o Instructions are available for your OS at that places as well.
Summary:
1. Start Teensy
2. Press button on the Teensy board
3. Select a HEX file (File menu)
4. Select "program" (Operations menu)
5. Reboot (Operations menu).
Serial Console
^^^^^^^^^^^^^^
A serial console is supported on an external MAX232/MAX3232 Connected
on PD2 and PD3:
Port D, Bit 2: RXD1, Receive Data (Data input pin for the USART1). When
the USART1 receiver is enabled this pin is configured as an input
regardless of the value of DDD2. When the USART forces this pin to
be an input, the pull-up can still be controlled by the PORTD2 bit.
Port D, Bit 3: TXD1, Transmit Data (Data output pin for the USART1).
When the USART1 Transmitter is enabled, this pin is configured as
an output regardless of the value of DDD3.
AT90USB90128/64 TQFP64
-- ------------------------ ---------------------------------------------
PIN SIGNAL BOARD CONNECTION
-- ------------------------ ---------------------------------------------
27 (RXD1/INT2) PD2 Pad D2
28 (TXD1/INT3) PD3 Pad D3
Plus power and ground. There are numerous ground points and both USB 5V
and Vcc are available.
SD Connection
^^^^^^^^^^^^^
I have the SD-ADP SD/MMC Card Adaptor from www.gravitech.com
(http://www.gravitech.us/sdcaad.html). Features:
o On-board 3.3V regulator
o Connect directly to 3.3V or 5.0V microcontroller
o Card detect LED
o Includes 11-pin male header
o Board dimension: 2.0”x1.3”
SD-ADP Pinout / SD Connection
-- ---- ----------- -------------------------------------------------------
J2 NAME SD CARD DESCRIPTION
-- ---- ----------- -------------------------------------------------------
1 VIN (regulator)Input power to the SD card (3.3V to 6.0V)
2 GND 3,6,12,13 Common (Connects to the housing of the SD socket)
3 3V3 4 3.3V Output voltage from the on-board 3.3V regulator (250mA)
4 NC 9 NC Connect to pin 9 on the SD card (not used in SPI mode)
5 CS 1 DAT3/CS Chip select *
6 DI 2 CMD/DI Serial input data *
7 SCK 5 SCK Serial clock *
8 DO 7 DAT0/DO Serial output data
9 IRQ 8 DAT1/IRQ Interrupt request, connect to pin 8 on the SD card (not used in SPI mode)
10 CD 10 CD Card detect (active low)
11 WP 11 WP Write protect
-- ---- ----------- -------------------------------------------------------
* Via a 74LCX245 level translator / buff
Teensy SPI Connection
-- ---- -- ------------------------- -------
J2 NAME PIN NAME PAD
-- ---- -- ------------------------- -------
1 VIN -- Connected to USB +5V
2 GND -- Connected to USB GND
3 3V3 -- Not used ---
4 NC -- Not used
5 CS 10 (SS/PCINT0) PB0 Pad B0
6 DI 12 (PDI/PCINT2/MOSI) PB2 Pad B2
7 SCK 11 (PCINT1/SCLK) PB1 Pad B1
8 DO 13 (PDO/PCINT3/MISO) PB3 Pad B3
9 IRQ -- Not used ---
10 CD 14 (PCINT4/OC.2A) PB4 Pad B4
11 WP 15 (PCINT5/OC.1A) PB5 Pad B5
-- ---- -- ------------------------- -------
Toolchains
^^^^^^^^^^
There are several toolchain options. However, testing has been performed
using *only* the NuttX buildroot toolchain described below. Therefore,
the NuttX buildroot toolchain is the recommended choice.
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://bitbucket.org/nuttx/buildroot/downloads/. See the
following section for details on building this toolchain.
Make sure that your PATH evirnoment variable includes the path the newly
built binaries.
After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT_TOOLCHAIN=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/
Make sure that your PATH evirnoment variable includes the path the WinAvR
binaries.
After configuring NuttX, make sure that CONFIG_AVR_WINAVR_TOOLCHAIN=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!
Atmel Studio
Another option is to use the AVR toolchain provided within the Atmel Studio
installation. Look in the Atmel/Studio directories and Program Files (x86)
to find the tools in a subdirectory like toolchain/avr8/avr8-gnu-toolchain/bin.
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_TOOLCHAIN=y is set in your
.config file.
macOS:
For macOS, 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.
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 Bitbucket download site (https://bitbucket.org/nuttx/nuttx/downloads/).
This GNU toolchain builds and executes in the Linux or Cygwin environment.
1. You must have already configured NuttX in <some-dir>/nuttx.
tools/configure.sh Teensy++:<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 boards/avr-defconfig-4.5.2 .config
6. make oldconfig
7. make
8. Make sure that the PATH variable includes the path to the newly built
binaries.
See the file boards/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
location:
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
Teensy++ 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_AVR=y
CONFIG_ARCH_architecture - For use in C code:
CONFIG_ARCH_CHIP_AT90USB=y
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
CONFIG_ARCH_CHIP=at90usb
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
chip.
CONFIG_ARCH_CHIP_AT90USB1286=y
CONFIG_ARCH_BOARD - Identifies the boards/ subdirectory and
hence, the board that supports the particular chip or SoC.
CONFIG_ARCH_BOARD=teensy-2.0
CONFIG_ARCH_BOARD_name - For use in C code
CONFIG_ARCH_BOARD_TEENSY_20=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=(8*1024) - (8Kb)
CONFIG_RAM_START - The start address of installed DRAM
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.
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_USBHOST=n
CONFIG_AVR_USBDEV=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_USART1=y
CONFIG_AVR_ANACOMP=n
CONFIG_AVR_ADC=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
AT90USB specific device driver settings
CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
console and ttys0 (default is no serial console).
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
AT90USB specific USB device configuration
CONFIG_USB_DISABLE_PADREGULATOR
CONFIG_USB_LOWSPEED
CONFIG_USB_NOISYVBUS
Configurations
^^^^^^^^^^^^^^
Common Configuration Notes
--------------------------
1. Each Teensy++ configuration is maintained in a sub-directory and
can be selected as follow:
tools/configure.sh teensy-2.0:<subdir>
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
see additional README.txt files in the NuttX tools repository.
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_TOOLCHAIN=y
Configuration Sub-Directories
-----------------------------
hello:
The simple apps/examples/hello "Hello, World!" example.
nsh:
This is a reduce NuttShell (NSH) configuration using apps/example/nsh.
The serial console is provided on USART1 and can be accessed via
an external RS-232 driver as described above under "Serial Console".
ostest:
This configuration directory, performs a simple OS test using
apps/examples/ostest. NOTE: The OS test is quite large. In order
to get it to fit within AVR memory constraints, it will probably be
necessary to disable some OS features.
usbmsc:
This configuration directory exercises the USB mass storage
class driver at apps/system/usbmsc. See apps/examples/README.txt
for more information.
NOTE: THIS CONFIGURATION HAS NOT YET BEEN DEBUGGED AND DOES NOT
WORK!!! ISSUES: (1) THE SPI DRIVER IS UNTESTED, (2) THE USB DRIVER
IS UNTESTED, AND (3) THE RAM USAGE MIGHT BE EXCESSIVE.
Update 7/11: (1) The SPI/SD driver has been verified, however, (2) I
believe that the current teensy-2.0/usbmsc configuration uses too
much SRAM for the system to behave sanely. A lower memory footprint
version of the mass storage driver will be required before this can
be debugged.
@@ -0,0 +1,43 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ARCH="avr"
CONFIG_ARCH_AVR=y
CONFIG_ARCH_BOARD="teensy-2.0"
CONFIG_ARCH_BOARD_TEENSY_20=y
CONFIG_ARCH_CHIP="at90usb"
CONFIG_ARCH_CHIP_AT90USB1286=y
CONFIG_ARCH_CHIP_AT90USB=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_AVR_LINUXGCC_TOOLCHAIN=y
CONFIG_AVR_USART1=y
CONFIG_BOARD_LOOPSPERMSEC=864
CONFIG_CONSOLE_SYSLOG=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_IDLETHREAD_STACKSIZE=512
CONFIG_INTELHEX_BINARY=y
CONFIG_MAX_TASKS=4
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=4
CONFIG_NUNGET_CHARS=0
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_STACK_DEFAULT=1024
CONFIG_RAM_SIZE=8192
CONFIG_RAM_START=0x800100
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=16
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2011
CONFIG_STDIO_DISABLE_BUFFERING=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_BAUD=38400
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USERMAIN_STACKSIZE=512
CONFIG_USER_ENTRYPOINT="hello_main"
@@ -0,0 +1,47 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_ENVIRON is not set
# CONFIG_NSH_DISABLEBG is not set
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="avr"
CONFIG_ARCH_AVR=y
CONFIG_ARCH_BOARD="teensy-2.0"
CONFIG_ARCH_BOARD_TEENSY_20=y
CONFIG_ARCH_CHIP="at90usb"
CONFIG_ARCH_CHIP_AT90USB1286=y
CONFIG_ARCH_CHIP_AT90USB=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_AVR_LINUXGCC_TOOLCHAIN=y
CONFIG_AVR_USART1=y
CONFIG_BOARD_LOOPSPERMSEC=864
CONFIG_DEFAULT_SMALL=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_IDLETHREAD_STACKSIZE=512
CONFIG_INTELHEX_BINARY=y
CONFIG_MAX_TASKS=8
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NUNGET_CHARS=0
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_STACK_DEFAULT=512
CONFIG_RAM_SIZE=8192
CONFIG_RAM_START=0x800100
CONFIG_RR_INTERVAL=200
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=17
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2010
CONFIG_STDIO_DISABLE_BUFFERING=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_BAUD=38400
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USERMAIN_STACKSIZE=512
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,62 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_SPI_EXCHANGE is not set
CONFIG_ARCH="avr"
CONFIG_ARCH_AVR=y
CONFIG_ARCH_BOARD="teensy-2.0"
CONFIG_ARCH_BOARD_TEENSY_20=y
CONFIG_ARCH_CHIP="at90usb"
CONFIG_ARCH_CHIP_AT90USB1286=y
CONFIG_ARCH_CHIP_AT90USB=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_AVR_LINUXGCC_TOOLCHAIN=y
CONFIG_AVR_SPI=y
CONFIG_AVR_USART1=y
CONFIG_AVR_USBDEV=y
CONFIG_BOARD_LOOPSPERMSEC=864
CONFIG_CONSOLE_SYSLOG=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_IDLETHREAD_STACKSIZE=512
CONFIG_INTELHEX_BINARY=y
CONFIG_LIB_BOARDCTL=y
CONFIG_MAX_TASKS=8
CONFIG_MMCSD=y
CONFIG_MMCSD_SPICLOCK=12500000
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NUNGET_CHARS=0
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_STACK_DEFAULT=512
CONFIG_RAM_SIZE=8192
CONFIG_RAM_START=0x800100
CONFIG_RR_INTERVAL=200
CONFIG_SDCLONE_DISABLE=y
CONFIG_SPI=y
CONFIG_START_DAY=2
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STDIO_DISABLE_BUFFERING=y
CONFIG_SYSTEM_USBMSC=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_TLS_NELEM=0
CONFIG_USART1_BAUD=38400
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USBDEV=y
CONFIG_USBMSC=y
CONFIG_USBMSC_BULKINREQLEN=256
CONFIG_USBMSC_EP0MAXPACKET=8
CONFIG_USBMSC_EPBULKIN=2
CONFIG_USBMSC_EPBULKOUT=1
CONFIG_USBMSC_NRDREQS=2
CONFIG_USBMSC_NWRREQS=2
CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
CONFIG_USBMSC_REMOVABLE=y
CONFIG_USBMSC_SCSI_STACKSIZE=512
CONFIG_USBMSC_VERSIONNO=0x0399
CONFIG_USERMAIN_STACKSIZE=512
CONFIG_USER_ENTRYPOINT="msconn_main"
@@ -0,0 +1,89 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/include/board.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_AVR_AT90USB_TEENSY_20_INCLUDE_BOARD_H
#define __BOARDS_AVR_AT90USB_TEENSY_20_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 Teensy++ 2.0 has a single on-board LEDs connected to PortD, Pin 6 */
/* ON OFF */
#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) */
/* Button definitions *******************************************************/
/* SW1 = Connects to AT90USBxx RESET pin and is not available to software */
/****************************************************************************
* 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 /* __BOARDS_AVR_AT90USB_TEENSY_20_INCLUDE_BOARD_H */
@@ -0,0 +1,54 @@
############################################################################
# boards/avr/at90usb/teensy-2.0/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/avr/src/avr/Toolchain.defs
LDSCRIPT = flash.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
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
@@ -0,0 +1,195 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/scripts/flash.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* Memory Regions ***********************************************************/
/* ------------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
* | REGISTERS REGISTERS |
* ------------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* AT90USB1286 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 8Kb | 0x0000 4Kb
* ------------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
*/
MEMORY
{
flash (rx) : ORIGIN = 0, LENGTH = 128K
sram (rw!x) : ORIGIN = 0x800100, LENGTH = 8K
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
}
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)
*(.progmem .progmem.*)
*(.text)
*(.text.*)
_etext = . ;
} > flash
_eronly = ABSOLUTE(.);
.data :
{
_sdata = ABSOLUTE(.);
*(.rodata .rodata.*)
*(.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) }
}
@@ -0,0 +1,41 @@
############################################################################
# boards/avr/at90usb/teensy-2.0/src/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/Make.defs
CSRCS = at90usb_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += at90usb_leds.c
endif
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += at90usb_appinit.c
endif
ifeq ($(CONFIG_USBMSC),y)
CSRCS += at90usb_usbmsc.c
endif
ifeq ($(CONFIG_AVR_SPI),y)
CSRCS += at90usb_spi.c
endif
include $(TOPDIR)/boards/Board.mk
@@ -0,0 +1,66 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/board.h>
#ifdef CONFIG_LIB_BOARDCTL
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
*
* Input Parameters:
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
* between the board-specific initialization logic and the
* matching application logic. The value could be such things as a
* mode enumeration value, a set of DIP switch switch settings, a
* pointer to configuration data read from a file or serial FLASH,
* or whatever you would like to do with it. Every implementation
* should accept zero/NULL as a default configuration.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/
int board_app_initialize(uintptr_t arg)
{
return OK;
}
#endif /* CONFIG_LIB_BOARDCTL */
@@ -0,0 +1,71 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "at90usb.h"
#include "teensy-20.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: at90usb_boardinitialize
*
* Description:
* All AT90USB architectures must provide the following entry point.
* This entry point is called early in the initialization -- after
* all memory has been configured and mapped but before any devices
* have been initialized.
*
****************************************************************************/
void at90usb_boardinitialize(void)
{
#ifdef CONFIG_AVR_SPI
/* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the
* weak function at90usb_spidev_initialize() has been brought into the
* link.
*/
if (at90usb_spidev_initialize)
{
at90usb_spidev_initialize();
}
#endif
#ifdef CONFIG_ARCH_LEDS
/* Configure on-board LEDs if LED support has been selected. */
at90usb_led_initialize();
#endif
}
@@ -0,0 +1,157 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/src/at90usb_leds.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <debug.h>
#include <avr/io.h>
#include <nuttx/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "at90usb.h"
#include "teensy-20.h"
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Private Data
****************************************************************************/
static bool g_ncoff;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: at90usb_led_initialize
****************************************************************************/
void at90usb_led_initialize(void)
{
/* The Teensy's single LED is on Port D, Pin 6. Configur 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 << 6);
PORTD &= ~(1 << 6);
g_ncoff = true;
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_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 << 6);
break;
case 1:
/* The steady state is ON */
PORTD |= (1 << 6);
g_ncoff = false;
break;
default:
return;
}
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_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 << 6);
break;
}
/* Otherwise, fall through to turn the LED ON */
case 0:
case 1:
/* Turn the LED on */
PORTD |= (1 << 6);
break;
default:
return;
}
}
#endif /* CONFIG_ARCH_LEDS */
@@ -0,0 +1,170 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/src/at90usb_spi.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include <avr/io.h>
#include "up_arch.h"
#include "chip.h"
#include "at90usb.h"
#include "teensy-20.h"
#ifdef CONFIG_AVR_SPI
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Teensy SPI Connection
*
* -- ---- -- ------------------------- -------
* J2 NAME PIN NAME PAD
* -- ---- -- ------------------------- -------
* 1 VIN -- Connected to USB +RV
* 2 GND -- Connected to USB GND
* 3 3V3 -- Not used ---
* 4 NC -- Not used
* 5 CS 10 (SS/PCINT0) PB0 Pad B0
* 6 DI 12 (PDI/PCINT2/MOSI) PB2 Pad B2
* 7 SCK 11 (PCINT1/SCLK) PB1 Pad B1
* 8 DO 13 (PDO/PCINT3/MISO) PB3 Pad B3
* 9 IRQ -- Not used ---
* 10 CD 14 (PCINT4/OC.2A) PB4 Pad B4
* 11 WP 15 (PCINT5/OC.1A) PB5 Pad B5
* -- ---- -- ------------------------- -------
*/
#define TEENSY_CS (1 << 0)
#define TEENSY_CD (1 << 4)
#define TEENSY_WP (1 << 5)
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: at90usb_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the LPC1766-STK.
*
****************************************************************************/
void weak_function at90usb_spidev_initialize(void)
{
/* The Teensy board has no dedicated SPI devices so we assume that SS is
* used for chip select:
*
* "When the SPI is configured as a Master (MSTR in SPCR is set), the
* user can determine the direction of the SS pin.
* If SS is configured as an output, the pin is a general output pin
* which does not affect the SPI system. ...
*
* "If SS is configured as an input, it must be held high to ensure
* Master SPI operation. If the SS pin is driven low by peripheral
* circuitry when the SPI is configured as a Master with the SS pin
* defined as an input, the SPI system interprets this as another
* master selecting the SPI ...
*/
DDRB |= TEENSY_CS; /* B0 is an output */
PORTB |= TEENSY_CS; /* Low de-selects */
DDRB &= ~(TEENSY_CD | TEENSY_WP); /* B4 and B5 are inputs */
PORTB |= (TEENSY_CD | TEENSY_WP); /* Pull high */
}
/****************************************************************************
* Name: avr_spiselect and avr_spistatus
*
* Description:
* The external functions, avr_spiselect and avr_spistatus must be
* provided by board-specific logic. They are implementations of the
* select and status methods of the SPI interface defined by struct
* spi_ops_s (see include/nuttx/spi/spi.h).
* All other methods (including avr_spibus_initialize()) are provided by
* common AVR logic.
* To use this common SPI logic on your board:
*
* 1. Provide logic in avr_spidev_initialize() to configure SPI
* chip select pins.
* 2. Provide avr_spiselect() and avr_spistatus() functions in your
* board-specific logic. These functions will perform chip selection
* and status operations in the way your board is configured.
* 3. Add a calls to at90usb_spidev_initialize() in your low level
* application initialization logic
* 4. The handle returned by avr_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic
* (e.g., calling mmcsd_spislotinitialize(),
* for example, will bind the SPI driver to the SPI MMC/SD driver).
*
****************************************************************************/
void avr_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
/* Assert/de-assert the CS pin to the card */
if (selected)
{
PORTB &= ~TEENSY_CS;
}
else
{
PORTB |= TEENSY_CS;
}
}
uint8_t avr_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
uint8_t regval = PINB;
/* Both the CD and WP pins are pull high by the AT90USB and will be
* grounded it a card is inserted or write protected.
*/
if ((regval & TEENSY_CD) == 0)
{
ret |= SPI_STATUS_PRESENT;
}
if ((regval & TEENSY_WP) == 0)
{
ret |= SPI_STATUS_WRPROTECTED;
}
spiinfo("Returning %02x\n", ret);
return ret;
}
#endif /* CONFIG_AVR_SPI */
@@ -0,0 +1,96 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/src/at90usb_usbmsc.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <syslog.h>
#include <errno.h>
#include <nuttx/board.h>
#include <nuttx/mmcsd.h>
#include <nuttx/spi/spi.h>
#include "avr.h"
#include "at90usb.h"
#include "teensy-20.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
#endif
/* MMC/SD PORT and SLOT number */
#define AVR_MMCSDSPIPORTNO 0
#define AVR_MMCSDSLOTNO 0
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_usbmsc_initialize
*
* Description:
* Perform architecture specific initialization as needed to establish
* the mass storage device that will be exported by the USB MSC device.
*
****************************************************************************/
int board_usbmsc_initialize(int port)
{
FAR struct spi_dev_s *spi;
int ret;
/* Get the SPI port */
syslog(LOG_INFO, "Initializing SPI port\n");
spi = avr_spibus_initialize(AVR_MMCSDSPIPORTNO);
if (!spi)
{
syslog(LOG_ERR, "ERROR: avr_spibus_initialize failed\n");
return -ENODEV;
}
/* Bind the SPI port to the slot */
syslog(LOG_INFO, "Binding SPI port to MMC/SD slot\n");
ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1,
AVR_MMCSDSLOTNO, spi);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: mmcsd_spislotinitialize failed: %d\n", ret);
return ret;
}
return OK;
}
@@ -0,0 +1,75 @@
/****************************************************************************
* boards/avr/at90usb/teensy-2.0/src/teensy-20.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_AVR_AT90USB_TEENSY_20_SRC_TEENSY_H
#define __BOARDS_AVR_AT90USB_TEENSY_20_SRC_TEENSY_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: at90usb_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the Teensy++ 2.0
* board.
*
****************************************************************************/
#ifdef CONFIG_AVR_SPI
void weak_function at90usb_spidev_initialize(void);
#endif
/****************************************************************************
* Name: at90usb_led_initialize
*
* Description:
* Configure on-board LEDs if LED support has been selected.
*
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void at90usb_led_initialize(void);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_AVR_AT90USB_TEENSY_20_SRC_TEENSY_H */