DM: added metro m4 variant

This commit is contained in:
dean 2017-08-04 14:37:22 -04:00
parent c1ce890973
commit 2ce0635ebc
50 changed files with 218 additions and 572 deletions

View file

@ -208,13 +208,21 @@ adafruit_trinket_m0.build.pid=0x801E
adafruit_trinket_m0.bootloader.tool=openocd
adafruit_trinket_m0.bootloader.file=trinket/samd21_sam_ba.bin
# Adafruit Metro M4 (SAMD51)
# Adafruit Metro M4
# ------------------------------
adafruit_metro_m4.name=Adafruit Metro M4 (SAMD51)
adafruit_metro_m4.vid.0=0x239A
adafruit_metro_m4.pid.0=0x8020
adafruit_metro_m4.vid.1=0x239A
adafruit_metro_m4.pid.1=0x0020
adafruit_metro_m4.name=Adafruit Metro M4
adafruit_metro_m4.vid.0=0x2341
adafruit_metro_m4.pid.0=0x804d
adafruit_metro_m4.vid.1=0x2341
adafruit_metro_m4.pid.1=0x004d
adafruit_metro_m4.vid.2=0x2341
adafruit_metro_m4.pid.2=0x824d
# If the board is a 2341:824d use 2341:824d for build and set other parameters as well
adafruit_metro_m4.vid.2.build.vid=0x2341
adafruit_metro_m4.vid.2.build.pid=0x824d
adafruit_metro_m4.vid.2.build.usb_product="Adafruit Metro M4"
adafruit_metro_m4.vid.2.bootloader.file=metroM4/samdx1_sam_ba.bin
adafruit_metro_m4.upload.tool=bossac
adafruit_metro_m4.upload.protocol=sam-ba
@ -227,14 +235,14 @@ adafruit_metro_m4.build.mcu=cortex-m4
adafruit_metro_m4.build.f_cpu=48000000L
adafruit_metro_m4.build.usb_product="Adafruit Metro M4"
adafruit_metro_m4.build.usb_manufacturer="Adafruit LLC"
adafruit_metro_m4.build.board=SAMD_51
adafruit_metro_m4.build.board=SAMD_METRO_M4
adafruit_metro_m4.build.core=arduino
adafruit_metro_m4.build.extra_flags=-D__SAMD51J20A__ -D__SAMD51__ {build.usb_flags}
adafruit_metro_m4.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_metro_m4.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_metro_m4.build.variant=metro_m4
adafruit_metro_m4.build.variant_system_lib=
adafruit_metro_m4.build.vid=0x239A
adafruit_metro_m4.build.pid=0x8020
adafruit_metro_m4.build.vid=0x2341
adafruit_metro_m4.build.pid=0x804d
adafruit_metro_m4.bootloader.tool=openocd
adafruit_metro_m4.bootloader.file=x1/samdx1_sam_ba.bin
adafruit_metro_m4.bootloader.file=metroM4/samdx1_sam_ba.bin

Binary file not shown.

View file

@ -57,7 +57,7 @@ SIZE=$(ARM_GCC_PATH)size
# -----------------------------------------------------------------------------
# Boards definitions
BOARD_ID?=arduino_x1
BOARD_ID?=METRO_M4
# -----------------------------------------------------------------------------
# Compiler options

View file

