mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 16:11:56 +08:00
Add a USB mass storage example for AVR
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3727 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||
<p>Last Updated: June 16, 2011</p>
|
||||
<p>Last Updated: June 20, 2011</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -1577,6 +1577,11 @@
|
||||
simplified NuttShell (NSH) configuration (see the
|
||||
<a href="http://www.nuttx.org/NuttShell.html">NSH User Guide</a>).
|
||||
</p>
|
||||
<p>
|
||||
An SPI driver and a USB device driver exist for the AT90USB (as well
|
||||
as a USB mass storage example). However, this configuration is not
|
||||
fully debugged as of the NuttX-6.5 release.
|
||||
</p>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
NuttX TODO List (Last updated June 17, 2011)
|
||||
NuttX TODO List (Last updated June 20, 2011)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
nuttx/
|
||||
@@ -29,7 +29,7 @@ nuttx/
|
||||
(3) ARM/STR71x (arch/arm/src/str71x/)
|
||||
(4) ARM/LM3S6918 (arch/arm/src/lm3s/)
|
||||
(4) ARM/STM32 (arch/arm/src/stm32/)
|
||||
(2) AVR (arch/avr)
|
||||
(3) AVR (arch/avr)
|
||||
(0) Intel x86 (arch/x86)
|
||||
(4) 8051 / MCS51 (arch/8051/)
|
||||
(2) Hitachi/Renesas SH-1 (arch/sh/src/sh1)
|
||||
@@ -900,6 +900,12 @@ o AVR (arch/avr)
|
||||
Priority: Low. The AVR is probably not the architecuture that you want to use
|
||||
for extensive string operations.
|
||||
|
||||
Description: An SPI driver and a USB device driver exist for the AT90USB (as well
|
||||
as a USB mass storage example). However, this configuration is not
|
||||
fully debugged as of the NuttX-6.5 release.
|
||||
Status: Open
|
||||
Priority: Medium-High.
|
||||
|
||||
o Intel x86 (arch/x86)
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -2303,7 +2303,7 @@ static void avr_epfreereq(FAR struct usbdev_ep_s *ep,
|
||||
static void *avr_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
|
||||
{
|
||||
usbtrace(TRACE_EPALLOCBUFFER, privep->ep.eplog);
|
||||
return malloc(bytes)}
|
||||
return malloc(bytes)}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -2314,7 +2314,7 @@ return malloc(bytes)}
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_AVR_USBDEV_DMA
|
||||
#ifdef CONFIG_ARCH_USBDEV_DMA
|
||||
static void avr_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
|
||||
{
|
||||
usbtrace(TRACE_EPFREEBUFFER, privep->ep.eplog);
|
||||
|
||||
@@ -152,12 +152,11 @@ extern uint8_t *up_doirq(uint8_t irq, uint8_t *regs);
|
||||
* avr_spicmddata() function in your board-specific logic. This functions will
|
||||
* perform cmd/data selection operations using GPIOs in the way your board is
|
||||
* configured.
|
||||
* 3. Add a call to up_spiinitialize() in your low level application
|
||||
* 3. Add a call to at90usb_spiinitialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by up_spiinitialize() may then be used to bind the
|
||||
* SPI driver to higher level logic (e.g., calling
|
||||
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
|
||||
* the SPI MMC/SD driver).
|
||||
* SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
|
||||
* for example, will bind the SPI driver to the SPI MMC/SD driver).
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
@@ -180,18 +180,21 @@ SD-ADP Pinout / SD Connection
|
||||
|
||||
Teensy SPI Connection
|
||||
|
||||
-- ---- -- ------------------------- -------
|
||||
J2 NAME PIN NAME PAD
|
||||
1 VIN
|
||||
2 GND
|
||||
3 3V3
|
||||
4 NC
|
||||
-- ---- -- ------------------------- -------
|
||||
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
|
||||
10 CD
|
||||
11 WP
|
||||
9 IRQ -- Not used ---
|
||||
10 CD 14 (PCINT4/OC.2A) PB4 Pad B4
|
||||
11 WP 15 (PCINT5/OC.1A) PB5 Pad B5
|
||||
-- ---- -- ------------------------- -------
|
||||
|
||||
Toolchains
|
||||
^^^^^^^^^^
|
||||
@@ -495,6 +498,12 @@ Teensy++ Configuration Options
|
||||
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
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# configs/teensy/nsh/defconfig
|
||||
#
|
||||
# Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**************************************************************************************
|
||||
* configs/teensy/teensy/ld.script
|
||||
* configs/teensy/nsh/ld.script
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# configs/teensy/teensy/setenv.sh
|
||||
# configs/teensy/nsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
@@ -41,6 +41,12 @@ CSRCS = up_boot.c
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += up_leds.c
|
||||
endif
|
||||
ifeq ($(CONFIG_USBSTRG),y)
|
||||
CSRCS += up_usbstrg.c
|
||||
endif
|
||||
ifeq ($(CONFIG_AVR_SPI),y)
|
||||
CSRCS += up_spi.c
|
||||
endif
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
@@ -76,7 +76,7 @@ extern "C" {
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
|
||||
#ifdef CONFIG_AVR_SPI
|
||||
EXTERN void weak_function at90usb_spiinitialize(void);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void up_boardinitialize(void)
|
||||
* function at90usb_spiinitialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
|
||||
#ifdef CONFIG_AVR_SPI
|
||||
if (at90usb_spiinitialize)
|
||||
{
|
||||
at90usb_spiinitialize();
|
||||
|
||||
Executable
+202
@@ -0,0 +1,202 @@
|
||||
/************************************************************************************
|
||||
* configs/teensy/src/up_spi.c
|
||||
* arch/arm/src/board/up_spi.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "at90Usb_internal.h"
|
||||
#include "teensy_internal.h"
|
||||
|
||||
#ifdef CONFIG_AVR_SPI
|
||||
|
||||
/************************************************************************************
|
||||
* 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)
|
||||
|
||||
/* The following enable debug output from this file (needs CONFIG_DEBUG too).
|
||||
*
|
||||
* CONFIG_SPI_DEBUG - Define to enable basic SSP debug
|
||||
* CONFIG_SPI_VERBOSE - Define to enable verbose SSP debug
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SPI_DEBUG
|
||||
# define sspdbg lldbg
|
||||
# ifdef CONFIG_SPI_VERBOSE
|
||||
# define sspvdbg lldbg
|
||||
# else
|
||||
# define sspvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# undef CONFIG_SPI_VERBOSE
|
||||
# define sspdbg(x...)
|
||||
# define sspvdbg(x...)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: at90usb_spiinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LPC1766-STK.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function at90usb_spiinitialize(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.h). All
|
||||
* other methods (including up_spiinitialize()) are provided by common AVR logic.
|
||||
* To use this common SPI logic on your board:
|
||||
*
|
||||
* 1. Provide logic in avr_sspinitialize() 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_spiinitialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by up_spiinitialize() may then be used to bind the
|
||||
* SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
|
||||
* for example, will bind the SPI driver to the SPI MMC/SD driver).
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void avr_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
sspdbg("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, enum spi_dev_e devid)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint8_t regval = PORTB;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
sspdbg("Returning %02x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_AVR_SPI */
|
||||
Executable
+137
@@ -0,0 +1,137 @@
|
||||
/****************************************************************************
|
||||
* configs/teensy/src/up_usbstrg.c
|
||||
* arch/arm/src/board/up_usbstrg.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Configure and register the AVR MMC/SD SPI block driver.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
#include "at90usb_internal.h"
|
||||
#include "teensy_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_USBSTRG_DEVMINOR1
|
||||
# define CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 0
|
||||
#endif
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_TEENSY
|
||||
# undef AVR_MMCSDSPIPORTNO
|
||||
# define AVR_MMCSDSPIPORTNO 0
|
||||
# undef AVR_MMCSDSLOTNO
|
||||
# define AVR_MMCSDSLOTNO 0
|
||||
#else
|
||||
/* Add configuration for new AVR boards here */
|
||||
# error "Unrecognized AVR board"
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
# define msgflush() fflush(stdout)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_lowprintf
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
# define msgflush() fflush(stdout)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: usbstrg_archinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int usbstrg_archinitialize(void)
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
message("Initializing SPI port\n");
|
||||
|
||||
spi = up_spiinitialize(AVR_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
message("up_spiinitialize failed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Bind the SPI port to the slot */
|
||||
|
||||
message("Binding SPI port to MMC/SD slot\n");
|
||||
|
||||
ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBSTRG_DEVMINOR1, AVR_MMCSDSLOTNO, spi);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("mmcsd_spislotinitialize failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
Executable
+149
@@ -0,0 +1,149 @@
|
||||
############################################################################
|
||||
# configs/teensy/usbstorage/Make.defs
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# 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
|
||||
|
||||
# Setup for the selected toolchain
|
||||
|
||||
ifeq ($(CONFIG_AVR_WINAVR),y)
|
||||
# WinAVR toolchain under Windows/Cygwin
|
||||
CROSSDEV = avr-
|
||||
WINTOOL = y
|
||||
MAXOPTIMIZATION = -O2
|
||||
ARCHCPUFLAGS = -mmcu=at90usb1286
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AVR_LINUXGCC),y)
|
||||
# GCC toolchain under Linux
|
||||
CROSSDEV = avr-
|
||||
MAXOPTIMIZATION = -O2
|
||||
ARCHCPUFLAGS = -mmcu=at90usb1286
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AVR_BUILDROOT),y)
|
||||
# NuttX buildroot GCC toolchain under Linux or Cygwin
|
||||
CROSSDEV = avr-elf-
|
||||
MAXOPTIMIZATION = -O2
|
||||
ARCHCPUFLAGS = -mmcu=at90usb1286
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/winlink.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = $(ARCHINCLUDES) -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/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)/usbstorage/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
|
||||
else
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES =
|
||||
|
||||
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.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
@$(CPP) $(CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
@echo "CC: $1"
|
||||
@$(CC) -c $(CFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILEXX
|
||||
@echo "CXX: $1"
|
||||
@$(CXX) -c $(CXXFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
@$(CC) -c $(AFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ARCHIVE
|
||||
echo "AR: $2"; \
|
||||
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
|
||||
endef
|
||||
|
||||
define CLEAN
|
||||
@rm -f *.o *.a
|
||||
endef
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
############################################################################
|
||||
# configs/teensy/usbstorage/appconfig
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
|
||||
CONFIGURED_APPS += examples/usbstorage
|
||||
|
||||
Executable
+847
File diff suppressed because it is too large
Load Diff
Executable
+210
@@ -0,0 +1,210 @@
|
||||
/**************************************************************************************
|
||||
* configs/teensy/usbstorage/ld.script
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* 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 |
|
||||
* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
|
||||
* 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
|
||||
}
|
||||
|
||||
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) }
|
||||
}
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# configs/teensy/usbstorage/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# 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 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 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}"
|
||||
Reference in New Issue
Block a user