Add board configuration for the SAMD21 Xplained board
This commit is contained in:
parent
3a4ab48049
commit
fe5f060486
22 changed files with 4643 additions and 22 deletions
|
@ -695,6 +695,17 @@ config ARCH_BOARD_SAMD20_XPLAINED
|
|||
This board features the ATSAMD20J18A MCU (Cortex-M0+ with 256KB of FLASH
|
||||
and 32KB of SRAM).
|
||||
|
||||
config ARCH_BOARD_SAMD21_XPLAINED
|
||||
bool "Atmel SAMD21-Xplained Pro development board"
|
||||
depends on ARCH_CHIP_SAMD21J18A
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
The port of NuttX to the Atmel SAMD21-Xplained Pro development board.
|
||||
This board features the ATSAMD21J18A MCU (Cortex-M0+ with 256KB of FLASH
|
||||
and 32KB of SRAM).
|
||||
|
||||
config ARCH_BOARD_SAML21_XPLAINED
|
||||
bool "Atmel SAML21-Xplained Pro development board"
|
||||
depends on ARCH_CHIP_SAML21J18
|
||||
|
@ -1239,6 +1250,7 @@ config ARCH_BOARD
|
|||
default "sama5d3-xplained" if ARCH_BOARD_SAMA5D3_XPLAINED
|
||||
default "sama5d4-ek" if ARCH_BOARD_SAMA5D4_EK
|
||||
default "samd20-xplained" if ARCH_BOARD_SAMD20_XPLAINED
|
||||
default "samd21-xplained" if ARCH_BOARD_SAMD21_XPLAINED
|
||||
default "saml21-xplained" if ARCH_BOARD_SAML21_XPLAINED
|
||||
default "sam3u-ek" if ARCH_BOARD_SAM3UEK
|
||||
default "sam4e-ek" if ARCH_BOARD_SAM4EEK
|
||||
|
@ -1533,6 +1545,9 @@ endif
|
|||
if ARCH_BOARD_SAMD20_XPLAINED
|
||||
source "configs/samd20-xplained/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SAMD21_XPLAINED
|
||||
source "configs/samd21-xplained/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SAML21_XPLAINED
|
||||
source "configs/saml21-xplained/Kconfig"
|
||||
endif
|
||||
|
|
|
@ -531,6 +531,11 @@ configs/samd20-xplained
|
|||
board features the ATSAMD20J18A MCU (Cortex-M0+ with 256KB of FLASH and
|
||||
32KB of SRAM).
|
||||
|
||||
configs/samd21-xplained
|
||||
The port of NuttX to the Atmel SAMD21-Xplained Pro development board. This
|
||||
board features the ATSAMD21J18A MCU (Cortex-M0+ with 256KB of FLASH and
|
||||
32KB of SRAM).
|
||||
|
||||
configs/sam3u-ek
|
||||
The port of NuttX to the Atmel SAM3U-EK development board.
|
||||
|
||||
|
|
82
configs/samd21-xplained/Kconfig
Normal file
82
configs/samd21-xplained/Kconfig
Normal file
|
@ -0,0 +1,82 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_SAMD21_XPLAINED
|
||||
|
||||
menu "SAMD21 Xplained Pro Modules"
|
||||
|
||||
config SAMD21_XPLAINED_IOMODULE
|
||||
bool "I/O1 Module"
|
||||
default n
|
||||
---help---
|
||||
The I/O 1 module is attached. This module provides an MMC/SD card
|
||||
slot.
|
||||
|
||||
if SAMD21_XPLAINED_IOMODULE
|
||||
|
||||
choice
|
||||
prompt "I/O1 Module Location"
|
||||
default SAMD21_XPLAINED_IOMODULE_EXT1
|
||||
|
||||
config SAMD21_XPLAINED_IOMODULE_EXT1
|
||||
bool "EXT1"
|
||||
|
||||
config SAMD21_XPLAINED_IOMODULE_EXT2
|
||||
bool "EXT2"
|
||||
|
||||
endchoice
|
||||
endif
|
||||
|
||||
config SAMD21_XPLAINED_OLED1MODULE
|
||||
bool "OLED1 Module"
|
||||
default n
|
||||
---help---
|
||||
The OLED 1 module is attached. This module provides an OLED plus 3
|
||||
additional switches and 3 additional LEDs.
|
||||
|
||||
if SAMD21_XPLAINED_OLED1MODULE
|
||||
|
||||
choice
|
||||
prompt "OLED1 Module Location"
|
||||
default SAMD21_XPLAINED_OLED1MODULE_EXT1
|
||||
|
||||
config SAMD21_XPLAINED_OLED1MODULE_EXT1
|
||||
bool "EXT1"
|
||||
|
||||
config SAMD21_XPLAINED_OLED1MODULE_EXT2
|
||||
bool "EXT2"
|
||||
|
||||
endchoice
|
||||
endif
|
||||
endmenu
|
||||
|
||||
if USART4_SERIAL_CONSOLE
|
||||
choice
|
||||
prompt "USART 4 Connection"
|
||||
default SAMD21_XPLAINED_USART4_EXT3
|
||||
|
||||
config SAMD21_XPLAINED_USART4_EXT1
|
||||
bool "EXT1"
|
||||
depends on !SAMD21_XPLAINED_OLED1MODULE_EXT1 && !SAMD21_XPLAINED_IOMODULE_EXT1
|
||||
---help---
|
||||
Select this option if the serial console is on SERCOM4 connected via
|
||||
EXT1. The RX will be on PB9 and TX signal will be on PB8.
|
||||
|
||||
config SAMD21_XPLAINED_USART4_EXT2
|
||||
bool "EXT2"
|
||||
depends on !SAMD21_XPLAINED_OLED1MODULE_EXT2 && !SAMD21_XPLAINED_IOMODULE_EXT2
|
||||
---help---
|
||||
Select this option if the serial console is on SERCOM4 connected via
|
||||
EXT2. The RX will be on PB13 and TX signal will be on PB12.
|
||||
|
||||
config SAMD21_XPLAINED_USART4_EXT3
|
||||
bool "EXT3"
|
||||
---help---
|
||||
Select this option if the serial console is on SERCOM4 connect via
|
||||
EXT3. The RX will be on PB11 and TX signal will be on PB10.
|
||||
|
||||
endchoice
|
||||
endif
|
||||
endif
|
745
configs/samd21-xplained/README.txt
Normal file
745
configs/samd21-xplained/README.txt
Normal file
|
@ -0,0 +1,745 @@
|
|||
README
|
||||
======
|
||||
|
||||
This README discusses issues unique to NuttX configurations for the
|
||||
Atmel SAMD21 Xplained Pro development board. This board features the
|
||||
ATSAMD21J18A MCU.
|
||||
|
||||
The SAMD21 Xplained Pro Starter Kit may be bundled with three modules:
|
||||
|
||||
1) I/O1 - An MMC/SD card slot, PWM LED control, ADC light sensor, USART
|
||||
loopback, TWI AT30TSE758 Temperature sensor.
|
||||
2) OLED1 - An OLED plus 3 additional switches and 3 additional LEDs
|
||||
3) PROTO1 - A prototyping board with logic on board (other than power-related
|
||||
logic).
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
- STATUS/ISSUES
|
||||
- Modules
|
||||
- LEDs
|
||||
- Serial Consoles
|
||||
- Atmel Studio 6.1
|
||||
- SAMD21 Xplained Pro-specific Configuration Options
|
||||
- Configurations
|
||||
|
||||
STATUS/ISSUES
|
||||
=============
|
||||
|
||||
1. See configs/samd20-xplained/README.txt. This port derives from the
|
||||
SAMD20 Xplained board board and all issues there should apply.
|
||||
2. As of this writing, no testing has been performed. The board is on
|
||||
order and testing will begin when I have the board in hand.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
There are several I/O modules available that will work with the SAMD21
|
||||
Xplained Pro Starter Kit:
|
||||
|
||||
1) I/O1 - An MMC/SD card slot, PWM LED control, ADC light sensor, USART
|
||||
loopback, TWI AT30TSE758 Temperature sensor.
|
||||
2) OLED1 - An OLED plus 3 additional switches and 3 additional LEDs
|
||||
3) PROTO1 - A prototyping board with logic on board (other than power-
|
||||
related logic).
|
||||
4) And others. See http://www.atmel.com/products/microcontrollers/avr/xplained.aspx
|
||||
|
||||
Some of these are discussed further below.
|
||||
|
||||
I/O1
|
||||
----
|
||||
The primary function of this module is to provide SD card support, but
|
||||
the full list of modules features include:
|
||||
|
||||
- microSD card connector (SPI interface)
|
||||
- PWM (LED control)
|
||||
- ADC (light sensor)
|
||||
- USART loopback
|
||||
- TWI AT30TSE758 Temperature sensor with EEPROM
|
||||
|
||||
SPI is available on two of the SAMD21 Xplained connectors, EXT1 and EXT2.
|
||||
They mate with the I/O1 connector as indicated in this table.
|
||||
|
||||
I/O1 CONNECTOR
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
I/O1 EXT1 EXT2 Other use of either pin
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
1 ID 1 1 Communication line to ID chip on
|
||||
extension board.
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
2 GND 2 GND 2 GND
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
3 LIGHTSENSOR 3 PB00 AIN[8] 3 PA10 AIN[18]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
4 LP_OUT 4 PB01 AIN[9] 4 PA11 AIN[19]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
5 GPIO1 5 PB06 GPIO 5 PA20 GPIO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
6 GPIO2 6 PB07 GPIO 6 PA21 GPIO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
7 LED 7 PB02 TC6/WO[0] 7 PB12 TC4/WO[0]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
8 LP_IN 8 PB03 TC6/WO[1] 8 PB13 TC4/WO[1]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
9 TEMP_ALERT 9 PB04 EXTINT[4] 9 PB14 EXTINT[14]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
10 microSD_DETECT 10 PB05 GPIO 10 PB15 GPIO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
11 TWI SDA 11 PA08 SERCOM2 PAD[0] 11 PA08 SERCOM2 PAD[0] EXT1, EXT2, EXT3 and EDBG
|
||||
I²C SDA I²C SDA
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
12 TWI SCL 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1] EXT2, EXT3 and EDBG
|
||||
I²C SCL I²C SCL
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
13 USART RX 13 PB09 SERCOM4 PAD[1] 13 PB11 SERCOM4 PAD[1] EXT3
|
||||
USART RX USART RX
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
14 USART TX 14 PB08 SERCOM4 PAD[0] 14 PB10 SERCOM4 PAD[0] EXT3
|
||||
USART TX USART TX
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
15 microSD_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1]
|
||||
SPI SS SPI SS
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PA18 SERCOM1 PAD[2]
|
||||
SPI MOSI SPI MOSI
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
17 SPI_MISO 17 PA04 SERCOM0 PAD[0] 17 PA16 SERCOM1 PAD[0]
|
||||
SPI MISO SPI MISO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PA19 SERCOM1 PAD[3]
|
||||
SPI SCK SPI SCK
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
19 GND 19 GND GND
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
20 VCC 20 VCC VCC
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
|
||||
The mapping between the I/O1 pins and the SD connector are shown in the
|
||||
following table.
|
||||
|
||||
SD Card Connection
|
||||
------------------
|
||||
I/O1 SD PIN Description
|
||||
---- ---- --- -------------------------------------------------
|
||||
D2 1 Data line 2 (not used)
|
||||
15 D3 2 Data line 3. Active low chip select, pulled high
|
||||
16 CMD 3 Command line, connected to SPI_MOSI.
|
||||
20 VDD 4
|
||||
18 CLK 5 Clock line, connected to SPI_SCK.
|
||||
2/19 GND 6
|
||||
17 D0 7 Data line 0, connected to SPI_MISO.
|
||||
D1 8 Data line 1 (not used)
|
||||
10 SW_A 9 Card detect
|
||||
2/19 SW_B 10 GND
|
||||
|
||||
Card Detect
|
||||
-----------
|
||||
When a microSD card is put into the connector SW_A and SW_B are short-
|
||||
circuited. SW_A is connected to the microSD_DETECT signal. To use this
|
||||
as a card indicator remember to enable internal pullup in the target
|
||||
device.
|
||||
|
||||
GPIOs
|
||||
-----
|
||||
So all that is required to connect the SD is configure the SPI
|
||||
|
||||
--- ------------------ ---------------------- -------------------------------------
|
||||
PIN EXT1 EXT2 Description
|
||||
--- ------------------ ---------------------- -------------------------------------
|
||||
15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT, pulled
|
||||
SPI SS SPI SS high on board.
|
||||
--- ------------------ ---------------------- -------------------------------------
|
||||
10 PB05 GPIO 10 PB15 GPIO Active low card detect INPUT, must
|
||||
use internal pull-up.
|
||||
--- ------------------ ---------------------- -------------------------------------
|
||||
|
||||
Configuration Options:
|
||||
----------------------
|
||||
CONFIG_SAMD21_XPLAINED_IOMODULE=y : Informs the system that the
|
||||
I/O1 module is installed
|
||||
CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1=y : The module is installed in EXT1
|
||||
CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2=y : The mdoule is installed in EXT2
|
||||
|
||||
See the set-up in the discussion of the nsh configuration below for other
|
||||
required configuration options.
|
||||
|
||||
NOTE: As of this writing, only the SD card slot is supported in the I/O1
|
||||
module.
|
||||
|
||||
OLED1
|
||||
-----
|
||||
This module provides an OLED plus 3 additional switches and 3 additional
|
||||
LEDs.
|
||||
|
||||
OLED1 CONNECTOR
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
OLED1 EXT1 EXT2 Other use of either pin
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
1 ID 1 1 Communication line to ID chip on
|
||||
extension board.
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
2 GND 2 GND 2 GND
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
3 BUTTON2 3 PB00 AIN[8] 3 PA10 AIN[18]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
4 BUTTON3 4 PB01 AIN[9] 4 PA11 AIN[19]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
5 DATA_CMD_SEL 5 PB06 GPIO 5 PA20 GPIO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
6 LED3 6 PB07 GPIO 6 PA21 GPIO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
7 LED1 7 PB02 TC6/WO[0] 7 PB12 TC4/WO[0]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
8 LED2 8 PB03 TC6/WO[1] 8 PB13 TC4/WO[1]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
9 BUTTON1 9 PB04 EXTINT[4] 9 PB14 EXTINT[14]
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
10 DISPLAY_RESET 10 PB05 GPIO 10 PB15 GPIO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
11 N/C 11 PA08 SERCOM2 PAD[0] 11 PA08 SERCOM2 PAD[0] EXT1, EXT2, EXT3 and EDBG
|
||||
I²C SDA I²C SDA
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
12 N/C 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1] EXT2, EXT3 and EDBG
|
||||
I²C SCL I²C SCL
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
13 N/C 13 PB09 SERCOM4 PAD[1] 13 PB11 SERCOM4 PAD[1] EXT3
|
||||
USART RX USART RX
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
14 N/C 14 PB08 SERCOM4 PAD[0] 14 PB10 SERCOM4 PAD[0] EXT3
|
||||
USART TX USART TX
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1]
|
||||
SPI SS SPI SS
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PA18 SERCOM1 PAD[2]
|
||||
SPI MOSI SPI MOSI
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
17 N/C 17 PA04 SERCOM0 PAD[0] 17 PA16 SERCOM1 PAD[0]
|
||||
SPI MISO SPI MISO
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PA19 SERCOM1 PAD[3]
|
||||
SPI SCK SPI SCK
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
19 GND 19 GND GND
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
20 VCC 20 VCC VCC
|
||||
----------------- ---------------------- ---------------------- ------------------------------------
|
||||
|
||||
Configuration Options:
|
||||
----------------------
|
||||
CONFIG_SAMD21_XPLAINED_OLED1MODULE=y : Informs the system that the
|
||||
I/O1 module is installed
|
||||
CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1=y : The module is installed in EXT1
|
||||
CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2=y : The mdoule is installed in EXT2
|
||||
|
||||
See the set-up in the discussion of the nsh configuration below for other
|
||||
required configuration options.
|
||||
|
||||
PROTO1
|
||||
------
|
||||
A prototyping board with logic on board (other than power-related logic).
|
||||
There is no built-in support for the PROTO1 module.
|
||||
|
||||
LEDs
|
||||
====
|
||||
|
||||
There is one yellow LED available on the SAM D20 Xplained Pro board that
|
||||
can be turned on and off. The LED can be activated by driving the connected
|
||||
PB30 I/O line to GND.
|
||||
|
||||
When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
|
||||
control the LED as follows:
|
||||
|
||||
SYMBOL Meaning LED0
|
||||
------------------- ----------------------- ------
|
||||
LED_STARTED NuttX has been started OFF
|
||||
LED_HEAPALLOCATE Heap has been allocated OFF
|
||||
LED_IRQSENABLED Interrupts enabled OFF
|
||||
LED_STACKCREATED Idle stack created ON
|
||||
LED_INIRQ In an interrupt N/C
|
||||
LED_SIGNAL In a signal handler N/C
|
||||
LED_ASSERTION An assertion failed N/C
|
||||
LED_PANIC The system has crashed FLASH
|
||||
|
||||
Thus is LED is statically on, NuttX has successfully booted and is,
|
||||
apparently, running normally. If LED is flashing at approximately
|
||||
2Hz, then a fatal error has been detected and the system has halted.
|
||||
|
||||
Serial Consoles
|
||||
===============
|
||||
|
||||
SERCOM4
|
||||
------
|
||||
|
||||
SERCOM4 is available on connectors EXT1, EXT2, and EXT3, but using
|
||||
different PORT pins:
|
||||
|
||||
PIN EXT1 EXT2 EXT3 GPIO Function
|
||||
---- ---- ---- ---- ------------------
|
||||
13 PB09 PB10 PB10 SERCOM4 / USART RX
|
||||
14 PB08 PB11 PB11 SERCOM4 / USART TX
|
||||
19 GND GND GND N/A
|
||||
20 VCC VCC VCC N/A
|
||||
|
||||
There are options available in the NuttX configuration to select which
|
||||
connector SERCOM4 is on: SAMD21_XPLAINED_USART4_EXTn, where n=1, 2, or 3.
|
||||
|
||||
If you have a TTL to RS-232 converter then this is the most convenient
|
||||
serial console to use (because you don't lose the console device each time
|
||||
you lose the USB connection). It is the default in all of these
|
||||
configurations. An option is to use the virtual COM port.
|
||||
|
||||
Virtual COM Port
|
||||
----------------
|
||||
|
||||
The SAMD21 Xplained Pro contains an Embedded Debugger (EDBG) that can be
|
||||
used to program and debug the ATSAMD21J18A using Serial Wire Debug (SWD).
|
||||
The Embedded debugger also include a Virtual COM port interface over
|
||||
SERCOM3. Virtual COM port connections:
|
||||
|
||||
PA22 SERCOM3 / USART TXD
|
||||
PA23 SERCOM3 / USART RXD
|
||||
|
||||
Atmel Studio 6.1
|
||||
================
|
||||
|
||||
Loading Code into FLASH:
|
||||
-----------------------
|
||||
|
||||
Tools menus: Tools -> Device Programming.
|
||||
|
||||
Debugging the NuttX Object File
|
||||
-------------------------------
|
||||
|
||||
1) Rename object file from nutt to nuttx.elf. That is an extension that
|
||||
will be recognized by the file menu.
|
||||
|
||||
2) File menu: File -> Open -> Open object file for debugging
|
||||
|
||||
- Select nuttx.elf object file
|
||||
- Select AT91SAMD21J18
|
||||
- Select files for symbols as desired
|
||||
- Select debugger
|
||||
|
||||
3) Debug menu: Debug -> Start debugging and break
|
||||
|
||||
- This will reload the nuttx.elf file into FLASH
|
||||
|
||||
SAMD21 Xplained Pro-specific Configuration Options
|
||||
==================================================
|
||||
|
||||
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
|
||||
be set to:
|
||||
|
||||
CONFIG_ARCH=arm
|
||||
|
||||
CONFIG_ARCH_family - For use in C code:
|
||||
|
||||
CONFIG_ARCH_ARM=y
|
||||
|
||||
CONFIG_ARCH_architecture - For use in C code:
|
||||
|
||||
CONFIG_ARCH_CORTEXM0=y
|
||||
|
||||
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
||||
|
||||
CONFIG_ARCH_CHIP="samdl"
|
||||
|
||||
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
|
||||
chip:
|
||||
|
||||
CONFIG_ARCH_CHIP_SAMD
|
||||
CONFIG_ARCH_CHIP_SAMD21
|
||||
CONFIG_ARCH_CHIP_ATSAMD21J18
|
||||
|
||||
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
||||
hence, the board that supports the particular chip or SoC.
|
||||
|
||||
CONFIG_ARCH_BOARD=samd21-xplained (for the SAMD21 Xplained Pro development board)
|
||||
|
||||
CONFIG_ARCH_BOARD_name - For use in C code
|
||||
|
||||
CONFIG_ARCH_BOARD_SAMD21_XPLAINED=y
|
||||
|
||||
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
|
||||
of delay loops
|
||||
|
||||
CONFIG_ENDIAN_BIG - define if big endian (default is little
|
||||
endian)
|
||||
|
||||
CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
|
||||
|
||||
CONFIG_RAM_SIZE=0x00010000 (64KB)
|
||||
|
||||
CONFIG_RAM_START - The start address of installed DRAM
|
||||
|
||||
CONFIG_RAM_START=0x20000000
|
||||
|
||||
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
|
||||
have LEDs
|
||||
|
||||
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
||||
stack. If defined, this symbol is the size of the interrupt
|
||||
stack in bytes. If not defined, the user task stacks will be
|
||||
used during interrupt handling.
|
||||
|
||||
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||
|
||||
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
|
||||
|
||||
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
||||
cause a 100 second delay during boot-up. This 100 second delay
|
||||
serves no purpose other than it allows you to calibratre
|
||||
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
||||
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
||||
the delay actually is 100 seconds.
|
||||
|
||||
Individual subsystems can be enabled:
|
||||
|
||||
CONFIG_SAMDL_AC - Analog Comparator
|
||||
CONFIG_SAMDL_ADC - Analog-to-Digital Converter
|
||||
CONFIG_SAMDL_DAC - Digital-to-Analog Converter
|
||||
CONFIG_SAMDL_DMAC - Analog Comparator
|
||||
CONFIG_SAMDL_EVSYS - Event System
|
||||
CONFIG_SAMDL_NVMCTRL - Non-Volatile Memory Controller
|
||||
CONFIG_SAMDL_PTC - Peripheral Touch Controller
|
||||
CONFIG_SAMDL_RTC - Real Time Counter
|
||||
CONFIG_SAMDL_SERCOM0 - Serial Communication Interface 0
|
||||
CONFIG_SAMDL_SERCOM1 - Serial Communication Interface 1
|
||||
CONFIG_SAMDL_SERCOM2 - Serial Communication Interface 2
|
||||
CONFIG_SAMDL_SERCOM3 - Serial Communication Interface 3
|
||||
CONFIG_SAMDL_SERCOM4 - Serial Communication Interface 4
|
||||
CONFIG_SAMDL_SERCOM5 - Serial Communication Interface 5
|
||||
CONFIG_SAMDL_TCC0 - Timer/Counter 0 for Control
|
||||
CONFIG_SAMDL_TCC1 - Timer/Counter 1 for Control
|
||||
CONFIG_SAMDL_TCC2 - Timer/Counter 2 for Control
|
||||
CONFIG_SAMDL_TC3 - Timer/Counter 3
|
||||
CONFIG_SAMDL_TC4 - Timer/Counter 4
|
||||
CONFIG_SAMDL_TC5 - Timer/Counter 5
|
||||
CONFIG_SAMDL_TC6 - Timer/Counter 6
|
||||
CONFIG_SAMDL_TC7 - Timer/Counter 6
|
||||
CONFIG_SAMDL_USB - USB device or host
|
||||
CONFIG_SAMDL_WDT - Watchdog Timer
|
||||
|
||||
Some subsystems can be configured to operate in different ways. The drivers
|
||||
need to know how to configure the subsystem.
|
||||
|
||||
CONFIG_SAMDL_SERCOM0_ISI2C, CONFIG_SAMDL_SERCOM0_ISSPI, or CONFIG_SAMDL_SERCOM0_ISUSART
|
||||
CONFIG_SAMDL_SERCOM1_ISI2C, CONFIG_SAMDL_SERCOM1_ISSPI, or CONFIG_SAMDL_SERCOM1_ISUSART
|
||||
CONFIG_SAMDL_SERCOM2_ISI2C, CONFIG_SAMDL_SERCOM2_ISSPI, or CONFIG_SAMDL_SERCOM2_ISUSART
|
||||
CONFIG_SAMDL_SERCOM3_ISI2C, CONFIG_SAMDL_SERCOM3_ISSPI, or CONFIG_SAMDL_SERCOM3_ISUSART
|
||||
CONFIG_SAMDL_SERCOM4_ISI2C, CONFIG_SAMDL_SERCOM4_ISSPI, or CONFIG_SAMDL_SERCOM4_ISUSART
|
||||
CONFIG_SAMDL_SERCOM5_ISI2C, CONFIG_SAMDL_SERCOM5_ISSPI, or CONFIG_SAMDL_SERCOM5_ISUSART
|
||||
|
||||
SAMD21 specific device driver settings
|
||||
|
||||
CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,..5) for the
|
||||
console and ttys0 (default is the USART4).
|
||||
CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
|
||||
This specific the size of the receive buffer
|
||||
CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
|
||||
being sent. This specific the size of the transmit buffer
|
||||
CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
|
||||
CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
|
||||
CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
|
||||
CONFIG_USARTn_2STOP - Two stop bits
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Each SAMD21 Xplained Pro configuration is maintained in a sub-directory and
|
||||
can be selected as follow:
|
||||
|
||||
cd tools
|
||||
./configure.sh samd21-xplained/<subdir>
|
||||
cd -
|
||||
. ./setenv.sh
|
||||
|
||||
Before sourcing the setenv.sh file above, you should examine it and perform
|
||||
edits as necessary so that BUILDROOT_BIN is the correct path to the directory
|
||||
than holds your toolchain binaries.
|
||||
|
||||
And then build NuttX by simply typing the following. At the conclusion of
|
||||
the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
|
||||
|
||||
make
|
||||
|
||||
The <subdir> that is provided above as an argument to the tools/configure.sh
|
||||
must be is one of the following.
|
||||
|
||||
NOTE: These configurations use the mconf-based configuration tool. To
|
||||
change any of these configurations using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
and misc/tools/
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. These configurations use the mconf-based configuration tool. To
|
||||
change any of these configurations using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
and misc/tools/
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. Unless stated otherwise, all configurations generate console
|
||||
output of on SERCOM4 which is available on EXT1, EXT2, or EXT3 (see
|
||||
the section "Serial Consoles" above). The virtual COM port could
|
||||
be used, instead, by reconfiguring to use SERCOM3 instead of
|
||||
SERCOM4:
|
||||
|
||||
System Type -> SAMD/L Peripheral Support
|
||||
CONFIG_SAMDL_SERCOM3=y : Enable one or both
|
||||
CONFIG_SAMDL_SERCOM4=n
|
||||
|
||||
Device Drivers -> Serial Driver Support -> Serial Console
|
||||
CONFIG_USART4_SERIAL_CONSOLE=y : Select only one for the console
|
||||
CONFIG_USART4_SERIAL_CONSOLE=n
|
||||
|
||||
Device Drivers -> Serial Driver Support -> SERCOM3 Configuration
|
||||
CONFIG_USART3_2STOP=0
|
||||
CONFIG_USART3_BAUD=115200
|
||||
CONFIG_USART3_BITS=8
|
||||
CONFIG_USART3_PARITY=0
|
||||
CONFIG_USART3_RXBUFSIZE=256
|
||||
CONFIG_USART3_TXBUFSIZE=256
|
||||
|
||||
Device Drivers -> Serial Driver Support -> SERCOM4 Configuration
|
||||
CONFIG_USART4_2STOP=0
|
||||
CONFIG_USART4_BAUD=115200
|
||||
CONFIG_USART4_BITS=8
|
||||
CONFIG_USART4_PARITY=0
|
||||
CONFIG_USART4_RXBUFSIZE=256
|
||||
CONFIG_USART4_TXBUFSIZE=256
|
||||
|
||||
Board Selection -> USART4 Connection
|
||||
CONFIG_SAMD21_XPLAINED_USART4_EXT1=n : Pick on if USART4 used
|
||||
CONFIG_SAMD21_XPLAINED_USART4_EXT2=n
|
||||
CONFIG_SAMD21_XPLAINED_USART4_EXT3=y
|
||||
|
||||
3. Unless otherwise stated, the configurations are setup for
|
||||
Cygwin under Windows:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Windows Host
|
||||
CONFIG_WINDOWS_CYGWIN=y : Cygwin environment on windoes
|
||||
|
||||
4. These configurations use the CodeSourcery toolchain. But
|
||||
that is easily reconfigured:
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV6M_TOOLCHAIN_CODESOURCERYW=y
|
||||
|
||||
Any re-configuration should be done before making NuttX or else the
|
||||
subsequent 'make' will fail. If you have already attempted building
|
||||
NuttX then you will have to 1) 'make distclean' to remove the old
|
||||
configuration, 2) 'cd tools; ./configure.sh sam3u-ek/ksnh' to start
|
||||
with a fresh configuration, and 3) perform the configuration changes
|
||||
above.
|
||||
|
||||
Also, make sure that your PATH variable has the new path to your
|
||||
Atmel tools. Try 'which arm-none-eabi-gcc' to make sure that you
|
||||
are selecting the right tool. setenv.sh is available for you to
|
||||
use to set or PATH variable. The path in the that file may not,
|
||||
however, be correct for your installation.
|
||||
|
||||
See also the "NOTE about Windows native toolchains" in the section
|
||||
called "GNU Toolchain Options" above.
|
||||
|
||||
Configuration sub-directories
|
||||
-----------------------------
|
||||
|
||||
nsh:
|
||||
This configuration directory will built the NuttShell. See NOTES above
|
||||
and below:
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration is set up to build on Windows using the Cygwin
|
||||
environment using the CodeSourcery toolchain. This can be easily
|
||||
changed as described above under "Configurations."
|
||||
|
||||
2. By default, this configuration provides a serial console on SERCOM4
|
||||
at 115200 8N1 via EXT3:
|
||||
|
||||
PIN EXT3 GPIO Function
|
||||
---- ---- ------------------
|
||||
13 PB11 SERCOM4 / USART RX
|
||||
14 PB10 SERCOM4 / USART TX
|
||||
19 GND N/A
|
||||
20 VCC N/A
|
||||
|
||||
If you would prefer to use the EDBG serial COM port or would prefer
|
||||
to use SERCOM4 on EXT1 or EXT2, you will need to reconfigure the
|
||||
SERCOM as described under "Configurations". See also the section
|
||||
entitled "Serial Consoles" above.
|
||||
|
||||
3. NOTE: If you get a compilation error like:
|
||||
|
||||
libxx_new.cxx:74:40: error: 'operator new' takes type 'size_t'
|
||||
('unsigned int') as first parameter [-fper
|
||||
|
||||
Sometimes NuttX and your toolchain will disagree on the underlying
|
||||
type of size_t; sometimes it is an 'unsigned int' and sometimes it is
|
||||
an 'unsigned long int'. If this error occurs, then you may need to
|
||||
toggle the value of CONFIG_CXX_NEWLONG.
|
||||
|
||||
4. If the I/O1 module is connected to the SAMD21 Xplained Pro, then
|
||||
support for the SD card slot can be enabled by making the following
|
||||
changes to the configuration. These changes assume that the I/O1
|
||||
modules is connected in EXT1. Most of the modifications necessary
|
||||
to work with the I/O1 in a different connector are obvious.. except
|
||||
for the selection of SERCOM SPI support:
|
||||
|
||||
EXT1: SPI is provided through SERCOM0
|
||||
EXT2: SPI is provided through SERCOM1
|
||||
EXT3: SPI is provided through SERCOM5
|
||||
|
||||
File Systems:
|
||||
CONFIG_FS_FAT=y : Enable the FAT file system
|
||||
CONFIG_FAT_LCNAMES=y : Enable upper/lower case 8.3 file names (Optional, see below)
|
||||
CONFIG_FAT_LFN=y : Enable long file named (Optional, see below)
|
||||
CONFIG_FAT_MAXFNAME=32 : Maximum supported file name length
|
||||
|
||||
There are issues related to patents that Microsoft holds on FAT long
|
||||
file name technologies. See the top level COPYING file for further
|
||||
details.
|
||||
|
||||
System Type -> Peripherals:
|
||||
CONFIG_SAMDL_SERCOM0=y : Use SERCOM0 if the I/O is in EXT1
|
||||
CONFIG_SAMDL_SERCOM0_ISSPI=y : Configure SERCOM0 as an SPI master
|
||||
|
||||
Device Drivers
|
||||
CONFIG_SPI=y : Enable SPI support
|
||||
CONFIG_SPI_EXCHANGE=y : The exchange() method is supported
|
||||
CONFIG_SPI_OWNBUS=y : Smaller code if this is the only SPI device
|
||||
|
||||
CONFIG_MMCSD=y : Enable MMC/SD support
|
||||
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
|
||||
CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers
|
||||
CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards
|
||||
CONFIG_MMCSD_HAVECARDDETECT=y : I/O1 module as a card detect GPIO
|
||||
CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card
|
||||
CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency
|
||||
CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required
|
||||
|
||||
Board Selection -> Common Board Options
|
||||
CONFIG_NSH_MMCSDSLOTNO=0 : Only one MMC/SD slot, slot 0
|
||||
CONFIG_NSH_MMCSDSPIPORTNO=0 : Use port=0 -> SERCOM0 if the I/O1 is in EXT1
|
||||
|
||||
Board Selection -> SAMD21 Xplained Pro Modules
|
||||
CONFIG_SAMD21_XPLAINED_IOMODULE=y : I/O1 module is connected
|
||||
CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1=y : I/O1 modules is in EXT1
|
||||
|
||||
Application Configuration -> NSH Library
|
||||
CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization
|
||||
|
||||
NOTE: If you enable the I/O1 this configuration with SERCOM4 as the
|
||||
console and with the I/O1 module in EXT1, you *must* remove USART
|
||||
jumper. Otherwise, you have lookpack on SERCOM4 and NSH will *not*
|
||||
behave very well (since its outgoing prompts also appear as incoming
|
||||
commands).
|
||||
|
||||
STATUS: As of 2013-6-18, this configuration appears completely
|
||||
functional. Testing, however, has been very light. Example:
|
||||
|
||||
NuttShell (NSH) NuttX-6.34
|
||||
nsh> mount -t vfat /dev/mmcsd0 /mnt/stuff
|
||||
nsh> ls /mnt/stuff
|
||||
/mnt/stuff:
|
||||
nsh> echo "This is a test" >/mnt/stuff/atest.txt
|
||||
nsh> ls /mnt/stuff
|
||||
/mnt/stuff:
|
||||
atest.txt
|
||||
nsh> cat /mnt/stuff/atest.txt
|
||||
This is a test
|
||||
nsh>
|
||||
|
||||
5. If the OLED1 module is connected to the SAMD21 Xplained Pro, then
|
||||
support for the OLED display can be enabled by making the following
|
||||
changes to the configuration. These changes assume that the I/O1
|
||||
modules is connected in EXT1. Most of the modifications necessary
|
||||
to work with the I/O1 in a different connector are obvious.. except
|
||||
for the selection of SERCOM SPI support:
|
||||
|
||||
EXT1: SPI is provided through SERCOM0
|
||||
EXT2: SPI is provided through SERCOM1
|
||||
EXT3: SPI is provided through SERCOM5
|
||||
|
||||
System Type -> Peripherals:
|
||||
CONFIG_SAMDL_SERCOM1=y : Use SERCOM1 if the I/O is in EXT2
|
||||
CONFIG_SAMDL_SERCOM1_ISSPI=y : Configure SERCOM1 as an SPI master
|
||||
|
||||
Device Drivers -> SPI
|
||||
CONFIG_SPI=y : Enable SPI support
|
||||
CONFIG_SPI_EXCHANGE=y : The exchange() method is supported
|
||||
CONFIG_SPI_CMDDATA=y : CMD/DATA support is required
|
||||
CONFIG_SPI_OWNBUS=y : Smaller code if this is the only SPI device
|
||||
|
||||
Device Drivers -> LCDs
|
||||
CONFIG_LCD=y : Enable LCD support
|
||||
CONFIG_LCD_MAXCONTRAST=255 : Maximum contrast value
|
||||
CONFIG_LCD_LANDSCAPE=y : Landscape orientation (see below*)
|
||||
CONFIG_LCD_UG2832HSWEG04=y : Enable support for the OLED
|
||||
CONFIG_LCD_SSD1306_SPIMODE=0 : SPI Mode 0
|
||||
CONFIG_LCD_SSD1306_SPIMODE=3500000 : Pick an SPI frequency
|
||||
|
||||
Board Selection -> SAMD21 Xplained Pro Modules
|
||||
CONFIG_SAMD21_XPLAINED_OLED1MODULE=y : OLED1 module is connected
|
||||
CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2=y : OLED1 modules is in EXT2
|
||||
|
||||
The NX graphics subsystem also needs to be configured:
|
||||
|
||||
CONFIG_NX=y : Enable graphics support
|
||||
CONFIG_NX_LCDDRIVER=y : Using an LCD driver
|
||||
CONFIG_NX_NPLANES=1 : With a single color plane
|
||||
CONFIG_NX_WRITEONLY=n : You can read from the LCD (see below**)
|
||||
CONFIG_NX_DISABLE_2BPP=y : Disable all resolutions except 1BPP
|
||||
CONFIG_NX_DISABLE_4BPP=y
|
||||
CONFIG_NX_DISABLE_8BPP=y
|
||||
CONFIG_NX_DISABLE_16BPP=y
|
||||
CONFIG_NX_DISABLE_24BPP=y
|
||||
CONFIG_NX_DISABLE_32BPP=y
|
||||
CONFIG_NX_PACKEDMSFIRST=y : LSB packed first (shouldn't matter)
|
||||
CONFIG_NXTK_BORDERWIDTH=2 : Use a small border
|
||||
CONFIG_NXTK_DEFAULT_BORDERCOLORS=y : Default border colors
|
||||
CONFIG_NXFONTS_CHARBITS=7 : 7-bit fonts
|
||||
CONFIG_NXFONT_SANS17X23B=y : Pick a font (any that will fit)
|
||||
|
||||
* This orientation will put the buttons "above" the LCD. The
|
||||
reverse landscape configuration (CONFIG_LCD_RLANDSCAPE) will
|
||||
"flip" the display so that the buttons are "below" the LCD.
|
||||
|
||||
** The hardware is write only, but the driver maintains a frame buffer
|
||||
to support read and read-write-modiry operations on the LCD.
|
||||
Reading from the frame buffer is, however, untested.
|
||||
|
||||
Then, in order to use the OLED, you will need to build some kind of
|
||||
graphics application or use one of the NuttX graphics examples.
|
||||
Here, for example, is the setup for the graphic "Hello, World!"
|
||||
example:
|
||||
|
||||
CONFIG_EXAMPLES_NXHELLO=y : Enables the example
|
||||
CONFIG_EXAMPLES_NXHELLO_DEFAULT_COLORS=y : Use default colors (see below *)
|
||||
CONFIG_EXAMPLES_NXHELLO_DEFAULT_FONT=y : Use the default font
|
||||
CONFIG_EXAMPLES_NXHELLO_BPP=1 : One bit per pixel
|
||||
CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=y : Special initialization is required.
|
||||
|
||||
* The OLED is monochrome so the only "colors" are blacka nd white.
|
||||
The default "colors" will give you while text on a black background.
|
||||
You can override the faults it you want black text on a while background.
|
||||
|
||||
NOTE: One issue that I have seen with the NXHello example when
|
||||
running as an NSH command is that it only works the first time.
|
||||
So, after you run the 'nxhello' command one time, you will have to
|
||||
reset the board before you run it again.
|
||||
|
||||
This is clearly some issue with initializing, un-initializing, and
|
||||
then re-initializing. If you want to fix this, patches are quite
|
||||
welcome.
|
587
configs/samd21-xplained/include/board.h
Normal file
587
configs/samd21-xplained/include/board.h
Normal file
|
@ -0,0 +1,587 @@
|
|||
/************************************************************************************
|
||||
* configs/samd21-xplained/include/board.h
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_SAMD21_XPLAINED_INCLUDE_BOARD_H
|
||||
#define __CONFIGS_SAMD21_XPLAINED_INCLUDE_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# ifdef CONFIG_GPIO_IRQ
|
||||
# include <arch/irq.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
/* Overview
|
||||
*
|
||||
* OSC8M Output = 8MHz
|
||||
* `- GCLK1 Input = 8MHz Prescaler = 1 output = 8MHz
|
||||
* `- DFLL Input = 8MHz Multiplier = 6 output = 48MHz
|
||||
* `- GCLK0 Input = 48MHz Prescaler = 1 output = 48MHz
|
||||
* `- PM Input = 48Mhz CPU divider = 1 CPU frequency = 48MHz
|
||||
* APBA divider = 1 APBA frequency = 48MHz
|
||||
* APBB divider = 1 APBB frequency = 48MHz
|
||||
* APBC divider = 1 APBC frequency = 48MHz
|
||||
*
|
||||
* The SAMD21 Xplained Pro has one on-board crystal:
|
||||
*
|
||||
* XC101 32.768KHz XOSC32
|
||||
*
|
||||
* REVISIT: Not currently used, may want to use as GCLK1 source with
|
||||
* DFLL multiplier of ((48000000+16384)/32768) = 1465 which would yield
|
||||
* a clock of 48,005,120 MHz.
|
||||
*/
|
||||
|
||||
/* XOSC Configuration -- Not available
|
||||
*
|
||||
* BOARD_XOSC_ENABLE - Boolean (defined / not defined)
|
||||
* BOARD_XOSC_FREQUENCY - In Hz
|
||||
* BOARD_XOSC_STARTUPTIME - See SYSCTRL_XOSC_STARTUP_* definitions
|
||||
* BOARD_XOSC_ISCRYSTAL - Boolean (defined / not defined)
|
||||
* BOARD_XOSC_AMPGC - Boolean (defined / not defined)
|
||||
* BOARD_XOSC_ONDEMAND - Boolean (defined / not defined)
|
||||
* BOARD_XOSC_RUNINSTANDBY - Boolean (defined / not defined)
|
||||
*/
|
||||
|
||||
#undef BOARD_XOSC_ENABLE
|
||||
#define BOARD_XOSC_FREQUENCY 12000000UL
|
||||
#define BOARD_XOSC_STARTUPTIME SYSCTRL_XOSC_STARTUP_1S
|
||||
#define BOARD_XOSC_ISCRYSTAL 1
|
||||
#define BOARD_XOSC_AMPGC 1
|
||||
#define BOARD_XOSC_ONDEMAND 1
|
||||
#undef BOARD_XOSC_RUNINSTANDBY
|
||||
|
||||
/* XOSC32 Configuration -- Not used
|
||||
*
|
||||
* BOARD_XOSC32K_ENABLE - Boolean (defined / not defined)
|
||||
* BOARD_XOSC32K_FREQUENCY - In Hz
|
||||
* BOARD_XOSC32K_STARTUPTIME - See SYSCTRL_XOSC32K_STARTUP_* definitions
|
||||
* BOARD_XOSC32K_ISCRYSTAL - Boolean (defined / not defined)
|
||||
* BOARD_XOSC32K_AAMPEN - Boolean (defined / not defined)
|
||||
* BOARD_XOSC32K_EN1KHZ - Boolean (defined / not defined)
|
||||
* BOARD_XOSC32K_EN32KHZ - Boolean (defined / not defined)
|
||||
* BOARD_XOSC32K_ONDEMAND - Boolean (defined / not defined)
|
||||
* BOARD_XOSC32K_RUNINSTANDBY - Boolean (defined / not defined)
|
||||
*/
|
||||
|
||||
#undef BOARD_XOSC32K_ENABLE
|
||||
#define BOARD_XOSC32K_FREQUENCY 32768 /* 32.768KHz XTAL */
|
||||
#define BOARD_XOSC32K_STARTUPTIME SYSCTRL_XOSC32K_STARTUP_2S
|
||||
#define BOARD_XOSC32K_ISCRYSTAL 1
|
||||
#define BOARD_XOSC32K_AAMPEN 1
|
||||
#undef BOARD_XOSC32K_EN1KHZ
|
||||
#define BOARD_XOSC32K_EN32KHZ 1
|
||||
#define BOARD_XOSC32K_ONDEMAND 1
|
||||
#undef BOARD_XOSC32K_RUNINSTANDBY
|
||||
|
||||
/* OSC32 Configuration -- not used
|
||||
*
|
||||
* BOARD_OSC32K_ENABLE - Boolean (defined / not defined)
|
||||
* BOARD_OSC32K_FREQUENCY - In Hz
|
||||
* BOARD_OSC32K_STARTUPTIME - See SYSCTRL_OSC32K_STARTUP_* definitions
|
||||
* BOARD_OSC32K_EN1KHZ - Boolean (defined / not defined)
|
||||
* BOARD_OSC32K_EN32KHZ - Boolean (defined / not defined)
|
||||
* BOARD_OSC32K_ONDEMAND - Boolean (defined / not defined)
|
||||
* BOARD_OSC32K_RUNINSTANDBY - Boolean (defined / not defined)
|
||||
*/
|
||||
|
||||
#undef BOARD_OSC32K_ENABLE
|
||||
#define BOARD_OSC32K_FREQUENCY 32768 /* 32.768kHz internal oscillator */
|
||||
#define BOARD_OSC32K_STARTUPTIME SYSCTRL_OSC32K_STARTUP_4MS
|
||||
#define BOARD_OSC32K_EN1KHZ 1
|
||||
#define BOARD_OSC32K_EN32KHZ 1
|
||||
#define BOARD_OSC32K_ONDEMAND 1
|
||||
#undef BOARD_OSC32K_RUNINSTANDBY
|
||||
|
||||
/* OSC8M Configuration -- always enabled
|
||||
*
|
||||
* BOARD_OSC8M_PRESCALER - See SYSCTRL_OSC8M_PRESC_DIV* definitions
|
||||
* BOARD_OSC8M_ONDEMAND - Boolean (defined / not defined)
|
||||
* BOARD_OSC8M_RUNINSTANDBY - Boolean (defined / not defined)
|
||||
*/
|
||||
|
||||
#define BOARD_OSC8M_PRESCALER SYSCTRL_OSC8M_PRESC_DIV1
|
||||
#define BOARD_OSC8M_ONDEMAND 1
|
||||
#undef BOARD_OSC8M_RUNINSTANDBY
|
||||
|
||||
#define BOARD_OSC8M_FREQUENCY 8000000 /* 8MHz high-accuracy internal oscillator */
|
||||
|
||||
/* OSCULP32K Configuration -- not used. */
|
||||
|
||||
#define BOARD_OSCULP32K_FREQUENCY 32000 /* 32kHz ultra-low-power internal oscillator */
|
||||
|
||||
/* Digital Frequency Locked Loop configuration. In closed-loop mode, the
|
||||
* DFLL output frequency (Fdfll) is given by:
|
||||
*
|
||||
* Fdfll = DFLLmul * Frefclk
|
||||
* = 6 * 8000000 = 48MHz
|
||||
*
|
||||
* Where the reference clock is Generic Clock Channel 0 output of GLCK1.
|
||||
* GCLCK1 provides OSC8M, undivided.
|
||||
*
|
||||
* When operating in open-loop mode, the output frequency of the DFLL will
|
||||
* be determined by the values written to the DFLL Coarse Value bit group
|
||||
* and the DFLL Fine Value bit group in the DFLL Value register.
|
||||
*
|
||||
* BOARD_DFLL_OPENLOOP - Boolean (defined / not defined)
|
||||
* BOARD_DFLL_TRACKAFTERFINELOCK - Boolean (defined / not defined)
|
||||
* BOARD_DFLL_KEEPLOCKONWAKEUP - Boolean (defined / not defined)
|
||||
* BOARD_DFLL_ENABLECHILLCYCLE - Boolean (defined / not defined)
|
||||
* BOARD_DFLL_QUICKLOCK - Boolean (defined / not defined)
|
||||
* BOARD_DFLL_ONDEMAND - Boolean (defined / not defined)
|
||||
* BOARD_DFLL_COARSEVALUE - Value
|
||||
* BOARD_DFLL_FINEVALUE - Value
|
||||
*
|
||||
* Open Loop mode only:
|
||||
* BOARD_DFLL_COARSEVALUE - Value
|
||||
* BOARD_DFLL_FINEVALUE - Value
|
||||
*
|
||||
* Closed loop mode only:
|
||||
* BOARD_DFLL_GCLKGEN - GCLK index
|
||||
* BOARD_DFLL_MULTIPLIER - Value
|
||||
* BOARD_DFLL_MAXCOARSESTEP - Value
|
||||
* BOARD_DFLL_MAXFINESTEP - Value
|
||||
*
|
||||
* BOARD_DFLL_FREQUENCY - The resulting frequency
|
||||
*/
|
||||
|
||||
#define BOARD_DFLL_ENABLE 1
|
||||
#undef BOARD_DFLL_OPENLOOP
|
||||
#undef BOARD_DFLL_ONDEMAND
|
||||
#undef BOARD_DFLL_RUNINSTANDBY
|
||||
|
||||
/* DFLL open loop mode configuration */
|
||||
|
||||
#define BOARD_DFLL_COARSEVALUE (0x1f / 4)
|
||||
#define BOARD_DFLL_FINEVALUE (0xff / 4)
|
||||
|
||||
/* DFLL closed loop mode configuration */
|
||||
|
||||
#define BOARD_DFLL_SRCGCLKGEN 1
|
||||
#define BOARD_DFLL_MULTIPLIER 6
|
||||
#define BOARD_DFLL_QUICKLOCK 1
|
||||
#define BOARD_DFLL_TRACKAFTERFINELOCK 1
|
||||
#define BOARD_DFLL_KEEPLOCKONWAKEUP 1
|
||||
#define BOARD_DFLL_ENABLECHILLCYCLE 1
|
||||
#define BOARD_DFLL_MAXCOARSESTEP (0x1f / 4)
|
||||
#define BOARD_DFLL_MAXFINESTEP (0xff / 4)
|
||||
|
||||
#define BOARD_DFLL_FREQUENCY (48000000)
|
||||
|
||||
/* GCLK Configuration
|
||||
*
|
||||
* Global enable/disable.
|
||||
*
|
||||
* BOARD_GCLK_ENABLE - Boolean (defined / not defined)
|
||||
*
|
||||
* For n=1-7:
|
||||
* BOARD_GCLKn_ENABLE - Boolean (defined / not defined)
|
||||
*
|
||||
* For n=0-8:
|
||||
* BOARD_GCLKn_RUN_IN_STANDBY - Boolean (defined / not defined)
|
||||
* BOARD_GCLKn_CLOCK_SOURCE - See GCLK_GENCTRL_SRC_* definitions
|
||||
* BOARD_GCLKn_PRESCALER - Value
|
||||
* BOARD_GCLKn_OUTPUT_ENABLE - Boolean (defined / not defined)
|
||||
*/
|
||||
|
||||
#define BOARD_GCLK_ENABLE 1
|
||||
|
||||
/* GCLK generator 0 (Main Clock) - Source is the DFLL */
|
||||
|
||||
#undef BOARD_GCLK0_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK0_CLOCK_SOURCE GCLK_GENCTRL_SRC_DFLL48M
|
||||
#define BOARD_GCLK0_PRESCALER 1
|
||||
#undef BOARD_GCLK0_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK0_FREQUENCY (BOARD_DFLL_FREQUENCY / BOARD_GCLK0_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 1 - Drives the DFLL */
|
||||
|
||||
#define BOARD_GCLK1_ENABLE 1
|
||||
#undef BOARD_GCLK1_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK1_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC8M
|
||||
#define BOARD_GCLK1_PRESCALER 1
|
||||
#undef BOARD_GCLK1_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK1_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK1_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 2 (RTC) */
|
||||
|
||||
#undef BOARD_GCLK2_ENABLE
|
||||
#undef BOARD_GCLK2_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK2_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC32K
|
||||
#define BOARD_GCLK2_PRESCALER 32
|
||||
#undef BOARD_GCLK2_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK2_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK2_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 3 */
|
||||
|
||||
#undef BOARD_GCLK3_ENABLE
|
||||
#undef BOARD_GCLK3_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK3_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC8M
|
||||
#define BOARD_GCLK3_PRESCALER 1
|
||||
#undef BOARD_GCLK3_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK3_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK3_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 4 */
|
||||
|
||||
#undef BOARD_GCLK4_ENABLE
|
||||
#undef BOARD_GCLK4_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK4_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC8M
|
||||
#define BOARD_GCLK4_PRESCALER 1
|
||||
#undef BOARD_GCLK4_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK4_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK4_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 5 */
|
||||
|
||||
#undef BOARD_GCLK5_ENABLE
|
||||
#undef BOARD_GCLK5_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK5_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC8M
|
||||
#define BOARD_GCLK5_PRESCALER 1
|
||||
#undef BOARD_GCLK5_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK5_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK5_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 6 */
|
||||
|
||||
#undef BOARD_GCLK6_ENABLE
|
||||
#undef BOARD_GCLK6_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK6_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC8M
|
||||
#define BOARD_GCLK6_PRESCALER 1
|
||||
#undef BOARD_GCLK6_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK6_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK6_PRESCALER)
|
||||
|
||||
/* Configure GCLK generator 7 */
|
||||
|
||||
#undef BOARD_GCLK7_ENABLE
|
||||
#undef BOARD_GCLK7_RUN_IN_STANDBY
|
||||
#define BOARD_GCLK7_CLOCK_SOURCE GCLK_GENCTRL_SRC_OSC8M
|
||||
#define BOARD_GCLK7_PRESCALER 1
|
||||
#undef BOARD_GCLK7_OUTPUT_ENABLE
|
||||
#define BOARD_GCLK7_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK7_PRESCALER)
|
||||
|
||||
/* The source of the main clock is always GCLK_MAIN. Also called GCLKGEN[0], this is
|
||||
* the clock feeding the Power Manager. The Power Manager, in turn, generates main
|
||||
* clock which is divided down to produce the CPU, AHB, and APB clocks.
|
||||
*
|
||||
* The main clock is initially OSC8M divided by 8.
|
||||
*/
|
||||
|
||||
#define BOARD_GCLK_MAIN_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* Main clock dividers
|
||||
*
|
||||
* BOARD_CPU_DIVIDER - See PM_CPUSEL_CPUDIV_* definitions
|
||||
* BOARD_CPU_FRQUENCY - In Hz
|
||||
* BOARD_CPU_FAILDECT - Boolean (defined / not defined)
|
||||
* BOARD_APBA_DIVIDER - See M_APBASEL_APBADIV_* definitions
|
||||
* BOARD_APBA_FRQUENCY - In Hz
|
||||
* BOARD_APBB_DIVIDER - See M_APBBSEL_APBBDIV_* definitions
|
||||
* BOARD_APBB_FRQUENCY - In Hz
|
||||
* BOARD_APBC_DIVIDER - See M_APBCSEL_APBCDIV_* definitions
|
||||
* BOARD_APBC_FRQUENCY - In Hz
|
||||
*/
|
||||
|
||||
#define BOARD_CPU_FAILDECT 1
|
||||
#define BOARD_CPU_DIVIDER PM_CPUSEL_CPUDIV_1
|
||||
#define BOARD_APBA_DIVIDER PM_APBASEL_APBADIV_1
|
||||
#define BOARD_APBB_DIVIDER PM_APBBSEL_APBBDIV_1
|
||||
#define BOARD_APBC_DIVIDER PM_APBCSEL_APBCDIV_1
|
||||
|
||||
/* Resulting frequencies */
|
||||
|
||||
#define BOARD_MCK_FREQUENCY (BOARD_GCLK_MAIN_FREQUENCY)
|
||||
#define BOARD_CPU_FREQUENCY (BOARD_MCK_FREQUENCY)
|
||||
#define BOARD_PBA_FREQUENCY (BOARD_MCK_FREQUENCY)
|
||||
#define BOARD_PBB_FREQUENCY (BOARD_MCK_FREQUENCY)
|
||||
#define BOARD_PBC_FREQUENCY (BOARD_MCK_FREQUENCY)
|
||||
#define BOARD_PBD_FREQUENCY (BOARD_MCK_FREQUENCY)
|
||||
|
||||
/* FLASH wait states
|
||||
*
|
||||
* Vdd Range Wait states Maximum Operating Frequency
|
||||
* ------------- -------------- ---------------------------
|
||||
* 1.62V to 2.7V 0 14 MHz
|
||||
* 1 28 MHz
|
||||
* 2 42 MHz
|
||||
* 3 48 MHz
|
||||
* 2.7V to 3.63V 0 24 MHz
|
||||
* 1 48 MHz
|
||||
*/
|
||||
|
||||
#if 0 /* REVISIT -- should not be necessary */
|
||||
# define BOARD_FLASH_WAITSTATES 1
|
||||
#else
|
||||
# define BOARD_FLASH_WAITSTATES 2
|
||||
#endif
|
||||
|
||||
/* SERCOM definitions ***************************************************************/
|
||||
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that is common
|
||||
* to all SERCOM modules.
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM05_SLOW_GCLKGEN 0
|
||||
|
||||
/* SERCOM0 SPI is available on EXT1
|
||||
*
|
||||
* PIN PORT SERCOM FUNCTION
|
||||
* --- ------------------ -----------
|
||||
* 15 PA5 SERCOM0 PAD1 SPI SS
|
||||
* 16 PA6 SERCOM0 PAD2 SPI MOSI
|
||||
* 17 PA4 SERCOM0 PAD0 SPI MISO
|
||||
* 18 PA7 SERCOM0 PAD3 SPI SCK
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM0_GCLKGEN 0
|
||||
#define BOARD_SERCOM0_SLOW_GCLKGEN BOARD_SERCOM05_SLOW_GCLKGEN
|
||||
#define BOARD_SERCOM0_MUXCONFIG (SPI_CTRLA_DOPO_DOPAD231 | SPI_CTRLA_DIPAD0)
|
||||
#define BOARD_SERCOM0_PINMAP_PAD0 PORT_SERCOM0_PAD0_2 /* SPI_MISO */
|
||||
#define BOARD_SERCOM0_PINMAP_PAD1 0 /* microSD_SS */
|
||||
#define BOARD_SERCOM0_PINMAP_PAD2 PORT_SERCOM0_PAD2_2 /* SPI_MOSI */
|
||||
#define BOARD_SERCOM0_PINMAP_PAD3 PORT_SERCOM0_PAD3_2 /* SPI_SCK */
|
||||
|
||||
#define BOARD_SERCOM0_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* SERCOM1 SPI is available on EXT2
|
||||
*
|
||||
* PIN PORT SERCOM FUNCTION
|
||||
* --- ------------------ -----------
|
||||
* 15 PA17 SERCOM1 PAD1 SPI SS
|
||||
* 16 PA18 SERCOM1 PAD2 SPI MOSI
|
||||
* 17 PA16 SERCOM1 PAD0 SPI MISO
|
||||
* 18 PA19 SERCOM1 PAD3 SPI SCK
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM1_GCLKGEN 0
|
||||
#define BOARD_SERCOM1_SLOW_GCLKGEN BOARD_SERCOM05_SLOW_GCLKGEN
|
||||
#define BOARD_SERCOM1_MUXCONFIG (SPI_CTRLA_DOPO_DOPAD231 | SPI_CTRLA_DIPAD0)
|
||||
#define BOARD_SERCOM1_PINMAP_PAD0 PORT_SERCOM1_PAD0_1 /* SPI_MISO */
|
||||
#define BOARD_SERCOM1_PINMAP_PAD1 0 /* microSD_SS */
|
||||
#define BOARD_SERCOM1_PINMAP_PAD2 PORT_SERCOM1_PAD2_1 /* SPI_MOSI */
|
||||
#define BOARD_SERCOM1_PINMAP_PAD3 PORT_SERCOM1_PAD3_1 /* SPI_SCK */
|
||||
|
||||
#define BOARD_SERCOM1_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* The SAMD21 Xplained Pro contains an Embedded Debugger (EDBG) that can be
|
||||
* used to program and debug the ATSAMD21J18A using Serial Wire Debug (SWD).
|
||||
* The Embedded debugger also include a Virtual COM port interface over
|
||||
* SERCOM3. Virtual COM port connections:
|
||||
*
|
||||
* PA22 SERCOM3 PAD[0] / USART TXD
|
||||
* PA23 SERCOM3 PAD[1] / USART RXD
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM3_GCLKGEN 0
|
||||
#define BOARD_SERCOM3_SLOW_GCLKGEN BOARD_SERCOM05_SLOW_GCLKGEN
|
||||
#define BOARD_SERCOM3_MUXCONFIG (USART_CTRLA_RXPAD1 | USART_CTRLA_TXPAD0)
|
||||
#define BOARD_SERCOM3_PINMAP_PAD0 PORT_SERCOM3_PAD0_1 /* USART TX */
|
||||
#define BOARD_SERCOM3_PINMAP_PAD1 PORT_SERCOM3_PAD1_1 /* USART RX */
|
||||
#define BOARD_SERCOM3_PINMAP_PAD2 0
|
||||
#define BOARD_SERCOM3_PINMAP_PAD3 0
|
||||
|
||||
#define BOARD_SERCOM3_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* The SERCOM4 USART is available on connectors EXT1, EXT2, and EXT3
|
||||
*
|
||||
* PIN EXT1 EXT2 EXT3 GPIO Function
|
||||
* ---- ---- ---- ---- ------------------
|
||||
* 13 PB09 PB10 PB10 SERCOM4 / USART RX
|
||||
* 14 PB08 PB11 PB11 SERCOM4 / USART TX
|
||||
* 19 GND GND GND N/A
|
||||
* 20 VCC VCC VCC N/A
|
||||
*
|
||||
* If you have a TTL to RS-232 converter then this is the most convenient
|
||||
* serial console to use (because you don't lose the console device each time
|
||||
* you lose the USB connection). It is the default in all of the SAMD21
|
||||
* configurations.
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM4_GCLKGEN 0
|
||||
#define BOARD_SERCOM4_SLOW_GCLKGEN BOARD_SERCOM05_SLOW_GCLKGEN
|
||||
|
||||
#if defined(CONFIG_SAMD21_XPLAINED_USART4_EXT1)
|
||||
# define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD1 | USART_CTRLA_TXPAD0)
|
||||
# define BOARD_SERCOM4_PINMAP_PAD0 PORT_SERCOM4_PAD0_3 /* USART TX */
|
||||
# define BOARD_SERCOM4_PINMAP_PAD1 PORT_SERCOM4_PAD1_3 /* USART RX */
|
||||
# define BOARD_SERCOM4_PINMAP_PAD2 0
|
||||
# define BOARD_SERCOM4_PINMAP_PAD3 0
|
||||
#elif defined(CONFIG_SAMD21_XPLAINED_USART4_EXT2)
|
||||
# define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD3 | USART_CTRLA_TXPAD2)
|
||||
# define BOARD_SERCOM4_PINMAP_PAD0 0
|
||||
# define BOARD_SERCOM4_PINMAP_PAD1 0
|
||||
# define BOARD_SERCOM4_PINMAP_PAD2 PORT_SERCOM4_PAD2_3 /* USART TX */
|
||||
# define BOARD_SERCOM4_PINMAP_PAD3 PORT_SERCOM4_PAD3_3 /* USART RX */
|
||||
#else /* if defined(CONFIG_SAMD21_XPLAINED_USART4_EXT3) */
|
||||
# define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD3 | USART_CTRLA_TXPAD2)
|
||||
# define BOARD_SERCOM4_PINMAP_PAD0 0
|
||||
# define BOARD_SERCOM4_PINMAP_PAD1 0
|
||||
# define BOARD_SERCOM4_PINMAP_PAD2 PORT_SERCOM4_PAD2_3 /* USART TX */
|
||||
# define BOARD_SERCOM4_PINMAP_PAD3 PORT_SERCOM4_PAD3_3 /* USART RX */
|
||||
#endif
|
||||
|
||||
#define BOARD_SERCOM4_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* SERCOM5 SPI is available on EXT3
|
||||
*
|
||||
* PIN PORT SERCOM FUNCTION
|
||||
* --- ------------------ -----------
|
||||
* 15 PB17 SERCOM5 PAD1 SPI SS
|
||||
* 16 PB22 SERCOM5 PAD2 SPI MOSI
|
||||
* 17 PB16 SERCOM5 PAD0 SPI MISO
|
||||
* 18 PB23 SERCOM5 PAD3 SPI SCK
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM5_GCLKGEN 0
|
||||
#define BOARD_SERCOM5_SLOW_GCLKGEN BOARD_SERCOM05_SLOW_GCLKGEN
|
||||
#define BOARD_SERCOM5_MUXCONFIG (SPI_CTRLA_DOPO_DOPAD231 | SPI_CTRLA_DIPAD0)
|
||||
#define BOARD_SERCOM5_PINMAP_PAD0 PORT_SERCOM5_PAD0_1 /* SPI_MISO */
|
||||
#define BOARD_SERCOM5_PINMAP_PAD1 0 /* microSD_SS */
|
||||
#define BOARD_SERCOM5_PINMAP_PAD2 PORT_SERCOM5_PAD2_4 /* SPI_MOSI */
|
||||
#define BOARD_SERCOM5_PINMAP_PAD3 PORT_SERCOM5_PAD3_4 /* SPI_SCK */
|
||||
|
||||
#define BOARD_SERCOM5_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
|
||||
* controls two of the LEDs, a power LED and a status LED. There is only
|
||||
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21 USB
|
||||
* connector.
|
||||
*
|
||||
* This LED is controlled by PC07 and the LED can be activated by driving the
|
||||
* PB30 to GND.
|
||||
*/
|
||||
|
||||
/* LED index values for use with sam_setled() */
|
||||
|
||||
#define BOARD_STATUS_LED 0
|
||||
#define BOARD_NLEDS 1
|
||||
|
||||
/* LED bits for use with sam_setleds() */
|
||||
|
||||
#define BOARD_STATUS LED_BIT (1 << BOARD_STATUS_LED)
|
||||
|
||||
/* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
|
||||
* control the LED as defined below. Thus if the LED is statically on, NuttX has
|
||||
* successfully booted and is, apparently, running normally. If the LED is
|
||||
* flashing at approximately 2Hz, then a fatal error has been detected and the
|
||||
* system has halted.
|
||||
*/
|
||||
|
||||
#define LED_STARTED 0 /* STATUS LED=OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* STATUS LED=OFF */
|
||||
#define LED_IRQSENABLED 0 /* STATUS LED=OFF */
|
||||
#define LED_STACKCREATED 1 /* STATUS LED=ON */
|
||||
#define LED_INIRQ 2 /* STATUS LED=no change */
|
||||
#define LED_SIGNAL 2 /* STATUS LED=no change */
|
||||
#define LED_ASSERTION 2 /* STATUS LED=no change */
|
||||
#define LED_PANIC 3 /* STATUS LED=flashing */
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* Mechanical buttons:
|
||||
*
|
||||
* The SAMD21 Xplained Pro contains two mechanical buttons. One button is the
|
||||
* RESET button connected to the SAMD21 reset line and the other is a generic user
|
||||
* configurable button. When a button is pressed it will drive the I/O line to GND.
|
||||
*
|
||||
* PA15 SW0
|
||||
*/
|
||||
|
||||
/* The SAMD21 Xplained Pro supports one button: */
|
||||
|
||||
#define BUTTON_SW0 0
|
||||
#define NUM_BUTTONS 1
|
||||
|
||||
#define BUTTON_SW0_BIT (1 << BUTTON_SW0)
|
||||
|
||||
/************************************************************************************
|
||||
* 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 SAM3U architectures must provide the following entry point. This entry point
|
||||
* is called early in the initialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void 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 interfaces are 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_SAMD21_XPLAINED_INCLUDE_BOARD_H */
|
122
configs/samd21-xplained/nsh/Make.defs
Normal file
122
configs/samd21-xplained/nsh/Make.defs
Normal file
|
@ -0,0 +1,122 @@
|
|||
############################################################################
|
||||
# configs/samd21-xplained/nsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv6-m/Toolchain.defs
|
||||
|
||||
LDSCRIPT = flash.ld
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
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/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(ARCROSSDEV)ar rcs
|
||||
NM = $(ARCROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
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 =
|
||||
ifeq ($(CONFIG_HOST_WINDOWS),y)
|
||||
HOSTEXEEXT = .exe
|
||||
else
|
||||
HOSTEXEEXT =
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native host tools
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
else
|
||||
# Linux/Cygwin-native host tools
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
endif
|
846
configs/samd21-xplained/nsh/defconfig
Normal file
846
configs/samd21-xplained/nsh/defconfig
Normal file
|
@ -0,0 +1,846 @@
|
|||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Nuttx/ Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Build Setup
|
||||
#
|
||||
# CONFIG_EXPERIMENTAL is not set
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
# CONFIG_HOST_LINUX is not set
|
||||
# CONFIG_HOST_OSX is not set
|
||||
CONFIG_HOST_WINDOWS=y
|
||||
# CONFIG_HOST_OTHER is not set
|
||||
# CONFIG_WINDOWS_NATIVE is not set
|
||||
CONFIG_WINDOWS_CYGWIN=y
|
||||
# CONFIG_WINDOWS_MSYS is not set
|
||||
# CONFIG_WINDOWS_OTHER is not set
|
||||
|
||||
#
|
||||
# Build Configuration
|
||||
#
|
||||
# CONFIG_APPS_DIR="../apps"
|
||||
CONFIG_BUILD_FLAT=y
|
||||
# CONFIG_BUILD_2PASS is not set
|
||||
|
||||
#
|
||||
# Binary Output Formats
|
||||
#
|
||||
# CONFIG_RRLOAD_BINARY is not set
|
||||
# CONFIG_INTELHEX_BINARY is not set
|
||||
# CONFIG_MOTOROLA_SREC is not set
|
||||
CONFIG_RAW_BINARY=y
|
||||
# CONFIG_UBOOT_UIMAGE is not set
|
||||
|
||||
#
|
||||
# Customize Header Files
|
||||
#
|
||||
# CONFIG_ARCH_STDINT_H is not set
|
||||
# CONFIG_ARCH_STDBOOL_H is not set
|
||||
# CONFIG_ARCH_MATH_H is not set
|
||||
# CONFIG_ARCH_FLOAT_H is not set
|
||||
# CONFIG_ARCH_STDARG_H is not set
|
||||
|
||||
#
|
||||
# Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG is not set
|
||||
# CONFIG_ARCH_HAVE_HEAPCHECK is not set
|
||||
CONFIG_ARCH_HAVE_STACKCHECK=y
|
||||
# CONFIG_STACK_COLORATION is not set
|
||||
# CONFIG_DEBUG_SYMBOLS is not set
|
||||
CONFIG_ARCH_HAVE_CUSTOMOPT=y
|
||||
# CONFIG_DEBUG_NOOPT is not set
|
||||
# CONFIG_DEBUG_CUSTOMOPT is not set
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
|
||||
#
|
||||
# System Type
|
||||
#
|
||||
CONFIG_ARCH_ARM=y
|
||||
# CONFIG_ARCH_AVR is not set
|
||||
# CONFIG_ARCH_HC is not set
|
||||
# CONFIG_ARCH_MIPS is not set
|
||||
# CONFIG_ARCH_RGMP is not set
|
||||
# CONFIG_ARCH_SH is not set
|
||||
# CONFIG_ARCH_SIM is not set
|
||||
# CONFIG_ARCH_X86 is not set
|
||||
# CONFIG_ARCH_Z16 is not set
|
||||
# CONFIG_ARCH_Z80 is not set
|
||||
CONFIG_ARCH="arm"
|
||||
|
||||
#
|
||||
# ARM Options
|
||||
#
|
||||
# CONFIG_ARCH_CHIP_A1X is not set
|
||||
# CONFIG_ARCH_CHIP_C5471 is not set
|
||||
# CONFIG_ARCH_CHIP_CALYPSO is not set
|
||||
# CONFIG_ARCH_CHIP_DM320 is not set
|
||||
# CONFIG_ARCH_CHIP_EFM32 is not set
|
||||
# CONFIG_ARCH_CHIP_IMX is not set
|
||||
# CONFIG_ARCH_CHIP_KINETIS is not set
|
||||
# CONFIG_ARCH_CHIP_KL is not set
|
||||
# CONFIG_ARCH_CHIP_LM is not set
|
||||
# CONFIG_ARCH_CHIP_TIVA is not set
|
||||
# CONFIG_ARCH_CHIP_LPC11XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC17XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC214X is not set
|
||||
# CONFIG_ARCH_CHIP_LPC2378 is not set
|
||||
# CONFIG_ARCH_CHIP_LPC31XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC43XX is not set
|
||||
# CONFIG_ARCH_CHIP_NUC1XX is not set
|
||||
# CONFIG_ARCH_CHIP_SAMA5 is not set
|
||||
CONFIG_ARCH_CHIP_SAMD=y
|
||||
# CONFIG_ARCH_CHIP_SAML is not set
|
||||
# CONFIG_ARCH_CHIP_SAM34 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMV7 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32 is not set
|
||||
# CONFIG_ARCH_CHIP_STR71X is not set
|
||||
# CONFIG_ARCH_ARM7TDMI is not set
|
||||
# CONFIG_ARCH_ARM926EJS is not set
|
||||
# CONFIG_ARCH_ARM920T is not set
|
||||
CONFIG_ARCH_CORTEXM0=y
|
||||
# CONFIG_ARCH_CORTEXM3 is not set
|
||||
# CONFIG_ARCH_CORTEXM4 is not set
|
||||
# CONFIG_ARCH_CORTEXM7 is not set
|
||||
# CONFIG_ARCH_CORTEXA5 is not set
|
||||
# CONFIG_ARCH_CORTEXA8 is not set
|
||||
CONFIG_ARCH_FAMILY="armv6-m"
|
||||
CONFIG_ARCH_CHIP="samdl"
|
||||
CONFIG_ARCH_HAVE_CMNVECTOR=y
|
||||
# CONFIG_ARMV7M_CMNVECTOR is not set
|
||||
# CONFIG_ARMV7M_LAZYFPU is not set
|
||||
# CONFIG_ARCH_HAVE_FPU is not set
|
||||
# CONFIG_ARCH_HAVE_DPFPU is not set
|
||||
|
||||
#
|
||||
# ARMV6M Configuration Options
|
||||
#
|
||||
# CONFIG_ARMV6M_TOOLCHAIN_ATOLLIC is not set
|
||||
# CONFIG_ARMV6M_TOOLCHAIN_BUILDROOT is not set
|
||||
# CONFIG_ARMV6M_TOOLCHAIN_CODEREDW is not set
|
||||
CONFIG_ARMV6M_TOOLCHAIN_CODESOURCERYW=y
|
||||
# CONFIG_ARMV6M_TOOLCHAIN_DEVKITARM is not set
|
||||
# CONFIG_ARMV6M_TOOLCHAIN_GNU_EABIL is not set
|
||||
# CONFIG_ARMV6M_TOOLCHAIN_GNU_EABIW is not set
|
||||
|
||||
#
|
||||
# Atmel SAMD/L Configuration Options
|
||||
#
|
||||
# CONFIG_ARCH_CHIP_SAMD21E14 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E15 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E16 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E17 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E18 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G14 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G15 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G16 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G17 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G18 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J14 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J15 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J16 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J17 is not set
|
||||
CONFIG_ARCH_CHIP_SAMD21J18=y
|
||||
# CONFIG_ARCH_CHIP_SAMD21E15A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E15B is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E16A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E16B is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E17A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21E18A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G15A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G15B is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G16A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G16B is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G17A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21G18A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J15A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J15B is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J16A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J16B is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J17A is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD21J18A is not set
|
||||
CONFIG_ARCH_FAMILY_SAMD21=y
|
||||
# CONFIG_ARCH_FAMILY_SAMD21E is not set
|
||||
# CONFIG_ARCH_FAMILY_SAMD21G is not set
|
||||
CONFIG_ARCH_FAMILY_SAMD21J=y
|
||||
# CONFIG_ARCH_FAMILY_SAMD21 is not set
|
||||
# CONFIG_ARCH_FAMILY_SAMD21E is not set
|
||||
# CONFIG_ARCH_FAMILY_SAMD21G is not set
|
||||
# CONFIG_ARCH_FAMILY_SAMD21J is not set
|
||||
# CONFIG_ARCH_FAMILY_SAML21 is not set
|
||||
# CONFIG_ARCH_FAMILY_SAML21E is not set
|
||||
# CONFIG_ARCH_FAMILY_SAML21G is not set
|
||||
# CONFIG_ARCH_FAMILY_SAML21J is not set
|
||||
|
||||
#
|
||||
# SAMD/L Peripheral Support
|
||||
#
|
||||
# CONFIG_SAMDL_HAVE_DMAC is not set
|
||||
CONFIG_SAMDL_HAVE_SERCOM4=y
|
||||
CONFIG_SAMDL_HAVE_SERCOM5=y
|
||||
CONFIG_SAMDL_HAVE_TC5=y
|
||||
CONFIG_SAMDL_HAVE_TC2=y
|
||||
CONFIG_SAMDL_HAVE_TC3=y
|
||||
CONFIG_SAMDL_HAVE_TC6=y
|
||||
CONFIG_SAMDL_HAVE_TC7=y
|
||||
# CONFIG_SAMDL_AC is not set
|
||||
# CONFIG_SAMDL_ADC is not set
|
||||
# CONFIG_SAMDL_DAC is not set
|
||||
# CONFIG_SAMDL_EVSYS is not set
|
||||
# CONFIG_SAMDL_NVMCTRL is not set
|
||||
# CONFIG_SAMDL_PTC is not set
|
||||
# CONFIG_SAMDL_RTC is not set
|
||||
# CONFIG_SAMDL_SERCOM0 is not set
|
||||
# CONFIG_SAMDL_SERCOM1 is not set
|
||||
# CONFIG_SAMDL_SERCOM2 is not set
|
||||
CONFIG_SAMDL_SERCOM3=y
|
||||
CONFIG_SAMDL_SERCOM4=y
|
||||
# CONFIG_SAMDL_SERCOM5 is not set
|
||||
# CONFIG_SAMDL_TC0 is not set
|
||||
# CONFIG_SAMDL_TC1 is not set
|
||||
# CONFIG_SAMDL_TC2 is not set
|
||||
# CONFIG_SAMDL_TC3 is not set
|
||||
# CONFIG_SAMDL_TC4 is not set
|
||||
# CONFIG_SAMDL_TC5 is not set
|
||||
# CONFIG_SAMDL_TC6 is not set
|
||||
# CONFIG_SAMDL_TC7 is not set
|
||||
# CONFIG_SAMDL_WDT is not set
|
||||
# CONFIG_SAMDL_SERCOM3_ISI2C is not set
|
||||
# CONFIG_SAMDL_SERCOM3_ISSPI is not set
|
||||
CONFIG_SAMDL_SERCOM3_ISUSART=y
|
||||
# CONFIG_SAMDL_SERCOM4_ISI2C is not set
|
||||
# CONFIG_SAMDL_SERCOM4_ISSPI is not set
|
||||
CONFIG_SAMDL_SERCOM4_ISUSART=y
|
||||
|
||||
#
|
||||
# Architecture Options
|
||||
#
|
||||
# CONFIG_ARCH_NOINTC is not set
|
||||
# CONFIG_ARCH_VECNOTIRQ is not set
|
||||
# CONFIG_ARCH_DMA is not set
|
||||
CONFIG_ARCH_HAVE_IRQPRIO=y
|
||||
# CONFIG_ARCH_L2CACHE is not set
|
||||
# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set
|
||||
# CONFIG_ARCH_HAVE_ADDRENV is not set
|
||||
# CONFIG_ARCH_NEED_ADDRENV_MAPPING is not set
|
||||
CONFIG_ARCH_HAVE_VFORK=y
|
||||
# CONFIG_ARCH_HAVE_MMU is not set
|
||||
# CONFIG_ARCH_HAVE_MPU is not set
|
||||
# CONFIG_ARCH_NAND_HWECC is not set
|
||||
# CONFIG_ARCH_HAVE_EXTCLK is not set
|
||||
# CONFIG_ARCH_IRQPRIO is not set
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
# CONFIG_ENDIAN_BIG is not set
|
||||
# CONFIG_ARCH_IDLE_CUSTOM is not set
|
||||
# CONFIG_ARCH_HAVE_RAMFUNCS is not set
|
||||
# CONFIG_ARCH_HAVE_RAMVECTORS is not set
|
||||
|
||||
#
|
||||
# Board Settings
|
||||
#
|
||||
CONFIG_BOARD_LOOPSPERMSEC=3410
|
||||
# CONFIG_ARCH_CALIBRATION is not set
|
||||
|
||||
#
|
||||
# Interrupt options
|
||||
#
|
||||
CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=0
|
||||
# CONFIG_ARCH_HAVE_HIPRI_INTERRUPT is not set
|
||||
|
||||
#
|
||||
# Boot options
|
||||
#
|
||||
# CONFIG_BOOT_RUNFROMEXTSRAM is not set
|
||||
CONFIG_BOOT_RUNFROMFLASH=y
|
||||
# CONFIG_BOOT_RUNFROMISRAM is not set
|
||||
# CONFIG_BOOT_RUNFROMSDRAM is not set
|
||||
# CONFIG_BOOT_COPYTORAM is not set
|
||||
|
||||
#
|
||||
# Boot Memory Configuration
|
||||
#
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAM_SIZE=32768
|
||||
# CONFIG_ARCH_HAVE_SDRAM is not set
|
||||
|
||||
#
|
||||
# Board Selection
|
||||
#
|
||||
CONFIG_ARCH_BOARD_SAMD21_XPLAINED=y
|
||||
# CONFIG_ARCH_BOARD_CUSTOM is not set
|
||||
CONFIG_ARCH_BOARD="samd21-xplained"
|
||||
|
||||
#
|
||||
# Common Board Options
|
||||
#
|
||||
CONFIG_ARCH_HAVE_LEDS=y
|
||||
CONFIG_ARCH_LEDS=y
|
||||
CONFIG_ARCH_HAVE_BUTTONS=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_HAVE_IRQBUTTONS=y
|
||||
# CONFIG_ARCH_IRQBUTTONS is not set
|
||||
CONFIG_NSH_MMCSDMINOR=0
|
||||
|
||||
#
|
||||
# Board-Specific Options
|
||||
#
|
||||
|
||||
#
|
||||
# SAMD21 Xplained Pro Modules
|
||||
#
|
||||
# CONFIG_SAMD21_XPLAINED_IOMODULE is not set
|
||||
# CONFIG_SAMD21_XPLAINED_OLED1MODULE is not set
|
||||
# CONFIG_SAMD21_XPLAINED_USART4_EXT1 is not set
|
||||
# CONFIG_SAMD21_XPLAINED_USART4_EXT2 is not set
|
||||
CONFIG_SAMD21_XPLAINED_USART4_EXT3=y
|
||||
# CONFIG_LIB_BOARDCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
#
|
||||
CONFIG_DISABLE_OS_API=y
|
||||
# CONFIG_DISABLE_POSIX_TIMERS is not set
|
||||
# CONFIG_DISABLE_PTHREAD is not set
|
||||
# CONFIG_DISABLE_SIGNALS is not set
|
||||
# CONFIG_DISABLE_MQUEUE is not set
|
||||
CONFIG_DISABLE_ENVIRON=y
|
||||
|
||||
#
|
||||
# Clocks and Timers
|
||||
#
|
||||
CONFIG_USEC_PER_TICK=10000
|
||||
# CONFIG_SYSTEM_TIME64 is not set
|
||||
# CONFIG_CLOCK_MONOTONIC is not set
|
||||
# CONFIG_JULIAN_TIME is not set
|
||||
CONFIG_START_YEAR=2014
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_DAY=12
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_PREALLOC_WDOGS=4
|
||||
CONFIG_WDOG_INTRESERVE=0
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
|
||||
#
|
||||
# Tasks and Scheduling
|
||||
#
|
||||
# CONFIG_INIT_NONE is not set
|
||||
CONFIG_INIT_ENTRYPOINT=y
|
||||
# CONFIG_INIT_FILEPATH is not set
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_MAX_TASKS=16
|
||||
# CONFIG_SCHED_HAVE_PARENT is not set
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
|
||||
#
|
||||
# Pthread Options
|
||||
#
|
||||
# CONFIG_MUTEX_TYPES is not set
|
||||
CONFIG_NPTHREAD_KEYS=4
|
||||
|
||||
#
|
||||
# Performance Monitoring
|
||||
#
|
||||
# CONFIG_SCHED_CPULOAD is not set
|
||||
# CONFIG_SCHED_INSTRUMENTATION is not set
|
||||
|
||||
#
|
||||
# Files and I/O
|
||||
#
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
# CONFIG_FDCLONE_DISABLE is not set
|
||||
# CONFIG_FDCLONE_STDIO is not set
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NAME_MAX=32
|
||||
# CONFIG_PRIORITY_INHERITANCE is not set
|
||||
|
||||
#
|
||||
# RTOS hooks
|
||||
#
|
||||
# CONFIG_BOARD_INITIALIZE is not set
|
||||
# CONFIG_SCHED_STARTHOOK is not set
|
||||
# CONFIG_SCHED_ATEXIT is not set
|
||||
# CONFIG_SCHED_ONEXIT is not set
|
||||
|
||||
#
|
||||
# Signal Numbers
|
||||
#
|
||||
CONFIG_SIG_SIGUSR1=1
|
||||
CONFIG_SIG_SIGUSR2=2
|
||||
CONFIG_SIG_SIGALARM=3
|
||||
CONFIG_SIG_SIGCONDTIMEDOUT=16
|
||||
|
||||
#
|
||||
# POSIX Message Queue Options
|
||||
#
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_MQ_MAXMSGSIZE=32
|
||||
|
||||
#
|
||||
# Work Queue Support
|
||||
#
|
||||
# CONFIG_SCHED_WORKQUEUE is not set
|
||||
# CONFIG_SCHED_HPWORK is not set
|
||||
# CONFIG_SCHED_LPWORK is not set
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
#
|
||||
CONFIG_IDLETHREAD_STACKSIZE=1024
|
||||
CONFIG_USERMAIN_STACKSIZE=1536
|
||||
CONFIG_PTHREAD_STACK_MIN=256
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1536
|
||||
# CONFIG_LIB_SYSCALL is not set
|
||||
|
||||
#
|
||||
# Device Drivers
|
||||
#
|
||||
CONFIG_DISABLE_POLL=y
|
||||
CONFIG_DEV_NULL=y
|
||||
# CONFIG_DEV_ZERO is not set
|
||||
# CONFIG_LOOP is not set
|
||||
|
||||
#
|
||||
# Buffering
|
||||
#
|
||||
# CONFIG_DRVR_WRITEBUFFER is not set
|
||||
# CONFIG_DRVR_READAHEAD is not set
|
||||
# CONFIG_RAMDISK is not set
|
||||
# CONFIG_CAN is not set
|
||||
# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
|
||||
# CONFIG_PWM is not set
|
||||
# CONFIG_ARCH_HAVE_I2CRESET is not set
|
||||
# CONFIG_I2C is not set
|
||||
# CONFIG_SPI is not set
|
||||
# CONFIG_I2S is not set
|
||||
|
||||
#
|
||||
# Timer Driver Support
|
||||
#
|
||||
# CONFIG_TIMER is not set
|
||||
# CONFIG_RTC is not set
|
||||
# CONFIG_WATCHDOG is not set
|
||||
# CONFIG_ANALOG is not set
|
||||
# CONFIG_AUDIO_DEVICES is not set
|
||||
# CONFIG_VIDEO_DEVICES is not set
|
||||
# CONFIG_BCH is not set
|
||||
# CONFIG_INPUT is not set
|
||||
# CONFIG_LCD is not set
|
||||
# CONFIG_MMCSD is not set
|
||||
# CONFIG_MTD is not set
|
||||
# CONFIG_EEPROM is not set
|
||||
# CONFIG_PIPES is not set
|
||||
# CONFIG_PM is not set
|
||||
# CONFIG_POWER is not set
|
||||
# CONFIG_SENSORS is not set
|
||||
# CONFIG_SERCOMM_CONSOLE is not set
|
||||
CONFIG_SERIAL=y
|
||||
# CONFIG_DEV_LOWCONSOLE is not set
|
||||
# CONFIG_16550_UART is not set
|
||||
# CONFIG_ARCH_HAVE_UART is not set
|
||||
# CONFIG_ARCH_HAVE_UART0 is not set
|
||||
# CONFIG_ARCH_HAVE_UART1 is not set
|
||||
# CONFIG_ARCH_HAVE_UART2 is not set
|
||||
# CONFIG_ARCH_HAVE_UART3 is not set
|
||||
# CONFIG_ARCH_HAVE_UART4 is not set
|
||||
# CONFIG_ARCH_HAVE_UART5 is not set
|
||||
# CONFIG_ARCH_HAVE_UART6 is not set
|
||||
# CONFIG_ARCH_HAVE_UART7 is not set
|
||||
# CONFIG_ARCH_HAVE_UART8 is not set
|
||||
# CONFIG_ARCH_HAVE_SCI0 is not set
|
||||
# CONFIG_ARCH_HAVE_SCI1 is not set
|
||||
# CONFIG_ARCH_HAVE_USART0 is not set
|
||||
# CONFIG_ARCH_HAVE_USART1 is not set
|
||||
# CONFIG_ARCH_HAVE_USART2 is not set
|
||||
CONFIG_ARCH_HAVE_USART3=y
|
||||
CONFIG_ARCH_HAVE_USART4=y
|
||||
# CONFIG_ARCH_HAVE_USART5 is not set
|
||||
# CONFIG_ARCH_HAVE_USART6 is not set
|
||||
# CONFIG_ARCH_HAVE_USART7 is not set
|
||||
# CONFIG_ARCH_HAVE_USART8 is not set
|
||||
# CONFIG_ARCH_HAVE_OTHER_UART is not set
|
||||
|
||||
#
|
||||
# USART Configuration
|
||||
#
|
||||
CONFIG_USART3_ISUART=y
|
||||
CONFIG_USART4_ISUART=y
|
||||
CONFIG_MCU_SERIAL=y
|
||||
CONFIG_STANDARD_SERIAL=y
|
||||
# CONFIG_SERIAL_IFLOWCONTROL is not set
|
||||
# CONFIG_SERIAL_OFLOWCONTROL is not set
|
||||
# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set
|
||||
# CONFIG_USART3_SERIAL_CONSOLE is not set
|
||||
CONFIG_USART4_SERIAL_CONSOLE=y
|
||||
# CONFIG_OTHER_SERIAL_CONSOLE is not set
|
||||
# CONFIG_NO_SERIAL_CONSOLE is not set
|
||||
|
||||
#
|
||||
# USART3 Configuration
|
||||
#
|
||||
CONFIG_USART3_RXBUFSIZE=64
|
||||
CONFIG_USART3_TXBUFSIZE=64
|
||||
CONFIG_USART3_BAUD=115200
|
||||
CONFIG_USART3_BITS=8
|
||||
CONFIG_USART3_PARITY=0
|
||||
CONFIG_USART3_2STOP=0
|
||||
# CONFIG_USART3_IFLOWCONTROL is not set
|
||||
# CONFIG_USART3_OFLOWCONTROL is not set
|
||||
|
||||
#
|
||||
# USART4 Configuration
|
||||
#
|
||||
CONFIG_USART4_RXBUFSIZE=64
|
||||
CONFIG_USART4_TXBUFSIZE=64
|
||||
CONFIG_USART4_BAUD=115200
|
||||
CONFIG_USART4_BITS=8
|
||||
CONFIG_USART4_PARITY=0
|
||||
CONFIG_USART4_2STOP=0
|
||||
# CONFIG_USART4_IFLOWCONTROL is not set
|
||||
# CONFIG_USART4_OFLOWCONTROL is not set
|
||||
# CONFIG_USBDEV is not set
|
||||
# CONFIG_USBHOST is not set
|
||||
# CONFIG_WIRELESS is not set
|
||||
|
||||
#
|
||||
# System Logging Device Options
|
||||
#
|
||||
|
||||
#
|
||||
# System Logging
|
||||
#
|
||||
# CONFIG_RAMLOG is not set
|
||||
# CONFIG_SYSLOG_CONSOLE is not set
|
||||
|
||||
#
|
||||
# Networking Support
|
||||
#
|
||||
# CONFIG_ARCH_HAVE_NET is not set
|
||||
# CONFIG_ARCH_HAVE_PHY is not set
|
||||
# CONFIG_NET is not set
|
||||
|
||||
#
|
||||
# Crypto API
|
||||
#
|
||||
# CONFIG_CRYPTO is not set
|
||||
|
||||
#
|
||||
# File Systems
|
||||
#
|
||||
|
||||
#
|
||||
# File system configuration
|
||||
#
|
||||
# CONFIG_DISABLE_MOUNTPOINT is not set
|
||||
# CONFIG_FS_AUTOMOUNTER is not set
|
||||
CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
|
||||
# CONFIG_FS_READABLE is not set
|
||||
# CONFIG_FS_WRITABLE is not set
|
||||
# CONFIG_FS_NAMED_SEMAPHORES is not set
|
||||
CONFIG_FS_MQUEUE_MPATH="/var/mqueue"
|
||||
# CONFIG_FS_RAMMAP is not set
|
||||
# CONFIG_FS_FAT is not set
|
||||
# CONFIG_FS_NXFFS is not set
|
||||
# CONFIG_FS_ROMFS is not set
|
||||
# CONFIG_FS_SMARTFS is not set
|
||||
# CONFIG_FS_BINFS is not set
|
||||
# CONFIG_FS_PROCFS is not set
|
||||
# CONFIG_FS_UNIONFS is not set
|
||||
|
||||
#
|
||||
# System Logging
|
||||
#
|
||||
# CONFIG_SYSLOG is not set
|
||||
# CONFIG_SYSLOG_TIMESTAMP is not set
|
||||
|
||||
#
|
||||
# Graphics Support
|
||||
#
|
||||
# CONFIG_NX is not set
|
||||
|
||||
#
|
||||
# Memory Management
|
||||
#
|
||||
# CONFIG_MM_SMALL is not set
|
||||
CONFIG_MM_REGIONS=1
|
||||
# CONFIG_ARCH_HAVE_HEAP2 is not set
|
||||
# CONFIG_GRAN is not set
|
||||
|
||||
#
|
||||
# Audio Support
|
||||
#
|
||||
# CONFIG_AUDIO is not set
|
||||
|
||||
#
|
||||
# Binary Loader
|
||||
#
|
||||
# CONFIG_BINFMT_DISABLE is not set
|
||||
# CONFIG_NXFLAT is not set
|
||||
# CONFIG_ELF is not set
|
||||
CONFIG_BUILTIN=y
|
||||
# CONFIG_PIC is not set
|
||||
# CONFIG_SYMTAB_ORDEREDBYNAME is not set
|
||||
|
||||
#
|
||||
# Library Routines
|
||||
#
|
||||
|
||||
#
|
||||
# Standard C Library Options
|
||||
#
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_STDIO_LINEBUFFER=y
|
||||
CONFIG_NUNGET_CHARS=2
|
||||
# CONFIG_LIBM is not set
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH is not set
|
||||
# CONFIG_LIBC_FLOATINGPOINT is not set
|
||||
# CONFIG_LIBC_LONG_LONG is not set
|
||||
# CONFIG_LIBC_IOCTL_VARIADIC is not set
|
||||
CONFIG_LIB_RAND_ORDER=1
|
||||
# CONFIG_EOL_IS_CR is not set
|
||||
# CONFIG_EOL_IS_LF is not set
|
||||
# CONFIG_EOL_IS_BOTH_CRLF is not set
|
||||
CONFIG_EOL_IS_EITHER_CRLF=y
|
||||
# CONFIG_LIBC_EXECFUNCS is not set
|
||||
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
|
||||
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
|
||||
# CONFIG_LIBC_STRERROR is not set
|
||||
# CONFIG_LIBC_PERROR_STDOUT is not set
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
# CONFIG_TIME_EXTENDED is not set
|
||||
CONFIG_LIB_SENDFILE_BUFSIZE=512
|
||||
# CONFIG_ARCH_ROMGETC is not set
|
||||
# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
|
||||
|
||||
#
|
||||
# Non-standard Library Support
|
||||
#
|
||||
# CONFIG_LIB_KBDCODEC is not set
|
||||
# CONFIG_LIB_SLCDCODEC is not set
|
||||
|
||||
#
|
||||
# Basic CXX Support
|
||||
#
|
||||
# CONFIG_C99_BOOL8 is not set
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
# CONFIG_CXX_NEWLONG is not set
|
||||
|
||||
#
|
||||
# uClibc++ Standard C++ Library
|
||||
#
|
||||
# CONFIG_UCLIBCXX is not set
|
||||
|
||||
#
|
||||
# Application Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Built-In Applications
|
||||
#
|
||||
CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
||||
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# CONFIG_EXAMPLES_BUTTONS is not set
|
||||
# CONFIG_EXAMPLES_CAN is not set
|
||||
# CONFIG_EXAMPLES_CONFIGDATA is not set
|
||||
# CONFIG_EXAMPLES_CPUHOG is not set
|
||||
# CONFIG_EXAMPLES_CXXTEST is not set
|
||||
# CONFIG_EXAMPLES_DHCPD is not set
|
||||
# CONFIG_EXAMPLES_ELF is not set
|
||||
# CONFIG_EXAMPLES_FTPC is not set
|
||||
# CONFIG_EXAMPLES_FTPD is not set
|
||||
# CONFIG_EXAMPLES_HELLO is not set
|
||||
# CONFIG_EXAMPLES_HELLOXX is not set
|
||||
# CONFIG_EXAMPLES_JSON is not set
|
||||
# CONFIG_EXAMPLES_HIDKBD is not set
|
||||
# CONFIG_EXAMPLES_KEYPADTEST is not set
|
||||
# CONFIG_EXAMPLES_IGMP is not set
|
||||
# CONFIG_EXAMPLES_MM is not set
|
||||
# CONFIG_EXAMPLES_MODBUS is not set
|
||||
# CONFIG_EXAMPLES_MOUNT is not set
|
||||
# CONFIG_EXAMPLES_NRF24L01TERM is not set
|
||||
CONFIG_EXAMPLES_NSH=y
|
||||
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
# CONFIG_EXAMPLES_NULL is not set
|
||||
# CONFIG_EXAMPLES_NX is not set
|
||||
# CONFIG_EXAMPLES_NXTERM is not set
|
||||
# CONFIG_EXAMPLES_NXFFS is not set
|
||||
# CONFIG_EXAMPLES_NXHELLO is not set
|
||||
# CONFIG_EXAMPLES_NXIMAGE is not set
|
||||
# CONFIG_EXAMPLES_NXLINES is not set
|
||||
# CONFIG_EXAMPLES_NXTEXT is not set
|
||||
# CONFIG_EXAMPLES_OSTEST is not set
|
||||
# CONFIG_EXAMPLES_PIPE is not set
|
||||
# CONFIG_EXAMPLES_PPPD is not set
|
||||
# CONFIG_EXAMPLES_POSIXSPAWN is not set
|
||||
# CONFIG_EXAMPLES_QENCODER is not set
|
||||
# CONFIG_EXAMPLES_RGMP is not set
|
||||
# CONFIG_EXAMPLES_SENDMAIL is not set
|
||||
# CONFIG_EXAMPLES_SERIALBLASTER is not set
|
||||
# CONFIG_EXAMPLES_SERIALRX is not set
|
||||
# CONFIG_EXAMPLES_SERLOOP is not set
|
||||
# CONFIG_EXAMPLES_SLCD is not set
|
||||
# CONFIG_EXAMPLES_SMART_TEST is not set
|
||||
# CONFIG_EXAMPLES_SMART is not set
|
||||
# CONFIG_EXAMPLES_TCPECHO is not set
|
||||
# CONFIG_EXAMPLES_TELNETD is not set
|
||||
# CONFIG_EXAMPLES_TIFF is not set
|
||||
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
|
||||
# CONFIG_EXAMPLES_WEBSERVER is not set
|
||||
# CONFIG_EXAMPLES_USBSERIAL is not set
|
||||
# CONFIG_EXAMPLES_USBTERM is not set
|
||||
# CONFIG_EXAMPLES_WATCHDOG is not set
|
||||
|
||||
#
|
||||
# Graphics Support
|
||||
#
|
||||
# CONFIG_TIFF is not set
|
||||
# CONFIG_GRAPHICS_TRAVELER is not set
|
||||
|
||||
#
|
||||
# Interpreters
|
||||
#
|
||||
# CONFIG_INTERPRETERS_FICL is not set
|
||||
# CONFIG_INTERPRETERS_PCODE is not set
|
||||
# CONFIG_INTERPRETERS_MICROPYTHON is not set
|
||||
|
||||
#
|
||||
# Network Utilities
|
||||
#
|
||||
|
||||
#
|
||||
# Networking Utilities
|
||||
#
|
||||
# CONFIG_NETUTILS_CODECS is not set
|
||||
# CONFIG_NETUTILS_FTPC is not set
|
||||
# CONFIG_NETUTILS_JSON is not set
|
||||
# CONFIG_NETUTILS_SMTP is not set
|
||||
|
||||
#
|
||||
# FreeModBus
|
||||
#
|
||||
# CONFIG_MODBUS is not set
|
||||
|
||||
#
|
||||
# NSH Library
|
||||
#
|
||||
CONFIG_NSH_LIBRARY=y
|
||||
|
||||
#
|
||||
# Command Line Configuration
|
||||
#
|
||||
CONFIG_NSH_READLINE=y
|
||||
# CONFIG_NSH_CLE is not set
|
||||
CONFIG_NSH_LINELEN=64
|
||||
# CONFIG_NSH_DISABLE_SEMICOLON is not set
|
||||
# CONFIG_NSH_CMDPARMS is not set
|
||||
CONFIG_NSH_MAXARGUMENTS=6
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
CONFIG_NSH_NESTDEPTH=3
|
||||
# CONFIG_NSH_DISABLEBG is not set
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
|
||||
#
|
||||
# Disable Individual commands
|
||||
#
|
||||
# CONFIG_NSH_DISABLE_ADDROUTE is not set
|
||||
# CONFIG_NSH_DISABLE_CAT is not set
|
||||
# CONFIG_NSH_DISABLE_CD is not set
|
||||
# CONFIG_NSH_DISABLE_CP is not set
|
||||
# CONFIG_NSH_DISABLE_CMP is not set
|
||||
CONFIG_NSH_DISABLE_DATE=y
|
||||
# CONFIG_NSH_DISABLE_DD is not set
|
||||
CONFIG_NSH_DISABLE_DF=y
|
||||
# CONFIG_NSH_DISABLE_DELROUTE is not set
|
||||
# CONFIG_NSH_DISABLE_ECHO is not set
|
||||
# CONFIG_NSH_DISABLE_EXEC is not set
|
||||
# CONFIG_NSH_DISABLE_EXIT is not set
|
||||
# CONFIG_NSH_DISABLE_FREE is not set
|
||||
# CONFIG_NSH_DISABLE_GET is not set
|
||||
# CONFIG_NSH_DISABLE_HELP is not set
|
||||
# CONFIG_NSH_DISABLE_HEXDUMP is not set
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_KILL is not set
|
||||
# CONFIG_NSH_DISABLE_LOSETUP is not set
|
||||
# CONFIG_NSH_DISABLE_LS is not set
|
||||
# CONFIG_NSH_DISABLE_MB is not set
|
||||
# CONFIG_NSH_DISABLE_MKDIR is not set
|
||||
# CONFIG_NSH_DISABLE_MKFIFO is not set
|
||||
# CONFIG_NSH_DISABLE_MKRD is not set
|
||||
# CONFIG_NSH_DISABLE_MH is not set
|
||||
# CONFIG_NSH_DISABLE_MOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_MV is not set
|
||||
# CONFIG_NSH_DISABLE_MW is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_NSH_DISABLE_PUT is not set
|
||||
# CONFIG_NSH_DISABLE_PWD is not set
|
||||
# CONFIG_NSH_DISABLE_RM is not set
|
||||
# CONFIG_NSH_DISABLE_RMDIR is not set
|
||||
# CONFIG_NSH_DISABLE_SET is not set
|
||||
# CONFIG_NSH_DISABLE_SH is not set
|
||||
# CONFIG_NSH_DISABLE_SLEEP is not set
|
||||
# CONFIG_NSH_DISABLE_TEST is not set
|
||||
# CONFIG_NSH_DISABLE_UMOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_UNSET is not set
|
||||
# CONFIG_NSH_DISABLE_USLEEP is not set
|
||||
# CONFIG_NSH_DISABLE_WGET is not set
|
||||
# CONFIG_NSH_DISABLE_XD is not set
|
||||
|
||||
#
|
||||
# Configure Command Options
|
||||
#
|
||||
CONFIG_NSH_CODECS_BUFSIZE=128
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
|
||||
#
|
||||
# Scripting Support
|
||||
#
|
||||
# CONFIG_NSH_DISABLESCRIPT is not set
|
||||
# CONFIG_NSH_DISABLE_ITEF is not set
|
||||
# CONFIG_NSH_DISABLE_LOOPS is not set
|
||||
|
||||
#
|
||||
# Console Configuration
|
||||
#
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
# CONFIG_NSH_ALTCONDEV is not set
|
||||
# CONFIG_NSH_ARCHINIT is not set
|
||||
|
||||
#
|
||||
# NxWidgets/NxWM
|
||||
#
|
||||
|
||||
#
|
||||
# Platform-specific Support
|
||||
#
|
||||
# CONFIG_PLATFORM_CONFIGDATA is not set
|
||||
|
||||
#
|
||||
# System Libraries and NSH Add-Ons
|
||||
#
|
||||
# CONFIG_SYSTEM_FREE is not set
|
||||
# CONFIG_SYSTEM_CLE is not set
|
||||
# CONFIG_SYSTEM_CUTERM is not set
|
||||
# CONFIG_SYSTEM_INSTALL is not set
|
||||
# CONFIG_SYSTEM_HEX2BIN is not set
|
||||
# CONFIG_SYSTEM_INIFILE is not set
|
||||
# CONFIG_SYSTEM_RAMTEST is not set
|
||||
CONFIG_SYSTEM_READLINE=y
|
||||
CONFIG_READLINE_ECHO=y
|
||||
# CONFIG_SYSTEM_POWEROFF is not set
|
||||
# CONFIG_SYSTEM_RAMTRON is not set
|
||||
# CONFIG_SYSTEM_SDCARD is not set
|
||||
# CONFIG_SYSTEM_SUDOKU is not set
|
||||
# CONFIG_SYSTEM_SYSINFO is not set
|
||||
# CONFIG_SYSTEM_VI is not set
|
||||
# CONFIG_SYSTEM_ZMODEM is not set
|
76
configs/samd21-xplained/nsh/setenv.sh
Executable file
76
configs/samd21-xplained/nsh/setenv.sh
Executable file
|
@ -0,0 +1,76 @@
|
|||
#!/bin/bash
|
||||
# configs/samd21-xplained/nsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
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"
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/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"
|
||||
|
||||
# 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}"
|
123
configs/samd21-xplained/scripts/flash.ld
Executable file
123
configs/samd21-xplained/scripts/flash.ld
Executable file
|
@ -0,0 +1,123 @@
|
|||
/****************************************************************************
|
||||
* configs/samd21-xplained/scripts/flash.ld
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The ATSAMD21J18A has 256KB of FLASH beginning at address 0x0000:0000 and
|
||||
* 32KB of SRAM beginning at address 0x2000:0000
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
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(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_eronly = LOADADDR(.data);
|
||||
|
||||
.ramfunc ALIGN(4): {
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* 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) }
|
||||
}
|
2
configs/samd21-xplained/src/.gitignore
vendored
Normal file
2
configs/samd21-xplained/src/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/.depend
|
||||
/Make.dep
|
118
configs/samd21-xplained/src/Makefile
Normal file
118
configs/samd21-xplained/src/Makefile
Normal file
|
@ -0,0 +1,118 @@
|
|||
############################################################################
|
||||
# configs/samd21-xplained/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-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_SAMDL_SERCOM0),y)
|
||||
CSRCS += sam_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += sam_autoleds.c
|
||||
else
|
||||
CSRCS += sam_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += sam_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||
CSRCS += sam_nsh.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMD21_XPLAINED_IOMODULE),y)
|
||||
CSRCS += sam_mmcsd.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMD21_XPLAINED_OLED1MODULE),y)
|
||||
ifeq ($(CONFIG_LCD_UG2832HSWEG04),y)
|
||||
CSRCS += sam_ug2832hsweg04.c
|
||||
endif
|
||||
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
|
178
configs/samd21-xplained/src/sam_autoleds.c
Normal file
178
configs/samd21-xplained/src/sam_autoleds.c
Normal file
|
@ -0,0 +1,178 @@
|
|||
/****************************************************************************
|
||||
* configs/samd21-xplained/src/sam_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
|
||||
* controls two of the LEDs, a power LED and a status LED. There is only
|
||||
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21 USB
|
||||
* connector.
|
||||
*
|
||||
* This LED is controlled by PB30 and the LED can be activated by driving PB30
|
||||
* to GND.
|
||||
*
|
||||
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
|
||||
* control the LED as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED
|
||||
* ------------------- ----------------------- ------
|
||||
* LED_STARTED NuttX has been started OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF
|
||||
* LED_STACKCREATED Idle stack created ON
|
||||
* LED_INIRQ In an interrupt** N/C
|
||||
* LED_SIGNAL In a signal handler*** N/C
|
||||
* LED_ASSERTION An assertion failed N/C
|
||||
* LED_PANIC The system has crashed FLASH
|
||||
*
|
||||
* Thus if the LED is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normally. If the LED is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "sam_port.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_led_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_led_initialize(void)
|
||||
{
|
||||
(void)sam_configport(PORT_STATUS_LED);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_led_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_led_on(int led)
|
||||
{
|
||||
bool ledstate = true;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
|
||||
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
|
||||
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
|
||||
break; /* Leave ledstate == true to turn OFF */
|
||||
|
||||
default:
|
||||
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
|
||||
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
|
||||
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
|
||||
return; /* Return to leave STATUS LED unchanged */
|
||||
|
||||
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
|
||||
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
|
||||
ledstate = false; /* Set ledstate == false to turn ON */
|
||||
break;
|
||||
}
|
||||
|
||||
sam_portwrite(PORT_STATUS_LED, ledstate);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_led_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_led_off(int led)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
/* These should not happen and are ignored */
|
||||
|
||||
default:
|
||||
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
|
||||
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
|
||||
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
|
||||
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
|
||||
|
||||
/* These result in no-change */
|
||||
|
||||
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
|
||||
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
|
||||
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
|
||||
return; /* Return to leave STATUS LED unchanged */
|
||||
|
||||
/* Turn STATUS LED off set driving the output high */
|
||||
|
||||
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
|
||||
sam_portwrite(PORT_STATUS_LED, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
89
configs/samd21-xplained/src/sam_boot.c
Normal file
89
configs/samd21-xplained/src/sam_boot.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
/************************************************************************************
|
||||
* configs/samd21-xplained/src/sam_boot.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "sam_config.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All SAM3U architectures must provide the following entry point. This entry point
|
||||
* is called early in the initialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void sam_boardinitialize(void)
|
||||
{
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
|
||||
* sam_spiinitialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI
|
||||
if (sam_spiinitialize)
|
||||
{
|
||||
sam_spiinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
board_led_initialize();
|
||||
#endif
|
||||
}
|
160
configs/samd21-xplained/src/sam_buttons.c
Normal file
160
configs/samd21-xplained/src/sam_buttons.c
Normal file
|
@ -0,0 +1,160 @@
|
|||
/****************************************************************************
|
||||
* configs/samd21-xplained/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "sam_port.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqsw0;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
(void)sam_configport(PORT_SW0);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_buttons
|
||||
*
|
||||
* Description:
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to collect
|
||||
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
|
||||
* associated with a button. See the BUTTON* definitions above for the meaning of
|
||||
* each bit in the returned value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
{
|
||||
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_irq
|
||||
*
|
||||
* Description:
|
||||
* This function may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is one
|
||||
* of the BUTTON* definitions provided above. The previous interrupt
|
||||
* handler address isreturned (so that it may restored, if so desired).
|
||||
*
|
||||
* Configuration Notes:
|
||||
* Configuration CONFIG_AVR32_PORTIRQ must be selected to enable the
|
||||
* overall PORT IRQ feature and CONFIG_AVR32_PORTIRQSETA and/or
|
||||
* CONFIG_AVR32_PORTIRQSETB must be enabled to select PORTs to support
|
||||
* interrupts on. For button support, bits 2 and 3 must be set in
|
||||
* CONFIG_AVR32_PORTIRQSETB (PB2 and PB3).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the
|
||||
* following operations are atomic.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *g_irqsw0;
|
||||
*g_irqsw0 = irqhandler;
|
||||
|
||||
/* Configure the interrupt */
|
||||
|
||||
sam_portirq(IRQ_SW0);
|
||||
(void)irq_attach(IRQ_SW0, irqhandler);
|
||||
sam_portirqenable(IRQ_SW0);
|
||||
irqrestore(flags);
|
||||
}
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
150
configs/samd21-xplained/src/sam_cxxinitialize.c
Normal file
150
configs/samd21-xplained/src/sam_cxxinitialize.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/************************************************************************************
|
||||
* configs/samd21-xplained/src/sam_cxxinitialize.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor 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 */
|
125
configs/samd21-xplained/src/sam_mmcsd.c
Normal file
125
configs/samd21-xplained/src/sam_mmcsd.c
Normal file
|
@ -0,0 +1,125 @@
|
|||
/****************************************************************************
|
||||
* config/samd21-xplained/src/sam_mmcsd.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
#include "sam_config.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_MOUNTPOINT
|
||||
# error Mountpoints are disabled (CONFIG_DISABLE_MOUNTPOINT=y)
|
||||
#endif
|
||||
|
||||
#ifndef SAMDL_HAVE_SPI0
|
||||
# error SERCOM0 SPI support is required
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MMCSD
|
||||
# error MMC/SD support is required (CONFIG_MMCSD)
|
||||
#endif
|
||||
|
||||
#define SAMDL_MMCSDSLOTNO 0 /* There is only one slot */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_sdinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the SPI-based SD card. Requires
|
||||
* - CONFIG_SAMD21_XPLAINED_IOMODULE=y,
|
||||
* - CONFIG_DISABLE_MOUNTPOINT=n,
|
||||
* - CONFIG_MMCSD=y, and
|
||||
* - SAMDL_HAVE_SPI0=y (CONFIG_SAMDL_SERCOM0 && CONFIG_SAMDL_SERCOM0_ISSPI)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
int sam_sdinitialize(int port, int minor)
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* Get the SPI driver instance for the SD chip select */
|
||||
|
||||
fvdbg("Initializing SERCOM SPI%d\n", port);
|
||||
|
||||
spi = up_spiinitialize(port);
|
||||
if (!spi)
|
||||
{
|
||||
fdbg("Failed to initialize SPI%d\n", port);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
fvdbg("Successfully initialized SPI%d\n", port);
|
||||
|
||||
/* Bind the SPI device for the chip select to the slot */
|
||||
|
||||
fvdbg("Binding SPI%d to MMC/SD slot %d\n", port, SAMDL_MMCSDSLOTNO);
|
||||
|
||||
ret = mmcsd_spislotinitialize(minor, SAMDL_MMCSDSLOTNO, spi);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Failed to bind SPI%d to MMC/SD slot %d: %d\n",
|
||||
port, SAMDL_MMCSDSLOTNO, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
fvdbg("Successfuly bound SPI%d to MMC/SD slot %d\n",
|
||||
port, SAMDL_MMCSDSLOTNO);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SAMD21_XPLAINED_IOMODULE */
|
125
configs/samd21-xplained/src/sam_nsh.c
Normal file
125
configs/samd21-xplained/src/sam_nsh.c
Normal file
|
@ -0,0 +1,125 @@
|
|||
/****************************************************************************
|
||||
* config/samd21-xplained/src/sam_nsh.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "sam_config.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Some configuration checks */
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
|
||||
# ifndef SAMDL_HAVE_SPI0
|
||||
# error I/O1 module on EXT1 requires SERCOM SPI0
|
||||
# undef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
# endif
|
||||
# define SPI_PORTNO 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
|
||||
# ifndef SAMDL_HAVE_SPI1
|
||||
# error I/O1 module on EXT2 requires SERCOM SPI1
|
||||
# undef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
# endif
|
||||
# define SPI_PORTNO 1
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
/* Support for the SD card slot on the I/O1 module */
|
||||
/* Verify NSH PORT and SLOT settings */
|
||||
|
||||
# define SAMDL_MMCSDSLOTNO 0 /* There is only one slot */
|
||||
|
||||
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMDL_MMCSDSLOTNO
|
||||
# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO)
|
||||
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||
# define CONFIG_NSH_MMCSDSLOTNO SAMDL_MMCSDSLOTNO
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO
|
||||
# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO
|
||||
# undef CONFIG_NSH_MMCSDSPIPORTNO
|
||||
# define CONFIG_NSH_MMCSDSPIPORTNO SPI_PORTNO
|
||||
# endif
|
||||
|
||||
/* Default MMC/SD minor number */
|
||||
|
||||
# ifndef CONFIG_NSH_MMCSDMINOR
|
||||
# define CONFIG_NSH_MMCSDMINOR 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(void)
|
||||
{
|
||||
#if defined(SAMDL_HAVE_SPI0) && defined(CONFIG_SAMD21_XPLAINED_IOMODULE)
|
||||
/* Initialize the SPI-based MMC/SD slot */
|
||||
|
||||
{
|
||||
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
452
configs/samd21-xplained/src/sam_spi.c
Normal file
452
configs/samd21-xplained/src/sam_spi.c
Normal file
|
@ -0,0 +1,452 @@
|
|||
/****************************************************************************
|
||||
* configs/samd21-xplained/src/sam_spi.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include "sam_config.h"
|
||||
#include "sam_port.h"
|
||||
#include "sam_spi.h"
|
||||
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAMD21_XPLAINED_IOMODULE) && \
|
||||
defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE) && defined(CONFIG_SPI_OWNBUS)
|
||||
# error CONFIG_SPI_OWNBUS must not defined if using both I/O1 and OLED1 modules
|
||||
#endif
|
||||
|
||||
/* Enables debug output from this file (needs CONFIG_DEBUG too) */
|
||||
|
||||
#undef SPI_DEBUG /* Define to enable debug */
|
||||
#undef SPI_VERBOSE /* Define to enable verbose debug */
|
||||
|
||||
#ifdef SPI_DEBUG
|
||||
# define spidbg lldbg
|
||||
# ifdef SPI_VERBOSE
|
||||
# define spivdbg lldbg
|
||||
# else
|
||||
# define spivdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# undef SPI_VERBOSE
|
||||
# define spidbg(x...)
|
||||
# define spivdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_spiinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select PORT pins for the SAMD21 Xplained
|
||||
* Pro board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void weak_function sam_spiinitialize(void)
|
||||
{
|
||||
/* The I/O module containing the SD connector may or may not be installed. And, if
|
||||
* it is installed, it may be in connector EXT1 or EXT2.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
/* TODO: enable interrupt on card detect */
|
||||
|
||||
sam_configport(PORT_SD_CD); /* Card detect input */
|
||||
sam_configport(PORT_SD_CS); /* Chip select output */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE
|
||||
sam_configport(PORT_OLED_DATA); /* Command/data */
|
||||
sam_configport(PORT_OLED_CS); /* Card detect input */
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_spi[n]select, sam_spi[n]status, and sam_spi[n]cmddata
|
||||
*
|
||||
* Description:
|
||||
* These external functions must be provided by board-specific logic. They
|
||||
* include:
|
||||
*
|
||||
* o sam_spi[n]select is a functions to manage the board-specific chip
|
||||
* selects
|
||||
* o sam_spi[n]status and sam_spi[n]cmddata: Implementations of the status
|
||||
* and cmddata methods of the SPI interface defined by struct spi_ops_
|
||||
* (see include/nuttx/spi/spi.h). All other methods including
|
||||
* up_spiinitialize()) are provided by common SAMD/L logic.
|
||||
*
|
||||
* Where [n] is the SERCOM number for the SPI module.
|
||||
*
|
||||
* To use this common SPI logic on your board:
|
||||
*
|
||||
* 1. Provide logic in sam_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide sam_spi[n]select() and sam_spi[n]status() functions in your
|
||||
* board-specific logic. These functions will perform chip selection
|
||||
* and status operations using GPIOs in the way your board is configured.
|
||||
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
|
||||
* sam_spi[n]cmddata() functions in your board-specific logic. This
|
||||
* function 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
|
||||
* 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).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_spi[n]select
|
||||
*
|
||||
* Description:
|
||||
* PIO chip select pins may be programmed by the board specific logic in
|
||||
* one of two different ways. First, the pins may be programmed as SPI
|
||||
* peripherals. In that case, the pins are completely controlled by the
|
||||
* SPI driver. This method still needs to be provided, but it may be only
|
||||
* a stub.
|
||||
*
|
||||
* An alternative way to program the PIO chip select pins is as a normal
|
||||
* GPIO output. In that case, the automatic control of the CS pins is
|
||||
* bypassed and this function must provide control of the chip select.
|
||||
* NOTE: In this case, the GPIO output pin does *not* have to be the
|
||||
* same as the NPCS pin normal associated with the chip select number.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - SPI device info
|
||||
* devid - Identifies the (logical) device
|
||||
* selected - TRUE:Select the device, FALSE:De-select the device
|
||||
*
|
||||
* Returned Values:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI0
|
||||
void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected)
|
||||
{
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
|
||||
/* Select/de-select the SD card */
|
||||
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Active low */
|
||||
|
||||
sam_portwrite(PORT_SD_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
|
||||
/* Select/de-select the OLED */
|
||||
|
||||
if (devid == SPIDEV_DISPLAY)
|
||||
{
|
||||
/* Active low */
|
||||
|
||||
sam_portwrite(PORT_OLED_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI1
|
||||
void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected)
|
||||
{
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
|
||||
/* Select/de-select the SD card */
|
||||
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Active low */
|
||||
|
||||
sam_portwrite(PORT_SD_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
|
||||
/* Select/de-select the OLED */
|
||||
|
||||
if (devid == SPIDEV_DISPLAY)
|
||||
{
|
||||
/* Active low */
|
||||
|
||||
sam_portwrite(PORT_OLED_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI2
|
||||
void sam_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI3
|
||||
void sam_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI4
|
||||
void sam_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI5
|
||||
void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
bool selected)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_spi[n]status
|
||||
*
|
||||
* Description:
|
||||
* Return status information associated with the SPI device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - SPI device info
|
||||
* devid - Identifies the (logical) device
|
||||
*
|
||||
* Returned Values:
|
||||
* Bit-encoded SPI status (see include/nuttx/spi/spi.h.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI0
|
||||
uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
|
||||
/* Check if an SD card is present in the microSD slot */
|
||||
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Active low */
|
||||
|
||||
if (!sam_portread(PORT_SD_CD))
|
||||
{
|
||||
ret |= SPI_STATUS_PRESENT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI1
|
||||
uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
|
||||
/* Check if an SD card is present in the microSD slot */
|
||||
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Active low */
|
||||
|
||||
if (!sam_portread(PORT_SD_CD))
|
||||
{
|
||||
ret |= SPI_STATUS_PRESENT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI2
|
||||
uint8_t sam_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI3
|
||||
uint8_t sam_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI4
|
||||
uint8_t sam_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI5
|
||||
uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_spi[n]cmddata
|
||||
*
|
||||
* Description:
|
||||
* Some SPI devices require an additional control to determine if the SPI
|
||||
* data being sent is a command or is data. If CONFIG_SPI_CMDDATA then
|
||||
* this function will be called to different be command and data transfers.
|
||||
*
|
||||
* This is often needed, for example, by LCD drivers. Some LCD hardware
|
||||
* may be configured to use 9-bit data transfers with the 9th bit
|
||||
* indicating command or data. That same hardware may be configurable,
|
||||
* instead, to use 8-bit data but to require an additional, board-
|
||||
* specific GPIO control to distinguish command and data. This function
|
||||
* would be needed in that latter case.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - SPI device info
|
||||
* devid - Identifies the (logical) device
|
||||
*
|
||||
* Returned Values:
|
||||
* Zero on success; a negated errno on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
#ifdef SAMDL_HAVE_SPI0
|
||||
int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
|
||||
if (devid == SPIDEV_DISPLAY)
|
||||
{
|
||||
/* This is the Data/Command control pad which determines whether the
|
||||
* data bits are data or a command.
|
||||
*
|
||||
* High: the inputs are treated as display data.
|
||||
* Low: the inputs are transferred to the command registers.
|
||||
*/
|
||||
|
||||
(void)sam_portwrite(PORT_OLED_DATA, !cmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI1
|
||||
int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
|
||||
if (devid == SPIDEV_DISPLAY)
|
||||
{
|
||||
/* This is the Data/Command control pad which determines whether the
|
||||
* data bits are data or a command.
|
||||
*
|
||||
* High: the inputs are treated as display data.
|
||||
* Low: the inputs are transferred to the command registers.
|
||||
*/
|
||||
|
||||
(void)sam_portwrite(PORT_OLED_DATA, !cmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI2
|
||||
int sam_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI3
|
||||
int sam_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI4
|
||||
int sam_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SAMDL_HAVE_SPI5
|
||||
int sam_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SPI_CMDDATA */
|
||||
#endif /* SAMDL_HAVE_SPI */
|
212
configs/samd21-xplained/src/sam_ug2832hsweg04.c
Normal file
212
configs/samd21-xplained/src/sam_ug2832hsweg04.c
Normal file
|
@ -0,0 +1,212 @@
|
|||
/****************************************************************************
|
||||
* config/samd21-xplained/src/sam_ug2832hsweg04.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* OLED1 Connector:
|
||||
*
|
||||
* OLED1 CONNECTOR
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* OLED1 EXT1 EXT2
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 1 ID 1 1
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 2 GND 2 GND 2 GND
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 3 BUTTON2 3 PB00 AIN[8] 3 PA10 AIN[18]
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 4 BUTTON3 4 PB01 AIN[9] 4 PA11 AIN[19]
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 5 DATA_CMD_SEL 5 PB06 PORT 5 PA20 PORT
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 6 LED3 6 PB07 PORT 6 PA21 PORT
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 7 LED1 7 PB02 TC6/WO[0] 7 PB12 TC4/WO[0]
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 8 LED2 8 PB03 TC6/WO[1] 8 PB13 TC4/WO[1]
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 9 BUTTON1 9 PB04 EXTINT[4] 9 PB14 EXTINT[14]
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 10 DISPLAY_RESET 10 PB05 PORT 10 PB15 PORT
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 11 N/C 11 PA08 SERCOM2 PAD[0] 11 PA08 SERCOM2 PAD[0]
|
||||
* I²C SDA I²C SDA
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 12 N/C 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1]
|
||||
* I²C SCL I²C SCL
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 13 N/C 13 PB09 SERCOM4 PAD[1] 13 PB11 SERCOM4 PAD[1]
|
||||
* USART RX USART RX
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 14 N/C 14 PB08 SERCOM4 PAD[0] 14 PB10 SERCOM4 PAD[0]
|
||||
* USART TX USART TX
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1]
|
||||
* SPI SS SPI SS
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PA18 SERCOM1 PAD[2]
|
||||
* SPI MOSI SPI MOSI
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 17 N/C 17 PA04 SERCOM0 PAD[0] 17 PA16 SERCOM1 PAD[0]
|
||||
* SPI MISO SPI MISO
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PA19 SERCOM1 PAD[3]
|
||||
* SPI SCK SPI SCK
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 19 GND 19 GND GND
|
||||
* ----------------- ---------------------- ----------------------
|
||||
* 20 VCC 20 VCC VCC
|
||||
* ----------------- ---------------------- ----------------------
|
||||
*
|
||||
* OLED1 signals
|
||||
*
|
||||
* DATA_CMD_SEL - Data/command select. Used to choose whether the
|
||||
* communication is data to the display memory or a command to the LCD
|
||||
* controller. High = data, low = command
|
||||
* DISPLAY_RESET - Reset signal to the OLED display, active low. Used during
|
||||
* initialization of the display.
|
||||
* DISPLAY_SS - SPI slave select signal, must be held low during SPI
|
||||
* communication.
|
||||
* SPI_MOSI - SPI master out, slave in signal. Used to write data to the
|
||||
* display
|
||||
* SPI_SCK SPI - clock signal, generated by the master.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/lcd/lcd.h>
|
||||
#include <nuttx/lcd/ssd1306.h>
|
||||
|
||||
#include "sam_port.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
/* The pin configurations here require that SPI1 is selected */
|
||||
|
||||
#ifndef CONFIG_LCD_SSD1306
|
||||
# error "The OLED driver requires CONFIG_LCD_SSD1306 in the configuration"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LCD_UG2832HSWEG04
|
||||
# error "The OLED driver requires CONFIG_LCD_UG2832HSWEG04 in the configuration"
|
||||
#endif
|
||||
|
||||
#ifndef SAMDL_HAVE_SPI0
|
||||
# error "The OLED driver requires SAMDL_HAVE_SPI0 in the configuration"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SPI_CMDDATA
|
||||
# error "The OLED driver requires CONFIG_SPI_CMDDATA in the configuration"
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
# define lcddbg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define lcdvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define lcddbg(x...)
|
||||
# define lcdvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_graphics_setup
|
||||
*
|
||||
* Description:
|
||||
* Called by NX initialization logic to configure the OLED.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct lcd_dev_s *dev;
|
||||
|
||||
/* Configure the OLED PORTs. This initial configuration is RESET low,
|
||||
* putting the OLED into reset state.
|
||||
*/
|
||||
|
||||
(void)sam_configport(PORT_OLED_RST);
|
||||
|
||||
/* Wait a bit then release the OLED from the reset state */
|
||||
|
||||
up_mdelay(20);
|
||||
sam_portwrite(PORT_OLED_RST, true);
|
||||
|
||||
/* Get the SPI1 port interface */
|
||||
|
||||
spi = up_spiinitialize(OLED_CSNO);
|
||||
if (!spi)
|
||||
{
|
||||
lcddbg("Failed to initialize SPI port 1\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bind the SPI port to the OLED */
|
||||
|
||||
dev = ssd1306_initialize(spi, devno);
|
||||
if (!dev)
|
||||
{
|
||||
lcddbg("Failed to bind SPI port 1 to OLED %d: %d\n", devno);
|
||||
}
|
||||
else
|
||||
{
|
||||
lcdvdbg("Bound SPI port 1 to OLED %d\n", devno);
|
||||
|
||||
/* And turn the OLED on */
|
||||
|
||||
(void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_SAMD21_XPLAINED_OLED1MODULE */
|
142
configs/samd21-xplained/src/sam_userleds.c
Normal file
142
configs/samd21-xplained/src/sam_userleds.c
Normal file
|
@ -0,0 +1,142 @@
|
|||
/****************************************************************************
|
||||
* configs/samd21-xplained/src/sam_userleds.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
|
||||
* controls two of the LEDs, a power LED and a status LED. There is only
|
||||
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21 USB
|
||||
* connector.
|
||||
*
|
||||
* This LED is controlled by PB30 and the LED can be activated by driving PB30
|
||||
* to GND.
|
||||
*
|
||||
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
|
||||
* control the LED. Otherwise, the LED can be controlled from user applications
|
||||
* using the logic in this file.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "sam_port.h"
|
||||
#include "samd21-xplained.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_ledinit
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
||||
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the sam_ledinit() is
|
||||
* available to initialize the LED from user application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sam_ledinit(void)
|
||||
{
|
||||
(void)sam_configport(PORT_STATUS_LED);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_setled
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
||||
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the sam_setled() is
|
||||
* available to control the LED from user application logic.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void sam_setled(int led, bool ledon)
|
||||
{
|
||||
if (led == BOARD_STATUS_LED)
|
||||
{
|
||||
sam_portwrite(PORT_STATUS_LED, !ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_setled
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
||||
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the sam_setleds() is
|
||||
* available to control the LED from user application logic. NOTE: since
|
||||
* there is only a single LED on-board, this is function is not very useful.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void sam_setleds(uint8_t ledset)
|
||||
{
|
||||
sam_setled(BOARD_STATUS_LED, (ledset & BOARD_STATUS_LED_BIT) != 0);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
264
configs/samd21-xplained/src/samd21-xplained.h
Normal file
264
configs/samd21-xplained/src/samd21-xplained.h
Normal file
|
@ -0,0 +1,264 @@
|
|||
/************************************************************************************
|
||||
* configs/samd21-xplained/src/samd21-xplained.h
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H
|
||||
#define __CONFIGS_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "sam_config.h"
|
||||
#include "sam_pinmap.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* LEDs: There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
|
||||
* controls two of the LEDs, a power LED and a status LED. There is only
|
||||
* one user controllable LED, a yellow LED labelled STATIS near the SAMD21 USB
|
||||
* connector.
|
||||
*
|
||||
* This LED is controlled by PB30 and the LED can be activated by driving PB30
|
||||
* to GND.
|
||||
*
|
||||
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
|
||||
* control the LED as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED
|
||||
* ------------------- ----------------------- ------
|
||||
* LED_STARTED NuttX has been started OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF
|
||||
* LED_STACKCREATED Idle stack created ON
|
||||
* LED_INIRQ In an interrupt N/C
|
||||
* LED_SIGNAL In a signal handler N/C
|
||||
* LED_ASSERTION An assertion failed N/C
|
||||
* LED_PANIC The system has crashed FLASH
|
||||
*
|
||||
* Thus if the LED is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normally. If the LED is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
*/
|
||||
|
||||
#define PORT_STATUS_LED (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTB | PORT_PIN30)
|
||||
|
||||
/* Mechanical buttons:
|
||||
*
|
||||
* The SAMD21 Xplained Pro contains two mechanical buttons. One button is the
|
||||
* RESET button connected to the SAMD21 reset line and the other is a generic user
|
||||
* configurable button. When a button is pressed it will drive the I/O line to GND.
|
||||
*
|
||||
* PA15 SW0
|
||||
*/
|
||||
|
||||
#define PORT_SW0 (PORT_INTERRUPT | PORT_PULL_UP | PORTA | PORT_PIN15)
|
||||
#define IRQ_SW0 SAM_IRQ_PA15
|
||||
|
||||
/* I/O1
|
||||
*
|
||||
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
|
||||
* SPI support and two PORTs. These the PORTs will vary if the I/O1
|
||||
* is installed on the EXT1 or EXT2 connector:
|
||||
*
|
||||
* --- ------------------ ---------------------- -------------------------------
|
||||
* PIN EXT1 EXT2 Description
|
||||
* --- ------------------ ---------------------- -------------------------------
|
||||
* 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT,
|
||||
* SPI SS SPI SS pulled high on board.
|
||||
* --- ------------------ ---------------------- -------------------------------
|
||||
* 10 PB05 PORT 10 PB15 PORT Active low card detect INPUT,
|
||||
* must use internal pull-up.
|
||||
* --- ------------------ ---------------------- -------------------------------
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
|
||||
# ifndef SAMDL_HAVE_SPI0
|
||||
# error SAMDL_HAVE_SPI0 is required to use the I/O1 module
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1)
|
||||
|
||||
# if defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE) && \
|
||||
defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1)
|
||||
# error I/O1 and OLED1 modules cannot both reside in EXT1
|
||||
# endif
|
||||
|
||||
# define PORT_SD_CD (PORT_INTERRUPT | PORT_INT_CHANGE | PORT_PULL_UP | \
|
||||
PORTB | PORT_PIN5)
|
||||
|
||||
# define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTA | PORT_PIN5)
|
||||
|
||||
# elif defined(CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2)
|
||||
|
||||
# if defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE) && \
|
||||
defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2)
|
||||
# error I/O1 and OLED1 modules cannot both reside in EXT2
|
||||
# endif
|
||||
|
||||
# define PORT_SD_CD (PORT_INTERRUPT | PORT_INT_CHANGE | PORT_PULL_UP | \
|
||||
PORTB | PORT_PIN15)
|
||||
|
||||
# define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTA | PORT_PIN17)
|
||||
|
||||
# else
|
||||
# error Which connector is the I/O1 module installed in?
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OLED1
|
||||
*
|
||||
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
|
||||
* SPI support and three output PORTs. These the PORTs will vary if the OLED1
|
||||
* is installed on the EXT1 or EXT2 connector:
|
||||
*
|
||||
*
|
||||
* PIN EXT1 EXT2 Description
|
||||
* --- ------------------- -------------------- -------------------------------------
|
||||
* 5 PB06 PORT PA20 PORT DATA_CMD_SEL
|
||||
* 10 PB05 PORT PB15 PORT DISPLAY_RESET. Active low.
|
||||
* 15 PA05 SERCOM0 PAD[1] PA17 SERCOM1 PAD[1] DISPLAY_SS. Active low.
|
||||
* SPI SS SPI SS
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE
|
||||
|
||||
# ifndef SAMDL_HAVE_SPI0
|
||||
# error SAMDL_HAVE_SPI0 is required to use the OLED1 module
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_SPI_CMDDATA
|
||||
# error CONFIG_SPI_CMDDATA is required to use the OLED1 module
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_LCD_SSD1306
|
||||
# error CONFIG_LCD_SSD1306 is required to use the OLED1 module
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_LCD_UG2832HSWEG04
|
||||
# error CONFIG_LCD_UG2832HSWEG04 is required to use the OLED1 module
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1)
|
||||
|
||||
# if defined(CONFIG_SAMD21_XPLAINED_IOMODULE) && \
|
||||
defined(CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1)
|
||||
# error OLED1 and I/O1 modules cannot both reside in EXT1
|
||||
# endif
|
||||
|
||||
# define PORT_OLED_DATA (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
|
||||
PORTB | PORT_PIN6)
|
||||
# define PORT_OLED_RST (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
|
||||
PORTB | PORT_PIN5)
|
||||
# define PORT_OLED_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTA | PORT_PIN5)
|
||||
|
||||
# elif defined(CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2)
|
||||
|
||||
# if defined(CONFIG_SAMD21_XPLAINED_IOMODULE) && \
|
||||
defined(CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2)
|
||||
# error OLED1 and I/O1 modules cannot both reside in EXT2
|
||||
# endif
|
||||
|
||||
# define PORT_OLED_DATA (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
|
||||
PORTA | PORT_PIN20)
|
||||
# define PORT_OLED_RST (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
|
||||
PORTB | PORT_PIN15)
|
||||
# define PORT_OLED_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTA | PORT_PIN17)
|
||||
|
||||
# else
|
||||
# error Which connector is the OLED1 module installed in?
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
|
||||
# define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTB | PORT_PIN11) /* REVISIT */
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_spiinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select PORT pins for the SAM3U-EK board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function sam_spiinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_sdinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the SPI-based SD card. Requires CONFIG_SAMD21_XPLAINED_IOMODULE=y,
|
||||
* CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and the appropriate SERCOM SPI
|
||||
* port enabled.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
|
||||
int sam_sdinitialize(int port, int minor);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H */
|
||||
|
|
@ -46,6 +46,7 @@ Modules
|
|||
2) OLED1 - An OLED plus 3 additional switches and 3 additional LEDs
|
||||
3) PROTO1 - A prototyping board with logic on board (other than power-
|
||||
related logic).
|
||||
4) And others. See http://www.atmel.com/products/microcontrollers/avr/xplained.aspx
|
||||
|
||||
Some of these are discussed further below.
|
||||
|
||||
|
@ -590,28 +591,30 @@ SAML21 Xplained Pro-specific Configuration Options
|
|||
|
||||
Individual subsystems can be enabled:
|
||||
|
||||
CONFIG_SAMDL_WDT - Watchdog Timer"
|
||||
CONFIG_SAMDL_RTC - Real Time Counter"
|
||||
CONFIG_SAMDL_NVMCTRL - Non-Volatile Memory Controller"
|
||||
CONFIG_SAMDL_EVSYS - Event System"
|
||||
CONFIG_SAMDL_SERCOM0 - Serial Communication Interface 0"
|
||||
CONFIG_SAMDL_SERCOM1 - Serial Communication Interface 1"
|
||||
CONFIG_SAMDL_SERCOM2 - Serial Communication Interface 2"
|
||||
CONFIG_SAMDL_SERCOM3 - Serial Communication Interface 3"
|
||||
CONFIG_SAMDL_SERCOM4 - Serial Communication Interface 4"
|
||||
CONFIG_SAMDL_SERCOM5 - Serial Communication Interface 5"
|
||||
CONFIG_SAMDL_TC0 - Timer/Counter 0"
|
||||
CONFIG_SAMDL_TC1 - Timer/Counter 1"
|
||||
CONFIG_SAMDL_TC2 - Timer/Counter 2"
|
||||
CONFIG_SAMDL_TC3 - Timer/Counter 3"
|
||||
CONFIG_SAMDL_TC4 - Timer/Counter 4"
|
||||
CONFIG_SAMDL_TC5 - Timer/Counter 5"
|
||||
CONFIG_SAMDL_TC6 - Timer/Counter 6"
|
||||
CONFIG_SAMDL_TC7 - Timer/Counter 6"
|
||||
CONFIG_SAMDL_ADC - Analog-to-Digital Converter"
|
||||
CONFIG_SAMDL_AC - Analog Comparator"
|
||||
CONFIG_SAMDL_DAC - Digital-to-Analog Converter"
|
||||
CONFIG_SAMDL_PTC - Peripheral Touch Controller"
|
||||
CONFIG_SAMDL_AC - Analog Comparator
|
||||
CONFIG_SAMDL_ADC - Analog-to-Digital Converter
|
||||
CONFIG_SAMDL_DAC - Digital-to-Analog Converter
|
||||
CONFIG_SAMDL_DMAC - Analog Comparator
|
||||
CONFIG_SAMDL_EVSYS - Event System
|
||||
CONFIG_SAMDL_NVMCTRL - Non-Volatile Memory Controller
|
||||
CONFIG_SAMDL_PTC - Peripheral Touch Controller
|
||||
CONFIG_SAMDL_RTC - Real Time Counter
|
||||
CONFIG_SAMDL_SERCOM0 - Serial Communication Interface 0
|
||||
CONFIG_SAMDL_SERCOM1 - Serial Communication Interface 1
|
||||
CONFIG_SAMDL_SERCOM2 - Serial Communication Interface 2
|
||||
CONFIG_SAMDL_SERCOM3 - Serial Communication Interface 3
|
||||
CONFIG_SAMDL_SERCOM4 - Serial Communication Interface 4
|
||||
CONFIG_SAMDL_SERCOM5 - Serial Communication Interface 5
|
||||
CONFIG_SAMDL_TCC0 - Timer/Counter 0 for Control
|
||||
CONFIG_SAMDL_TCC1 - Timer/Counter 1 for Control
|
||||
CONFIG_SAMDL_TCC2 - Timer/Counter 2 for Control
|
||||
CONFIG_SAMDL_TC3 - Timer/Counter 3
|
||||
CONFIG_SAMDL_TC4 - Timer/Counter 4
|
||||
CONFIG_SAMDL_TC5 - Timer/Counter 5
|
||||
CONFIG_SAMDL_TC6 - Timer/Counter 6
|
||||
CONFIG_SAMDL_TC7 - Timer/Counter 6
|
||||
CONFIG_SAMDL_USB - USB device or host
|
||||
CONFIG_SAMDL_WDT - Watchdog Timer
|
||||
|
||||
Some subsystems can be configured to operate in different ways. The drivers
|
||||
need to know how to configure the subsystem.
|
||||
|
|
Loading…
Reference in a new issue