mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Flesh out the Arduino Due board configuratino and integrate it with the build and configuration system
This commit is contained in:
+14
-2
@@ -20,6 +20,14 @@ config ARCH_BOARD_AMBER
|
||||
on the Atmel AVR ATMega128 MCU. There is not much there yet and what is
|
||||
there is untested due to tool-related issues.
|
||||
|
||||
config ARCH_BOARD_ARDUINO_DUE
|
||||
bool "Arduino Due"
|
||||
depends on ARCH_CHIP_ATSAM3X8E
|
||||
select ARCH_HAVE_LEDS
|
||||
---help---
|
||||
This options selects the Arduino DUE board featuring the Atmel
|
||||
ATSAM3X8E MCU running at 84 MHz.
|
||||
|
||||
config ARCH_BOARD_AVR32DEV1
|
||||
bool "Atmel AVR32DEV1 board"
|
||||
depends on ARCH_CHIP_AT32UC3B0256
|
||||
@@ -466,7 +474,7 @@ config ARCH_BOARD_RGMP
|
||||
|
||||
config ARCH_BOARD_SAM3UEK
|
||||
bool "Atmel SAM3U-EK development board"
|
||||
depends on ARCH_CHIP_AT91SAM3U4E
|
||||
depends on ARCH_CHIP_ATSAM3U4E
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
@@ -744,6 +752,7 @@ endchoice
|
||||
config ARCH_BOARD
|
||||
string
|
||||
default "amber" if ARCH_BOARD_AMBER
|
||||
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
|
||||
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
|
||||
default "c5471evm" if ARCH_BOARD_C5471EVM
|
||||
default "compal_e88" if ARCH_BOARD_COMPALE88
|
||||
@@ -756,7 +765,7 @@ config ARCH_BOARD
|
||||
default "ez80f910200kitg" if ARCH_BOARD_EZ80F910200KITG
|
||||
default "ez80f910200zco" if ARCH_BOARD_EZ80F910200ZCO
|
||||
default "fire-stm32v2" if ARCH_BOARD_FIRE_STM32
|
||||
default "freedom-kl25z" if ARCH_BOARD_FREEDOM_KL25Z
|
||||
default "freedom-kl25z" if ARCH_BOARD_FREEDOM_KL25Z
|
||||
default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V
|
||||
default "kwikstik-k40" if ARCH_BOARD_KWIKSTIK_K40
|
||||
default "lincoln60" if ARCH_BOARD_LINCOLN60
|
||||
@@ -877,6 +886,9 @@ comment "Board-Specific Options"
|
||||
if ARCH_BOARD_AMBER
|
||||
source "configs/amber/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_ARDUINO_DUE
|
||||
source "configs/arduino-due/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_AVR32DEV1
|
||||
source "configs/avr32dev1/Kconfig"
|
||||
endif
|
||||
|
||||
@@ -1702,6 +1702,10 @@ configs/amber
|
||||
on the Atmel AVR ATMega128 MCU. There is not much there yet and what is
|
||||
there is untested due to tool-related issues.
|
||||
|
||||
configs/arduino-due
|
||||
This sub-directory holds board support for the Arduino DUE board featuring
|
||||
the Atmel ATSAM3X8E MCU running at 84 MHz.
|
||||
|
||||
configs/avr32dev1
|
||||
This is a port of NuttX to the Atmel AVR32DEV1 board. That board is
|
||||
based on the Atmel AT32UC3B0256 MCU and uses a specially patched
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_ARDUINO_DUE
|
||||
endif
|
||||
@@ -2,8 +2,8 @@ README
|
||||
^^^^^^
|
||||
|
||||
This README discusses issues unique to NuttX configurations for the
|
||||
Arduion DUE board featuring the Atmel ATSAM3X8E MSU.
|
||||
|
||||
Arduino DUE board featuring the Atmel ATSAM3X8E MCU running at 84
|
||||
MHz.
|
||||
|
||||
Contents
|
||||
^^^^^^^^
|
||||
@@ -23,7 +23,81 @@ Contents
|
||||
PIO Pin Usage
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
To be provided
|
||||
PORTA PORTB PORTC
|
||||
------------------------------ ------------------------------ --------------------------------
|
||||
PIO SIGNAL CONN PIN PIO SIGNAL CONN PIN PIO SIGNAL CONN PIN
|
||||
----- ---------- ---- -------- ----- ------------ ---- ------ ----- ----------- ---- ---------
|
||||
PA0 CANTX0 ADCH 8 PB0 ETX_CLK ETH 1 PC0 ERASE N/A
|
||||
PA1 CANRX0 ACDH 7 PB1 ETX_EN ETH 3 PC1 PIN33 XIO 14
|
||||
PA2 AD7 ADCL 7 PB2 ETXD0 ETH 5 PC2 PIN34 XIO 15
|
||||
PA3 AD6 ADCL 6 PB3 ETXD1 ETH 7 PC3 PIN35 XIO 16
|
||||
PA4 AD5 ADCL 5 PB4 ERX_DV ETH 10 PC4 PIN36 XIO 17
|
||||
PA5 EEXTINT ETH 8 PB5 ERXD0 ETH 9 PC5 PIN37 XIO 18
|
||||
PA6 AD4 ADCL 4 PB6 ERXD1 ETH 11 PC6 PIN38 XIO 19
|
||||
PA7 PIN31 XIO 12 PB7 ERX_ER ETH 13 PC7 PIN39 XIO 20
|
||||
PA8 [U]RX PWML 1 PB8 EMDC ETH 14 PC8 PIN40 XIO 21
|
||||
PA9 [U]TX PWML 2 PB9 EMDIO ETH 12 PC9 PIN41 XIO 22
|
||||
PA10 RXD2 COMM 6 PB10 UOTGVBOF Vbus power PC10 N/C N/A
|
||||
PA11 TXD2 COMM 5 PB11 UOTGID USB1 4 PC11 N/C N/A
|
||||
PA12 RXD1 COMM 4 PB12 SDA0-3 COMM 7 PC12 PIN51 XIO 32
|
||||
PA13 TXD1 COMM 3 PB13 SCL0-3 COMM 8 PC13 PIN50 XIO 31
|
||||
PA14 PIN23 XIO 4 PB14 CANTX1/IO XIO 34 PC14 PIN49 XIO 30
|
||||
PA15 PIN24 XIO 5 PB15 DAC0(CANRX1) ADCH 5 PC15 PIN48 XIO 29
|
||||
PA16 AD0 ADCL 0 PB16 DAC1 ADCH 6 PC16 PIN47 XIO 28
|
||||
PA17 SDA1 PWMH 9 PB17 AD8 ADCH 1 PC17 PIN46 XIO 27
|
||||
PA18 SCL1 PWMH 10 PB18 AD9 ADCH 2 PC18 PIN45 XIO 26
|
||||
PA19 PIN42 XIO 23 PB19 AD10 ADCH 3 PC19 PIN44 XIO 25
|
||||
PA20 PIN43 XIO 24 PB20 AD11(TXD3) ADCH 4 PC20 N/C N/A
|
||||
PA21 TXL TX YELLOW LED PB21 AD14(RXD3) XIO 33 PC21 PWM9 PWMH 2
|
||||
PA22 AD3 ADCL 3 PB22 N/C N/A PC22 PWM8 PWMH 1
|
||||
PA23 AD2 ADCL 2 PB23 SS3 ??? PC23 PWM7 PWML 8
|
||||
PA24 AD1 ADCL 1 PB24 N/C N/A PC24 PWM6 PWML 7
|
||||
PA25 MISO SPI 1 PB25 PWM2 PWML 3 PC25 PWM5 PWML 6
|
||||
PA26 MOSI SPI 4 PB26 PIN22 ??? PC26 SS1/PWM4 ??? (there are two)
|
||||
PA27 SPCK SPI 3 PB27 PWM13 PWMH 6 PC27 N/C N/A
|
||||
PA28 SS0/PWM10 (ETH) PB28 JTAG_TCK JTAG 4 PC28 PWM3 PWML 4
|
||||
PA29 SS1/PWM4 (SD) PB29 JTAG_TDI JTAG 8 PC29 SS0/PWM10 ??? (there are two)
|
||||
PA30 N/A N/A PB30 JTAG_TDO JTAG 6 PC30 RXL RX YELLOW LED
|
||||
PA31 N/A N/A PB31 JTAG_TMS JTAG 2 PC31 N/A N/A
|
||||
----- ---------- ---- -------- ----- ------------ ---- ------ ----- ----------- ---- ---------
|
||||
|
||||
PORTA PORTB PORTC
|
||||
------------------------------ ------------------------------ --------------------------------
|
||||
PIO SIGNAL CONN PIN PIO SIGNAL CONN PIN PIO SIGNAL CONN PIN
|
||||
----- ---------- ---- -------- ----- ------------ ---- ------ ----- ----------- ---- ---------
|
||||
PA0 PIN25 XIO 6 PE0 N/A N/A PF0 N/A N/A
|
||||
PD1 PIN26 XIO 7 PE1 N/A N/A PF1 N/A N/A
|
||||
PD2 PIN27 XIO 8 PE2 N/A N/A PF2 N/A N/A
|
||||
PD3 PIN28 XIO 9 PE3 N/A N/A PF3 N/A N/A
|
||||
PD4 TXD0 COMM 1 PE4 N/A N/A PF4 N/A N/A
|
||||
PD5 RXD0 COMM 2 PE5 N/A N/A PF5 N/A N/A
|
||||
PD6 PIN29 XIO 10 PE6 N/A N/A PF6 N/A N/A
|
||||
PD7 PWM11 PWMH 4 PE7 N/A N/A PF7 N/A N/A
|
||||
PD8 PWM12 PWMH 5 PE8 N/A N/A PF8 N/A N/A
|
||||
PD9 PIN30 XIO 11 PE9 N/A N/A PF9 N/A N/A
|
||||
PD10 PIN32 XIO 13 PE10 N/A N/A PF10 N/A N/A
|
||||
PD11 N/A N/A PE11 N/A N/A PF11 N/A N/A
|
||||
PD12 N/A N/A PE12 N/A N/A PF12 N/A N/A
|
||||
PD13 N/A N/A PE13 N/A N/A PF13 N/A N/A
|
||||
PD14 N/A N/A PE14 N/A N/A PF14 N/A N/A
|
||||
PD15 N/A N/A PE15 N/A N/A PF15 N/A N/A
|
||||
PD16 N/A N/A PE16 N/A N/A PF16 N/A N/A
|
||||
PD17 N/A N/A PE17 N/A N/A PF17 N/A N/A
|
||||
PD18 N/A N/A PE18 N/A N/A PF18 N/A N/A
|
||||
PD19 N/A N/A PE19 N/A N/A PF19 N/A N/A
|
||||
PD20 N/A N/A PE20 N/A N/A PF20 N/A N/A
|
||||
PD21 N/A N/A PE21 N/A N/A PF21 N/A N/A
|
||||
PD22 N/A N/A PE22 N/A N/A PF22 N/A N/A
|
||||
PD23 N/A N/A PE23 N/A N/A PF23 N/A N/A
|
||||
PD24 N/A N/A PE24 N/A N/A PF24 N/A N/A
|
||||
PD25 N/A N/A PE25 N/A N/A PF25 N/A N/A
|
||||
PD26 N/A N/A PE26 N/A N/A PF26 N/A N/A
|
||||
PD27 N/A N/A PE27 N/A N/A PF27 N/A N/A
|
||||
PD28 N/A N/A PE28 N/A N/A PF28 N/A N/A
|
||||
PD29 N/A N/A PE29 N/A N/A PF29 N/A N/A
|
||||
PD30 N/A N/A PE30 N/A N/A PF30 N/A N/A
|
||||
PD31 N/A5 N/A PE31 N/A N/A PF31 N/A N/A
|
||||
----- ---------- ---- -------- ----- ------------ ---- ------ ----- ----------- ---- ---------
|
||||
|
||||
Development Environment
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -232,12 +306,70 @@ NXFLAT Toolchain
|
||||
Buttons and LEDs
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
To be provided
|
||||
Buttons
|
||||
-------
|
||||
There are no buttons on the Arduino Due board.
|
||||
|
||||
LEDs
|
||||
----
|
||||
There are two user-controllable LEDs on board the Arduino Due board:
|
||||
|
||||
LED GPIO
|
||||
---------------- -----
|
||||
TX Yellow LED PA21
|
||||
RX Yellow LED PC30
|
||||
|
||||
Both are pulled high and can be illuminated by driving the corresponding
|
||||
GPIO output to low.
|
||||
|
||||
These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
defined. In that case, the usage by the board port is defined in
|
||||
include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
events as follows:
|
||||
|
||||
SYMBOL Meaning LED state
|
||||
RX TX
|
||||
------------------- ----------------------- -------- --------
|
||||
LED_STARTED NuttX has been started OFF OFF
|
||||
LED_HEAPALLOCATE Heap has been allocated OFF OFF
|
||||
LED_IRQSENABLED Interrupts enabled OFF OFF
|
||||
LED_STACKCREATED Idle stack created ON OFF
|
||||
LED_INIRQ In an interrupt No change
|
||||
LED_SIGNAL In a signal handler No change
|
||||
LED_ASSERTION An assertion failed No change
|
||||
LED_PANIC The system has crashed OFF Blinking
|
||||
LED_IDLE MCU is is sleep mode Not used
|
||||
|
||||
Thus if RX is statically on, NuttX has successfully booted and is,
|
||||
apparently, running normmally. If TX is flashing at approximately
|
||||
2Hz, then a fatal error has been detected and the system has halted.
|
||||
|
||||
|
||||
Serial Consoles
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
To be provided
|
||||
Any of UART and USART0-3 may be used as a serial console. By default,
|
||||
the UART is used as the serial console in all configurations. But that is
|
||||
easily changed by modifying the configuration as described under
|
||||
"Configurations" below.
|
||||
|
||||
------------------------------
|
||||
PIO SIGNAL CONN PIN
|
||||
----- ---------- ---- --------
|
||||
PA8 [U]RX PWML 1
|
||||
PA9 [U]TX PWML 2
|
||||
PD4 TXD0 COMM 1
|
||||
PD5 RXD0 COMM 2
|
||||
PA12 RXD1 COMM 4
|
||||
PA13 TXD1 COMM 3
|
||||
PA10 RXD2 COMM 6
|
||||
PA11 TXD2 COMM 5
|
||||
PB20 AD11(TXD3) ADCH 4
|
||||
PB21 AD14(RXD3) XIO 33
|
||||
|
||||
The outputs from these pins is 3.3V. You will need to connect RS232
|
||||
transceiver to get the signals to RS232 levels (or connect the pins to the
|
||||
USB virual COM port.
|
||||
|
||||
Arduino DUE-specific Configuration Options
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -383,7 +515,7 @@ Configurations
|
||||
can be selected as follow:
|
||||
|
||||
cd tools
|
||||
./configure.shsam4s-xplained/<subdir>
|
||||
./configure.sh arduino-due/<subdir>
|
||||
cd -
|
||||
. ./setenv.sh
|
||||
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
/************************************************************************************
|
||||
* configs/arduino-due/include/board.h
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_ARDUINO_DUE_INCLUDE_BOARD_H
|
||||
#define __CONFIGS_ARDUINO_DUE_INCLUDE_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# ifdef CONFIG_GPIO_IRQ
|
||||
# include <arch/irq.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. These
|
||||
* definitions will configure clocking
|
||||
*
|
||||
* MAINOSC: Frequency = 12MHz (crysta)
|
||||
* PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz
|
||||
* Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz
|
||||
* CPU clock: 84MHz
|
||||
*/
|
||||
|
||||
/* Main oscillator register settings.
|
||||
*
|
||||
* The start up time should be should be:
|
||||
* Start Up Time = 8 * MOSCXTST / SLCK = 56 Slow Clock Cycles.
|
||||
*/
|
||||
|
||||
#define BOARD_CKGR_MOR_MOSCXTST (62 << PMC_CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */
|
||||
|
||||
/* PLLA configuration.
|
||||
*
|
||||
* Divider = 1
|
||||
* Multipler = 14
|
||||
*/
|
||||
|
||||
#define BOARD_CKGR_PLLAR_MUL (13 << PMC_CKGR_PLLAR_MUL_SHIFT)
|
||||
#define BOARD_CKGR_PLLAR_STMODE PMC_CKGR_PLLAR_STMODE_FAST
|
||||
#define BOARD_CKGR_PLLAR_COUNT (63 << PMC_CKGR_PLLAR_COUNT_SHIFT)
|
||||
#define BOARD_CKGR_PLLAR_DIV PMC_CKGR_PLLAR_DIV_BYPASS
|
||||
|
||||
/* PMC master clock register settings.
|
||||
*
|
||||
* Source = PLLA
|
||||
* Divider = 2
|
||||
*/
|
||||
|
||||
#define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLA
|
||||
#define BOARD_PMC_MCKR_PRES PMC_MCKR_PRES_DIV2
|
||||
|
||||
/* USB UTMI PLL start-up time */
|
||||
|
||||
#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << PMC_CKGR_UCKR_UPLLCOUNT_SHIFT)
|
||||
|
||||
/* Resulting frequencies */
|
||||
|
||||
#define BOARD_MAINOSC_FREQUENCY (12000000) /* MAINOSC: 12MHz crystal on-board */
|
||||
#define BOARD_PLLA_FREQUENCY (168000000) /* PLLACK: 14 * 12Mhz / 1 */
|
||||
#define BOARD_MCK_FREQUENCY (84000000) /* MCK: PLLACK / 2 */
|
||||
#define BOARD_CPU_FREQUENCY (84000000) /* CPU: MCK */
|
||||
|
||||
/* HSMCI clocking
|
||||
*
|
||||
* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
|
||||
* divided by (2*(CLKDIV+1)).
|
||||
*
|
||||
* MCI_SPEED = MCCK / (2*(CLKDIV+1))
|
||||
* CLKDIV = MCCK / MCI_SPEED / 2 - 1
|
||||
*
|
||||
* Where CLKDIV has a range of 0-255.
|
||||
*/
|
||||
|
||||
/* MCK = 84MHz, CLKDIV = 104, MCI_SPEED = 84MHz / 2 * (104+1) = 400 KHz */
|
||||
|
||||
#define HSMCI_INIT_CLKDIV (104 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
|
||||
/* MCK = 84MHz, CLKDIV = 2, MCI_SPEED = 84MHz / 2 * (2+1) = 14 MHz */
|
||||
|
||||
#define HSMCI_MMCXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
|
||||
/* MCK = 84MHz, CLKDIV = 1, MCI_SPEED = 84MHz / 2 * (1+1) = 21 MHz */
|
||||
|
||||
#define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
|
||||
|
||||
/* FLASH wait states
|
||||
*
|
||||
* FWS Max frequency
|
||||
* 1.62V 1.8V
|
||||
* --- ----- ------
|
||||
* 0 24MHz 27MHz
|
||||
* 1 40MHz 47MHz
|
||||
* 2 72MHz 84MHz
|
||||
* 3 84MHz 96MHz
|
||||
*/
|
||||
|
||||
#define BOARD_FWS 2
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* There are two user-controllable LEDs on board the Arduino Due board:
|
||||
*
|
||||
* LED GPIO
|
||||
* ---------------- -----
|
||||
* TX Yellow LED PA21
|
||||
* RX Yellow LED PC30
|
||||
*
|
||||
* Both are pulled high and can be illuminated by driving the corresponding
|
||||
* GPIO output to low.
|
||||
*/
|
||||
|
||||
/* LED index values for use with sam_setled() */
|
||||
|
||||
#define BOARD_LED_RX 0
|
||||
#define BOARD_LED_TX 1
|
||||
#define BOARD_NLEDS 2
|
||||
|
||||
/* LED bits for use with sam_setleds() */
|
||||
|
||||
#define BOARD_LED_RX_BIT (1 << BOARD_LED_RX)
|
||||
#define BOARD_LED_TX_BIT (1 << BOARD_LED_TX)
|
||||
|
||||
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
* SYMBOL Val Meaning LED state
|
||||
* RX TX
|
||||
* ------------------- --- ----------------------- -------- --------- */
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */
|
||||
#define LED_STACKCREATED 1 /* Idle stack created ON OFF */
|
||||
#define LED_INIRQ 2 /* In an interrupt No change */
|
||||
#define LED_SIGNAL 2 /* In a signal handler No change */
|
||||
#define LED_ASSERTION 2 /* An assertion failed No change */
|
||||
#define LED_PANIC 3 /* The system has crashed OFF Blinking */
|
||||
#undef LED_IDLE /* MCU is is sleep mode Not used */
|
||||
|
||||
/* Thus if RX is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally. If TX is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* There are no buttons on the Arduino Due board. */
|
||||
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
/************************************************************************************
|
||||
* Name: sam_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All SAM3X architectures must provide the following entry point. This entry point
|
||||
* is called early in the intitialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void sam_boardinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_ledinit, sam_setled, and sam_setleds
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
|
||||
* CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
|
||||
* control the LEDs from user applications.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
void sam_ledinit(void);
|
||||
void sam_setled(int led, bool ledon);
|
||||
void sam_setleds(uint8_t ledset);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_ARDUINO_DUE_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,107 @@
|
||||
############################################################################
|
||||
# configs/arduino-due/ostest/Make.defs
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
|
||||
MAXOPTIMIZATION = -O2
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
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 =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# configs/arduino-due/ostest/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This is the Cygwin path to the location where I installed the Atmel GCC
|
||||
# toolchain under Windows. You will also have to edit this if you install
|
||||
# this toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
|
||||
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||
# at those locations as well.
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
Executable
+123
@@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
* configs/arduino-due/scripts/ld.script
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The ATSAM3X8E has 512KB of FLASH beginning at address 0x0040:0000 and
|
||||
* up to 100KB SRAM in three memory regions.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x00400000, LENGTH = 1024K
|
||||
sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 32K
|
||||
nfcram (rwx) : ORIGIN = 0x20100000, LENGTH = 4K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >flash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} >flash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram0 AT > flash
|
||||
|
||||
_eronly = LOADADDR(.data);
|
||||
|
||||
.ramfunc ALIGN(4): {
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > sram0 AT > flash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram0
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
############################################################################
|
||||
# configs/arduino-due/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = sam_boot.c
|
||||
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
CSRCS += sam_cxxinitialize.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += sam_autoleds.c
|
||||
else
|
||||
CSRCS += sam_userleds.c
|
||||
endif
|
||||
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(WINTOOL),y)
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
|
||||
else
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/common
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/armv7-m
|
||||
endif
|
||||
|
||||
all: libboard$(LIBEXT)
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
libboard$(LIBEXT): $(OBJS)
|
||||
$(call ARCHIVE, $@, $(OBJS))
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
$(call DELFILE, libboard$(LIBEXT))
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
@@ -0,0 +1,130 @@
|
||||
/************************************************************************************
|
||||
* configs/arduino-due/src/arduino-due.h
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H
|
||||
#define __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "chip/sam_pinmap.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* There are two user-controllable LEDs on board the Arduino Due board:
|
||||
*
|
||||
* LED GPIO
|
||||
* ---------------- -----
|
||||
* TX Yellow LED PA21
|
||||
* RX Yellow LED PC30
|
||||
*
|
||||
* Both are pulled high and can be illuminated by driving the corresponding
|
||||
* GPIO output to low.
|
||||
*
|
||||
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RX TX
|
||||
* ------------------- ----------------------- -------- --------
|
||||
* LED_STARTED NuttX has been started OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF
|
||||
* LED_STACKCREATED Idle stack created ON OFF
|
||||
* LED_INIRQ In an interrupt No change
|
||||
* LED_SIGNAL In a signal handler No change
|
||||
* LED_ASSERTION An assertion failed No change
|
||||
* LED_PANIC The system has crashed OFF Blinking
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
*
|
||||
* Thus if RX is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally. If TX is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
#define GPIO_LED_RX (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
|
||||
GPIO_PORT_PIOC | GPIO_PIN30)
|
||||
#define GPIO_LED_TX (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
|
||||
GPIO_PORT_PIOA | GPIO_PIN21)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_sram_initialize
|
||||
*
|
||||
* Description:
|
||||
* Configure and enable SRAM on board the SAM4S Xplained
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_EXTSRAM0
|
||||
void sam_sram_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_ledinit
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
void up_ledinit(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H */
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/****************************************************************************
|
||||
* configs/arduino-due/src/sam_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "sam_gpio.h"
|
||||
#include "arduino-due.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
/* There are two user-controllable LEDs on board the Arduino Due board:
|
||||
*
|
||||
* LED GPIO
|
||||
* ---------------- -----
|
||||
* TX Yellow LED PA21
|
||||
* RX Yellow LED PC30
|
||||
*
|
||||
* Both are pulled high and can be illuminated by driving the corresponding
|
||||
* GPIO output to low.
|
||||
*
|
||||
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RX TX
|
||||
* ------------------- ----------------------- -------- --------
|
||||
* LED_STARTED NuttX has been started OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF
|
||||
* LED_STACKCREATED Idle stack created ON OFF
|
||||
* LED_INIRQ In an interrupt No change
|
||||
* LED_SIGNAL In a signal handler No change
|
||||
* LED_ASSERTION An assertion failed No change
|
||||
* LED_PANIC The system has crashed OFF Blinking
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
*
|
||||
* Thus if RX is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally. If TX is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledinit(void)
|
||||
{
|
||||
/* Configure RX and TX LED GPIOs for output */
|
||||
|
||||
sam_configgpio(GPIO_LED_RX);
|
||||
sam_configgpio(GPIO_LED_TX);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledon
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledon(int led)
|
||||
{
|
||||
bool rxledon = false;
|
||||
bool txledon = false;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED */
|
||||
break;
|
||||
|
||||
case 1: /* LED_STACKCREATED */
|
||||
rxledon = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 2: /* LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
return;
|
||||
|
||||
case 3: /* LED_PANIC */
|
||||
txledon = true;
|
||||
break;
|
||||
}
|
||||
|
||||
sam_gpiowrite(GPIO_LED_RX, rxledon);
|
||||
sam_gpiowrite(GPIO_LED_TX, txledon);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledoff
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledoff(int led)
|
||||
{
|
||||
if (led != 2)
|
||||
{
|
||||
sam_gpiowrite(GPIO_LED_RX, false);
|
||||
sam_gpiowrite(GPIO_LED_TX, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
@@ -0,0 +1,75 @@
|
||||
/************************************************************************************
|
||||
* configs/arduino-due/src/sam_boot.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include "arduino-due.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All SAM3X architectures must provide the following entry point. This entry point
|
||||
* is called early in the intitialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void sam_boardinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
up_ledinit();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/************************************************************************************
|
||||
* configs/arduino-due/src/sam_cxxinitialize.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <arch/sam34/chip.h>
|
||||
#include "chip.h"
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
/* Debug ****************************************************************************/
|
||||
/* Non-standard debug that may be enabled just for testing the static constructors */
|
||||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_CXX
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CXX
|
||||
# define cxxdbg dbg
|
||||
# define cxxlldbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define cxxvdbg vdbg
|
||||
# define cxxllvdbg llvdbg
|
||||
# else
|
||||
# define cxxvdbg(x...)
|
||||
# define cxxllvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define cxxdbg(x...)
|
||||
# define cxxlldbg(x...)
|
||||
# define cxxvdbg(x...)
|
||||
# define cxxllvdbg(x...)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Types
|
||||
************************************************************************************/
|
||||
/* This type defines one entry in initialization array */
|
||||
|
||||
typedef void (*initializer_t)(void);
|
||||
|
||||
/************************************************************************************
|
||||
* External references
|
||||
************************************************************************************/
|
||||
/* _sinit and _einit are symbols exported by the linker script that mark the
|
||||
* beginning and the end of the C++ initialization section.
|
||||
*/
|
||||
|
||||
extern initializer_t _sinit;
|
||||
extern initializer_t _einit;
|
||||
|
||||
/* _stext and _etext are symbols exported by the linker script that mark the
|
||||
* beginning and the end of text.
|
||||
*/
|
||||
|
||||
extern uint32_t _stext;
|
||||
extern uint32_t _etext;
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_cxxinitialize
|
||||
*
|
||||
* Description:
|
||||
* If C++ and C++ static constructors are supported, then this function
|
||||
* must be provided by board-specific logic in order to perform
|
||||
* initialization of the static C++ class instances.
|
||||
*
|
||||
* This function should then be called in the application-specific
|
||||
* user_start logic in order to perform the C++ initialization. NOTE
|
||||
* that no component of the core NuttX RTOS logic is involved; This
|
||||
* function defintion only provides the 'contract' between application
|
||||
* specific C++ code and platform-specific toolchain support
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_cxxinitialize(void)
|
||||
{
|
||||
initializer_t *initp;
|
||||
|
||||
cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
|
||||
&_sinit, &_einit, &_stext, &_etext);
|
||||
|
||||
/* Visit each entry in the initialzation table */
|
||||
|
||||
for (initp = &_sinit; initp != &_einit; initp++)
|
||||
{
|
||||
initializer_t initializer = *initp;
|
||||
cxxdbg("initp: %p initializer: %p\n", initp, initializer);
|
||||
|
||||
/* Make sure that the address is non-NULL and lies in the text region
|
||||
* defined by the linker script. Some toolchains may put NULL values
|
||||
* or counts in the initialization table
|
||||
*/
|
||||
|
||||
if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
|
||||
{
|
||||
cxxdbg("Calling %p\n", initializer);
|
||||
initializer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/****************************************************************************
|
||||
* configs/arduino-due/src/sam_userleds.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "sam_gpio.h"
|
||||
#include "arduino-due.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Protototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_ledinit
|
||||
****************************************************************************/
|
||||
|
||||
void sam_ledinit(void)
|
||||
{
|
||||
/* Configure LED1-2 GPIOs for output */
|
||||
|
||||
sam_configgpio(GPIO_LED_RX);
|
||||
sam_configgpio(GPIO_LED_TX);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_setled
|
||||
****************************************************************************/
|
||||
|
||||
void sam_setled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_RX)
|
||||
{
|
||||
ledcfg = GPIO_LED_RX;
|
||||
}
|
||||
else if (led == BOARD_LED_TX)
|
||||
{
|
||||
ledcfg = GPIO_LED_TX;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sam_gpiowrite(ledcfg, ledon);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_setleds
|
||||
****************************************************************************/
|
||||
|
||||
void sam_setleds(uint8_t ledset)
|
||||
{
|
||||
bool ledon;
|
||||
|
||||
ledon = ((ledset & BOARD_LED_RX_BIT) != 0);
|
||||
sam_gpiowrite(GPIO_LED_RX, ledon);
|
||||
|
||||
ledon = ((ledset & BOARD_LED_TX_BIT) != 0);
|
||||
sam_gpiowrite(GPIO_LED_TX, ledon);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
||||
@@ -3,7 +3,7 @@ README
|
||||
|
||||
This README discusses issues unique to NuttX configurations for the Atmel
|
||||
SAM3U-EK development board featuring the ATAM3U. This board features the
|
||||
AT91SAM3U4E MCU running at 96MHz.
|
||||
ATSAM3U4E MCU running at 96MHz.
|
||||
|
||||
Contents
|
||||
^^^^^^^^
|
||||
@@ -292,7 +292,7 @@ SAM3U-EK-specific Configuration Options
|
||||
|
||||
CONFIG_ARCH_CHIP_SAM34
|
||||
CONFIG_ARCH_CHIP_SAM3U
|
||||
CONFIG_ARCH_CHIP_AT91SAM3U4
|
||||
CONFIG_ARCH_CHIP_ATSAM3U4
|
||||
|
||||
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
||||
hence, the board that supports the particular chip or SoC.
|
||||
@@ -377,7 +377,7 @@ SAM3U-EK-specific Configuration Options
|
||||
CONFIG_USART3_ISUART
|
||||
CONFIG_SAM34_NAND - NAND memory
|
||||
|
||||
AT91SAM3U specific device driver settings
|
||||
SAM3U specific device driver settings
|
||||
|
||||
CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,3) or UART
|
||||
m (m=4,5) for the console and ttys0 (default is the USART1).
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
/* MCK = 96MHz, CLKDIV = 1, MCI_SPEED = 96MHz / 2 * (1+1) = 24 MHz */
|
||||
|
||||
#define HSMCI_SDXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
#define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
|
||||
|
||||
/* FLASH wait states
|
||||
|
||||
@@ -105,7 +105,7 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
CONFIG_ARCH_CHIP_AT91SAM3U4E=y
|
||||
CONFIG_ARCH_CHIP_ATSAM3U4E=y
|
||||
# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -97,13 +97,13 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
CONFIG_ARCH_CHIP_AT91SAM3U4E=y
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X8E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X8C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X4E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X4C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3A8C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3A4C is not set
|
||||
CONFIG_ARCH_CHIP_ATSAM3U4E=y
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X8E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X8C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3A8C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3A4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -97,7 +97,7 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
CONFIG_ARCH_CHIP_AT91SAM3U4E=y
|
||||
CONFIG_ARCH_CHIP_ATSAM3U4E=y
|
||||
# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -97,7 +97,7 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
CONFIG_ARCH_CHIP_AT91SAM3U4E=y
|
||||
CONFIG_ARCH_CHIP_ATSAM3U4E=y
|
||||
# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
|
||||
/* The ATSAM3U4E has 256Kb of FLASH beginning at address 0x0008:0000,
|
||||
* 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
|
||||
* at address 0x2008:000 (used only for heap). When booting from FLASH,
|
||||
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The AT91SAM3U-4 has 256KB of FLASH beginning at address 0x0008:0000,
|
||||
/* The ATSAM3U4E has 256KB of FLASH beginning at address 0x0008:0000,
|
||||
* 32KB of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
|
||||
* at address 0x2008:000 (used only for heap). When booting from FLASH,
|
||||
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
/* SAM3U-EK GPIO Pin Definitions ****************************************************/
|
||||
|
||||
/* LCD:
|
||||
* LCD Module Pin Out: AT91SAM3U PIO:
|
||||
* LCD Module Pin Out: SAM3U PIO:
|
||||
* -------------------------------------------- --------------------------------------
|
||||
* Pin Symbol Function LCD PeriphA PeriphB Extra
|
||||
* ---- ------ -------------------------------- -------------- -------- ------- ------
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
* touch-screen, FTM280C12D, with integratd driver IC HX8346. The LCD display size
|
||||
* is 2.8 inches, with a native resolution of 240 x 320 pixels.
|
||||
*
|
||||
* LCD Module Pin Out: AT91SAM3U PIO:
|
||||
* LCD Module Pin Out: SAM3U PIO:
|
||||
* -------------------------------------------- --------------------------------------
|
||||
* Pin Symbol Function LCD PeriphA PeriphB Extra
|
||||
* ---- ------ -------------------------------- -------------- -------- ------- ------
|
||||
|
||||
@@ -97,13 +97,13 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X8E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X8C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X4E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X4C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3A8C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3A4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X8E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X8C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3A8C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3A4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -96,7 +96,7 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -299,7 +299,7 @@ Buttons and LEDs
|
||||
|
||||
These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
defined. In that case, the usage by the board port is defined in
|
||||
include/board.h and src/up_leds.c. The LEDs are used to encode OS-related
|
||||
include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
events as follows:
|
||||
|
||||
SYMBOL Meaning LED state
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
/* MCK = 48MHz, CLKDIV = 1, MCI_SPEED = 48MHz / 2 * (1+1) = 12 MHz */
|
||||
|
||||
#define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
#define HSMCI_MMCXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
|
||||
|
||||
/* MCK = 48MHz, CLKDIV = 0, MCI_SPEED = 48MHz / 2 * (0+1) = 24 MHz */
|
||||
|
||||
|
||||
@@ -97,13 +97,13 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X8E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X8C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X4E is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3X4C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3A8C is not set
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3A4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X8E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X8C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3X4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3A8C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3A4C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
@@ -96,7 +96,7 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
#
|
||||
# AT91SAM3/4 Configuration Options
|
||||
#
|
||||
# CONFIG_ARCH_CHIP_AT91SAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM3U4E is not set
|
||||
# CONFIG_ARCH_CHIP_SAM34_NDMACHANC2C is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
|
||||
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
|
||||
|
||||
Reference in New Issue
Block a user