@ -1,4 +1,4 @@
# Arduino x1 Bootloader
# Metro M4 Bootloader
## 1- Prerequisites
@ -55,9 +55,8 @@ The following pins are used by the program :
PA25 : input/output (USB DP)
PA24 : input/output (USB DM)
### TODO: not correct
PA11 : input (USART RX)
PA10 : output (USART TX)
PA23 : input (USART RX)
PA22 : output (USART TX)
The application board shall avoid driving the PA25, PA24, PB23 and PB22 signals while the boot program is running (after a POR for example).
@ -79,7 +78,7 @@ Before jumping to the application, the bootloader changes the VTOR register to u
## 5- How to build
If not specified the makefile builds for **Arduino x1**:
If not specified the makefile builds for **Metro M4**:
```
make

View file

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if defined(BOARD_ID_arduino_x1)
#include "board_definitions_arduino_x1.h"
#if defined(BOARD_ID_METRO_M4)
#include "board_definitions_metro_m4.h"
#else
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
#endif

View file

@ -23,7 +23,7 @@
/*
* USB device definitions
*/
#define STRING_PRODUCT "Arduino x1"
#define STRING_PRODUCT "Metro M4"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x00

View file

@ -1,82 +0,0 @@
/*
Copyright (c) 2015 Arduino LLC. All right reserved.
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Arduino MKR1000"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x00
#define USB_PID_LOW 0x4E
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5
#define BOOT_USART_MODULE SERCOM0
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM0
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM0_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3
#define BOOT_USART_PAD2 PINMUX_PA10C_SERCOM0_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
// PA20 (digital pin 6)
#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (20)
// No RX/TX led
//#define BOARD_LEDRX_PORT
//#define BOARD_LEDRX_PIN
//#define BOARD_LEDTX_PORT
//#define BOARD_LEDTX_PIN
#endif // _BOARD_DEFINITIONS_H_

View file

@ -1,81 +0,0 @@
/*
Copyright (c) 2016 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Arduino MKRFox1200"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x00
#define USB_PID_LOW 0x50
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21
//#define BOOT_LOAD_PIN PIN_PA15
#define BOOT_USART_MODULE SERCOM5
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM5
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM5_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3
#define BOOT_USART_PAD2 PINMUX_PB22D_SERCOM5_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
// PA20 (digital pin 6)
#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (20)
// No RX/TX led
//#define BOARD_LEDRX_PORT
//#define BOARD_LEDRX_PIN
//#define BOARD_LEDTX_PORT
//#define BOARD_LEDTX_PIN
#endif // _BOARD_DEFINITIONS_H_

View file

@ -1,81 +0,0 @@
/*
Copyright (c) 2016 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Arduino MKRZero"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x00
#define USB_PID_LOW 0x4F
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21
//#define BOOT_LOAD_PIN PIN_PA15
#define BOOT_USART_MODULE SERCOM5
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM5
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM5_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3
#define BOOT_USART_PAD2 PINMUX_PB22D_SERCOM5_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
// PB08 (digital pin 32)
#define BOARD_LED_PORT (1)
#define BOARD_LED_PIN (8)
// No RX/TX led
//#define BOARD_LEDRX_PORT
//#define BOARD_LEDRX_PIN
//#define BOARD_LEDTX_PORT
//#define BOARD_LEDTX_PIN
#endif // _BOARD_DEFINITIONS_H_

View file

@ -1,81 +0,0 @@
/*
Copyright (c) 2015 Arduino LLC. All right reserved.
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Arduino Zero"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x00
#define USB_PID_LOW 0x4D
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5
#define BOOT_USART_MODULE SERCOM0
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM0
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM0_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3
#define BOOT_USART_PAD2 PINMUX_PA10C_SERCOM0_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (17)
#define BOARD_LEDRX_PORT (1)
#define BOARD_LEDRX_PIN (3)
#define BOARD_LEDTX_PORT (0)
#define BOARD_LEDTX_PIN (27)
#endif // _BOARD_DEFINITIONS_H_

View file

@ -1,83 +0,0 @@
/*
Copyright (c) 2015 Arduino LLC. All right reserved.
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Genuino MKR1000"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x02
#define USB_PID_LOW 0x4E
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5
#define BOOT_USART_MODULE SERCOM0
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM0
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM0_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3
#define BOOT_USART_PAD2 PINMUX_PA10C_SERCOM0_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
// PA20 (digital pin 6)
#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (20)
// No RX/TX led
//#define BOARD_LEDRX_PORT
//#define BOARD_LEDRX_PIN
//#define BOARD_LEDTX_PORT
//#define BOARD_LEDTX_PIN
#endif // _BOARD_DEFINITIONS_H_

View file

@ -1,81 +0,0 @@
/*
Copyright (c) 2015 Arduino LLC. All right reserved.
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Genuino Zero"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x02
#define USB_PID_LOW 0x4D
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5
#define BOOT_USART_MODULE SERCOM0
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM0
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM0_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3
#define BOOT_USART_PAD2 PINMUX_PA10C_SERCOM0_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (17)
#define BOARD_LEDRX_PORT (1)
#define BOARD_LEDRX_PIN (3)
#define BOARD_LEDTX_PORT (0)
#define BOARD_LEDTX_PIN (27)
#endif // _BOARD_DEFINITIONS_H_

View file

@ -37,13 +37,13 @@ typedef enum _EAnalogChannel
ADC_Channel5=5,
ADC_Channel6=6,
ADC_Channel7=7,
#if defined __SAMD21J18A__
#if defined __SAMD21J18A__ || defined(__SAMD51__)
ADC_Channel8=8,
ADC_Channel9=9,
#endif // __SAMD21J18A__
ADC_Channel10=10,
ADC_Channel11=11,
#if defined __SAMD21J18A__
#if defined __SAMD21J18A__ || defined(__SAMD51__)
ADC_Channel12=12,
ADC_Channel13=13,
ADC_Channel14=14,
@ -54,6 +54,7 @@ typedef enum _EAnalogChannel
ADC_Channel18=18,
ADC_Channel19=19,
DAC_Channel0,
DAC_Channel1,
} EAnalogChannel ;
// Definitions for TC channels
@ -72,26 +73,35 @@ typedef enum _ETCChannel
TCC1_CH1 = (1<<8)|(1),
TCC1_CH2 = (1<<8)|(0), // Channel 2 is 0!
TCC1_CH3 = (1<<8)|(1), // Channel 3 is 1!
#if defined(__SAMD51J20A__)
TCC1_CH4 = (1<<8)|(2),
TCC1_CH5 = (1<<8)|(3),
TCC1_CH6 = (1<<8)|(4),
TCC1_CH7 = (1<<8)|(5),
#endif //__SAMD51J20A__
TCC2_CH0 = (2<<8)|(0),
TCC2_CH1 = (2<<8)|(1),
TCC2_CH2 = (2<<8)|(0), // Channel 2 is 0!
TCC2_CH3 = (2<<8)|(1), // Channel 3 is 1!
#if defined(__SAMD51J20A__) //TODO: fix some of these PWM channels
TCC3_CH0 = (2<<8)|(0),
TCC3_CH1 = (2<<8)|(1),
TCC3_CH2 = (2<<8)|(0), // Channel 2 is 0!
TCC3_CH3 = (2<<8)|(1), // Channel 3 is 1!
TCC4_CH0 = (2<<8)|(0),
TCC4_CH1 = (2<<8)|(1),
TCC4_CH2 = (2<<8)|(0), // Channel 2 is 0!
TCC4_CH3 = (2<<8)|(1), // Channel 3 is 1
TC5_CH0 = (5<<8)|(0),
TC5_CH1 = (5<<8)|(1),
#else //end __SAMD51J20A__
TC3_CH0 = (3<<8)|(0),
TC3_CH1 = (3<<8)|(1),
TC4_CH0 = (4<<8)|(0),
TC4_CH1 = (4<<8)|(1),
TC5_CH0 = (5<<8)|(0),
TC5_CH1 = (5<<8)|(1),
#if defined __SAMD21J18A__
TC6_CH0 = (6<<8)|(0),
TC6_CH1 = (6<<8)|(1),
TC7_CH0 = (7<<8)|(0),
TC7_CH1 = (7<<8)|(1),
#endif // __SAMD21J18A__
#if defined(__SAMD51__) //TODO: these
TCC1_CH4 = (1<<8)|(2),
TCC1_CH5 = (1<<8)|(3),
#endif
#endif //__SAMD51J20A__
} ETCChannel ;
extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ;
@ -100,43 +110,77 @@ extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ;
#define GetTCChannelNumber( x ) ( (x) & 0xff )
#define GetTC( x ) ( g_apTCInstances[(x) >> 8] )
// Definitions for PWM channels
typedef enum _EPWMChannel
{
NOT_ON_PWM=-1,
PWM0_CH0=TCC0_CH0,
PWM0_CH1=TCC0_CH1,
PWM0_CH2=TCC0_CH2,
PWM0_CH3=TCC0_CH3,
PWM0_CH4=TCC0_CH4,
PWM0_CH5=TCC0_CH5,
PWM0_CH6=TCC0_CH6,
PWM0_CH7=TCC0_CH7,
PWM1_CH0=TCC1_CH0,
PWM1_CH1=TCC1_CH1,
PWM1_CH2=TCC1_CH2,
PWM1_CH3=TCC1_CH3,
PWM2_CH0=TCC2_CH0,
PWM2_CH1=TCC2_CH1,
PWM2_CH2=TCC2_CH2,
PWM2_CH3=TCC2_CH3,
PWM3_CH0=TC3_CH0,
PWM3_CH1=TC3_CH1,
PWM4_CH0=TC4_CH0,
PWM4_CH1=TC4_CH1,
PWM5_CH0=TC5_CH0,
PWM5_CH1=TC5_CH1,
#if defined __SAMD21J18A__
PWM6_CH0=TC6_CH0,
PWM6_CH1=TC6_CH1,
PWM7_CH0=TC7_CH0,
PWM7_CH1=TC7_CH1,
#endif // __SAMD21J18A__
#if defined(__SAMD51__)
PWM1_CH4=TCC1_CH4,
PWM1_CH5=TCC1_CH5,
#if defined(__SAMD51J20A__)
typedef enum _EPWMChannel
{
NOT_ON_PWM=-1,
PWM0_CH0=TCC0_CH0,
PWM0_CH1=TCC0_CH1,
PWM0_CH2=TCC0_CH2,
PWM0_CH3=TCC0_CH3,
PWM0_CH4=TCC0_CH4,
PWM0_CH5=TCC0_CH5,
PWM0_CH6=TCC0_CH6,
PWM0_CH7=TCC0_CH7,
PWM1_CH0=TCC1_CH0,
PWM1_CH1=TCC1_CH1,
PWM1_CH2=TCC1_CH2,
PWM1_CH3=TCC1_CH3,
PWM1_CH4=TCC1_CH4,
PWM1_CH5=TCC1_CH5,
PWM1_CH6=TCC1_CH6,
PWM1_CH7=TCC1_CH7,
PWM2_CH0=TCC2_CH0,
PWM2_CH1=TCC2_CH1,
PWM2_CH2=TCC2_CH2,
PWM2_CH3=TCC2_CH3,
PWM3_CH0=TCC3_CH0,
PWM3_CH1=TCC3_CH1,
PWM4_CH0=TCC4_CH0,
PWM4_CH1=TCC4_CH1,
PWM5_CH0=TC5_CH0,
PWM5_CH1=TC5_CH1,
} EPWMChannel ;
#else //end __SAMD51J20A__
// Definitions for PWM channels
typedef enum _EPWMChannel
{
NOT_ON_PWM=-1,
PWM0_CH0=TCC0_CH0,
PWM0_CH1=TCC0_CH1,
PWM0_CH2=TCC0_CH2,
PWM0_CH3=TCC0_CH3,
PWM0_CH4=TCC0_CH4,
PWM0_CH5=TCC0_CH5,
PWM0_CH6=TCC0_CH6,
PWM0_CH7=TCC0_CH7,
PWM1_CH0=TCC1_CH0,
PWM1_CH1=TCC1_CH1,
PWM1_CH2=TCC1_CH2,
PWM1_CH3=TCC1_CH3,
PWM2_CH0=TCC2_CH0,
PWM2_CH1=TCC2_CH1,
PWM2_CH2=TCC2_CH2,
PWM2_CH3=TCC2_CH3,
PWM3_CH0=TC3_CH0,
PWM3_CH1=TC3_CH1,
PWM4_CH0=TC4_CH0,
PWM4_CH1=TC4_CH1,
PWM5_CH0=TC5_CH0,
PWM5_CH1=TC5_CH1,
#if defined(__SAMD21J18A__)
PWM6_CH0=TC6_CH0,
PWM6_CH1=TC6_CH1,
PWM7_CH0=TC7_CH0,
PWM7_CH1=TC7_CH1,
#endif // __SAMD21J18A__
} EPWMChannel ;
#endif
} EPWMChannel ;
typedef enum _EPortType
{

View file

@ -434,7 +434,9 @@ void analogWrite(uint32_t pin, uint32_t value)
TCC0_GCLK_ID,
TCC1_GCLK_ID,
TCC2_GCLK_ID,
TC3_GCLK_ID
TCC3_GCLK_ID,
TCC4_GCLK_ID,
TC5_GCLK_ID,
};
GCLK->PCHCTRL[GCLK_CLKCTRL_IDs[tcNum]].reg = GCLK_PCHCTRL_GEN_GCLK0_Val | (1 << GCLK_PCHCTRL_CHEN_Pos); //use clock generator 0

View file

@ -0,0 +1,31 @@
#
# Arduino Zero OpenOCD script.
#
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Define 'reset' command
define reset
info reg
break main
# End of 'reset' command
end
target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"

View file

@ -25,8 +25,8 @@
*/
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00080000-0x2000 /* First 8KB used by bootloader */
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00100000-0x2000 /* First 8KB used by bootloader */
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}
/* Linker script to place sections and symbol values. Should be used together

View file

@ -25,8 +25,8 @@
*/
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}
/* Linker script to place sections and symbol values. Should be used together

View file

@ -0,0 +1,30 @@
#
# Arduino Zero OpenOCD script.
#
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
source [find interface/cmsis-dap.cfg]
# chip name
set CHIPNAME at91samd21g18
set ENDIAN little
# choose a port here
set telnet_port 0
source [find target/at91samdXX.cfg]

View file

View file

@ -0,0 +1,21 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// API compatibility
#include "variant.h"

View file

@ -16,8 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_ARDUINO_ZERO_
#define _VARIANT_ARDUINO_ZERO_
#ifndef _VARIANT_MERTO_M4_
#define _VARIANT_MERTO_M4_
// The definitions here needs a SAMD core >=1.6.10
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
@ -78,8 +78,8 @@ extern "C"
// LEDs
#define PIN_LED_13 (13u)
#define PIN_LED_RXL (31u)
#define PIN_LED_TXL (32u)
#define PIN_LED_RXL (29u)
#define PIN_LED_TXL (30u)
#define PIN_LED PIN_LED_13
#define PIN_LED2 PIN_LED_RXL
#define PIN_LED3 PIN_LED_TXL
@ -98,9 +98,8 @@ extern "C"
#define PIN_A7 (PIN_A0 + 7)
#define PIN_A8 (PIN_A0 + 8)
#define PIN_A9 (PIN_A0 + 9)
#define PIN_A10 (PIN_A0 + 10)
#define PIN_A11 (PIN_A0 + 11)
#define PIN_DAC0 (14ul)
#define PIN_DAC1 PIN_A1
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
@ -112,10 +111,9 @@ static const uint8_t A6 = PIN_A6 ;
static const uint8_t A7 = PIN_A7 ;
static const uint8_t A8 = PIN_A8 ;
static const uint8_t A9 = PIN_A9 ;
static const uint8_t A10 = PIN_A10 ;
static const uint8_t A11 = PIN_A11 ;
static const uint8_t DAC0 = PIN_DAC0;
static const uint8_t DAC1 = PIN_DAC1;
#define ADC_RESOLUTION 12
@ -130,8 +128,8 @@ static const uint8_t ATN = PIN_ATN;
// Serial1
#define PIN_SERIAL1_RX (0ul)
#define PIN_SERIAL1_TX (1ul)
#define PAD_SERIAL1_TX (UART_TX_PAD_2)
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
#define PAD_SERIAL1_TX (UART_TX_PAD_0)
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_1)
/*
* SPI Interfaces
@ -191,6 +189,8 @@ static const uint8_t SCL = PIN_WIRE_SCL;
#define I2S_DEVICE 0
#define I2S_CLOCK_GENERATOR 3
//TODO: these
#define PIN_I2S_SD (9u)
#define PIN_I2S_SCK (1u)
#define PIN_I2S_FS (0u)
@ -241,5 +241,5 @@ extern Uart Serial1;
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial1
#endif /* _VARIANT_ARDUINO_ZERO_ */
#endif /* _VARIANT_MERTO_M4_ */