Author: Gregory Nutt <gnutt@nuttx.org>
Run all .c and .h files in last PR through nxstyle. Author: macman88 <jjlange91@gmail.com> SAME5x Ethernet Support (#25) boards/arm/samd5e5/same54-xplained-pro/: Adds basic support for Microchip SAM E54 Xplained Pro board. arch/arm/src/samd5e5/: Adds an Ethernet driver for the SAME5x family (based on the SAMA5 GMAC driver).
This commit is contained in:
parent
6a3c2aded6
commit
084f81e76e
27 changed files with 7523 additions and 3 deletions
|
@ -76,7 +76,7 @@
|
|||
|
||||
#define SAM_IRQ_EXTINT (16) /* Vector number of the first external interrupt */
|
||||
|
||||
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(ARCH_CHIP_SAME5X)
|
||||
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(CONFIG_ARCH_CHIP_SAME5X)
|
||||
# include <arch/samd5e5/samd5e5_irq.h>
|
||||
#else
|
||||
# error "Unsupported SAMD5/E5 family"
|
||||
|
|
|
@ -361,6 +361,13 @@ config SAMD5E5_DMAC
|
|||
default n
|
||||
select ARCH_DMA
|
||||
|
||||
config SAMD5E5_GMAC
|
||||
bool "Ethernet"
|
||||
default n
|
||||
depends on SAMD5E5_HAVE_ETHERNET
|
||||
select NETDEVICES
|
||||
select ARCH_HAVE_PHY
|
||||
|
||||
config SAMD5E5_EVSYS
|
||||
bool "Event System"
|
||||
default n
|
||||
|
@ -710,3 +717,111 @@ config SAMD5E5_USB_REGDEBUG
|
|||
CONFIG_DEBUG_USB_INFO.
|
||||
|
||||
endmenu # USB options
|
||||
|
||||
|
||||
if SAMD5E5_GMAC
|
||||
|
||||
menu "GMAC device driver options"
|
||||
|
||||
config SAMD5E5_GMAC_NRXBUFFERS
|
||||
int "Number of RX buffers"
|
||||
default 16
|
||||
---help---
|
||||
GMAC buffer memory is segmented into 128 byte units (not
|
||||
configurable). This setting provides the number of such 128 byte
|
||||
units used for reception. This is also equal to the number of RX
|
||||
descriptors that will be allocated The selected value must be an
|
||||
even power of 2.
|
||||
|
||||
config SAMD5E5_GMAC_NTXBUFFERS
|
||||
int "Number of TX buffers"
|
||||
default 8
|
||||
---help---
|
||||
GMAC buffer memory is segmented into full Ethernet packets (size
|
||||
NET_BUFSIZE bytes). This setting provides the number of such packets
|
||||
that can be in flight. This is also equal to the number of TX
|
||||
descriptors that will be allocated.
|
||||
|
||||
config SAMD5E5_GMAC_PREALLOCATE
|
||||
bool "Preallocate buffers"
|
||||
default n
|
||||
---help---
|
||||
Buffer an descriptor many may either be allocated from the memory
|
||||
pool or pre-allocated to lie in .bss. This options selected pre-
|
||||
allocated buffer memory.
|
||||
|
||||
config SAMD5E5_GMAC_NBC
|
||||
bool "Disable Broadcast"
|
||||
default n
|
||||
---help---
|
||||
Select to disable receipt of broadcast packets.
|
||||
|
||||
config SAMD5E5_GMAC_PHYADDR
|
||||
int "PHY address"
|
||||
default 1
|
||||
---help---
|
||||
The 5-bit address of the PHY on the board. Default: 1
|
||||
|
||||
config SAMD5E5_GMAC_PHYINIT
|
||||
bool "Board-specific PHY Initialization"
|
||||
default n
|
||||
---help---
|
||||
Some boards require specialized initialization of the PHY before it can be used.
|
||||
This may include such things as configuring GPIOs, resetting the PHY, etc. If
|
||||
SAMD5E5_GMAC_PHYINIT is defined in the configuration then the board specific logic must
|
||||
provide sam_phyinitialize(); The SAMD5E5 GMAC driver will call this function
|
||||
one time before it first uses the PHY.
|
||||
|
||||
config SAMD5E5_GMAC_AUTONEG
|
||||
bool "Use autonegotiation"
|
||||
default y
|
||||
---help---
|
||||
Use PHY autonegotiation to determine speed and mode
|
||||
|
||||
if !SAMD5E5_GMAC_AUTONEG
|
||||
|
||||
config SAMD5E5_GMAC_ETHFD
|
||||
bool "Full duplex"
|
||||
default n
|
||||
---help---
|
||||
If SAMD5E5_GMAC_AUTONEG is not defined, then this may be defined to
|
||||
select full duplex mode. Default: half-duplex
|
||||
|
||||
choice
|
||||
prompt "GMAC Speed"
|
||||
default SAMD5E5_GMAC_ETH100MBPS
|
||||
---help---
|
||||
If autonegotiation is not used, then you must select the fixed speed
|
||||
of the PHY
|
||||
|
||||
config SAMD5E5_GMAC_ETH10MBPS
|
||||
bool "10 Mbps"
|
||||
---help---
|
||||
If SAMD5E5_GMAC_AUTONEG is not defined, then this may be defined to select 10 MBps
|
||||
speed. Default: 100 Mbps
|
||||
|
||||
config SAMD5E5_GMAC_ETH100MBPS
|
||||
bool "100 Mbps"
|
||||
---help---
|
||||
If SAMD5E5_GMAC_AUTONEG is not defined, then this may be defined to select 100 MBps
|
||||
speed. Default: 100 Mbps
|
||||
|
||||
endchoice # GMAC speed
|
||||
endif # !SAMD5E5_GMAC_AUTONEG
|
||||
|
||||
config SAMD5E5_GMAC_REGDEBUG
|
||||
bool "Register-Level Debug"
|
||||
default n
|
||||
depends on DEBUG_NET_INFO
|
||||
---help---
|
||||
Enable very low-level register access debug. Depends on CONFIG_DEBUG_NET_INFO.
|
||||
|
||||
config SAMD5E5_GMAC_USE_MII
|
||||
bool "Use MII interface for Ethernet"
|
||||
default n
|
||||
---help---
|
||||
If selected, use MII interface to Ethernet PHY. Otherwise, RMII will be used.
|
||||
|
||||
endmenu # GMAC device driver options
|
||||
endif # SAMD5E5_GMAC
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ endif
|
|||
|
||||
ifeq ($(CONFIG_SAMD5E5_GMAC),y)
|
||||
CHIP_CSRCS += sam_gmac.c
|
||||
CHIP_CSRCS += sam_ethernet.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMD5E5_USB),y)
|
||||
|
|
1015
arch/arm/src/samd5e5/hardware/sam_gmac.h
Normal file
1015
arch/arm/src/samd5e5/hardware/sam_gmac.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(ARCH_CHIP_SAME5X)
|
||||
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(CONFIG_ARCH_CHIP_SAME5X)
|
||||
# include "hardware/samd5e5_memorymap.h"
|
||||
#else
|
||||
# error "Unsupported SAMD5/E5 family"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(ARCH_CHIP_SAME5X)
|
||||
#if defined(CONFIG_ARCH_CHIP_SAMD5X) || defined(CONFIG_ARCH_CHIP_SAME5X)
|
||||
# include "hardware/samd5e5_pinmap.h"
|
||||
#else
|
||||
# error "Unsupported SAMD5/E5 family"
|
||||
|
|
124
arch/arm/src/samd5e5/sam_ethernet.c
Normal file
124
arch/arm/src/samd5e5/sam_ethernet.c
Normal file
|
@ -0,0 +1,124 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/samd5e5/sam_ethernet.c
|
||||
*
|
||||
* Copyright (C) 2013-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 "sam_ethernet.h"
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: up_gmac_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the GMAC driver
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMD5E5_GMAC
|
||||
static inline void up_gmac_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Initialize the GMAC driver */
|
||||
|
||||
ret = sam_gmac_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: sam_gmac_initialize failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define up_gmac_initialize()
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: up_netinitialize
|
||||
*
|
||||
* Description:
|
||||
* This is the "standard" network initialization logic called from the
|
||||
* low-level initialization logic in up_initialize.c.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_netinitialize(void)
|
||||
{
|
||||
up_gmac_initialize();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET */
|
149
arch/arm/src/samd5e5/sam_ethernet.h
Normal file
149
arch/arm/src/samd5e5/sam_ethernet.h
Normal file
|
@ -0,0 +1,149 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/samd5e5/sam_ethernet.h
|
||||
*
|
||||
* Copyright (C) 2013-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 __ARCH_ARM_SRC_SAMD5E5_SAM_ETHERNET_H
|
||||
#define __ARCH_ARM_SRC_SAMD5E5_SAM_ETHERNET_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "hardware/sam_gmac.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Understood PHY types */
|
||||
|
||||
#define SAMD5E5_PHY_DM9161 0
|
||||
#define SAMD5E5_PHY_LAN8700 1
|
||||
#define SAMD5E5_PHY_KSZ8051 2
|
||||
#define SAMD5E5_PHY_KSZ8081 3
|
||||
#define SAMD5E5_PHY_KSZ90x1 4
|
||||
|
||||
/* Definitions for use with sam_phy_boardinitialize */
|
||||
|
||||
# if defined(CONFIG_ETH0_PHY_DM9161)
|
||||
# define SAMD5E5_GMAC_PHY_DM9161 1
|
||||
# define SAMD5E5_GMAC_PHY_TYPE SAMD5E5_PHY_DM9161
|
||||
# elif defined(CONFIG_ETH0_PHY_LAN8700)
|
||||
# define SAMD5E5_GMAC_PHY_LAN8700 1
|
||||
# define SAMD5E5_GMAC_PHY_TYPE SAMD5E5_PHY_LAN8700
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ8051)
|
||||
# define SAMD5E5_GMAC_PHY_KSZ8051 1
|
||||
# define SAMD5E5_GMAC_PHY_TYPE SAMD5E5_PHY_KSZ8051
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ8081)
|
||||
# define SAMD5E5_GMAC_PHY_KSZ8081 1
|
||||
# define SAMD5E5_GMAC_PHY_TYPE SAMD5E5_PHY_KSZ8081
|
||||
# elif defined(CONFIG_ETH0_PHY_KSZ90x1)
|
||||
# define SAMD5E5_GMAC_PHY_KSZ90x1 1
|
||||
# define SAMD5E5_GMAC_PHY_TYPE SAMD5E5_PHY_KSZ90x1
|
||||
# else
|
||||
# error ETH0 PHY unrecognized
|
||||
# endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sam_gmac_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the GMAC driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called very early in the initialization sequence.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMD5E5_GMAC
|
||||
int sam_gmac_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sam_phy_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* Some boards require specialized initialization of the PHY before it can
|
||||
* be used. This may include such things as configuring GPIOs, resetting
|
||||
* the PHY, etc. If CONFIG_SAMD5E5_GMAC_PHYINIT is defined in the
|
||||
* configuration then the board specific logic must provide
|
||||
* sam_phyinitialize(); The SAMD5E5 Ethernet driver will call this
|
||||
* function one time before it first uses the PHY.
|
||||
*
|
||||
* Input Parameters:
|
||||
* intf - Always zero for now.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMD5E5_GMAC_PHYINIT
|
||||
int sam_phy_boardinitialize(int intf);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM_SRC_SAMD5E5_SAM_ETHERNET_H */
|
||||
|
3831
arch/arm/src/samd5e5/sam_gmac.c
Normal file
3831
arch/arm/src/samd5e5/sam_gmac.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1336,6 +1336,15 @@ config ARCH_BOARD_SAMD21_XPLAINED
|
|||
This board features the ATSAMD21J18A MCU (Cortex-M0+ with 256KB of FLASH
|
||||
and 32KB of SRAM).
|
||||
|
||||
config ARCH_BOARD_SAME54_XPLAINED_PRO
|
||||
bool "Atmel SAME54-Xplained Pro development board"
|
||||
depends on ARCH_CHIP_SAME54P20
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
The port of NuttX to the Atmel SAME54-Xplained Pro development board.
|
||||
|
||||
config ARCH_BOARD_SAML21_XPLAINED
|
||||
bool "Atmel SAML21-Xplained Pro development board"
|
||||
depends on ARCH_CHIP_SAML21J18
|
||||
|
@ -2129,6 +2138,7 @@ config ARCH_BOARD
|
|||
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 "same54-xplained-pro" if ARCH_BOARD_SAME54_XPLAINED_PRO
|
||||
default "saml21-xplained" if ARCH_BOARD_SAML21_XPLAINED
|
||||
default "sam3u-ek" if ARCH_BOARD_SAM3UEK
|
||||
default "sam4cmp-db" if ARCH_BOARD_SAM4CMP_DB
|
||||
|
@ -2439,6 +2449,9 @@ endif
|
|||
if ARCH_BOARD_SAMD21_XPLAINED
|
||||
source "boards/arm/samd2l2/samd21-xplained/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SAME54_XPLAINED_PRO
|
||||
source "boards/arm/samd5e5/same54-xplained-pro/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SAML21_XPLAINED
|
||||
source "boards/arm/samd2l2/saml21-xplained/Kconfig"
|
||||
endif
|
||||
|
|
50
boards/arm/samd5e5/same54-xplained-pro/Kconfig
Normal file
50
boards/arm/samd5e5/same54-xplained-pro/Kconfig
Normal file
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_SAME54_XPLAINED_PRO
|
||||
|
||||
choice
|
||||
prompt "Execution memory"
|
||||
default SAME54_XPLAINED_PRO_RUNFROMFLASH
|
||||
|
||||
config SAME54_XPLAINED_PRO_RUNFROMFLASH
|
||||
bool "Run from FLASH"
|
||||
select BOOT_RUNFROMFLASH
|
||||
---help---
|
||||
This is the normal configuration for building SAM E54 Xplained
|
||||
Pro code.
|
||||
|
||||
config SAME54_XPLAINED_PRO_RUNFROMSRAM
|
||||
bool "Run from SRAM"
|
||||
select BOOT_RUNFROMISRAM
|
||||
---help---
|
||||
During early bring-up, it is safer to execute entirely from
|
||||
SRAM until you are confident in the initialization logic.
|
||||
Then you can safely switch to FLASH.
|
||||
|
||||
REVISIT: This auto-selects CONFIG_BOOT_RUNFROMISRAM but I have
|
||||
found, with some difficulty, that that choice still defaults to
|
||||
CONFIG_BOOT_RUNFROMFLASH, causing link-time failures when running
|
||||
from SRAM.
|
||||
|
||||
endchoice # Execution memory
|
||||
|
||||
config SAME54_XPLAINED_PRO_32KHZXTAL
|
||||
bool "32.768 KHz XTAL"
|
||||
default n
|
||||
---help---
|
||||
According to the schematic, a 32.768 KHz crystal is installed on
|
||||
board. However, I have been unable to use this crystal and thought
|
||||
perhaps it is missing or defective on my board (there is a metal
|
||||
package that could be a crystal on board, but I am not certain).
|
||||
Another, more likely option is that there is a coding error on my
|
||||
part that prevents the 32.768 KHz crystal from usable(?)
|
||||
|
||||
The configuration defaults to using the always-on OSCULP32 as the
|
||||
slow clock source. This option will select instead XOSC32 as the
|
||||
slow clock source.
|
||||
|
||||
|
||||
endif # ARCH_BOARD_SAME54_XPLAINED_PRO
|
160
boards/arm/samd5e5/same54-xplained-pro/README.txt
Normal file
160
boards/arm/samd5e5/same54-xplained-pro/README.txt
Normal file
|
@ -0,0 +1,160 @@
|
|||
README
|
||||
======
|
||||
|
||||
This directory contains the port of NuttX to the Microchip SAME54 Xplained
|
||||
Pro board. This board is powered by an ATSAME54P20A:
|
||||
|
||||
o Cortex M4 core running at 120 MHz
|
||||
o Hardware DSP and floating point support
|
||||
o 1 MB flash, 256 KB RAM
|
||||
o 32-bit, 3.3V logic and power
|
||||
o Dual 1 MSPS DAC (A0 and A1)
|
||||
o Dual 1 MSPS ADC (8 analog pins)
|
||||
o 8 x hardware SERCOM (I2C, SPI or UART)
|
||||
o 16 x PWM outputs
|
||||
o Stereo I2S input/output with MCK pin
|
||||
o 14-bit Parallel capture controller (for camera/video in)
|
||||
o Built in crypto engines with AES (256 bit), true RNG, Pubkey controller
|
||||
o 10/100 Ethernet MAC
|
||||
o Dual SD/MMC controller
|
||||
o Dual CAN bus interfaces
|
||||
o 100-TQFP
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
o STATUS
|
||||
o Serial Console
|
||||
o LEDs
|
||||
o Run from SRAM
|
||||
o Configurations
|
||||
|
||||
STATUS
|
||||
======
|
||||
|
||||
2019-09-17: Board port started based on Metro M4 board.
|
||||
|
||||
WARNING: If you decide to invest the time to discover whey the XOSC32K
|
||||
clock source is not working, be certain to use the SRAM configuration.
|
||||
That configuration in FLASH is most likely lock up your board irrecoverably
|
||||
is there are any start-up errors!
|
||||
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
|
||||
The onboard debugger on the SAME54 Xplained Pro provides a virtual serial
|
||||
interface over the DEBUG USB port. The pins on the SAME54 are as follows:
|
||||
|
||||
----------------- -----------
|
||||
SAMD5E5 FUNCTION
|
||||
----------------- -----------
|
||||
PB24 SERCOM2 PAD1 RXD
|
||||
PB25 SERCOM2 PAD0 TXD
|
||||
|
||||
|
||||
An external RS-232 or serial-to-USB adapter can be connected on pins PA22
|
||||
and PA23:
|
||||
|
||||
----------------- ---------
|
||||
SAMD5E5 FUNCTION
|
||||
----------------- ---------
|
||||
PA23 SERCOM3 PAD1 RXD
|
||||
PA22 SERCOM3 PAD0 TXD
|
||||
|
||||
|
||||
LEDs
|
||||
====
|
||||
|
||||
The SAME54 Xplained Pro has three LEDs, but only one is controllable by software:
|
||||
|
||||
1. LED0 near the edge of the board
|
||||
|
||||
|
||||
----------------- -----------
|
||||
SAMD5E5 FUNCTION
|
||||
----------------- -----------
|
||||
PC18 GPIO output
|
||||
|
||||
Run from SRAM
|
||||
=============
|
||||
|
||||
I bricked my first Metro M4 board because there were problems in the
|
||||
bring-up logic. These problems left the chip in a bad state that was
|
||||
repeated on each reset because the code was written into FLASH and I was
|
||||
unable to ever connect to it again via SWD.
|
||||
|
||||
To make the bring-up less risky, I added a configuration option to build
|
||||
the code to execution entirely out of SRAM. By default, the setting
|
||||
CONFIG_SAME54_XPLAINED_PRO_RUNFROMFLASH=y is used and the code is built to run out of
|
||||
FLASH. If CONFIG_SAME54_XPLAINED_PRO_RUNFROMSRAM=y is selected instead, then the
|
||||
code is built to run out of SRAM.
|
||||
|
||||
To use the code in this configuration, the program must be started a
|
||||
little differently:
|
||||
|
||||
gdb> mon reset
|
||||
gdb> mon halt
|
||||
gdb> load nuttx << Load NuttX into SRAM
|
||||
gdb> file nuttx << Assuming debug symbols are enabled
|
||||
gdb> mon memu32 0x20000000 << Get the address of initial stack
|
||||
gdb> mon reg sp 0x200161c4 << Set the initial stack pointer using this address
|
||||
gdb> mon memu32 0x20000004 << Get the address of __start entry point
|
||||
gdb> mon reg pc 0x20000264 << Set the PC using this address (without bit 0 set)
|
||||
gdb> si << Step in just to make sure everything is okay
|
||||
gdb> [ set breakpoints ]
|
||||
gdb> c << Then continue until you hit a breakpoint
|
||||
|
||||
Where 0x200161c4 and 0x20000264 are the values of the initial stack and
|
||||
the __start entry point that I read from SRAM
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Each SAME54 Xplained Pro configuration is maintained in a sub-directory and
|
||||
can be selected as follow:
|
||||
|
||||
tools/configure.sh [OPTIONS] same54-xplained-pro:<subdir>
|
||||
|
||||
Do 'tools/configure.sh -h' for the list of options. If you are building
|
||||
under Windows with Cygwin, you would need the -c option, for example.
|
||||
|
||||
Before building, make sure that the PATH environmental variable includes 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 configurations listed in the following paragraph.
|
||||
|
||||
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
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. Unless stated otherwise, all configurations generate console
|
||||
output on SERCOM2 which is available via USB debug.
|
||||
|
||||
3. Unless otherwise stated, the configurations are setup build under
|
||||
Linux with a generic ARM EABI toolchain:
|
||||
|
||||
Configuration sub-directories
|
||||
-----------------------------
|
||||
|
||||
nsh:
|
||||
This configuration directory will built the NuttShell. See NOTES for
|
||||
common configuration above and the following:
|
||||
|
||||
NOTES:
|
||||
|
||||
1. The CMCC (Cortex M Cache Controller) is enabled.
|
||||
|
55
boards/arm/samd5e5/same54-xplained-pro/configs/nsh/defconfig
Normal file
55
boards/arm/samd5e5/same54-xplained-pro/configs/nsh/defconfig
Normal file
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="same54-xplained-pro"
|
||||
CONFIG_ARCH_BOARD_SAME54_XPLAINED_PRO=y
|
||||
CONFIG_ARCH_CHIP="samd5e5"
|
||||
CONFIG_ARCH_CHIP_SAME54P20=y
|
||||
CONFIG_ARCH_CHIP_SAME5X=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=7225
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DISABLE_ENVIRON=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PREALLOC_WDOGS=4
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1536
|
||||
CONFIG_RAM_SIZE=196608
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SAMD5E5_CMCC=y
|
||||
CONFIG_SAMD5E5_EIC=y
|
||||
CONFIG_SAMD5E5_SERCOM2=y
|
||||
CONFIG_SAMD5E5_SERCOM3=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_START_DAY=23
|
||||
CONFIG_START_MONTH=7
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_CXXINITIALIZE=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USART3_RXBUFSIZE=64
|
||||
CONFIG_USART3_TXBUFSIZE=64
|
||||
CONFIG_USERMAIN_STACKSIZE=1536
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
CONFIG_WDOG_INTRESERVE=0
|
503
boards/arm/samd5e5/same54-xplained-pro/include/board.h
Normal file
503
boards/arm/samd5e5/same54-xplained-pro/include/board.h
Normal file
|
@ -0,0 +1,503 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/include/board.h
|
||||
*
|
||||
* Copyright (C) 2018 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 __BOARDS_ARM_SAMD5E5_SAME54_XPLAINED_PRO_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_SAMD5E5_SAME54_XPLAINED_PRO_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* Overview
|
||||
*
|
||||
* Per the schematic Adafruit Metro M4 Pro has one on-board crystal:
|
||||
*
|
||||
* X4 32.768KHz XOSC32
|
||||
*
|
||||
* However, I have been unsuccessful using it and have fallen back to using
|
||||
* OSCULP32K(Unless CONFIG_SAME54_XPLAINED_PRO_32KHZXTAL=y)
|
||||
*
|
||||
* Since there is no high speed crystal, we will run from the OSC16M clock
|
||||
* source.
|
||||
*
|
||||
* OSC48M Output = 48Mhz
|
||||
* |
|
||||
* FDLL Input = 48MHz
|
||||
* | Output = 48MHz
|
||||
* GCLK5 Input = 48MHz
|
||||
* | Output = 2MHz
|
||||
* DPLL0 Input = 2MHz
|
||||
* | Output = 120MHz
|
||||
* GCLK0 Input = 120MHz
|
||||
* | Output = 120MHz
|
||||
* MCK Input = 120MHz
|
||||
* | Output = 120MHz
|
||||
* CPU Input = 120MHz
|
||||
*/
|
||||
|
||||
#define BOARD_OSC32K_FREQUENCY 32768 /* OSCULP32K frequency 32.768 KHz (nominal) */
|
||||
#define BOARD_XOSC32K_FREQUENCY 32768 /* XOSC32K frequency 32.768 KHz */
|
||||
#define BOARD_DFLL_FREQUENCY 48000000 /* FDLL frequency 28MHz */
|
||||
#define BOARD_XOSC0_FREQUENCY 12000000 /* XOSC0 frequency 12MHz (disabled) */
|
||||
#define BOARD_XOSC1_FREQUENCY 12000000 /* XOSC0 frequency 12MHz (disabled)*/
|
||||
#define BOARD_DPLL0_FREQUENCY 120000000 /* DPLL0 output frueuency (120MHz) */
|
||||
#define BOARD_DPLL1_FREQUENCY 47985664 /* DPLL1 output frequency (disabled) */
|
||||
|
||||
#define BOARD_GCLK0_FREQUENCY BOARD_DPLL0_FREQUENCY
|
||||
#define BOARD_GCLK1_FREQUENCY BOARD_DFLL_FREQUENCY
|
||||
#define BOARD_GCLK2_FREQUENCY (BOARD_XOSC32K_FREQUENCY / 4) /* Disabled */
|
||||
#ifdef CONFIG_SAME54_XPLAINED_PRO_32KHZXTAL
|
||||
# define BOARD_GCLK3_FREQUENCY BOARD_XOSC32K_FREQUENCY /* Enabled */
|
||||
#else
|
||||
# define BOARD_GCLK3_FREQUENCY BOARD_OSC32K_FREQUENCY /* Always-on */
|
||||
#endif
|
||||
#define BOARD_GCLK4_FREQUENCY BOARD_DPLL0_FREQUENCY
|
||||
#define BOARD_GCLK5_FREQUENCY (BOARD_DFLL_FREQUENCY / 24)
|
||||
#define BOARD_GCLK6_FREQUENCY BOARD_XOSC1_FREQUENCY /* Disabled */
|
||||
#define BOARD_GCLK7_FREQUENCY BOARD_XOSC1_FREQUENCY /* Disabled */
|
||||
#define BOARD_GCLK8_FREQUENCY BOARD_XOSC1_FREQUENCY /* Disabled */
|
||||
#define BOARD_GCLK9_FREQUENCY BOARD_XOSC1_FREQUENCY /* Disabled */
|
||||
#define BOARD_GCLK10_FREQUENCY BOARD_XOSC1_FREQUENCY /* Disabled */
|
||||
#define BOARD_GCLK11_FREQUENCY BOARD_XOSC1_FREQUENCY /* Disabled */
|
||||
|
||||
#define BOARD_CPU_FREQUENCY BOARD_GCLK0_FREQUENCY /* CPU frequency 120MHz */
|
||||
|
||||
/* XOSC32 */
|
||||
|
||||
#ifdef CONFIG_SAME54_XPLAINED_PRO_32KHZXTAL
|
||||
# define BOARD_HAVE_XOSC32K 1 /* 32.768 KHz XOSC32 crystal installed */
|
||||
# define BOARD_XOSC32K_ENABLE TRUE /* Enable XOSC32 */
|
||||
#else
|
||||
# define BOARD_HAVE_XOSC32K 0 /* No 32.768 KHz XOSC32 crystal installed */
|
||||
# define BOARD_XOSC32K_ENABLE FALSE /* Disable XOSC32 */
|
||||
#endif
|
||||
#define BOARD_XOSC32K_XTALEN TRUE /* Crystal connected on XIN32 */
|
||||
#define BOARD_XOSC32K_EN32K FALSE /* No 32KHz output */
|
||||
#define BOARD_XOSC32K_EN1K FALSE /* No 1KHz output */
|
||||
#define BOARD_XOSC32K_HIGHSPEED TRUE /* High speed mode */
|
||||
#define BOARD_XOSC32K_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_XOSC32K_ONDEMAND TRUE /* Enable on-demand control */
|
||||
#define BOARD_XOSC32K_CFDEN FALSE /* Clock failure detector not enabled */
|
||||
#define BOARD_XOSC32K_CFDEO FALSE /* No clock failure event */
|
||||
#define BOARD_XOSC32K_CALIBEN FALSE /* No OSCULP32K calibration */
|
||||
#define BOARD_XOSC32K_STARTUP 0 /* Startup time: 62592us */
|
||||
#define BOARD_XOSC32K_CALIB 0 /* Dummy OSCULP32K calibration value */
|
||||
#define BOARD_XOSC32K_RTCSEL 0 /* RTC clock = ULP1K */
|
||||
|
||||
/* XOSC0 */
|
||||
|
||||
#define BOARD_HAVE_XOSC0 0 /* No XOSC0 clock/crystal installed */
|
||||
#define BOARD_XOSC0_ENABLE FALSE /* Don't enable XOSC0 */
|
||||
#define BOARD_XOSC0_XTALEN FALSE /* External clock connected */
|
||||
#define BOARD_XOSC0_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_XOSC0_ONDEMAND TRUE /* Disable on-demand control */
|
||||
#define BOARD_XOSC0_LOWGAIN FALSE /* Disable low buffer gain */
|
||||
#define BOARD_XOSC0_ENALC FALSE /* Disable automatic loop control */
|
||||
#define BOARD_XOSC0_CFDEN FALSE /* Clock failure detector not enabled */
|
||||
#define BOARD_XOSC0_SWBEN FALSE /* XOSC clock switch not enabled */
|
||||
#define BOARD_XOSC0_STARTUP 0 /* XOSC0 start-up time 31µs */
|
||||
|
||||
/* XOSC1 */
|
||||
|
||||
#define BOARD_HAVE_XOSC1 0 /* No XOSC0 clock/crystal installed */
|
||||
#define BOARD_XOSC1_ENABLE FALSE /* Don't enable XOSC1 */
|
||||
#define BOARD_XOSC1_XTALEN TRUE /* External crystal connected */
|
||||
#define BOARD_XOSC1_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_XOSC1_ONDEMAND TRUE /* Disable on-demand control */
|
||||
#define BOARD_XOSC1_LOWGAIN FALSE /* Disable low buffer gain */
|
||||
#define BOARD_XOSC1_ENALC FALSE /* Disable automatic loop control */
|
||||
#define BOARD_XOSC1_CFDEN FALSE /* Clock failure detector not enabled */
|
||||
#define BOARD_XOSC1_SWBEN FALSE /* XOSC clock switch not enabled */
|
||||
#define BOARD_XOSC1_STARTUP 0 /* XOSC0 start-up time 31µs */
|
||||
|
||||
/* GCLK */
|
||||
|
||||
#define BOARD_GCLK_SET1 0x0020 /* Pre-configure: GCLK5 needed by DPLL0 */
|
||||
#define BOARD_GCLK_SET2 0x0fdf /* Post-configure: All GCLKs except GCLK5 */
|
||||
|
||||
#define BOARD_GCLK0_ENABLE TRUE /* Enable GCLK0 */
|
||||
#define BOARD_GCLK0_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK0_OE TRUE /* Generate output on GCLK_IO */
|
||||
#define BOARD_GCLK0_DIVSEL 0 /* GCLK frequency is source/DIV */
|
||||
#define BOARD_GCLK0_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK0_SOURCE 7 /* Select DPLL0 output as GCLK0 source */
|
||||
#define BOARD_GCLK0_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK1_ENABLE TRUE /* Enable GCLK1 */
|
||||
#define BOARD_GCLK1_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK1_OE TRUE /* Generate output on GCLK_IO */
|
||||
#define BOARD_GCLK1_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK1_SOURCE 6 /* Select DFLL output as GCLK1 source */
|
||||
#define BOARD_GCLK1_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK2_ENABLE FALSE /* Don't enable GCLK2 */
|
||||
#define BOARD_GCLK2_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK2_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK2_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK2_SOURCE 1 /* Select XOSC1 as GCLK2 source */
|
||||
#define BOARD_GCLK2_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK3_ENABLE TRUE /* Enable GCLK3 */
|
||||
#define BOARD_GCLK3_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK3_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK3_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#ifdef CONFIG_SAME54_XPLAINED_PRO_32KHZXTAL
|
||||
# define BOARD_GCLK3_SOURCE 5 /* Select XOSC32K as GCLK3 source */
|
||||
#else
|
||||
# define BOARD_GCLK3_SOURCE 4 /* Select OSCULP32K as GCLK3 source */
|
||||
#endif
|
||||
#define BOARD_GCLK3_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK4_ENABLE TRUE /* Enable GCLK4 */
|
||||
#define BOARD_GCLK4_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK4_OE TRUE /* Generate output on GCLK_IO */
|
||||
#define BOARD_GCLK4_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK4_SOURCE 7 /* Select DPLL0 output as GCLK4 source */
|
||||
#define BOARD_GCLK4_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK5_ENABLE TRUE /* Enable GCLK5 */
|
||||
#define BOARD_GCLK5_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK5_OE TRUE /* Generate output on GCLK_IO */
|
||||
#define BOARD_GCLK5_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK5_SOURCE 6 /* Select DFLL output as GCLK5 source */
|
||||
#define BOARD_GCLK5_DIV 24 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK6_ENABLE FALSE /* Don't enable GCLK6 */
|
||||
#define BOARD_GCLK6_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK6_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK6_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK6_SOURCE 1 /* Select XOSC1 as GCLK6 source */
|
||||
#define BOARD_GCLK6_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK7_ENABLE FALSE /* Don't enable GCLK7 */
|
||||
#define BOARD_GCLK7_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK7_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK7_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK7_SOURCE 1 /* Select XOSC1 as GCLK7 source */
|
||||
#define BOARD_GCLK7_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK8_ENABLE FALSE /* Don't enable GCLK8 */
|
||||
#define BOARD_GCLK8_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK8_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK8_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK8_SOURCE 1 /* Select XOSC1 as GCLK8 source */
|
||||
#define BOARD_GCLK8_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK9_ENABLE FALSE /* Don't enable GCLK9 */
|
||||
#define BOARD_GCLK9_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK9_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK9_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK9_SOURCE 1 /* Select XOSC1 as GCLK9 source */
|
||||
#define BOARD_GCLK9_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK10_ENABLE FALSE /* Don't enable GCLK10 */
|
||||
#define BOARD_GCLK10_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK10_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK10_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK10_SOURCE 1 /* Select XOSC1 as GCLK10 source */
|
||||
#define BOARD_GCLK10_DIV 1 /* Division factor */
|
||||
|
||||
#define BOARD_GCLK11_ENABLE FALSE /* Don't enable GCLK11 */
|
||||
#define BOARD_GCLK11_OOV FALSE /* Clock output will be LOW */
|
||||
#define BOARD_GCLK11_OE FALSE /* No generator output of GCLK_IO */
|
||||
#define BOARD_GCLK11_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_GCLK11_SOURCE 1 /* Select XOSC1 as GCLK11 source */
|
||||
#define BOARD_GCLK11_DIV 1 /* Division factor */
|
||||
#define BOARD_GCLK11_FREQUENCY BOARD_XOSC1_FREQUENCY
|
||||
|
||||
/* FDLL */
|
||||
|
||||
#define BOARD_DFLL_ENABLE TRUE /* DFLL enable */
|
||||
#define BOARD_DFLL_RUNSTDBY FALSE /* Don't run in standby */
|
||||
#define BOARD_DFLL_ONDEMAND FALSE /* No n-demand control */
|
||||
#define BOARD_DFLL_MODE FALSE /* Open loop mode */
|
||||
#define BOARD_DFLL_STABLE FALSE /* No stable DFLL frequency */
|
||||
#define BOARD_DFLL_LLAW FALSE /* Don't ose lock after wake */
|
||||
#define BOARD_DFLL_USBCRM TRUE /* Use USB clock recovery mode */
|
||||
#define BOARD_DFLL_CCDIS TRUE /* Chill cycle disable */
|
||||
#define BOARD_DFLL_QLDIS FALSE /* No Quick Lock Disable */
|
||||
#define BOARD_DFLL_BPLCKC FALSE /* No ypass coarse clock */
|
||||
#define BOARD_DFLL_WAITLOCK TRUE /* Wait lock */
|
||||
#define BOARD_DFLL_CALIBEN FALSE /* Don't verwrite factory calibration */
|
||||
#define BOARD_DFLL_GCLKLOCK FALSE /* Don't lock the GCLK source */
|
||||
#define BOARD_DFLL_FCALIB 128 /* Coarse calibration value (if caliben) */
|
||||
#define BOARD_DFLL_CCALIB (31 / 4) /* Fine calibration value (if caliben) */
|
||||
#define BOARD_DFLL_FSTEP 1 /* Fine maximum step */
|
||||
#define BOARD_DFLL_CSTEP 1 /* Coarse maximum step */
|
||||
#define BOARD_DFLL_GCLK 3 /* GCLK source (if !usbcrm && !mode) */
|
||||
#define BOARD_DFLL_MUL 0 /* DFLL multiply factor */
|
||||
|
||||
/* DPLL0/1
|
||||
*
|
||||
* Fckr is the frequency of the selected reference clock reference:
|
||||
*
|
||||
* BOARD_XOSC32K_FREQENCY,
|
||||
* BOARD_XOSCn_FREQUENCY / DIV, or
|
||||
* BOARD_GCLKn_FREQUENCY
|
||||
*
|
||||
* The DPLL output frequency is then given by:
|
||||
*
|
||||
* Fdpll = Fckr * (LDR + 1 + LDRFRAC / 32)
|
||||
*
|
||||
* DPLL0:
|
||||
* Fckr = BOARD_GCLK5_FREQUENCY = BOARD_DFLL_FREQUENCY / 24 = 2MHz
|
||||
* Fdpll = 2Mhz * (59 + 1 + 0 / 32) = 120MHz
|
||||
*
|
||||
* DPLL1: (not enabled)
|
||||
* Fckr = BOARD_XOSCK32_FREQUENCY = 32.768KHz
|
||||
* Fdpll = 32768 * (1463 + 1 + 13/32) = 47.986 MHz
|
||||
*/
|
||||
|
||||
#define BOARD_DPLL0_ENABLE TRUE /* DPLL enable */
|
||||
#define BOARD_DPLL0_DCOEN FALSE /* DCO filter enable */
|
||||
#define BOARD_DPLL0_LBYPASS FALSE /* Lock bypass */
|
||||
#define BOARD_DPLL0_WUF FALSE /* Wake up fast */
|
||||
#define BOARD_DPLL0_RUNSTDBY FALSE /* Run in standby */
|
||||
#define BOARD_DPLL0_ONDEMAND FALSE /* On demand clock activation */
|
||||
#define BOARD_DPLL0_REFLOCK FALSE /* Do not lock reference clock section */
|
||||
#define BOARD_DPLL0_REFCLK 0 /* Reference clock selection */
|
||||
#define BOARD_DPLL0_LTIME 0 /* Lock time */
|
||||
#define BOARD_DPLL0_FILTER 0 /* Proportional integer filter selection */
|
||||
#define BOARD_DPLL0_DCOFILTER 0 /* Sigma-delta DCO filter selection */
|
||||
#define BOARD_DPLL0_GCLK 5 /* GCLK source (if refclock == 0) */
|
||||
#define BOARD_DPLL0_GCLKLOCK 0 /* Don't lock GCLK source clock configuration */
|
||||
#define BOARD_DPLL0_LDRFRAC 0 /* Loop divider fractional part */
|
||||
#define BOARD_DPLL0_LDRINT 59 /* Loop divider ratio */
|
||||
#define BOARD_DPLL0_DIV 0 /* Clock divider */
|
||||
|
||||
#define BOARD_DPLL1_ENABLE FALSE /* DPLL enable */
|
||||
#define BOARD_DPLL1_DCOEN FALSE /* DCO filter enable */
|
||||
#define BOARD_DPLL1_LBYPASS FALSE /* Lock bypass */
|
||||
#define BOARD_DPLL1_WUF FALSE /* Wake up fast */
|
||||
#define BOARD_DPLL1_RUNSTDBY FALSE /* Run in standby */
|
||||
#define BOARD_DPLL1_ONDEMAND FALSE /* On demand clock activation */
|
||||
#define BOARD_DPLL1_REFLOCK FALSE /* Do not lock reference clock section */
|
||||
#define BOARD_DPLL1_REFCLK 1 /* Reference clock = XOSCK32 */
|
||||
#define BOARD_DPLL1_LTIME 0 /* Lock time */
|
||||
#define BOARD_DPLL1_FILTER 0 /* Sigma-delta DCO filter selection */
|
||||
#define BOARD_DPLL1_DCOFILTER 0 /* Sigma-delta DCO filter selection */
|
||||
#define BOARD_DPLL1_GCLK 0 /* GCLK source (if refclock == 0) */
|
||||
#define BOARD_DPLL1_GCLKLOCK 0 /* Don't lock GCLK source clock configuration */
|
||||
#define BOARD_DPLL1_LDRFRAC 13 /* Loop divider fractional part */
|
||||
#define BOARD_DPLL1_LDRINT 1463 /* Loop divider ratio */
|
||||
#define BOARD_DPLL1_DIV 0 /* Clock divider */
|
||||
|
||||
/* Master Clock (MCLK)
|
||||
*
|
||||
* GCLK0 is always the direct source the GCLK_MAIN.
|
||||
* CPU frequency = 120MHz / 1 = 120MHz
|
||||
*/
|
||||
|
||||
#define BOARD_MCLK_CPUDIV 1 /* MCLK divder to get CPU frequency */
|
||||
|
||||
#define BOARD_MCK_FREQUENCY BOARD_GCLK0_FREQUENCY
|
||||
|
||||
/* Peripheral clocking */
|
||||
|
||||
#define BOARD_GCLK_EIC 4 /* EIC GCLK index */
|
||||
|
||||
/* FLASH wait states
|
||||
*
|
||||
* Vdd Range Wait states Maximum Operating Frequency
|
||||
* --------- ----------- ---------------------------
|
||||
* > 2.7V 0 24 MHz
|
||||
* 1 51 MHz
|
||||
* 2 77 MHz
|
||||
* 3 101 MHz
|
||||
* 4 119 MHz
|
||||
* 5 120 MHz
|
||||
* >1.71V 0 22 MHz
|
||||
* 1 44 MHz
|
||||
* 2 67 MHz
|
||||
* 3 89 MHz
|
||||
* 4 111 MHz
|
||||
* 5 120 MHz
|
||||
*/
|
||||
|
||||
#define BOARD_FLASH_WAITSTATES 6
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* LEDs
|
||||
*
|
||||
* The SAME54 Xplained Pro has three LEDs, but only one is controllable by software:
|
||||
*
|
||||
* 1. LED0 near the edge of the board
|
||||
*
|
||||
*
|
||||
* ----------------- -----------
|
||||
* SAMD5E5 FUNCTION
|
||||
* ----------------- -----------
|
||||
* PC18 GPIO output
|
||||
*
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED0 0
|
||||
#define BOARD_NLEDS 1
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED0_BIT (1 << BOARD_LED0)
|
||||
|
||||
/* This LED is not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode
|
||||
* OS-related events as follows:
|
||||
*
|
||||
* ------------------- ---------------------------- ------
|
||||
* SYMBOL Meaning LED
|
||||
* ------------------- ---------------------------- ------
|
||||
*/
|
||||
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */
|
||||
#define LED_STACKCREATED 1 /* Idle stack created ON */
|
||||
#define LED_INIRQ 2 /* In an interrupt N/C */
|
||||
#define LED_SIGNAL 2 /* In a signal handler N/C */
|
||||
#define LED_ASSERTION 2 /* An assertion failed N/C */
|
||||
#define LED_PANIC 3 /* The system has crashed FLASH */
|
||||
#undef LED_IDLE /* MCU is is sleep mode Not used */
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* Alternate function pin selections ****************************************/
|
||||
|
||||
/* SERCOM definitions *******************************************************/
|
||||
|
||||
/* The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the
|
||||
* Main Clock Controller.
|
||||
* The SERCOM uses two generic clocks: GCLK_SERCOMn_CORE and GCLK_SERCOM_SLOW.
|
||||
* The core clock (GCLK_SERCOMx_CORE) is required to clock the SERCOM while
|
||||
* working as a master. The slow clock (GCLK_SERCOM_SLOW) is only required
|
||||
* for certain functions and is common to all SERCOM modules.
|
||||
*
|
||||
* These clocks must be configured and enabled in the Generic Clock
|
||||
* Controller (GCLK) before using the SERCOM.
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM_SLOWGEN 3 /* 32.768KHz, common to all SERCOMS */
|
||||
#define BOARD_SERCOM_SLOWLOCK FALSE /* Don't lock the SLOWCLOCK */
|
||||
#define BOARD_SLOWCLOCK_FREQUENCY BOARD_GCLK3_FREQUENCY
|
||||
|
||||
/* SERCOM2
|
||||
*
|
||||
* Built-in virtual COM port using the EDBG chip on the board.
|
||||
* DTR must be asserted by your console software in order to enable this port.
|
||||
*
|
||||
* ----------------- ---------
|
||||
* SAMD5E5 FUNCTION
|
||||
* ----------------- ---------
|
||||
* PB24 SERCOM2 PAD1 RXD
|
||||
* PB25 SERCOM2 PAD0 TXD
|
||||
*
|
||||
* NOTES:
|
||||
* USART_CTRLA_TXPAD0_2: TxD=PAD0 XCK=N/A RTS/TE=PAD2 CTS=PAD3
|
||||
* USART_CTRLA_RXPAD1: RxD=PAD1
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM2_MUXCONFIG (USART_CTRLA_TXPAD0_2 | USART_CTRLA_RXPAD1)
|
||||
#define BOARD_SERCOM2_PINMAP_PAD0 PORT_SERCOM2_PAD0_4 /* PAD0: USART TX */
|
||||
#define BOARD_SERCOM2_PINMAP_PAD1 PORT_SERCOM2_PAD1_4 /* PAD1: USART RX */
|
||||
#define BOARD_SERCOM2_PINMAP_PAD2 0 /* PAD2: (not used) */
|
||||
#define BOARD_SERCOM2_PINMAP_PAD3 0 /* PAD3: (not used) */
|
||||
|
||||
#define BOARD_TXIRQ_SERCOM2 SAM_IRQ_SERCOM2_0 /* INTFLAG[0] DRE */
|
||||
#define BOARD_RXIRQ_SERCOM2 SAM_IRQ_SERCOM2_2 /* INTFLAG[2] RXC */
|
||||
|
||||
#define BOARD_SERCOM2_COREGEN 1 /* 48MHz Core clock */
|
||||
#define BOARD_SERCOM2_CORELOCK FALSE /* Don't lock the CORECLOCK */
|
||||
#define BOARD_SERCOM2_FREQUENCY BOARD_GCLK1_FREQUENCY
|
||||
|
||||
/* SERCOM3
|
||||
*
|
||||
* An external RS-232 or serial-to-USB adapter can be connected on pins PA22
|
||||
* and PA23:
|
||||
*
|
||||
* ----------------- ---------
|
||||
* SAMD5E5 FUNCTION
|
||||
* ----------------- ---------
|
||||
* PA23 SERCOM3 PAD1 RXD
|
||||
* PA22 SERCOM3 PAD0 TXD
|
||||
*
|
||||
* NOTES:
|
||||
* USART_CTRLA_TXPAD0_2: TxD=PAD0 XCK=N/A RTS/TE=PAD2 CTS=PAD3
|
||||
* USART_CTRLA_RXPAD1: RxD=PAD1
|
||||
*/
|
||||
|
||||
#define BOARD_SERCOM3_MUXCONFIG (USART_CTRLA_TXPAD0_2 | USART_CTRLA_RXPAD1)
|
||||
#define BOARD_SERCOM3_PINMAP_PAD0 PORT_SERCOM3_PAD0_1 /* PAD0: USART TX */
|
||||
#define BOARD_SERCOM3_PINMAP_PAD1 PORT_SERCOM3_PAD1_1 /* PAD1: USART RX */
|
||||
#define BOARD_SERCOM3_PINMAP_PAD2 0 /* PAD2: (not used) */
|
||||
#define BOARD_SERCOM3_PINMAP_PAD3 0 /* PAD3: (not used) */
|
||||
|
||||
#define BOARD_TXIRQ_SERCOM3 SAM_IRQ_SERCOM3_0 /* INTFLAG[0] DRE */
|
||||
#define BOARD_RXIRQ_SERCOM3 SAM_IRQ_SERCOM3_2 /* INTFLAG[2] RXC */
|
||||
|
||||
#define BOARD_SERCOM3_COREGEN 1 /* 48MHz Core clock */
|
||||
#define BOARD_SERCOM3_CORELOCK FALSE /* Don't lock the CORECLOCK */
|
||||
#define BOARD_SERCOM3_FREQUENCY BOARD_GCLK1_FREQUENCY
|
||||
|
||||
/* USB */
|
||||
|
||||
#define BOARD_USB_GCLKGEN 1 /* GCLK1, 48MHz */
|
||||
|
||||
/* Ethernet */
|
||||
|
||||
#define BOARD_GMAC_GMDC PORT_GMAC_GMDC_3
|
||||
#define BOARD_GMAC_GMDIO PORT_GMAC_GMDIO_3
|
||||
|
||||
#endif /* __BOARDS_ARM_SAMD5E5_SAME54_XPLAINED_PRO_INCLUDE_BOARD_H */
|
128
boards/arm/samd5e5/same54-xplained-pro/scripts/Make.defs
Normal file
128
boards/arm/samd5e5/same54-xplained-pro/scripts/Make.defs
Normal file
|
@ -0,0 +1,128 @@
|
|||
############################################################################
|
||||
# boards/arm/samd5e5/same54-xplained-pro/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_SAME54_XPLAINED_PRO_RUNFROMFLASH),y)
|
||||
LDSCRIPT = flash.ld
|
||||
else ifeq ($(CONFIG_SAME54_XPLAINED_PRO_RUNFROMSRAM),y)
|
||||
LDSCRIPT = sram.ld
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
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 -fcheck-new -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
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
|
||||
|
||||
# Loadable module definitions
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ASMEXT = .S
|
||||
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 -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
123
boards/arm/samd5e5/same54-xplained-pro/scripts/flash.ld
Normal file
123
boards/arm/samd5e5/same54-xplained-pro/scripts/flash.ld
Normal file
|
@ -0,0 +1,123 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/scripts/flash.ld
|
||||
*
|
||||
* Copyright (C) 2018 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 ATSAME54P20A has 1024Kb of FLASH beginning at address 0x0000:0000 and
|
||||
* 256Kb of SRAM at address 0x2000:0000.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
EXTERN(_vectors)
|
||||
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(.);
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
.data :
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.bss :
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_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) }
|
||||
}
|
74
boards/arm/samd5e5/same54-xplained-pro/scripts/nvm.c
Normal file
74
boards/arm/samd5e5/same54-xplained-pro/scripts/nvm.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/scripts/nvm.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt 9
|
||||
* 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 <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint8_t nvm[20] =
|
||||
{
|
||||
0x14, /* Count 20 bytes */
|
||||
0x80, 0x40, 0x00, /* 24-address : 804000 */
|
||||
0x39, 0x92, 0x9a, 0xfe, 0x80, 0xff, 0xec, 0xae, /* 16-bytes of NVM data */
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned int csum;
|
||||
int i;
|
||||
|
||||
printf("S2");
|
||||
|
||||
for (i = 0, csum = 0; i < 20; i++)
|
||||
{
|
||||
csum += nvm[i];
|
||||
printf("%02X", (unsigned int)nvm[i]);
|
||||
}
|
||||
|
||||
printf("%02X\r\n", ~csum & 0xff);
|
||||
printf("S9030000FC\r\n");
|
||||
return 0;
|
||||
}
|
2
boards/arm/samd5e5/same54-xplained-pro/scripts/nvm.srec
Normal file
2
boards/arm/samd5e5/same54-xplained-pro/scripts/nvm.srec
Normal file
|
@ -0,0 +1,2 @@
|
|||
S21480400039929AFE80FFECAEFFFFFFFFFFFFFFFFB7
|
||||
S9030000FC
|
122
boards/arm/samd5e5/same54-xplained-pro/scripts/sram.ld
Normal file
122
boards/arm/samd5e5/same54-xplained-pro/scripts/sram.ld
Normal file
|
@ -0,0 +1,122 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/scripts/sram.ld
|
||||
*
|
||||
* Copyright (C) 2018 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 ATSAME54P20A has 1024Kb of FLASH beginning at address 0x0000:0000 and
|
||||
* 256Kb of SRAM at address 0x2000:0000. Only sram is used by this linker
|
||||
* script.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
EXTERN(_vectors)
|
||||
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(.);
|
||||
} > sram
|
||||
|
||||
.init_section :
|
||||
{
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab*)
|
||||
} > sram
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx*)
|
||||
} > sram
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.data :
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.bss :
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_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) }
|
||||
}
|
55
boards/arm/samd5e5/same54-xplained-pro/src/Makefile
Normal file
55
boards/arm/samd5e5/same54-xplained-pro/src/Makefile
Normal file
|
@ -0,0 +1,55 @@
|
|||
############################################################################
|
||||
# boards/arm/samd5e5/same54-xplained-pro/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = sam_boot.c sam_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += sam_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += sam_autoleds.c
|
||||
else
|
||||
CSRCS += sam_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMD5E5_GMAC_PHYINIT), y)
|
||||
CSRCS += sam_phyinit.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
94
boards/arm/samd5e5/same54-xplained-pro/src/sam_appinit.c
Normal file
94
boards/arm/samd5e5/same54-xplained-pro/src/sam_appinit.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/sam_appinit.c
|
||||
*
|
||||
* Copyright (C) 2018 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 <nuttx/board.h>
|
||||
|
||||
#include "same54-xplained-pro.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return sam_bringup();
|
||||
#endif
|
||||
}
|
295
boards/arm/samd5e5/same54-xplained-pro/src/sam_autoleds.c
Normal file
295
boards/arm/samd5e5/same54-xplained-pro/src/sam_autoleds.c
Normal file
|
@ -0,0 +1,295 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/sam_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2018 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 SAME54 Xplained Pro has three LEDs, but only one is controllable by software:
|
||||
*
|
||||
* 1. LED0 near the edge of the board
|
||||
*
|
||||
* ----------------- -----------
|
||||
* SAMD5E5 FUNCTION
|
||||
* ----------------- -----------
|
||||
* PC18 GPIO output
|
||||
*
|
||||
* This LED is not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
* defined. In that case, the usage by the board port is defined in
|
||||
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode
|
||||
* OS-related events 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
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "sam_port.h"
|
||||
#include "same54-xplained-pro.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* LED Power Management */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static struct pm_callback_s g_ledscb =
|
||||
{
|
||||
.notify = led_pm_notify,
|
||||
.prepare = led_pm_prepare,
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_notify
|
||||
*
|
||||
* Description:
|
||||
* Notify the driver of new power state. This callback is called after
|
||||
* all drivers have had the opportunity to prepare for the new power state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
switch (pmstate)
|
||||
{
|
||||
case(PM_NORMAL):
|
||||
{
|
||||
/* Restore normal LEDs operation */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_IDLE):
|
||||
{
|
||||
/* Entering IDLE mode - Turn leds off */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_STANDBY):
|
||||
{
|
||||
/* Entering STANDBY mode - Logic for PM_STANDBY goes here */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_SLEEP):
|
||||
{
|
||||
/* Entering SLEEP mode - Logic for PM_SLEEP goes here */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Should not get here */
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_prepare
|
||||
*
|
||||
* Description:
|
||||
* Request the driver to prepare for a new power state. This is a warning
|
||||
* that the system is about to enter into a new power state. The driver
|
||||
* should begin whatever operations that may be required to enter power
|
||||
* state. The driver may abort the state change mode by returning a
|
||||
* non-zero value from the callback function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
/* No preparation to change power modes is required by the LEDs driver.
|
||||
* We always accept the state change by returning OK.
|
||||
*/
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
(void)sam_portconfig(PORT_LED0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_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_LED0, ledstate);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_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_LED0, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_led_pminitialize
|
||||
*
|
||||
* Description:
|
||||
* Register LED power management features.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void sam_led_pminitialize(void)
|
||||
{
|
||||
/* Register to receive power management callbacks */
|
||||
|
||||
int ret = pm_register(&g_ledscb);
|
||||
if (ret != OK)
|
||||
{
|
||||
board_autoled_on(LED_ASSERTION);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
94
boards/arm/samd5e5/same54-xplained-pro/src/sam_boot.c
Normal file
94
boards/arm/samd5e5/same54-xplained-pro/src/sam_boot.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/sam_boot.c
|
||||
*
|
||||
* Copyright (C) 2018 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 "same54-xplained-pro.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All SAMD5/E5 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_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_late_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_late_initialize(). board_late_initialize() will be
|
||||
* called immediately after up_initialize() is called and just before the
|
||||
* initial application is started. This additional initialization phase
|
||||
* may be used, for example, to initialize board-specific device drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
(void)sam_bringup();
|
||||
}
|
||||
#endif
|
91
boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c
Normal file
91
boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c
|
||||
*
|
||||
* Copyright (C) 2018 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 <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "same54-xplained-pro.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define PROCFS_MOUNTPOINT "/proc"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sam_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, PROCFS_MOUNTPOINT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslot(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
|
||||
PROCFS_MOUNTPOINT, ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
69
boards/arm/samd5e5/same54-xplained-pro/src/sam_phyinit.c
Normal file
69
boards/arm/samd5e5/same54-xplained-pro/src/sam_phyinit.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/sam_phyinit.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Darcy Gong <darcy.gong@gmail.com>
|
||||
*
|
||||
* 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 "sam_port.h"
|
||||
#include "sam_ethernet.h"
|
||||
|
||||
#include "same54-xplained-pro.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ETH0_PHY_KSZ8081) && defined(CONFIG_SAMD5E5_GMAC_PHYINIT)
|
||||
int sam_phy_boardinitialize(int intf)
|
||||
{
|
||||
/* Configure the KSZ8081 PHY reset pin and take it out of reset */
|
||||
|
||||
sam_portconfig(PORT_PHY_RESET);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
229
boards/arm/samd5e5/same54-xplained-pro/src/sam_userleds.c
Normal file
229
boards/arm/samd5e5/same54-xplained-pro/src/sam_userleds.c
Normal file
|
@ -0,0 +1,229 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/sam_userleds.c
|
||||
*
|
||||
* Copyright (C) 2018 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 SAME54 Xplained Pro has three LEDs, but only one is controllable by software:
|
||||
*
|
||||
* 1. LED0 near the edge of the board
|
||||
*
|
||||
* ----------------- -----------
|
||||
* SAMD5E5 FUNCTION
|
||||
* ----------------- -----------
|
||||
* PC18 GPIO output
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "sam_port.h"
|
||||
|
||||
#include "same54-xplained-pro.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* LED Power Management */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static struct pm_callback_s g_ledscb =
|
||||
{
|
||||
.notify = led_pm_notify,
|
||||
.prepare = led_pm_prepare,
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_notify
|
||||
*
|
||||
* Description:
|
||||
* Notify the driver of new power state. This callback is called after
|
||||
* all drivers have had the opportunity to prepare for the new power state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void led_pm_notify(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
switch (pmstate)
|
||||
{
|
||||
case(PM_NORMAL):
|
||||
{
|
||||
/* Restore normal LEDs operation */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_IDLE):
|
||||
{
|
||||
/* Entering IDLE mode - Turn leds off */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_STANDBY):
|
||||
{
|
||||
/* Entering STANDBY mode - Logic for PM_STANDBY goes here */
|
||||
}
|
||||
break;
|
||||
|
||||
case(PM_SLEEP):
|
||||
{
|
||||
/* Entering SLEEP mode - Logic for PM_SLEEP goes here */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Should not get here */
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_pm_prepare
|
||||
*
|
||||
* Description:
|
||||
* Request the driver to prepare for a new power state. This is a warning
|
||||
* that the system is about to enter into a new power state. The driver
|
||||
* should begin whatever operations that may be required to enter power
|
||||
* state. The driver may abort the state change mode by returning a
|
||||
* non-zero value from the callback function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int led_pm_prepare(struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate)
|
||||
{
|
||||
/* No preparation to change power modes is required by the LEDs driver.
|
||||
* We always accept the state change by returning OK.
|
||||
*/
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
(void)sam_portconfig(PORT_STATUS_LED);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if (led == BOARD_STATUS_LED)
|
||||
{
|
||||
sam_portwrite(PORT_STATUS_LED, !ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
board_userled(BOARD_STATUS_LED, (ledset & BOARD_STATUS_LED_BIT) != 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_led_pminitialize
|
||||
*
|
||||
* Description:
|
||||
* Register LED power management features.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void sam_led_pminitialize(void)
|
||||
{
|
||||
/* Register to receive power management callbacks */
|
||||
|
||||
int ret = pm_register(&g_ledscb);
|
||||
if (ret != OK)
|
||||
{
|
||||
board_autoled_on(LED_ASSERTION);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
128
boards/arm/samd5e5/same54-xplained-pro/src/same54-xplained-pro.h
Normal file
128
boards/arm/samd5e5/same54-xplained-pro/src/same54-xplained-pro.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/samd5e5/same54-xplained-pro/src/same54-xplained-pro.h
|
||||
*
|
||||
* Copyright (C) 2018 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 __BOARDS_ARM_SAMD5E5_SAME54_XPLAINED_PRO_SRC_SAME54_XPLAINED_PRO_H
|
||||
#define __BOARDS_ARM_SAMD5E5_SAME54_XPLAINED_PRO_SRC_SAME54_XPLAINED_PRO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Metro-M4 GPIOs ***********************************************************/
|
||||
|
||||
/* LEDs
|
||||
*
|
||||
* The SAME54 Xplained Pro has three LEDs, but only one is controllable by software:
|
||||
*
|
||||
* 1. LED0 near the edge of the board
|
||||
*
|
||||
*
|
||||
* ----------------- -----------
|
||||
* SAMD5E5 FUNCTION
|
||||
* ----------------- -----------
|
||||
* PC18 GPIO output
|
||||
*
|
||||
*/
|
||||
|
||||
#define PORT_LED0 (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTC | PORT_PIN18)
|
||||
/* Ethernet *****************************************************************/
|
||||
|
||||
/* PHY pins:
|
||||
*
|
||||
* -------- ----------------- -----------
|
||||
* PHY SAMD5E5 FUNCTION
|
||||
* -------- ----------------- -----------
|
||||
* Reset PD12 GPIO output
|
||||
* IRQ PC21 GPIO input
|
||||
*/
|
||||
|
||||
#define PORT_PHY_RESET (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
|
||||
PORTD | PORT_PIN12)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sam_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_led_pminitialize
|
||||
*
|
||||
* Description:
|
||||
* Register LED power management features.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void sam_led_pminitialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_SAMD5E5_SAME54_XPLAINED_PRO_SRC_SAME54_XPLAINED_PRO_H */
|
Loading…
Reference in a new issue