From 3371d3ad6d6741d4193183047192b68bbf411b98 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 20 Jun 2015 13:11:42 +0000 Subject: [PATCH 001/124] Add README --- README | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 000000000..2fec07667 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +This is a fork from arduino/ArduinoCore-samd on GitHub. +This will be used to add Arduino support to the MattairTech +MT-D21E and probably also the MT-D11. From ff3470b5cf0f517747b19d4bdeaf7e377391f03f Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sun, 21 Jun 2015 18:01:16 +0000 Subject: [PATCH 002/124] Initial commit of MT-D21E variant directory files --- .../gcc/flash_with_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_without_bootloader.ld | 212 ++++++++++++++++ variants/MT_D21E/pins_arduino.h | 21 ++ variants/MT_D21E/variant.cpp | 160 +++++++++++++ variants/MT_D21E/variant.h | 226 ++++++++++++++++++ 5 files changed, 830 insertions(+) create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_with_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_without_bootloader.ld create mode 100644 variants/MT_D21E/pins_arduino.h create mode 100644 variants/MT_D21E/variant.cpp create mode 100644 variants/MT_D21E/variant.h diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_with_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_with_bootloader.ld new file mode 100644 index 000000000..4475f9511 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_with_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_without_bootloader.ld new file mode 100644 index 000000000..0162f0774 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/pins_arduino.h b/variants/MT_D21E/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/MT_D21E/pins_arduino.h @@ -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" + diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp new file mode 100644 index 000000000..9ab048009 --- /dev/null +++ b/variants/MT_D21E/variant.cpp @@ -0,0 +1,160 @@ +/* + 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 +*/ + +/* + Modified 21 June 2015 by Justin Mattair + for the MattairTech MT-D21E board (www.mattairtech.com) +*/ + + +/* Pins descriptions for the MattairTech MT-D21E + * + * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (* is for default peripheral in use, () means unavailable) + * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- + * | 0 | -- | A0 | PA00 | Xin32 | *Xin32 + * | 1 | -- | A1 | PA01 | Xout32 | *Xout32 + * | 2 | 2 | A2 | PA02 | | EIC/EXTINT[2] *ADC/AIN[0] PTC/Y[0] DAC/VOUT + * | 3 | 3 | A3 | PA03 | REFA | EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFP *ADC/AIN[1] PTC/Y[1] + * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFP *ADC/AIN[4] AC/AIN[0] PTC/Y[2] (SERCOM0/PAD[0]) (TCC0/WO[0]) + * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[3] (SERCOM0/PAD[1]) (TCC0/WO[1]) + * | 6 | 6 | A6 | PA06 | | EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] (SERCOM0/PAD[2]) (TCC1/WO[0]) + * | 7 | 7 | A7 | PA07 | Voltage Divider | EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] (SERCOM0/PAD[3]) (TCC1/WO[1]) + * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] (SERCOM0/PAD[0]) (SERCOM2/PAD[0]) *TCC0/WO[0] (TCC1/WO[2]) + * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] (SERCOM0/PAD[1]) (SERCOM2/PAD[1]) *TCC0/WO[1] (TCC1/WO[3]) + * | 10 | 10 | A10 | PA10 | TX | EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] (SERCOM2/PAD[2]) (TCC1/WO[0]) TCC0/WO[2] + * | 11 | 11 | A11 | PA11 | RX | EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] (SERCOM2/PAD[3]) (TCC1/WO[1]) TCC0/WO[3] + * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] (SERCOM4/PAD[2]) *TC3/WO[0] (TCC0/WO[4]) Xin, HOST_ENABLE + * | 13 | 15 | A15 | PA15 | Xout, ATN | EIC/EXTINT[15] SERCOM2/PAD[3] (SERCOM4/PAD[3]) *TC3/WO[1] (TCC0/WO[5]) Xout, ATN + * | 14 | -- | NC | ---- | | Not Connected + * | 15 | -- | NC | ---- | | Not Connected + * | 16 | -- | Vbus | ---- | | USB Vbus + * | 17 | -- | A24- | PA24 | USB_NEGATIVE | *USB/DM + * | 18 | -- | A25+ | PA25 | USB_POSITIVE | *USB/DP + * | 19 | -- | Gnd | ---- | | Ground + * | 20 | -- | Gnd | ---- | | Ground + * | 21 | -- | Vin | ---- | | Vin + * | 22 | -- | Vcc | ---- | | Vcc + * | 23 | -- | 3.3V | ---- | | 3.3V + * | 24 | -- | NC | ---- | | Not Connected + * | 25 | -- | NC | ---- | | Not Connected + * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] (SERCOM3/PAD[0]) TCC2/WO[0] (TCC0/WO[6]) + * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] (SERCOM3/PAD[1]) TCC2/WO[1] (TCC0/WO[7]) + * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] (SERCOM1/PAD[2]) *SERCOM3/PAD[2] (TC3/WO[0]) (TCC0/WO[2]) + * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] (SERCOM1/PAD[3]) *SERCOM3/PAD[3] (TC3/WO[1]) (TCC0/WO[3]) + * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] (SERCOM5/PAD[0]) TC4/WO[0] (TCC0/WO[4]) + * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] (SERCOM5/PAD[1]) TC4/WO[1] (TCC0/WO[5]) + * | 32 | 27 | A27 | PA27 | Button A | EIC/EXTINT[15] *Button A + * | 33 | 28 | A28 | PA28 | LED | EIC/EXTINT[8] *LED + * | 34 | -- | NC | ---- | | Not Connected + * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] (SERCOM1/PAD[2]) *TCC1/WO[0] SWD CLK + * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] (SERCOM1/PAD[3]) *TCC1/WO[1] Button B SWD IO + * | 37 | -- | NC | ---- | | Not Connected + * | 38 | -- | NC | ---- | | Not Connected + * | 39 | -- | RST | ---- | | Reset + * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- + * + * You may use Arduino pin numbers ranging from 0 to 31. The Arduino pin corresponds to the silkscreen (without the 'A'). + * For example, use pinMode(28, OUTPUT) to set the LED pin (marked as A28) as an output. + * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 12, 13, 20, 21, 24, 25, 26, and 29. + * Note that pins 0 and 1 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). + * Note also that pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +const PinDescription g_APinDescription[]= +{ + // 0..1 are unused (pins in use by 32.768KHz crystal, which in turn is used by the Arduino core) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 2..9 - Analog capable pins (DAC avalable on 2) + { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC + { PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel1, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[1] + { PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4] + { PORTA, 5, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5] + { PORTA, 6, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL), ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[6] + { PORTA, 7, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL), ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_TIMER, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), ADC_Channel16, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NMI }, // TCC0/WO[0] + { PORTA, 9, PIO_TIMER, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), ADC_Channel17, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_9 }, // TCC0/WO[1] + + // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions + { PORTA, 10, PIO_SERCOM, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel18, PWM0_CH2, TCC0_CH2, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2], PIO_TIMER_ALT + { PORTA, 11, PIO_SERCOM, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel19, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3], PIO_TIMER_ALT + + // 12..13 pins don't exist + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 14..15 - Digital functions + { PORTA, 14, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM3_CH0, TC3_CH0, EXTERNAL_INT_14 }, // TC3/WO[0], HOST_ENABLE + { PORTA, 15, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_NONE }, // TC3/WO[1], ATN + + // 16..17 I2C pins (SDA/SCL) or Digital functions + { PORTA, 16, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // SDA: SERCOM1/PAD[0] + { PORTA, 17, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM2_CH1, TCC2_CH1, EXTERNAL_INT_1 }, // SCL: SERCOM1/PAD[1] + + // 18..23 - SPI Pins or Digital functions (pins 20..21 do not exist) + { PORTA, 18, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // SPI MOSI: SERCOM3/PAD[2], PIO_SERCOM_ALT + { PORTA, 19, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // SPI SCK: SERCOM3/PAD[3], PIO_SERCOM_ALT + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused +// { PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM4_CH0, TC4_CH0, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] +// { PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] + { PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] + { PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] + + // 24..26 are unused (25 and 26 in use by USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist) + { PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM + { PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 27..29 Button A and LED (pin 29 does not exist) + { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // Button A + { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // LED + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) + { PORTA, 30, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_10 }, // TCC1/WO[0] / SWD CLK + { PORTA, 31, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_11 }, // TCC1/WO[1] / SWD IO + + // 32 - Alternate use of pin 2 (DAC output) + //{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, DAC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VOUT +} ; + +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; +SERCOM sercom3( SERCOM3 ) ; +SERCOM sercom4( SERCOM4 ) ; +SERCOM sercom5( SERCOM5 ) ; + +Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM0_Handler() +{ + Serial1.IrqHandler(); +} + diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h new file mode 100644 index 000000000..e3eb01e92 --- /dev/null +++ b/variants/MT_D21E/variant.h @@ -0,0 +1,226 @@ +/* + 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 +*/ + +/* + Modified 21 June 2015 by Justin Mattair + for the MattairTech MT-D21E board (www.mattairtech.com) +*/ + +#ifndef _VARIANT_MATTAIRTECH_MT_D21E_ +#define _VARIANT_MATTAIRTECH_MT_D21E_ + +/*---------------------------------------------------------------------------- + * Definitions + *----------------------------------------------------------------------------*/ + +/** Frequency of the board main oscillator */ +#define VARIANT_MAINOSC (32768ul) + +/** Master clock frequency */ +#define VARIANT_MCK (48000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (10u) +#define NUM_ANALOG_OUTPUTS (1u) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +// Interrupts +#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) + +// LEDs +// None of these defines are currently used by the core. +// The MT-D21E onboard LED is on pin 28. +// The RX and TX LEDs are not present. +// You may optionally add them to any free pins. +#define PIN_LED_13 (28u) +#define PIN_LED_RXL (30u) +#define PIN_LED_TXL (31u) +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + +/* + * Analog pins + */ +#define PIN_A0 (2ul) +#define PIN_A1 (3ul) +#define PIN_A2 (4ul) +#define PIN_A3 (5ul) +#define PIN_A4 (6ul) +#define PIN_A5 (7ul) +#define PIN_A6 (8ul) +#define PIN_A7 (9ul) +#define PIN_A8 (10ul) +#define PIN_A9 (11ul) + +static const uint8_t A0 = PIN_A0 ; +static const uint8_t A1 = PIN_A1 ; +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +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 ; + +#define ADC_RESOLUTION 12 + +// Other pins +#define PIN_ATN (15ul) +static const uint8_t ATN = PIN_ATN; + +/* + * Serial interfaces + */ +// Serial1 +#define PIN_SERIAL1_RX (11ul) +#define PIN_SERIAL1_TX (10ul) +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI1_MISO (22u) +#define PIN_SPI1_MOSI (18u) +#define PIN_SPI1_SCK (19u) +#define PIN_SPI1_SS (23u) +#define PIN_SPI_MISO PIN_SPI1_MISO +#define PIN_SPI_MOSI PIN_SPI1_MOSI +#define PIN_SPI_SCK PIN_SPI1_SCK +#define PIN_SPI_SS PIN_SPI1_SS + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE1_SDA (16u) +#define PIN_WIRE1_SCL (17u) +#define PIN_WIRE_SDA PIN_WIRE1_SDA +#define PIN_WIRE_SCL PIN_WIRE1_SCL + +/* + * USB + */ +#define PIN_USB_HOST_ENABLE (14ul) +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; +extern SERCOM sercom3; +extern SERCOM sercom4; +extern SERCOM sercom5; + +extern Uart Serial1; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +#define SERIAL_PORT_MONITOR SerialUSB +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. +#define Serial SerialUSB + +#endif /* _VARIANT_ARDUINO_ZERO_ */ + From 41a865127c17f29a215aee2419f4038a3f08a98e Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 27 Jun 2015 19:53:11 +0000 Subject: [PATCH 003/124] Modified boards.txt to support MT-D21E and other related changes in variants directory --- README | 7 +- boards.txt | 175 ++++++++++----- bootloaders/zero/Makefile | 15 +- bootloaders/zero/main.c | 10 +- bootloaders/zero/main.h | 3 +- bootloaders/zero/readme.txt | 9 +- bootloaders/zero/samd21_sam_ba.bin | Bin 6328 -> 0 bytes bootloaders/zero/samd21j18a_flash.ld | 157 ------------- platform.txt | 9 +- programmers.txt | 6 - variants/MT_D21E/debug_scripts/SAMD21E15A.gdb | 31 +++ variants/MT_D21E/debug_scripts/SAMD21E16A.gdb | 31 +++ variants/MT_D21E/debug_scripts/SAMD21E17A.gdb | 31 +++ variants/MT_D21E/debug_scripts/SAMD21E18A.gdb | 31 +++ .../gcc/flash_128KB_with_16KB_bootloader.ld | 211 +++++++++++++++++ .../gcc/flash_128KB_with_8KB_bootloader.ld | 211 +++++++++++++++++ .../gcc/flash_128KB_without_bootloader.ld | 212 ++++++++++++++++++ .../gcc/flash_256KB_with_16KB_bootloader.ld | 211 +++++++++++++++++ ....ld => flash_256KB_with_8KB_bootloader.ld} | 0 ...r.ld => flash_256KB_without_bootloader.ld} | 0 .../gcc/flash_32KB_with_16KB_bootloader.ld | 211 +++++++++++++++++ .../gcc/flash_32KB_with_8KB_bootloader.ld | 211 +++++++++++++++++ .../gcc/flash_32KB_without_bootloader.ld | 212 ++++++++++++++++++ .../gcc/flash_64KB_with_16KB_bootloader.ld | 211 +++++++++++++++++ .../gcc/flash_64KB_with_8KB_bootloader.ld | 211 +++++++++++++++++ .../gcc/flash_64KB_without_bootloader.ld | 212 ++++++++++++++++++ .../MT_D21E/openocd_scripts/SAMD21E15A.cfg | 30 +++ .../MT_D21E/openocd_scripts/SAMD21E16A.cfg | 30 +++ .../MT_D21E/openocd_scripts/SAMD21E17A.cfg | 30 +++ .../MT_D21E/openocd_scripts/SAMD21E18A.cfg | 30 +++ 30 files changed, 2515 insertions(+), 233 deletions(-) delete mode 100644 bootloaders/zero/samd21_sam_ba.bin delete mode 100644 bootloaders/zero/samd21j18a_flash.ld create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E15A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E16A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E17A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E18A.gdb create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld rename variants/MT_D21E/linker_scripts/gcc/{flash_with_bootloader.ld => flash_256KB_with_8KB_bootloader.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_without_bootloader.ld => flash_256KB_without_bootloader.ld} (100%) create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg diff --git a/README b/README index 2fec07667..b7ae2959c 100644 --- a/README +++ b/README @@ -1,3 +1,6 @@ This is a fork from arduino/ArduinoCore-samd on GitHub. -This will be used to add Arduino support to the MattairTech -MT-D21E and probably also the MT-D11. +This will be used to maintain Arduino support for the +MattairTech MT-D21E and probably also the MT-D11. + +The resulting Arduino support package will be available +at mattairtech.github.io diff --git a/boards.txt b/boards.txt index ad7d50242..402d45548 100644 --- a/boards.txt +++ b/boards.txt @@ -14,54 +14,129 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -arduino_zero_edbg.name=Arduino Zero (Programming Port) -arduino_zero_edbg.vid.0=0x03eb -arduino_zero_edbg.pid.0=0x2157 -arduino_zero_edbg.upload.tool=openocd -arduino_zero_edbg.upload.protocol=sam-ba -arduino_zero_edbg.upload.maximum_size=262144 -arduino_zero_edbg.upload.use_1200bps_touch=false -arduino_zero_edbg.upload.wait_for_upload_port=false -arduino_zero_edbg.upload.native_usb=false -arduino_zero_edbg.build.mcu=cortex-m0plus -arduino_zero_edbg.build.f_cpu=48000000L -arduino_zero_edbg.build.usb_product="Arduino Zero" -arduino_zero_edbg.build.usb_manufacturer="Arduino LLC" -arduino_zero_edbg.build.board=SAMD_ZERO -arduino_zero_edbg.build.core=arduino -arduino_zero_edbg.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -arduino_zero_edbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld -arduino_zero_edbg.build.openocdscript=openocd_scripts/arduino_zero.cfg -arduino_zero_edbg.build.variant=arduino_zero -arduino_zero_edbg.build.variant_system_lib= -arduino_zero_edbg.build.vid=0x2341 -arduino_zero_edbg.build.pid=0x804d -arduino_zero_edbg.bootloader.tool=openocd -arduino_zero_edbg.bootloader.file=zero/samd21_sam_ba.bin +/* + * Modified 23 June 2015 by Justin Mattair + * for the MattairTech MT-D21E board (www.mattairtech.com) + */ -arduino_zero_native.name=Arduino Zero (Native USB Port) -arduino_zero_native.vid.0=0x2341 -arduino_zero_native.pid.0=0x804d -arduino_zero_native.vid.1=0x2341 -arduino_zero_native.pid.1=0x004d -arduino_zero_native.upload.tool=bossac -arduino_zero_native.upload.protocol=sam-ba -arduino_zero_native.upload.maximum_size=262144 -arduino_zero_native.upload.use_1200bps_touch=true -arduino_zero_native.upload.wait_for_upload_port=true -arduino_zero_native.upload.native_usb=true -arduino_zero_native.build.mcu=cortex-m0plus -arduino_zero_native.build.f_cpu=48000000L -arduino_zero_native.build.usb_product="Arduino Zero" -arduino_zero_native.build.usb_manufacturer="Arduino LLC" -arduino_zero_native.build.board=SAMD_ZERO -arduino_zero_native.build.core=arduino -arduino_zero_native.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -arduino_zero_native.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld -arduino_zero_native.build.openocdscript=openocd_scripts/arduino_zero.cfg -arduino_zero_native.build.variant=arduino_zero -arduino_zero_native.build.variant_system_lib= -arduino_zero_native.build.vid=0x2341 -arduino_zero_native.build.pid=0x804d -arduino_zero_native.bootloader.tool=openocd -arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin +menu.cpu=Processor + +# MattairTech MT-D21E (default 8KB bootloader) +mattairtech_mt_d21e.bl8k.name=MattairTech MT-D21E (SAM-BA bootloader) +mattairtech_mt_d21e.bl8k.vid.0=0x16D0 +mattairtech_mt_d21e.bl8k.pid.0=0x0557 +mattairtech_mt_d21e.bl8k.vid.1=0x16D0 +mattairtech_mt_d21e.bl8k.pid.1=0x0856 +mattairtech_mt_d21e.bl8k.upload.tool=arduino:bossac +mattairtech_mt_d21e.bl8k.upload.protocol=sam-ba +mattairtech_mt_d21e.bl8k.upload.use_1200bps_touch=true +mattairtech_mt_d21e.bl8k.upload.wait_for_upload_port=true +mattairtech_mt_d21e.bl8k.upload.native_usb=true +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +mattairtech_mt_d21e.bl8k.build.mcu=cortex-m0plus +mattairtech_mt_d21e.bl8k.build.f_cpu=48000000L +mattairtech_mt_d21e.bl8k.build.usb_product="MT-D21E" +mattairtech_mt_d21e.bl8k.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e.bl8k.build.board=MT_D21E +mattairtech_mt_d21e.bl8k.build.core=arduino +mattairtech_mt_d21e.bl8k.build.variant=MT_D21E +mattairtech_mt_d21e.bl8k.build.variant_system_lib= +mattairtech_mt_d21e.bl8k.build.vid=0x16D0 +mattairtech_mt_d21e.bl8k.build.pid=0x0856 +mattairtech_mt_d21e.bl8k.bootloader.tool=arduino:openocd +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.bootloader.file=zero/samd21e18a_sam_ba.bin +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.bootloader.file=zero/samd21e17a_sam_ba.bin +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.bootloader.file=zero/samd21e16a_sam_ba.bin +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam_ba.bin + + +# MattairTech MT-D21E (16KB bootloader), build only +mattairtech_mt_d21e.bl16k.name=MattairTech MT-D21E (MSD bootloader) +mattairtech_mt_d21e.bl16k.vid.0=0x16D0 +mattairtech_mt_d21e.bl16k.pid.0=0x0557 +mattairtech_mt_d21e.bl16k.vid.1=0x16D0 +mattairtech_mt_d21e.bl16k.pid.1=0x0856 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.upload.maximum_size=245760 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.upload.maximum_size=114688 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.upload.maximum_size=49152 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.upload.maximum_size=16384 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.build.mcu=cortex-m0plus +mattairtech_mt_d21e.bl16k.build.f_cpu=48000000L +mattairtech_mt_d21e.bl16k.build.usb_product="MT-D21E" +mattairtech_mt_d21e.bl16k.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e.bl16k.build.board=MT_D21E +mattairtech_mt_d21e.bl16k.build.core=arduino +mattairtech_mt_d21e.bl16k.build.variant=MT_D21E +mattairtech_mt_d21e.bl16k.build.variant_system_lib= +mattairtech_mt_d21e.bl16k.build.vid=0x16D0 +mattairtech_mt_d21e.bl16k.build.pid=0x0856 + + +# MattairTech MT-D21E (no bootloader) +mattairtech_mt_d21e.bl0k.name=MattairTech MT-D21E (no bootloader) +mattairtech_mt_d21e.bl0k.vid.0=0x16D0 +mattairtech_mt_d21e.bl0k.pid.0=0x0557 +mattairtech_mt_d21e.bl0k.vid.1=0x16D0 +mattairtech_mt_d21e.bl0k.pid.1=0x0856 +mattairtech_mt_d21e.bl0k.upload.tool=arduino:openocd +mattairtech_mt_d21e.bl0k.upload.protocol=sam-ba +mattairtech_mt_d21e.bl0k.upload.use_1200bps_touch=false +mattairtech_mt_d21e.bl0k.upload.wait_for_upload_port=false +mattairtech_mt_d21e.bl0k.upload.native_usb=false +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.upload.maximum_size=262144 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.upload.maximum_size=131072 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.upload.maximum_size=65536 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.upload.maximum_size=32768 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.build.mcu=cortex-m0plus +mattairtech_mt_d21e.bl0k.build.f_cpu=48000000L +mattairtech_mt_d21e.bl0k.build.usb_product="MT-D21E" +mattairtech_mt_d21e.bl0k.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e.bl0k.build.board=MT_D21E +mattairtech_mt_d21e.bl0k.build.core=arduino +mattairtech_mt_d21e.bl0k.build.variant=MT_D21E +mattairtech_mt_d21e.bl0k.build.variant_system_lib= +mattairtech_mt_d21e.bl0k.build.vid=0x16D0 +mattairtech_mt_d21e.bl0k.build.pid=0x0856 diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index d8fb2f349..d3758b86b 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -1,15 +1,15 @@ -IDE_PATH="../../../../.." -ARM_GCC_PATH=$(IDE_PATH)/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin +TOOLS_PATH="../../../arduino15/packages/arduino/tools" +ARM_GCC_PATH=$(TOOLS_PATH)/arm-none-eabi-gcc/4.8.3-2014q1/bin CC=$(ARM_GCC_PATH)/arm-none-eabi-gcc CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -g -Os -w -std=gnu99 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 LDFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -BLD_EXTA_FLAGS=-D__SAMD21G18A__ +BLD_EXTA_FLAGS=-D__SAMD21E18A__ BUILD_PATH=build -INCLUDES=-I$(IDE_PATH)/hardware/tools/CMSIS/CMSIS/Include/ -I$(IDE_PATH)/hardware/tools/CMSIS/Device/ATMEL/ -I./drivers/ -I./utils/ -I./utils/preprocessor/ -I./utils/interrupt +INCLUDES=-I$(TOOLS_PATH)/CMSIS/4.0.0-atmel/CMSIS/Include/ -I$(TOOLS_PATH)/CMSIS/4.0.0-atmel/Device/ATMEL/ -I./drivers/ -I./utils/ -I./utils/preprocessor/ -I./utils/interrupt SOURCES=main.c sam_ba_monitor.c startup_samd21.c usart_sam_ba.c drivers/cdc_enumerate.c drivers/uart_driver.c utils/interrupt/interrupt_sam_nvic.c OBJECTS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.o)) -NAME=samd21_sam_ba +NAME=samd21e18a_sam_ba EXECUTABLE=$(NAME).bin SLASH=/ @@ -18,7 +18,7 @@ BSLASH=$(EMPTY)\$(EMPTY) all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tsamd21j18a_flash.ld -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group + $(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tsamd21e18a_flash.ld -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group $(ARM_GCC_PATH)/arm-none-eabi-objcopy -O binary $(BUILD_PATH)/$(NAME).elf $@ $(BUILD_PATH)/%.o: %.c @@ -26,4 +26,5 @@ $(BUILD_PATH)/%.o: %.c $(CC) $(CFLAGS) $(BLD_EXTA_FLAGS) $(INCLUDES) $< -o $@ clean: - del $(EXECUTABLE) $(subst /,\,$(OBJECTS)) $(subst /,\,$(BUILD_PATH)/$(NAME).*) +# del $(EXECUTABLE) $(subst /,\,$(OBJECTS)) $(subst /,\,$(BUILD_PATH)/$(NAME).*) + rm -f $(EXECUTABLE) $(OBJECTS) $(BUILD_PATH)/$(NAME).* diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 4ad7abd54..8232238ee 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -36,7 +36,7 @@ * Supported communication interfaces : * -------------------- * - * SERCOM5 : RX:PB23 TX:PB22 + * SERCOM5 : RX:PA11 TX:PA10 * Baudrate : 115200 8N1 * * USB : D-:PA24 D+:PA25 @@ -46,11 +46,11 @@ * The following pins are used by the program : * PA25 : input/output * PA24 : input/output - * PB23 : input - * PB22 : output - * PA15 : input + * PA11 : input + * PA10 : output + * PA27 : input * - * The application board shall avoid driving the PA25,PA24,PB23,PB22 and PA15 signals + * The application board shall avoid driving the PA25,PA24,PA11,PA10 and PA27 signals * while the boot program is running (after a POR for example) * * Clock system diff --git a/bootloaders/zero/main.h b/bootloaders/zero/main.h index b8c58ec79..bcff3a546 100644 --- a/bootloaders/zero/main.h +++ b/bootloaders/zero/main.h @@ -42,8 +42,7 @@ * 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_LOAD_PIN PIN_PA27 // Pin 27 #define BOOT_PIN_MASK (1U << (BOOT_LOAD_PIN & 0x1f)) #define CPU_FREQUENCY 8000000 diff --git a/bootloaders/zero/readme.txt b/bootloaders/zero/readme.txt index 8c760449e..28ea8d431 100644 --- a/bootloaders/zero/readme.txt +++ b/bootloaders/zero/readme.txt @@ -1,6 +1,6 @@ 1- Prerequisites -IAR Embedded Workbench for ARM 7.30 +gcc-arm-none-eabi-4.8.3-2014q1 2- Selecting between USB and UART interface @@ -12,10 +12,15 @@ SAM_BA_BOTH_INTERFACES for enabling both the interfaces SAM_BA_INTERFACE value should be modified in Project Options -> C/C++ Compiler -> Preprocessor -> Defined symbols Project Options -> Assembler -> Preprocessor -> Defined symbols +The default value of SAM_BA_BOTH_INTERFACES is defined in sam_ba_monitor.h + +Additionally, you must select the cpu in the makefile (3 locations) +as well as the TOOLS_PATH variable (and possibly other include paths). +On Windows, change 'rm -f' to 'del' in the makefile (uncomment line 29, comment line 30). 3- Start application check Bootloader checks for the state of BOOT_LOAD_PIN (configurable by the user from main.h). If BOOT_LOAD_PIN is pulled low, bootloader execution is resumed. Else, the first location of application is fetched and checked. If it is empty (0xFFFFFFFF), then bootloader execution is resumed. Else it jumps to application and starts execution from there. -Currently, BOOT_LOAD_PIN is PA15 of SAMD21G18A, pin 5 of Arduino Zero board. +BOOT_LOAD_PIN is PA27 of SAMD21ExxA, Arduino pin 27 of MT-D21E board. diff --git a/bootloaders/zero/samd21_sam_ba.bin b/bootloaders/zero/samd21_sam_ba.bin deleted file mode 100644 index 08f40f425437f8fc80c2462668f3d15bdf5453d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6328 zcmcgwdw3JawV&D5%aV;H8-pY-W~DVown!pBAjS|_w8WOQ#t`Brws}-0G+h%4vYVtb z%|phak$E(J1IrL%$@(NKLWY@ooTzhNX`jFD6_D2dn9+au=Sz$q{)F#beB%r{PLO( zhaa`C>3FCvy3nyzsEgD_BhC}p2sKy-P%x~6%$nlAGOJHY3s6Gfn>js17alD_2E?ml zs)|w(pBs!I7eJ*EQZYi2H$XW(M&_7X1nJt|U|oHFz{*&{*lFQiB66a9qs&Nofk(Yq zwgsms_F!%Rm!X0&*&gIXyL2m)8jo;8+Sd9Aw-aYet>+EV95Lc(!#zQBg_>NWW{cQq z4;?)J-AC5EhDJP>@W=zB8m3QTneK`#5xH=j^xMOzKpTgh8sSFK$bqlNhO=QmKaO^ZuqaYV0YXVrb2SXJRjM(S05V{BWMxgY>?BbUFWXAlsCLha`q){kRMv+2={YdkI zU^UHKY47uz;_0lJPjOMFJTqJZQf~BELm4S}-dDr;1rJAu!kiE?It6QQD9w2$q!l%V z*%DT0FQE8r2u`TFI-pNQ;p}HKS7I9dA4M55ZQXzZz6Xj_I~C2OE`&lWH&s#-vw4a z?mr%QPc#G(n-#PMk5#?xFOpKEtzPuug~ZXNr4kiZ3y}Pm1XqCK1BthmxWNvZI42$Q z4M~)vyJAqx4&Um&Nq!y18Kib^&glapF3OgQf;J{5;zC>SSK?-Sw$$rIr|ryZ;(;Yr zsUV0)wvYaz$}P>2N~K=gOI1a|x2$EsR|1)#z5YE*Q=~mrCT5|8=M@L%F@05}+!NR< zTBPjoHm~-CQ+m#K%#NhahW3iVayGHtt&^V#aFSViGO(h-B27swb!+9FVs9W@%8=}# z^n?%EPl%6SX-D*l+o9bhc3x=*Rb``_mLCzZ!z$?&$!(Cgi`#tJpkH>B4ywuV@h_Ag z!5j~ZTY#!@WJ`4L{BVVPs@x)4B{k_%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|49;=@twwusG(>%-fhinG%530Ht|= z#IgIJUmt@^q#f_2e3>BY$QWiP4G?-}Y<;=D!~tGK`P5|77#p54K{vVOVL;7@2XfoX8Eu43#>Dh5S%WK6d#^{>Z|u zT>$NcV>DxhERpby#!@S_z&8o#Exei4GmO-Ue{1Fp(EnpjT3)w<&kP!d~w)3 zKr@@IT`;dLgp0o(ChIdGumu2)6pNY_8fPDZN@cGp;YcfJB z7B#KCr(wg!vYOhuRlw^od)YfY5An}0`;Xvo$k3AC5qS2lSGFJ8C;v9_G^}6T9m}^VQ zV_$so!G)KO?l^htoTfa>6p!u?_x}CP$8P&&`HBOZ_Sl{%efUqw@!==`@aEe`e4o_( zMA{SP4fR&a#g)Ey?DNw<{q*IFzP5%Q<6igc7wUc&II!vQb&d9A#^SP!g3Ci^j~~4B z)Mw2*YqrgM!~WvW)<1mTpDT~9bk3sZ2U8a@zxe!-%YS?S{f`RvnFgdC{wJS!;I$1W zSO0fa=7OT@Z^;QwdRqO>mmmFU?1SusWiQu09eyO*vA5;jS3Y|-Rle>})mIx65%aU? zEzdbtvup-m9{PUp_15mLOMPcvz3DLX;e+Q^pMQmF&p7WqQ8e2-dHIjl+}8A;vE$Fb z@L1cH4HuSvGV5g8(T__G=RPyJMRVuf6>D>=wTp-Le0`wj;a@%R-Qfq4)83x{hY$1q zYfgu5|CHPBy!YO$@{-#sPygW9q>DFv`cBWMZChV|aqr@q@A-7$nbM#&Vc1;S=eqy+ z%AtjyLXUG>3zf7 rom - - /* .ARM.exidx is sorted, so has to go in its own output section. */ - PROVIDE_HIDDEN (__exidx_start = .); - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > rom - PROVIDE_HIDDEN (__exidx_end = .); - - . = ALIGN(4); - _etext = .; - - .relocate : AT (_etext) - { - . = ALIGN(4); - _srelocate = .; - *(.ramfunc .ramfunc.*); - *(.data .data.*); - . = ALIGN(4); - _erelocate = .; - } > ram - - /* .bss section which is used for uninitialized data */ - .bss (NOLOAD) : - { - . = ALIGN(4); - _sbss = . ; - _szero = .; - *(.bss .bss.*) - *(COMMON) - . = ALIGN(4); - _ebss = . ; - _ezero = .; - } > ram - - /* stack section */ - .stack (NOLOAD): - { - . = ALIGN(8); - _sstack = .; - . = . + STACK_SIZE; - . = ALIGN(8); - _estack = .; - } > ram - - . = ALIGN(4); - _end = . ; -} diff --git a/platform.txt b/platform.txt index 2a130468c..8363ea9f9 100644 --- a/platform.txt +++ b/platform.txt @@ -14,13 +14,18 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +/* + * Modified 23 June 2015 by Justin Mattair + * for the MattairTech MT-D21E board (www.mattairtech.com) + */ + # Arduino SAMD Core and platform. # # For more info: # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification -name=Arduino SAMD (32-bits ARM Cortex-M0+) Boards -version=1.6.0 +name=MattairTech SAMD Boards +version=1.6.5-mt1 # Compile variables # ----------------- diff --git a/programmers.txt b/programmers.txt index fd7471b7d..93a928fc4 100644 --- a/programmers.txt +++ b/programmers.txt @@ -14,12 +14,6 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -edbg.name=Atmel EDBG -edbg.communication=USB -edbg.protocol= -edbg.program.protocol= -edbg.program.tool=openocd -edbg.program.extra_params= atmel_ice.name=Atmel-ICE atmel_ice.communication=USB diff --git a/variants/MT_D21E/debug_scripts/SAMD21E15A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E15A.gdb new file mode 100644 index 000000000..4ae3c04f0 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E15A.gdb @@ -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 at91samd21e15" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMD21E16A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E16A.gdb new file mode 100644 index 000000000..eb114b493 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E16A.gdb @@ -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 at91samd21e16" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMD21E17A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E17A.gdb new file mode 100644 index 000000000..cb1c7c44e --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E17A.gdb @@ -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 at91samd21e17" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMD21E18A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E18A.gdb new file mode 100644 index 000000000..13ee2a173 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E18A.gdb @@ -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 at91samd21e18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..717073abe --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00020000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..61ad501ed --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00020000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld new file mode 100644 index 000000000..3a172e3ae --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..710c8664c --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00040000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_with_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_with_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_without_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..d4fa67a05 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00008000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..475b359e4 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00008000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld new file mode 100644 index 000000000..4155e0791 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..6a6cc4ab0 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00010000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..a692b2ce1 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00010000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld new file mode 100644 index 000000000..5ed72842d --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg new file mode 100644 index 000000000..0355cc401 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg @@ -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 at91samd21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg new file mode 100644 index 000000000..4eaf7acfc --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg @@ -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 at91samd21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg new file mode 100644 index 000000000..6b5641483 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg @@ -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 at91samd21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg new file mode 100644 index 000000000..b99d610ef --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg @@ -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 at91samd21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] From c1fc711c08af4cb57ad4ae9620ea00b046fc944f Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 27 Jun 2015 19:56:37 +0000 Subject: [PATCH 004/124] Modified bootloader to support MT-D21E (continued from last commit) --- bootloaders/zero/samd21e15a_flash.ld | 157 +++++++++++++++++++++++++ bootloaders/zero/samd21e15a_sam_ba.bin | Bin 0 -> 6360 bytes bootloaders/zero/samd21e16a_flash.ld | 157 +++++++++++++++++++++++++ bootloaders/zero/samd21e16a_sam_ba.bin | Bin 0 -> 6360 bytes bootloaders/zero/samd21e17a_flash.ld | 157 +++++++++++++++++++++++++ bootloaders/zero/samd21e17a_sam_ba.bin | Bin 0 -> 6360 bytes bootloaders/zero/samd21e18a_flash.ld | 157 +++++++++++++++++++++++++ bootloaders/zero/samd21e18a_sam_ba.bin | Bin 0 -> 6360 bytes 8 files changed, 628 insertions(+) create mode 100644 bootloaders/zero/samd21e15a_flash.ld create mode 100755 bootloaders/zero/samd21e15a_sam_ba.bin create mode 100644 bootloaders/zero/samd21e16a_flash.ld create mode 100755 bootloaders/zero/samd21e16a_sam_ba.bin create mode 100644 bootloaders/zero/samd21e17a_flash.ld create mode 100755 bootloaders/zero/samd21e17a_sam_ba.bin create mode 100644 bootloaders/zero/samd21e18a_flash.ld create mode 100755 bootloaders/zero/samd21e18a_sam_ba.bin diff --git a/bootloaders/zero/samd21e15a_flash.ld b/bootloaders/zero/samd21e15a_flash.ld new file mode 100644 index 000000000..43d77e4f8 --- /dev/null +++ b/bootloaders/zero/samd21e15a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E15A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e15a_sam_ba.bin b/bootloaders/zero/samd21e15a_sam_ba.bin new file mode 100755 index 0000000000000000000000000000000000000000..98598dd28166dda8b565047946ec6293b18e85ab GIT binary patch literal 6360 zcmcgQdwdkt)%VWqdlRyo@Yvl9VRko!O%`$U07AlJ*ui9XCj`V)lkn&UshuE&O{#W7 zRW?NG^3ss_NP;hj7OA2byHcwuLEuwF>kgC_2)46Y8?9C2N9hI$neW^LtY7=<_vg32 z-0q3WYkfLD;n4bMk@Ph{Me&YuU2k96b>1qNN9K^9Cw7C7 zWv>;}*lj#zH}HA>+Mr==o{+&ASLX_~;%2@!SR0<^Th@c}zUf~iwm6ni4&DniLb=j! z517QrxCJgGO<|`5*ot(qP2HBd*NddAK!h^!+jc~<_ww5wcuyQ3_(XH%jMXo#-evcr z*44WnsEsbLZ{uqtHPMLU6gEH$)&Ud@>mXY7{xPjSF*QK(fp2wsh%Fpih;)ckh7|>+ zATB!?K`sD=Mo7U3Mcx48v>45f6$&6--4(2@%MVx>a~M0!oJT+olxvU}aYo<~FP5yq z9N89}9>66iZ&7Us+@kT3DpD1(GXZf7bzEml~o*6R-s}f+eJqk&BX40W8>pq4Ik%V&9v9 z(A~ginMmTmCTuxKH0Q=uxmcn^l}r&FMKTrkBh~Y~#aOz+*6lUM(^wOycTs0OQ(Zig zXL~H6bUiNpdH_G~anhl%lMfjjyrnCY>Np=#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--git a/bootloaders/zero/samd21e16a_flash.ld b/bootloaders/zero/samd21e16a_flash.ld new file mode 100644 index 000000000..d33d2d948 --- /dev/null +++ b/bootloaders/zero/samd21e16a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E16A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x800; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e16a_sam_ba.bin b/bootloaders/zero/samd21e16a_sam_ba.bin new file mode 100755 index 0000000000000000000000000000000000000000..1226419b41e3bdd43368c38fd6fd3f54cf3f5173 GIT binary patch literal 6360 zcmcgQdwdkt)%VWqdlRyo@Yvl9VRko!O%`$U07AlJ*ui9XCj`V)lkn&UshuE&O{#W7 zRW?NG^3ss_NP;hj7OA2byHcwuLEuwF>kgC_2)46Y8?9C2N9hI$neW^LtY7=<_vg32 z-0q3WYkfLD;n4bMk@Ph{Me&YuU2k96b>1qNN9K^9Cw7C7 zWv>;}*lj#zH}HA>+Mr==o{+&ASLX_~;%2@!SR0<^Th@c}zUf~iwm6ni4&DniLb=j! z517QrxCJgGO<|`5*ot(qP2HBd*NddAK!h^!+jc~<_ww5wcuyQ3_(XH%jMXo#-evcr z*44WnsEsbLZ{uqtHPMLU6gEH$)&Ud@>mXY7{xPjSF*QK(fp2wsh%Fpih;)ckh7|>+ zATB!?K`sD=Mo7U3Mcx48v>45f6$&6--4(2@%MVx>a~M0!oJT+olxvU}aYo<~FP5yq z9N89}9>66iZ&7Us+@kT3DpD1(GXZf7bzEml~o*6R-s}f+eJqk&BX40W8>pq4Ik%V&9v9 z(A~ginMmTmCTuxKH0Q=uxmcn^l}r&FMKTrkBh~Y~#aOz+*6lU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##v|`gtgme7P2HPMm4(XB0n2y$uRvc<@rc5x59uM0F$Ln(*&s}nO+iD0up0g_ hz*=<+twV}lg%Jg@jkM}!iX(_32%)!#a^2{W_#dHUAG-hm literal 0 HcmV?d00001 diff --git a/bootloaders/zero/samd21e17a_flash.ld b/bootloaders/zero/samd21e17a_flash.ld new file mode 100644 index 000000000..5167be9b1 --- /dev/null +++ b/bootloaders/zero/samd21e17a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E17A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e17a_sam_ba.bin b/bootloaders/zero/samd21e17a_sam_ba.bin new file mode 100755 index 0000000000000000000000000000000000000000..1c3d0ba58e90b82c5235c900570a1018d51081bc GIT binary patch literal 6360 zcmcgQdwdkt)%VWqdlRyo@Yvl9VRko!O%`$U07AlJ*ui9XCj`V)lkn&UshuE&O{#W7 zRW?NG^3ss_NP;hj7OA2byHcwuLEuwF>kgC_2)46Y8?9C2N9hI$neW^LtY7=<_vg32 z-@isBvRy57FB>%3JkkIW%IPwWOE z%U&y{vD)mmjb&<}h}cIgfxGDAyn{;*7u}UMyLI zIkGJ{J%CG4-mqi~x&^B!FiboT=H^wTt2I+=gHuCYb(w3|mSy7pw9^fzn~*yt9&z@o zTk0at7r0EZ<)SXi0)HFs3hK(0aN+&rXWx3UrH^#Fd}_(Q|uQz%GC!wy?235qQCJq z;v0xi@WNLYbuFquMvxx$BQILYL*>Md2=HlRT4$Pr;>--vd-C;p=tFJ(+Op0nTzc^o zEr?~AqRviaYauR(+`-uU74I*0ikv;O{=tJT@b*dn$-sMpE{NC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, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e18a_sam_ba.bin b/bootloaders/zero/samd21e18a_sam_ba.bin new file mode 100755 index 0000000000000000000000000000000000000000..864d191cfd9cb51244a8b251e9216686899fc9fc GIT binary patch literal 6360 zcmcgQdwdkt)%VWqE4vBVO?YfJLzvwOVUtDNJb;k!7T2<1w@ z-EWq{;}$rPJcXU&XDiaAHf>wVUJsJ9{9(#0Y}*me-YaZ-;5})){}bJnGZ{X4^)9;) zwXWXvKy74!eVb4lu8D*lr?3%PunwSLSO?LXeCIgGE>H;N~F>(=D+~NBJZX zIdP1P+d?Q$8-tx3oHm38-}q*DAQSfca~Tajeg!!PVi-njF!B%E_1q+!8Upf3kNUm&Fd_IDisc4{GNbbebvCt8CV1vx2Mc5G=nJBlf)s z2;B{Q)`=tzY~q%KM00LTlZ$0a(kK+c5u{KdAJRN8SWTrXY~3DHER{9$Nlxmld#Y1F z%51kan3jY~zaGHPyE!@-;)I~lAy~VDDUS0&t*FV*l(0gJnNq*hQLa7c?!60i68(*@ z5#K^V)pMy1inlN*$(^5+hd$KjuPy7W!lf5a z(V|qADH-fUwjSbw$Q_KnU-AB8PU7vE^$#9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3ufG$6&&}p`kSvl z{L}CUnTJbWu6a82aAep1=67HDd{44`!;#9bH^jr{J?Jg>$E;@QRK6_u!@%n;9qm`T z&%ZkFD06z#$Ez;BLbaw{bet-f=^4N5C#!F5{A={&bI(7zb<6roOFo%?Cgu1?MMtxr z8Q-kAKp{fWtM&;7&cod2G+OLuVMZFk&r&xEp~TPx1} z=)}0oH-7d`=Vx2Dz5c@fMb$s>>O#|`K5N{txwzYT-^msI3qH@fa(VmN-EX|m^~T-) zs@mCWCvN=O7_+^a*H$v)YU&s3K3x3%FM78h`1HvWJ9F;UuUoU?ri#6DTc#__k>n{~ z%~w}`aPOaXzx?aN=N=w hz Date: Sat, 27 Jun 2015 20:49:05 +0000 Subject: [PATCH 005/124] Re-added all changes that git undid/deleted, maybe I should try CVS --- README | 7 +- boards.txt | 175 ++++++++++---- bootloaders/zero/Makefile | 15 +- bootloaders/zero/main.c | 10 +- bootloaders/zero/main.h | 3 +- bootloaders/zero/readme.txt | 9 +- bootloaders/zero/samd21e15a_flash.ld | 157 ++++++++++++ bootloaders/zero/samd21e16a_flash.ld | 157 ++++++++++++ bootloaders/zero/samd21e17a_flash.ld | 157 ++++++++++++ bootloaders/zero/samd21e18a_flash.ld | 157 ++++++++++++ platform.txt | 9 +- programmers.txt | 6 - variants/MT_D21E/debug_scripts/SAMD21E15A.gdb | 31 +++ variants/MT_D21E/debug_scripts/SAMD21E16A.gdb | 31 +++ variants/MT_D21E/debug_scripts/SAMD21E17A.gdb | 31 +++ variants/MT_D21E/debug_scripts/SAMD21E18A.gdb | 31 +++ .../gcc/flash_128KB_with_16KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_128KB_with_8KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_128KB_without_bootloader.ld | 212 ++++++++++++++++ .../gcc/flash_256KB_with_16KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_256KB_with_8KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_256KB_without_bootloader.ld | 212 ++++++++++++++++ .../gcc/flash_32KB_with_16KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_32KB_with_8KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_32KB_without_bootloader.ld | 212 ++++++++++++++++ .../gcc/flash_64KB_with_16KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_64KB_with_8KB_bootloader.ld | 211 ++++++++++++++++ .../gcc/flash_64KB_without_bootloader.ld | 212 ++++++++++++++++ .../MT_D21E/openocd_scripts/SAMD21E15A.cfg | 30 +++ .../MT_D21E/openocd_scripts/SAMD21E16A.cfg | 30 +++ .../MT_D21E/openocd_scripts/SAMD21E17A.cfg | 30 +++ .../MT_D21E/openocd_scripts/SAMD21E18A.cfg | 30 +++ variants/MT_D21E/pins_arduino.h | 21 ++ variants/MT_D21E/variant.cpp | 160 +++++++++++++ variants/MT_D21E/variant.h | 226 ++++++++++++++++++ 35 files changed, 3973 insertions(+), 76 deletions(-) create mode 100644 bootloaders/zero/samd21e15a_flash.ld create mode 100644 bootloaders/zero/samd21e16a_flash.ld create mode 100644 bootloaders/zero/samd21e17a_flash.ld create mode 100644 bootloaders/zero/samd21e18a_flash.ld create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E15A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E16A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E17A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMD21E18A.gdb create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld create mode 100644 variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg create mode 100644 variants/MT_D21E/pins_arduino.h create mode 100644 variants/MT_D21E/variant.cpp create mode 100644 variants/MT_D21E/variant.h diff --git a/README b/README index 2fec07667..b7ae2959c 100644 --- a/README +++ b/README @@ -1,3 +1,6 @@ This is a fork from arduino/ArduinoCore-samd on GitHub. -This will be used to add Arduino support to the MattairTech -MT-D21E and probably also the MT-D11. +This will be used to maintain Arduino support for the +MattairTech MT-D21E and probably also the MT-D11. + +The resulting Arduino support package will be available +at mattairtech.github.io diff --git a/boards.txt b/boards.txt index ad7d50242..402d45548 100644 --- a/boards.txt +++ b/boards.txt @@ -14,54 +14,129 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -arduino_zero_edbg.name=Arduino Zero (Programming Port) -arduino_zero_edbg.vid.0=0x03eb -arduino_zero_edbg.pid.0=0x2157 -arduino_zero_edbg.upload.tool=openocd -arduino_zero_edbg.upload.protocol=sam-ba -arduino_zero_edbg.upload.maximum_size=262144 -arduino_zero_edbg.upload.use_1200bps_touch=false -arduino_zero_edbg.upload.wait_for_upload_port=false -arduino_zero_edbg.upload.native_usb=false -arduino_zero_edbg.build.mcu=cortex-m0plus -arduino_zero_edbg.build.f_cpu=48000000L -arduino_zero_edbg.build.usb_product="Arduino Zero" -arduino_zero_edbg.build.usb_manufacturer="Arduino LLC" -arduino_zero_edbg.build.board=SAMD_ZERO -arduino_zero_edbg.build.core=arduino -arduino_zero_edbg.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -arduino_zero_edbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld -arduino_zero_edbg.build.openocdscript=openocd_scripts/arduino_zero.cfg -arduino_zero_edbg.build.variant=arduino_zero -arduino_zero_edbg.build.variant_system_lib= -arduino_zero_edbg.build.vid=0x2341 -arduino_zero_edbg.build.pid=0x804d -arduino_zero_edbg.bootloader.tool=openocd -arduino_zero_edbg.bootloader.file=zero/samd21_sam_ba.bin +/* + * Modified 23 June 2015 by Justin Mattair + * for the MattairTech MT-D21E board (www.mattairtech.com) + */ -arduino_zero_native.name=Arduino Zero (Native USB Port) -arduino_zero_native.vid.0=0x2341 -arduino_zero_native.pid.0=0x804d -arduino_zero_native.vid.1=0x2341 -arduino_zero_native.pid.1=0x004d -arduino_zero_native.upload.tool=bossac -arduino_zero_native.upload.protocol=sam-ba -arduino_zero_native.upload.maximum_size=262144 -arduino_zero_native.upload.use_1200bps_touch=true -arduino_zero_native.upload.wait_for_upload_port=true -arduino_zero_native.upload.native_usb=true -arduino_zero_native.build.mcu=cortex-m0plus -arduino_zero_native.build.f_cpu=48000000L -arduino_zero_native.build.usb_product="Arduino Zero" -arduino_zero_native.build.usb_manufacturer="Arduino LLC" -arduino_zero_native.build.board=SAMD_ZERO -arduino_zero_native.build.core=arduino -arduino_zero_native.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -arduino_zero_native.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld -arduino_zero_native.build.openocdscript=openocd_scripts/arduino_zero.cfg -arduino_zero_native.build.variant=arduino_zero -arduino_zero_native.build.variant_system_lib= -arduino_zero_native.build.vid=0x2341 -arduino_zero_native.build.pid=0x804d -arduino_zero_native.bootloader.tool=openocd -arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin +menu.cpu=Processor + +# MattairTech MT-D21E (default 8KB bootloader) +mattairtech_mt_d21e.bl8k.name=MattairTech MT-D21E (SAM-BA bootloader) +mattairtech_mt_d21e.bl8k.vid.0=0x16D0 +mattairtech_mt_d21e.bl8k.pid.0=0x0557 +mattairtech_mt_d21e.bl8k.vid.1=0x16D0 +mattairtech_mt_d21e.bl8k.pid.1=0x0856 +mattairtech_mt_d21e.bl8k.upload.tool=arduino:bossac +mattairtech_mt_d21e.bl8k.upload.protocol=sam-ba +mattairtech_mt_d21e.bl8k.upload.use_1200bps_touch=true +mattairtech_mt_d21e.bl8k.upload.wait_for_upload_port=true +mattairtech_mt_d21e.bl8k.upload.native_usb=true +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +mattairtech_mt_d21e.bl8k.build.mcu=cortex-m0plus +mattairtech_mt_d21e.bl8k.build.f_cpu=48000000L +mattairtech_mt_d21e.bl8k.build.usb_product="MT-D21E" +mattairtech_mt_d21e.bl8k.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e.bl8k.build.board=MT_D21E +mattairtech_mt_d21e.bl8k.build.core=arduino +mattairtech_mt_d21e.bl8k.build.variant=MT_D21E +mattairtech_mt_d21e.bl8k.build.variant_system_lib= +mattairtech_mt_d21e.bl8k.build.vid=0x16D0 +mattairtech_mt_d21e.bl8k.build.pid=0x0856 +mattairtech_mt_d21e.bl8k.bootloader.tool=arduino:openocd +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.bootloader.file=zero/samd21e18a_sam_ba.bin +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.bootloader.file=zero/samd21e17a_sam_ba.bin +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.bootloader.file=zero/samd21e16a_sam_ba.bin +mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam_ba.bin + + +# MattairTech MT-D21E (16KB bootloader), build only +mattairtech_mt_d21e.bl16k.name=MattairTech MT-D21E (MSD bootloader) +mattairtech_mt_d21e.bl16k.vid.0=0x16D0 +mattairtech_mt_d21e.bl16k.pid.0=0x0557 +mattairtech_mt_d21e.bl16k.vid.1=0x16D0 +mattairtech_mt_d21e.bl16k.pid.1=0x0856 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.upload.maximum_size=245760 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.upload.maximum_size=114688 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.upload.maximum_size=49152 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.upload.maximum_size=16384 +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld +mattairtech_mt_d21e.bl16k.build.mcu=cortex-m0plus +mattairtech_mt_d21e.bl16k.build.f_cpu=48000000L +mattairtech_mt_d21e.bl16k.build.usb_product="MT-D21E" +mattairtech_mt_d21e.bl16k.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e.bl16k.build.board=MT_D21E +mattairtech_mt_d21e.bl16k.build.core=arduino +mattairtech_mt_d21e.bl16k.build.variant=MT_D21E +mattairtech_mt_d21e.bl16k.build.variant_system_lib= +mattairtech_mt_d21e.bl16k.build.vid=0x16D0 +mattairtech_mt_d21e.bl16k.build.pid=0x0856 + + +# MattairTech MT-D21E (no bootloader) +mattairtech_mt_d21e.bl0k.name=MattairTech MT-D21E (no bootloader) +mattairtech_mt_d21e.bl0k.vid.0=0x16D0 +mattairtech_mt_d21e.bl0k.pid.0=0x0557 +mattairtech_mt_d21e.bl0k.vid.1=0x16D0 +mattairtech_mt_d21e.bl0k.pid.1=0x0856 +mattairtech_mt_d21e.bl0k.upload.tool=arduino:openocd +mattairtech_mt_d21e.bl0k.upload.protocol=sam-ba +mattairtech_mt_d21e.bl0k.upload.use_1200bps_touch=false +mattairtech_mt_d21e.bl0k.upload.wait_for_upload_port=false +mattairtech_mt_d21e.bl0k.upload.native_usb=false +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.upload.maximum_size=262144 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.upload.maximum_size=131072 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.upload.maximum_size=65536 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.upload.maximum_size=32768 +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_without_bootloader.ld +mattairtech_mt_d21e.bl0k.build.mcu=cortex-m0plus +mattairtech_mt_d21e.bl0k.build.f_cpu=48000000L +mattairtech_mt_d21e.bl0k.build.usb_product="MT-D21E" +mattairtech_mt_d21e.bl0k.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e.bl0k.build.board=MT_D21E +mattairtech_mt_d21e.bl0k.build.core=arduino +mattairtech_mt_d21e.bl0k.build.variant=MT_D21E +mattairtech_mt_d21e.bl0k.build.variant_system_lib= +mattairtech_mt_d21e.bl0k.build.vid=0x16D0 +mattairtech_mt_d21e.bl0k.build.pid=0x0856 diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index d8fb2f349..d3758b86b 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -1,15 +1,15 @@ -IDE_PATH="../../../../.." -ARM_GCC_PATH=$(IDE_PATH)/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin +TOOLS_PATH="../../../arduino15/packages/arduino/tools" +ARM_GCC_PATH=$(TOOLS_PATH)/arm-none-eabi-gcc/4.8.3-2014q1/bin CC=$(ARM_GCC_PATH)/arm-none-eabi-gcc CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -g -Os -w -std=gnu99 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 LDFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -BLD_EXTA_FLAGS=-D__SAMD21G18A__ +BLD_EXTA_FLAGS=-D__SAMD21E18A__ BUILD_PATH=build -INCLUDES=-I$(IDE_PATH)/hardware/tools/CMSIS/CMSIS/Include/ -I$(IDE_PATH)/hardware/tools/CMSIS/Device/ATMEL/ -I./drivers/ -I./utils/ -I./utils/preprocessor/ -I./utils/interrupt +INCLUDES=-I$(TOOLS_PATH)/CMSIS/4.0.0-atmel/CMSIS/Include/ -I$(TOOLS_PATH)/CMSIS/4.0.0-atmel/Device/ATMEL/ -I./drivers/ -I./utils/ -I./utils/preprocessor/ -I./utils/interrupt SOURCES=main.c sam_ba_monitor.c startup_samd21.c usart_sam_ba.c drivers/cdc_enumerate.c drivers/uart_driver.c utils/interrupt/interrupt_sam_nvic.c OBJECTS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.o)) -NAME=samd21_sam_ba +NAME=samd21e18a_sam_ba EXECUTABLE=$(NAME).bin SLASH=/ @@ -18,7 +18,7 @@ BSLASH=$(EMPTY)\$(EMPTY) all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tsamd21j18a_flash.ld -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group + $(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tsamd21e18a_flash.ld -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group $(ARM_GCC_PATH)/arm-none-eabi-objcopy -O binary $(BUILD_PATH)/$(NAME).elf $@ $(BUILD_PATH)/%.o: %.c @@ -26,4 +26,5 @@ $(BUILD_PATH)/%.o: %.c $(CC) $(CFLAGS) $(BLD_EXTA_FLAGS) $(INCLUDES) $< -o $@ clean: - del $(EXECUTABLE) $(subst /,\,$(OBJECTS)) $(subst /,\,$(BUILD_PATH)/$(NAME).*) +# del $(EXECUTABLE) $(subst /,\,$(OBJECTS)) $(subst /,\,$(BUILD_PATH)/$(NAME).*) + rm -f $(EXECUTABLE) $(OBJECTS) $(BUILD_PATH)/$(NAME).* diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 4ad7abd54..8232238ee 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -36,7 +36,7 @@ * Supported communication interfaces : * -------------------- * - * SERCOM5 : RX:PB23 TX:PB22 + * SERCOM5 : RX:PA11 TX:PA10 * Baudrate : 115200 8N1 * * USB : D-:PA24 D+:PA25 @@ -46,11 +46,11 @@ * The following pins are used by the program : * PA25 : input/output * PA24 : input/output - * PB23 : input - * PB22 : output - * PA15 : input + * PA11 : input + * PA10 : output + * PA27 : input * - * The application board shall avoid driving the PA25,PA24,PB23,PB22 and PA15 signals + * The application board shall avoid driving the PA25,PA24,PA11,PA10 and PA27 signals * while the boot program is running (after a POR for example) * * Clock system diff --git a/bootloaders/zero/main.h b/bootloaders/zero/main.h index b8c58ec79..bcff3a546 100644 --- a/bootloaders/zero/main.h +++ b/bootloaders/zero/main.h @@ -42,8 +42,7 @@ * 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_LOAD_PIN PIN_PA27 // Pin 27 #define BOOT_PIN_MASK (1U << (BOOT_LOAD_PIN & 0x1f)) #define CPU_FREQUENCY 8000000 diff --git a/bootloaders/zero/readme.txt b/bootloaders/zero/readme.txt index 8c760449e..28ea8d431 100644 --- a/bootloaders/zero/readme.txt +++ b/bootloaders/zero/readme.txt @@ -1,6 +1,6 @@ 1- Prerequisites -IAR Embedded Workbench for ARM 7.30 +gcc-arm-none-eabi-4.8.3-2014q1 2- Selecting between USB and UART interface @@ -12,10 +12,15 @@ SAM_BA_BOTH_INTERFACES for enabling both the interfaces SAM_BA_INTERFACE value should be modified in Project Options -> C/C++ Compiler -> Preprocessor -> Defined symbols Project Options -> Assembler -> Preprocessor -> Defined symbols +The default value of SAM_BA_BOTH_INTERFACES is defined in sam_ba_monitor.h + +Additionally, you must select the cpu in the makefile (3 locations) +as well as the TOOLS_PATH variable (and possibly other include paths). +On Windows, change 'rm -f' to 'del' in the makefile (uncomment line 29, comment line 30). 3- Start application check Bootloader checks for the state of BOOT_LOAD_PIN (configurable by the user from main.h). If BOOT_LOAD_PIN is pulled low, bootloader execution is resumed. Else, the first location of application is fetched and checked. If it is empty (0xFFFFFFFF), then bootloader execution is resumed. Else it jumps to application and starts execution from there. -Currently, BOOT_LOAD_PIN is PA15 of SAMD21G18A, pin 5 of Arduino Zero board. +BOOT_LOAD_PIN is PA27 of SAMD21ExxA, Arduino pin 27 of MT-D21E board. diff --git a/bootloaders/zero/samd21e15a_flash.ld b/bootloaders/zero/samd21e15a_flash.ld new file mode 100644 index 000000000..43d77e4f8 --- /dev/null +++ b/bootloaders/zero/samd21e15a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E15A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e16a_flash.ld b/bootloaders/zero/samd21e16a_flash.ld new file mode 100644 index 000000000..d33d2d948 --- /dev/null +++ b/bootloaders/zero/samd21e16a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E16A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x800; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e17a_flash.ld b/bootloaders/zero/samd21e17a_flash.ld new file mode 100644 index 000000000..5167be9b1 --- /dev/null +++ b/bootloaders/zero/samd21e17a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E17A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e18a_flash.ld b/bootloaders/zero/samd21e18a_flash.ld new file mode 100644 index 000000000..d90abac6d --- /dev/null +++ b/bootloaders/zero/samd21e18a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21E18A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/platform.txt b/platform.txt index 2a130468c..8363ea9f9 100644 --- a/platform.txt +++ b/platform.txt @@ -14,13 +14,18 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +/* + * Modified 23 June 2015 by Justin Mattair + * for the MattairTech MT-D21E board (www.mattairtech.com) + */ + # Arduino SAMD Core and platform. # # For more info: # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification -name=Arduino SAMD (32-bits ARM Cortex-M0+) Boards -version=1.6.0 +name=MattairTech SAMD Boards +version=1.6.5-mt1 # Compile variables # ----------------- diff --git a/programmers.txt b/programmers.txt index fd7471b7d..93a928fc4 100644 --- a/programmers.txt +++ b/programmers.txt @@ -14,12 +14,6 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -edbg.name=Atmel EDBG -edbg.communication=USB -edbg.protocol= -edbg.program.protocol= -edbg.program.tool=openocd -edbg.program.extra_params= atmel_ice.name=Atmel-ICE atmel_ice.communication=USB diff --git a/variants/MT_D21E/debug_scripts/SAMD21E15A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E15A.gdb new file mode 100644 index 000000000..4ae3c04f0 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E15A.gdb @@ -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 at91samd21e15" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMD21E16A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E16A.gdb new file mode 100644 index 000000000..eb114b493 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E16A.gdb @@ -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 at91samd21e16" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMD21E17A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E17A.gdb new file mode 100644 index 000000000..cb1c7c44e --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E17A.gdb @@ -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 at91samd21e17" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMD21E18A.gdb b/variants/MT_D21E/debug_scripts/SAMD21E18A.gdb new file mode 100644 index 000000000..13ee2a173 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMD21E18A.gdb @@ -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 at91samd21e18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..717073abe --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00020000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..61ad501ed --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00020000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld new file mode 100644 index 000000000..3a172e3ae --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..710c8664c --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00040000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..4475f9511 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld new file mode 100644 index 000000000..0162f0774 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..d4fa67a05 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00008000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..475b359e4 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00008000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld new file mode 100644 index 000000000..4155e0791 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld new file mode 100644 index 000000000..6a6cc4ab0 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00010000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld new file mode 100644 index 000000000..a692b2ce1 --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld @@ -0,0 +1,211 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00010000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld new file mode 100644 index 000000000..5ed72842d --- /dev/null +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg new file mode 100644 index 000000000..0355cc401 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E15A.cfg @@ -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 at91samd21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg new file mode 100644 index 000000000..4eaf7acfc --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E16A.cfg @@ -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 at91samd21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg new file mode 100644 index 000000000..6b5641483 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E17A.cfg @@ -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 at91samd21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg b/variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg new file mode 100644 index 000000000..b99d610ef --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMD21E18A.cfg @@ -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 at91samd21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E/pins_arduino.h b/variants/MT_D21E/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/MT_D21E/pins_arduino.h @@ -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" + diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp new file mode 100644 index 000000000..9ab048009 --- /dev/null +++ b/variants/MT_D21E/variant.cpp @@ -0,0 +1,160 @@ +/* + 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 +*/ + +/* + Modified 21 June 2015 by Justin Mattair + for the MattairTech MT-D21E board (www.mattairtech.com) +*/ + + +/* Pins descriptions for the MattairTech MT-D21E + * + * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (* is for default peripheral in use, () means unavailable) + * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- + * | 0 | -- | A0 | PA00 | Xin32 | *Xin32 + * | 1 | -- | A1 | PA01 | Xout32 | *Xout32 + * | 2 | 2 | A2 | PA02 | | EIC/EXTINT[2] *ADC/AIN[0] PTC/Y[0] DAC/VOUT + * | 3 | 3 | A3 | PA03 | REFA | EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFP *ADC/AIN[1] PTC/Y[1] + * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFP *ADC/AIN[4] AC/AIN[0] PTC/Y[2] (SERCOM0/PAD[0]) (TCC0/WO[0]) + * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[3] (SERCOM0/PAD[1]) (TCC0/WO[1]) + * | 6 | 6 | A6 | PA06 | | EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] (SERCOM0/PAD[2]) (TCC1/WO[0]) + * | 7 | 7 | A7 | PA07 | Voltage Divider | EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] (SERCOM0/PAD[3]) (TCC1/WO[1]) + * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] (SERCOM0/PAD[0]) (SERCOM2/PAD[0]) *TCC0/WO[0] (TCC1/WO[2]) + * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] (SERCOM0/PAD[1]) (SERCOM2/PAD[1]) *TCC0/WO[1] (TCC1/WO[3]) + * | 10 | 10 | A10 | PA10 | TX | EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] (SERCOM2/PAD[2]) (TCC1/WO[0]) TCC0/WO[2] + * | 11 | 11 | A11 | PA11 | RX | EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] (SERCOM2/PAD[3]) (TCC1/WO[1]) TCC0/WO[3] + * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] (SERCOM4/PAD[2]) *TC3/WO[0] (TCC0/WO[4]) Xin, HOST_ENABLE + * | 13 | 15 | A15 | PA15 | Xout, ATN | EIC/EXTINT[15] SERCOM2/PAD[3] (SERCOM4/PAD[3]) *TC3/WO[1] (TCC0/WO[5]) Xout, ATN + * | 14 | -- | NC | ---- | | Not Connected + * | 15 | -- | NC | ---- | | Not Connected + * | 16 | -- | Vbus | ---- | | USB Vbus + * | 17 | -- | A24- | PA24 | USB_NEGATIVE | *USB/DM + * | 18 | -- | A25+ | PA25 | USB_POSITIVE | *USB/DP + * | 19 | -- | Gnd | ---- | | Ground + * | 20 | -- | Gnd | ---- | | Ground + * | 21 | -- | Vin | ---- | | Vin + * | 22 | -- | Vcc | ---- | | Vcc + * | 23 | -- | 3.3V | ---- | | 3.3V + * | 24 | -- | NC | ---- | | Not Connected + * | 25 | -- | NC | ---- | | Not Connected + * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] (SERCOM3/PAD[0]) TCC2/WO[0] (TCC0/WO[6]) + * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] (SERCOM3/PAD[1]) TCC2/WO[1] (TCC0/WO[7]) + * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] (SERCOM1/PAD[2]) *SERCOM3/PAD[2] (TC3/WO[0]) (TCC0/WO[2]) + * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] (SERCOM1/PAD[3]) *SERCOM3/PAD[3] (TC3/WO[1]) (TCC0/WO[3]) + * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] (SERCOM5/PAD[0]) TC4/WO[0] (TCC0/WO[4]) + * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] (SERCOM5/PAD[1]) TC4/WO[1] (TCC0/WO[5]) + * | 32 | 27 | A27 | PA27 | Button A | EIC/EXTINT[15] *Button A + * | 33 | 28 | A28 | PA28 | LED | EIC/EXTINT[8] *LED + * | 34 | -- | NC | ---- | | Not Connected + * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] (SERCOM1/PAD[2]) *TCC1/WO[0] SWD CLK + * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] (SERCOM1/PAD[3]) *TCC1/WO[1] Button B SWD IO + * | 37 | -- | NC | ---- | | Not Connected + * | 38 | -- | NC | ---- | | Not Connected + * | 39 | -- | RST | ---- | | Reset + * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- + * + * You may use Arduino pin numbers ranging from 0 to 31. The Arduino pin corresponds to the silkscreen (without the 'A'). + * For example, use pinMode(28, OUTPUT) to set the LED pin (marked as A28) as an output. + * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 12, 13, 20, 21, 24, 25, 26, and 29. + * Note that pins 0 and 1 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). + * Note also that pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +const PinDescription g_APinDescription[]= +{ + // 0..1 are unused (pins in use by 32.768KHz crystal, which in turn is used by the Arduino core) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 2..9 - Analog capable pins (DAC avalable on 2) + { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC + { PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel1, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[1] + { PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4] + { PORTA, 5, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5] + { PORTA, 6, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL), ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[6] + { PORTA, 7, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL), ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_TIMER, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), ADC_Channel16, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NMI }, // TCC0/WO[0] + { PORTA, 9, PIO_TIMER, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), ADC_Channel17, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_9 }, // TCC0/WO[1] + + // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions + { PORTA, 10, PIO_SERCOM, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel18, PWM0_CH2, TCC0_CH2, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2], PIO_TIMER_ALT + { PORTA, 11, PIO_SERCOM, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel19, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3], PIO_TIMER_ALT + + // 12..13 pins don't exist + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 14..15 - Digital functions + { PORTA, 14, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM3_CH0, TC3_CH0, EXTERNAL_INT_14 }, // TC3/WO[0], HOST_ENABLE + { PORTA, 15, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_NONE }, // TC3/WO[1], ATN + + // 16..17 I2C pins (SDA/SCL) or Digital functions + { PORTA, 16, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // SDA: SERCOM1/PAD[0] + { PORTA, 17, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM2_CH1, TCC2_CH1, EXTERNAL_INT_1 }, // SCL: SERCOM1/PAD[1] + + // 18..23 - SPI Pins or Digital functions (pins 20..21 do not exist) + { PORTA, 18, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // SPI MOSI: SERCOM3/PAD[2], PIO_SERCOM_ALT + { PORTA, 19, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // SPI SCK: SERCOM3/PAD[3], PIO_SERCOM_ALT + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused +// { PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM4_CH0, TC4_CH0, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] +// { PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] + { PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] + { PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] + + // 24..26 are unused (25 and 26 in use by USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist) + { PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM + { PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 27..29 Button A and LED (pin 29 does not exist) + { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // Button A + { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // LED + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + + // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) + { PORTA, 30, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_10 }, // TCC1/WO[0] / SWD CLK + { PORTA, 31, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_11 }, // TCC1/WO[1] / SWD IO + + // 32 - Alternate use of pin 2 (DAC output) + //{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, DAC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VOUT +} ; + +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; +SERCOM sercom3( SERCOM3 ) ; +SERCOM sercom4( SERCOM4 ) ; +SERCOM sercom5( SERCOM5 ) ; + +Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM0_Handler() +{ + Serial1.IrqHandler(); +} + diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h new file mode 100644 index 000000000..e3eb01e92 --- /dev/null +++ b/variants/MT_D21E/variant.h @@ -0,0 +1,226 @@ +/* + 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 +*/ + +/* + Modified 21 June 2015 by Justin Mattair + for the MattairTech MT-D21E board (www.mattairtech.com) +*/ + +#ifndef _VARIANT_MATTAIRTECH_MT_D21E_ +#define _VARIANT_MATTAIRTECH_MT_D21E_ + +/*---------------------------------------------------------------------------- + * Definitions + *----------------------------------------------------------------------------*/ + +/** Frequency of the board main oscillator */ +#define VARIANT_MAINOSC (32768ul) + +/** Master clock frequency */ +#define VARIANT_MCK (48000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (10u) +#define NUM_ANALOG_OUTPUTS (1u) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +// Interrupts +#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) + +// LEDs +// None of these defines are currently used by the core. +// The MT-D21E onboard LED is on pin 28. +// The RX and TX LEDs are not present. +// You may optionally add them to any free pins. +#define PIN_LED_13 (28u) +#define PIN_LED_RXL (30u) +#define PIN_LED_TXL (31u) +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + +/* + * Analog pins + */ +#define PIN_A0 (2ul) +#define PIN_A1 (3ul) +#define PIN_A2 (4ul) +#define PIN_A3 (5ul) +#define PIN_A4 (6ul) +#define PIN_A5 (7ul) +#define PIN_A6 (8ul) +#define PIN_A7 (9ul) +#define PIN_A8 (10ul) +#define PIN_A9 (11ul) + +static const uint8_t A0 = PIN_A0 ; +static const uint8_t A1 = PIN_A1 ; +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +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 ; + +#define ADC_RESOLUTION 12 + +// Other pins +#define PIN_ATN (15ul) +static const uint8_t ATN = PIN_ATN; + +/* + * Serial interfaces + */ +// Serial1 +#define PIN_SERIAL1_RX (11ul) +#define PIN_SERIAL1_TX (10ul) +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI1_MISO (22u) +#define PIN_SPI1_MOSI (18u) +#define PIN_SPI1_SCK (19u) +#define PIN_SPI1_SS (23u) +#define PIN_SPI_MISO PIN_SPI1_MISO +#define PIN_SPI_MOSI PIN_SPI1_MOSI +#define PIN_SPI_SCK PIN_SPI1_SCK +#define PIN_SPI_SS PIN_SPI1_SS + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE1_SDA (16u) +#define PIN_WIRE1_SCL (17u) +#define PIN_WIRE_SDA PIN_WIRE1_SDA +#define PIN_WIRE_SCL PIN_WIRE1_SCL + +/* + * USB + */ +#define PIN_USB_HOST_ENABLE (14ul) +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; +extern SERCOM sercom3; +extern SERCOM sercom4; +extern SERCOM sercom5; + +extern Uart Serial1; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +#define SERIAL_PORT_MONITOR SerialUSB +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. +#define Serial SerialUSB + +#endif /* _VARIANT_ARDUINO_ZERO_ */ + From 862489d4dcfa0ab962bdcbef8e5d3644513f1339 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 27 Jun 2015 20:52:54 +0000 Subject: [PATCH 006/124] delete stock bootloader binary and linker script --- bootloaders/zero/samd21_sam_ba.bin | Bin 6328 -> 0 bytes bootloaders/zero/samd21j18a_flash.ld | 157 --------------------------- 2 files changed, 157 deletions(-) delete mode 100644 bootloaders/zero/samd21_sam_ba.bin delete mode 100644 bootloaders/zero/samd21j18a_flash.ld diff --git a/bootloaders/zero/samd21_sam_ba.bin b/bootloaders/zero/samd21_sam_ba.bin deleted file mode 100644 index 08f40f425437f8fc80c2462668f3d15bdf5453d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6328 zcmcgwdw3JawV&D5%aV;H8-pY-W~DVown!pBAjS|_w8WOQ#t`Brws}-0G+h%4vYVtb z%|phak$E(J1IrL%$@(NKLWY@ooTzhNX`jFD6_D2dn9+au=Sz$q{)F#beB%r{PLO( zhaa`C>3FCvy3nyzsEgD_BhC}p2sKy-P%x~6%$nlAGOJHY3s6Gfn>js17alD_2E?ml zs)|w(pBs!I7eJ*EQZYi2H$XW(M&_7X1nJt|U|oHFz{*&{*lFQiB66a9qs&Nofk(Yq zwgsms_F!%Rm!X0&*&gIXyL2m)8jo;8+Sd9Aw-aYet>+EV95Lc(!#zQBg_>NWW{cQq z4;?)J-AC5EhDJP>@W=zB8m3QTneK`#5xH=j^xMOzKpTgh8sSFK$bqlNhO=QmKaO^ZuqaYV0YXVrb2SXJRjM(S05V{BWMxgY>?BbUFWXAlsCLha`q){kRMv+2={YdkI zU^UHKY47uz;_0lJPjOMFJTqJZQf~BELm4S}-dDr;1rJAu!kiE?It6QQD9w2$q!l%V z*%DT0FQE8r2u`TFI-pNQ;p}HKS7I9dA4M55ZQXzZz6Xj_I~C2OE`&lWH&s#-vw4a z?mr%QPc#G(n-#PMk5#?xFOpKEtzPuug~ZXNr4kiZ3y}Pm1XqCK1BthmxWNvZI42$Q z4M~)vyJAq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Vc1;S=eqy+ z%AtjyLXUG>3zf7 rom - - /* .ARM.exidx is sorted, so has to go in its own output section. */ - PROVIDE_HIDDEN (__exidx_start = .); - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > rom - PROVIDE_HIDDEN (__exidx_end = .); - - . = ALIGN(4); - _etext = .; - - .relocate : AT (_etext) - { - . = ALIGN(4); - _srelocate = .; - *(.ramfunc .ramfunc.*); - *(.data .data.*); - . = ALIGN(4); - _erelocate = .; - } > ram - - /* .bss section which is used for uninitialized data */ - .bss (NOLOAD) : - { - . = ALIGN(4); - _sbss = . ; - _szero = .; - *(.bss .bss.*) - *(COMMON) - . = ALIGN(4); - _ebss = . ; - _ezero = .; - } > ram - - /* stack section */ - .stack (NOLOAD): - { - . = ALIGN(8); - _sstack = .; - . = . + STACK_SIZE; - . = ALIGN(8); - _estack = .; - } > ram - - . = ALIGN(4); - _end = . ; -} From 6bf52720110135e1681622f27f7c24ab0aeed845 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 20 Jul 2015 12:15:53 +0000 Subject: [PATCH 007/124] New pinDescriptions table format --- README | 6 - README.md | 341 ++++++ boards.txt | 230 ++--- bootloaders/zero/Makefile | 24 +- bootloaders/zero/drivers/cdc_enumerate.c | 8 +- bootloaders/zero/drivers/cdc_enumerate.h | 5 + .../zero/linker_scripts/samd11c14a_flash.ld | 157 +++ .../zero/linker_scripts/samd11d14am_flash.ld | 157 +++ .../zero/linker_scripts/samd11d14as_flash.ld | 157 +++ .../{ => linker_scripts}/samd21e15a_flash.ld | 0 .../{ => linker_scripts}/samd21e16a_flash.ld | 0 .../{ => linker_scripts}/samd21e17a_flash.ld | 0 .../{ => linker_scripts}/samd21e18a_flash.ld | 0 .../zero/linker_scripts/samd21g15a_flash.ld | 157 +++ .../zero/linker_scripts/samd21g16a_flash.ld | 157 +++ .../zero/linker_scripts/samd21g17a_flash.ld | 157 +++ .../zero/linker_scripts/samd21g18a_flash.ld | 157 +++ .../zero/linker_scripts/samd21j15a_flash.ld | 157 +++ .../zero/linker_scripts/samd21j16a_flash.ld | 157 +++ .../zero/linker_scripts/samd21j17a_flash.ld | 157 +++ .../zero/linker_scripts/samd21j18a_flash.ld | 157 +++ bootloaders/zero/main.c | 43 +- bootloaders/zero/main.h | 23 +- bootloaders/zero/readme.txt | 79 +- bootloaders/zero/sam_ba_monitor.c | 22 +- bootloaders/zero/sam_ba_monitor.h | 3 + bootloaders/zero/samd21e15a_sam_ba.bin | Bin 6360 -> 6384 bytes bootloaders/zero/samd21e16a_sam_ba.bin | Bin 6360 -> 6384 bytes bootloaders/zero/samd21e17a_sam_ba.bin | Bin 6360 -> 6384 bytes bootloaders/zero/samd21e18a_sam_ba.bin | Bin 6360 -> 6384 bytes bootloaders/zero/startup_samd11.c | 201 ++++ bootloaders/zero/startup_samd21.c | 74 +- cores/arduino/Reset.cpp | 14 +- cores/arduino/SERCOM.cpp | 15 +- cores/arduino/SERCOM.h | 2 + cores/arduino/Tone.cpp | 3 +- cores/arduino/USB/samd21_device.c | 14 +- cores/arduino/USB/samd21_host.c | 970 +++++++++--------- cores/arduino/Uart.cpp | 26 +- cores/arduino/WInterrupts.c | 14 +- cores/arduino/WVariant.h | 199 ++-- cores/arduino/cortex_handlers.c | 178 ++++ cores/arduino/delay.c | 4 +- cores/arduino/startup.c | 173 ---- cores/arduino/wiring.c | 11 +- cores/arduino/wiring_analog.c | 156 ++- cores/arduino/wiring_digital.c | 55 +- cores/arduino/wiring_private.c | 154 ++- cores/arduino/wiring_private.h | 4 +- libraries/SPI/SPI.cpp | 12 +- libraries/SPI/SPI.h | 1 + libraries/USBHost/src/Usb.cpp | 8 +- libraries/Wire/Wire.cpp | 14 +- libraries/Wire/Wire.h | 4 + platform.txt | 9 +- programmers.txt | 30 - variants/MT_D21E/variant.cpp | 215 ++-- variants/MT_D21E/variant.h | 128 ++- 58 files changed, 3941 insertions(+), 1258 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100644 bootloaders/zero/linker_scripts/samd11c14a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd11d14am_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd11d14as_flash.ld rename bootloaders/zero/{ => linker_scripts}/samd21e15a_flash.ld (100%) rename bootloaders/zero/{ => linker_scripts}/samd21e16a_flash.ld (100%) rename bootloaders/zero/{ => linker_scripts}/samd21e17a_flash.ld (100%) rename bootloaders/zero/{ => linker_scripts}/samd21e18a_flash.ld (100%) create mode 100644 bootloaders/zero/linker_scripts/samd21g15a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21g16a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21g17a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21g18a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21j15a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21j16a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21j17a_flash.ld create mode 100644 bootloaders/zero/linker_scripts/samd21j18a_flash.ld create mode 100644 bootloaders/zero/startup_samd11.c create mode 100644 cores/arduino/cortex_handlers.c delete mode 100644 programmers.txt diff --git a/README b/README deleted file mode 100644 index b7ae2959c..000000000 --- a/README +++ /dev/null @@ -1,6 +0,0 @@ -This is a fork from arduino/ArduinoCore-samd on GitHub. -This will be used to maintain Arduino support for the -MattairTech MT-D21E and probably also the MT-D11. - -The resulting Arduino support package will be available -at mattairtech.github.io diff --git a/README.md b/README.md new file mode 100644 index 000000000..0bad69d63 --- /dev/null +++ b/README.md @@ -0,0 +1,341 @@ +# MattairTech Arduino SAMD Core + +This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support +for SAMD boards including the MattairTech MT-D21E and the MT-D11 (see https://www.mattairtech.com/). +It primarily adds support for new devices as well as a more flexible pin configuration / mapping system. +This core is intended to be installed using the Boards Manager (see below). + + +## Summary +Feature | Value +------------------------|------------------------------------------------------------------------------ +Microcontroller | ATSAMD21ExxA, 32-Bit ARM Cortex M0+ +Clock Speed | 48 MHz +Flash Memory | 256 KB (D21E18A) / 128 KB (D21E17A) / 64 KB (D21E16A) / 32 KB (D21E15A) +SRAM | 32 KB (D21E18A) / 16 KB (D21E17A) / 8 KB (D21E16A) / 4 KB (D21E15A) +EEPROM | None (emulation may be available in the future) +Digital Pins | 22 +Analog Input Pins | 10, 12-bit ADC channels +Analog Output Pins | 1, 10-bit DAC +PWM Output Pins | 12 +External Interrupts | 15 (1 NMI) +UART (Serial) | 2 +SPI | 1 +I2C (TWI) | 1 +Operating Voltage | 3.3V (Do not connect voltages higher than 3.3V!) +DC Current per I/O Pin | 7 mA + + +## Pin Configurations + +Most pins have multiple configurations available (even analog pins). For example, pin A10 can be an analog input, a +PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board but +without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! + +``` +============================================ MattairTech MT-D21E (ATsamd21eXXa) ======================================= +Comm/Other INT PWM Digital Analog Digital PWM INT Comm/other +======================================================================================================================= + ----------------------- +Xin32 | A0 RST | Reset +Xout32 | A1 NC | + 2 2 (ADC0, DAC) | A2 NC | + 3 3 (ADC1, REF) | A3 A31 | 31 TCC1/WO[1] INT11 Button B / SWD IO + INT4 4 4 (ADC4) | A4 A30 | 30 TCC1/WO[0] INT10 SWD CLK + INT5 5 5 (ADC5) | A5 NC | + 6 6 (ADC6) | A6 A28 | 28 INT8 LED +VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A + INTNMI TCC0/WO[0] 8 8 (ADC16) | A8 A23 | 23 TC4/WO[1] INT7 SPI SS + INT9 TCC0/WO[1] 9 9 (ADC17) | A9 A22 | 22 TC4/WO[0] INT6 SPI MISO +TX (1) TCC0/WO[2] 10 10 (ADC18) | A10 A19 | 19 INT3 SPI SCK +RX (1) TCC0/WO[3] 11 11 (ADC19) | A11 A18 | 18 INT2 SPI MOSI +TX (2) INT14 TC3/WO[0] 14 | A14 A17 | 17 TCC2/WO[1] INT1 I2C/SCL +RX (2) TC3/WO[1] 15 | A15 A16 | 16 TCC2/WO[0] INT0 I2C/SDA + | NC NC | + | NC NC | + | Vbus 3.3V | +USB D- | A24- _____ Vcc | +USB D+ | A25+ | | Vin | + | Gnd | USB | Gnd | + ----------------------- +``` + +#### All pins operate at 3.3 volts. DO NOT connect voltages higher than 3.3V! + +* Digital: All 22 pins can be used for general purpose I/O (INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN). + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + * Use the pinMode(), digitalWrite(), and digitalRead() functions. +* Analog Inputs: 10 pins can be configured as ADC analog inputs. + * These are available on pins 2 through 11 using the analogRead() function. + * These pins can be used for GPIO and other digital functions (ie. pwm and serial) as well. + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * Each pin measures from ground to 3.3 volts. + * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. +* DAC: One analog output is available on pin 2. + * Provides a 10-bit voltage output with the analogWrite() function. +* PWM: 12 pins can be configured as PWM outputs. + * Available on pins 8, 9, 10, 11, 14, 15, 16, 17, 22, 23, 30, and 31 using the analogWrite() function. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. +* External Interrupts: 15 pins can be configured with external interrupts. + * Available on all the pins except pins 2, 3, 6, 7, 10, 11, and 15 using the attachInterrupt() function. +* Serial: 2 pairs of pins can be configured for TTL serial I/O. + * Serial1: pin 11 (RX) and pin 10 (TX). + * Serial2: pin 15 (RX) and pin 14 (TX). +* SPI: 3 or 4 pins can be configured for SPI I/O. + * Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). + * SPI communication using the SPI library. +* TWI (I2C): 2 pins can be configured for TWI I/O. + * Pin 16 (SDA) and pin 17 (SCL). + * TWI communication using the Wire library. +* LED: One pin can be configured to light the onboard LED. + * Pin 28 (LED_BUILTIN). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. +* Button: One pin can be configured to read the onboard Button A. + * Pin 27 (BUTTON_BUILTIN). Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. +* AREF: One pin can be configured as an AREF analog input. + * The upper end of the analog measurement range can be changed using the analogReference() function. +* Reset: Bring this line LOW to reset the microcontroller. + +#### MT-D21E Board Configuration + +* The 32.768KHz crystal is used by the Arduino core, so it MUST be connected via the solder jumpers. +* Note that the sketch may still run without the crystal attached, but the clock speed will be very inaccurate. +* The 16MHz crystal is not used. It should be disconnected via the solder jumpers. +* The I2C (TWI) pullup resistors should be enabled via the solder jumpers. +* The LED should be enabled via the solder jumper. +* Button A should be connected via the solder jumper. The debouncing capacitor should also be connected. +* Button B is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. +* A reference voltage can be connected to AREF. In this case, the capacitors should be enabled via the solder jumper. + + +## Serial Monitor + +To print to the Serial Monitor over USB, use 'Serial'. Serial points to SerialUSB (Serial1 and Serial2 are UARTS). +Unlike most Arduino boards (ie. Uno), SAMD boards do not automatically reset when the serial monitor is opened. +To see what your sketch outputs to the serial monitor from the beginning, the sketch must wait for the SerialUSB +port to open first. Add the following to setup(): + +``` +while (!Serial) ; +``` + +Remember that if the sketch needs to run without SerialUSB connected, another approach must be used. + +You can also reset the board manually with the Reset button if you wish to restart your sketch. However, pressing +the Reset button will reset the SAMD chip, which in turn will reset USB communication. This interruption means +that if the serial monitor is open, it will be necessary to close and re-open it to restart communication. + + + +## Installation + +### Driver Installation + +#### Windows + +There are two "drivers", a CDC only driver for the bootloader, and a CDC-HID driver for Arduino sketches (optional). +The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP3), Vista, 7, and 8. + +1. If you do not already have the SAM-BA bootloader installed, see below. +2. Download https://www.mattairtech.com/software/MattairTech_CDC_Driver_Signed.zip and unzip into any folder. +3. Plug in the board while holding down button A to enter the bootloader. The LED should light. +4. Windows will detect the board. Point the installer to the folder from above to install the bootloader driver. +5. If you don't intend on using Arduino, you can skip the rest of this list. See Using Bossac Standalone below. +6. If you do not already have the test firmware installed, see Using Bossac Standalone below. +7. Press the reset button to run the test firmware (blink sketch with CDC-HID). +8. Windows will detect the board. Point the installer to the folder from above to install the sketch driver. +9. Continue with SAMD Core Installation below. + +#### Linux + +0. No driver installation is needed. +1. On some distros, you may need to add your user to the same group as the port (ie: dialout) and/or set udev rules. +2. You MAY have to install and use Arduino as the root user in order to get reliable access to the serial port. + * This is true even when group permissions are set correctly, and it may fail after previously working. + * You can also create/modify a udev rule to set permissions on the port so *everyone* can read / write. +3. Continue with SAMD Core Installation below. + +#### OS X + +1. As of this writing, only the 256 KB chip variants work with the OS X version of the upload tool, bossac. +2. First, you will need to open boards.txt and change mattairtech_mt_d21e_bl8k.upload.tool to equal arduino:bossac. +3. No driver installation is needed. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: + * Click the "Network Preferences..." button, then click "Apply". + * The board will show up as “Not Configuredâ€, but it will work fine. +4. Continue with SAMD Core Installation below. + +### SAMD Core Installation + +1. The MattairTech SAMD Core requires Arduino 1.6.5+. +2. In the Arduino IDE 1.6.5+, click File->Preferences. +3. Click the button next to Additional Boards Manager URLs. +4. Add https://www.mattairtech.com/software/arduino/package_MattairTech_index.json. +5. Save preferences, then open the Boards Manager. +6. Install the Arduino SAMD Boards package. +7. Install the MattairTech SAMD Boards package. +8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E. +9. Select the processor with the now visible Tools->Processor menu. +10. If you do not already have the bootloader or blink sketch installed, see SAM-BA USB CDC Bootloader below. +11. Plug in the board. The blink sketch should be running. +12. Click Tools->Port and choose the COM port. +13. You can now upload your own sketch. + + + +## SAM-BA USB CDC Bootloader (Arduino Zero compatible) + +The SAM-BA bootloader has both a CDC USB interface, and a UART interface (TX: pin 10, RX: pin 11). It is +compatible with the Arduino IDE (Zero compatible), or it can be used with the Bossac tool standalone. Under +Arduino, auto-reset is supported (automatically runs the bootloader while the sketch is running) as well as +automatic return freom reset. The SAM-BA bootloader described here adds to the Arduino version, which in +turn is based on the bootloader from Atmel. The Arduino version added several features, including three +new commands (Arduino Extended Capabilities) that increase upload speed. The bootloader normally requires +8 KB FLASH, however, a 4 KB version can be used for the D11 chips. + +Bossac is a command line utility for uploading firmware to SAM-BA bootloaders. It runs on Windows. Linux, and OS X. +It is used by Arduino to upload firmware to SAM and SAMD boards. The version Bossac described here adds to the +Arduino version (https://github.com/shumatech/BOSSA, Arduino branch), which in turn is a fork from the original +Bossa (http://www.shumatech.com/web/products/bossa). It adds support for more SAMD chips (both D21 and D11). + +Note that only the Arduino or Mattairtech versions of bossac are currently supported for SAMD chips. +Neither the stock bossac (or Bossa) nor the Atmel SAM-BA upload tool will work. + +Arduino Extended Capabilities: + + * X: Erase the flash memory starting from ADDR to the end of flash. + * Y: Write the content of a buffer in SRAM into flash memory. + * Z: Calculate the CRC for a given area of memory. + +The bootloader can be started by: + + * Tapping reset twice in quick succession (BOOT_DOUBLE_TAP). + * Holding down button A (BOOT_LOAD_PIN) while powering up. + * Clicking 'Upload Sketch' in the Arduino IDE, which will automatically start the bootloader. + * If the application (sketch) area is blank, the bootloader will run. + +Otherwise, it jumps to application and starts execution from there. The LED will light during bootloader execution. +Note that the 4KB bootloader does not support the Arduino Extended Capabilities or BOOT_DOUBLE_TAP. + +When the Arduino IDE initiates the bootloader, the following procedure is used: + +1. The IDE opens and closes the USB serial port at a baud rate of 1200bps. This triggers a “soft erase†procedure. +2. The flash memory is erased by the MCU. If it is interrupted for any reason, the erase procedure will likely fail. +3. The board is reset. The bootloader (which always runs first) detects a blank FLASH, so bootloader operation resumes. +4. Opening and closing the port at a baud rate other than 1200bps will not erase or reset the SAMD. + +### Bootloader Firmware Installation + +#### Bootloader Installation Using the Arduino IDE + +1. If you do not already have the MattairTech SAMD core installed, see SAMD Core Installation above. +2. Plug an Atmel ICE into USB, then connect it to the powered SAMD board. A green LED should light on the Atmel ICE. +3. Click Tools->Programmer->Atmel ICE. +4. Click Tools->Board->MattairTech MT-D21E. +5. Click Tools->Burn Bootloader. Ignore any messages about not supporting shutdown or reset. +6. Continue with driver installation above. + +#### Bootloader Installation Using Another Tool (ie: Atmel Studio, openocd) + +1. Download the bootloader from https://www.mattairtech.com/software/arduino/SAM-BA-bootloaders-zero-mattairtech.zip. +2. Unzip to any directory. Be sure that a bootloader is available for your particular chip. +3. Follow the procedures for your upload tool to upload the firmware. + * Perform a chip erase first. Be sure no BOOTPROT bits are set. + * Install the binary file to 0x00000000 of the FLASH. + * You can optionally set the BOOTPROT bits to 8KB. The Arduino installation method does not set these. + * You can optionally set the EEPROM bits or anything else. The Arduino installation method uses factory defaults. +4. Continue with driver installation above. + +### Using Bossac Standalone + +When using Bossac standalone, you will need to ensure that your application starts at 0x00002000 for 8 KB bootloaders, +and 0x00001000 for 4 KB bootloaders. This is because the bootloader resides at 0x00000000. This can be accomplished +by passing the following flag to the linker (typically LDFLAGS in your makefile; adjust for your bootloader size): + +``` +­Wl,­­section­start=.text=0x2000 +``` + +You may also use a linker script. See the MattairTech SAMD package for examples. +Be sure to generate and use a binary file. Many makefiles are set up to generate an elf, hex, and bin already. + +Download Bossac from: + +* https://www.mattairtech.com/software/arduino/bossac-1.5-arduino-mattairtech-1-mingw32.zip (Windows 32 bit and 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.5-arduino-mattairtech-1-x86_64-linux-gnu.tar.bz2 (Linux 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.5-arduino-mattairtech-1-i686-linux-gnu.tar.bz2 (Linux 32 bit) +* Use the bossac command from the Arduino SAMD package for OS X support. Only the 256 KB chip versions are supported + +As an example, bossac will be used to upload the test firmware (blink sketch): + +1. Download firmware from https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip and unzip. +2. If you have not already installed the bootloader driver, see Driver Installation above. +3. Be sure there is a binary that matches your chip. On the command line (change the binary to match yours): +4. On Linux --port might be /dev/ttyACM0. If the device is not found, remove the --port argument for auto-detection. + +``` +bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R +``` +5. See http://manpages.ubuntu.com/manpages/vivid/man1/bossac.1.html for details. +6. Continue with the CDC-HID driver installation above (optional). + + + +## New PinDescription Table + +``` +/* The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple + * functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures + * which functions can be used for each pin. This table is mainly accessed by the pinPeripheral function in + * wiring_private.c, which is used to attach a pin to a particular peripheral function. The communications drivers + * (ie: SPI, I2C, and UART), analogRead(), analogWrite(), analogReference(), attachInterrupt(), and pinMode() all + * call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for + * that function. Most of the contents of pinMode() are now in pinPeripheral(). + * + * Explanation of PinDescription table: + * + * Port This is the port (ie: PORTA). + * Pin This is the pin (bit) within the port. Valid values are 0 through 31. + * PinType This indicates what peripheral function the pin can be attached to. In most cases, this + * is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. + * It can also be set to a specific peripheral. In this case, any attempt to configure the + * pin (using pinPeripheral or pinMode) as anything else will fail (and pinPeripheral will + * return -1). This can be used to prevent accidental re-configuration of a pin that is + * configured for only one function (ie: USB D- and D+ pins). If a pin is not used or does + * not exist, PIO_NOT_A_PIN must be entered in this field. See WVariant.h for valid + * entries. These entries are also used as a parameter to pinPeripheral() with the + * exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function now calls pinPeripheral() + * with the desired mode. Note that this field is not used to select between the two + * peripherals possible with each of the SERCOM and TIMER functions. PeripheralAttribute + * is now used for this. + * PeripheralAttribute This is an 8-bit bitfield used for various peripheral configuration. It is primarily + * used to select between the two peripherals possible with each of the SERCOM and TIMER + * functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. + * This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) uses + * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. Both TIMER and + * SERCOM can exist for each pin. This bitfield is also used to set the pin drive strength. + * In the future, other attributes (like input buffer configuration) may be added. + * See WVariant.h for valid entries. + * PinAttribute This is a 32-bit bitfield used to list all of the valid peripheral functions that a pin + * can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain attributes + * are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL includes all of + * the GPIO functions, while PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and + * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). PIN_ATTR_ANALOG is an alias to + * PIN_ATTR_ANALOG_ADC. There is only one DAC channel, so PIN_ATTR_DAC appears only once. + * This bitfield is useful for limiting a pin to only input related functions or output + * functions. This allows a pin to have a more flexible configuration, while restricting + * the direction (ie: to avoid contention). See WVariant.h for valid entries. + * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some TC channels are available + * on multiple pins (ie: TCC0/WO[0] is available on pin A4 or pin A8). In general, only + * one pin should be configured (in the pinDescription table) per TC channel. + * See WVariant.h for valid entries. The tone library uses TC5. + * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See WVariant.h for valid entries. + * ExtInt This is the interrupt (if any) assigned to the pin. Some interrupt numbers are available + * on multiple pins (ie: EIC/EXTINT[2] is available on pin A2 or pin A18). In general, only + * one pin should be configured (in the pinDescription table) per interrupt number. Thus, + * if an interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. + * See WVariant.h for valid entries. + */ +``` diff --git a/boards.txt b/boards.txt index 402d45548..baf3dd41c 100644 --- a/boards.txt +++ b/boards.txt @@ -14,129 +14,125 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* - * Modified 23 June 2015 by Justin Mattair - * for the MattairTech MT-D21E board (www.mattairtech.com) - */ - menu.cpu=Processor # MattairTech MT-D21E (default 8KB bootloader) -mattairtech_mt_d21e.bl8k.name=MattairTech MT-D21E (SAM-BA bootloader) -mattairtech_mt_d21e.bl8k.vid.0=0x16D0 -mattairtech_mt_d21e.bl8k.pid.0=0x0557 -mattairtech_mt_d21e.bl8k.vid.1=0x16D0 -mattairtech_mt_d21e.bl8k.pid.1=0x0856 -mattairtech_mt_d21e.bl8k.upload.tool=arduino:bossac -mattairtech_mt_d21e.bl8k.upload.protocol=sam-ba -mattairtech_mt_d21e.bl8k.upload.use_1200bps_touch=true -mattairtech_mt_d21e.bl8k.upload.wait_for_upload_port=true -mattairtech_mt_d21e.bl8k.upload.native_usb=true -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a=SAMD21E18A -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.upload.maximum_size=253952 -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a=SAMD21E17A -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.upload.maximum_size=122880 -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a=SAMD21E16A -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.upload.maximum_size=57344 -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a=SAMD21E15A -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.upload.maximum_size=24576 -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg -mattairtech_mt_d21e.bl8k.build.mcu=cortex-m0plus -mattairtech_mt_d21e.bl8k.build.f_cpu=48000000L -mattairtech_mt_d21e.bl8k.build.usb_product="MT-D21E" -mattairtech_mt_d21e.bl8k.build.usb_manufacturer="MattairTech LLC" -mattairtech_mt_d21e.bl8k.build.board=MT_D21E -mattairtech_mt_d21e.bl8k.build.core=arduino -mattairtech_mt_d21e.bl8k.build.variant=MT_D21E -mattairtech_mt_d21e.bl8k.build.variant_system_lib= -mattairtech_mt_d21e.bl8k.build.vid=0x16D0 -mattairtech_mt_d21e.bl8k.build.pid=0x0856 -mattairtech_mt_d21e.bl8k.bootloader.tool=arduino:openocd -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e18a.bootloader.file=zero/samd21e18a_sam_ba.bin -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e17a.bootloader.file=zero/samd21e17a_sam_ba.bin -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e16a.bootloader.file=zero/samd21e16a_sam_ba.bin -mattairtech_mt_d21e.bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam_ba.bin +mattairtech_mt_d21e_bl8k.name=MattairTech MT-D21E (SAM-BA bootloader) +mattairtech_mt_d21e_bl8k.vid.0=0x16D0 +mattairtech_mt_d21e_bl8k.pid.0=0x0557 +mattairtech_mt_d21e_bl8k.vid.1=0x16D0 +mattairtech_mt_d21e_bl8k.pid.1=0x0856 +mattairtech_mt_d21e_bl8k.upload.tool=MattairTech_Arduino:bossac +# mattairtech_mt_d21e_bl8k.upload.tool=arduino:bossac +mattairtech_mt_d21e_bl8k.upload.protocol=sam-ba +mattairtech_mt_d21e_bl8k.upload.use_1200bps_touch=true +mattairtech_mt_d21e_bl8k.upload.wait_for_upload_port=true +mattairtech_mt_d21e_bl8k.upload.native_usb=true +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ -D__8KB_BOOTLOADER__ {build.usb_flags} +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ -D__8KB_BOOTLOADER__ {build.usb_flags} +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ -D__8KB_BOOTLOADER__ {build.usb_flags} +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ -D__8KB_BOOTLOADER__ {build.usb_flags} +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +mattairtech_mt_d21e_bl8k.build.mcu=cortex-m0plus +mattairtech_mt_d21e_bl8k.build.f_cpu=48000000L +mattairtech_mt_d21e_bl8k.build.usb_product="MT-D21E" +mattairtech_mt_d21e_bl8k.build.usb_manufacturer="MattairTech" +mattairtech_mt_d21e_bl8k.build.board=MT_D21E +mattairtech_mt_d21e_bl8k.build.core=arduino +mattairtech_mt_d21e_bl8k.build.variant=MT_D21E +mattairtech_mt_d21e_bl8k.build.variant_system_lib= +mattairtech_mt_d21e_bl8k.build.vid=0x16D0 +mattairtech_mt_d21e_bl8k.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.bootloader.tool=arduino:openocd +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.bootloader.file=zero/samd21e18a_sam_ba.bin +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.bootloader.file=zero/samd21e17a_sam_ba.bin +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.bootloader.file=zero/samd21e16a_sam_ba.bin +mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam_ba.bin # MattairTech MT-D21E (16KB bootloader), build only -mattairtech_mt_d21e.bl16k.name=MattairTech MT-D21E (MSD bootloader) -mattairtech_mt_d21e.bl16k.vid.0=0x16D0 -mattairtech_mt_d21e.bl16k.pid.0=0x0557 -mattairtech_mt_d21e.bl16k.vid.1=0x16D0 -mattairtech_mt_d21e.bl16k.pid.1=0x0856 -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a=SAMD21E18A -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.upload.maximum_size=245760 -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a=SAMD21E17A -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.upload.maximum_size=114688 -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a=SAMD21E16A -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.upload.maximum_size=49152 -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a=SAMD21E15A -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.upload.maximum_size=16384 -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} -mattairtech_mt_d21e.bl16k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld -mattairtech_mt_d21e.bl16k.build.mcu=cortex-m0plus -mattairtech_mt_d21e.bl16k.build.f_cpu=48000000L -mattairtech_mt_d21e.bl16k.build.usb_product="MT-D21E" -mattairtech_mt_d21e.bl16k.build.usb_manufacturer="MattairTech LLC" -mattairtech_mt_d21e.bl16k.build.board=MT_D21E -mattairtech_mt_d21e.bl16k.build.core=arduino -mattairtech_mt_d21e.bl16k.build.variant=MT_D21E -mattairtech_mt_d21e.bl16k.build.variant_system_lib= -mattairtech_mt_d21e.bl16k.build.vid=0x16D0 -mattairtech_mt_d21e.bl16k.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.name=MattairTech MT-D21E (MSD bootloader) +#mattairtech_mt_d21e_bl16k.vid.0=0x16D0 +#mattairtech_mt_d21e_bl16k.pid.0=0x0557 +#mattairtech_mt_d21e_bl16k.vid.1=0x16D0 +#mattairtech_mt_d21e_bl16k.pid.1=0x0856 +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a=SAMD21E18A +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a.upload.maximum_size=245760 +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ -D__16KB_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a=SAMD21E17A +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a.upload.maximum_size=114688 +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ -D__16KB_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a=SAMD21E16A +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a.upload.maximum_size=49152 +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ -D__16KB_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a=SAMD21E15A +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a.upload.maximum_size=16384 +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ -D__16KB_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld +#mattairtech_mt_d21e_bl16k.build.mcu=cortex-m0plus +#mattairtech_mt_d21e_bl16k.build.f_cpu=48000000L +#mattairtech_mt_d21e_bl16k.build.usb_product="MT-D21E" +#mattairtech_mt_d21e_bl16k.build.usb_manufacturer="MattairTech" +#mattairtech_mt_d21e_bl16k.build.board=MT_D21E +#mattairtech_mt_d21e_bl16k.build.core=arduino +#mattairtech_mt_d21e_bl16k.build.variant=MT_D21E +#mattairtech_mt_d21e_bl16k.build.variant_system_lib= +#mattairtech_mt_d21e_bl16k.build.vid=0x16D0 +#mattairtech_mt_d21e_bl16k.build.pid=0x0856 # MattairTech MT-D21E (no bootloader) -mattairtech_mt_d21e.bl0k.name=MattairTech MT-D21E (no bootloader) -mattairtech_mt_d21e.bl0k.vid.0=0x16D0 -mattairtech_mt_d21e.bl0k.pid.0=0x0557 -mattairtech_mt_d21e.bl0k.vid.1=0x16D0 -mattairtech_mt_d21e.bl0k.pid.1=0x0856 -mattairtech_mt_d21e.bl0k.upload.tool=arduino:openocd -mattairtech_mt_d21e.bl0k.upload.protocol=sam-ba -mattairtech_mt_d21e.bl0k.upload.use_1200bps_touch=false -mattairtech_mt_d21e.bl0k.upload.wait_for_upload_port=false -mattairtech_mt_d21e.bl0k.upload.native_usb=false -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a=SAMD21E18A -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.upload.maximum_size=262144 -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_without_bootloader.ld -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a=SAMD21E17A -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.upload.maximum_size=131072 -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_without_bootloader.ld -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a=SAMD21E16A -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.upload.maximum_size=65536 -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_without_bootloader.ld -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a=SAMD21E15A -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.upload.maximum_size=32768 -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} -mattairtech_mt_d21e.bl0k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_without_bootloader.ld -mattairtech_mt_d21e.bl0k.build.mcu=cortex-m0plus -mattairtech_mt_d21e.bl0k.build.f_cpu=48000000L -mattairtech_mt_d21e.bl0k.build.usb_product="MT-D21E" -mattairtech_mt_d21e.bl0k.build.usb_manufacturer="MattairTech LLC" -mattairtech_mt_d21e.bl0k.build.board=MT_D21E -mattairtech_mt_d21e.bl0k.build.core=arduino -mattairtech_mt_d21e.bl0k.build.variant=MT_D21E -mattairtech_mt_d21e.bl0k.build.variant_system_lib= -mattairtech_mt_d21e.bl0k.build.vid=0x16D0 -mattairtech_mt_d21e.bl0k.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.name=MattairTech MT-D21E (no bootloader) +#mattairtech_mt_d21e_bl0k.vid.0=0x16D0 +#mattairtech_mt_d21e_bl0k.pid.0=0x0557 +#mattairtech_mt_d21e_bl0k.vid.1=0x16D0 +#mattairtech_mt_d21e_bl0k.pid.1=0x0856 +#mattairtech_mt_d21e_bl0k.upload.tool=arduino:openocd +#mattairtech_mt_d21e_bl0k.upload.protocol=sam-ba +#mattairtech_mt_d21e_bl0k.upload.use_1200bps_touch=false +#mattairtech_mt_d21e_bl0k.upload.wait_for_upload_port=false +#mattairtech_mt_d21e_bl0k.upload.native_usb=false +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a=SAMD21E18A +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a.upload.maximum_size=262144 +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ -D__NO_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_without_bootloader.ld +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a=SAMD21E17A +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a.upload.maximum_size=131072 +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ -D__NO_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_without_bootloader.ld +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a=SAMD21E16A +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a.upload.maximum_size=65536 +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ -D__NO_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_without_bootloader.ld +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a=SAMD21E15A +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a.upload.maximum_size=32768 +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ -D__NO_BOOTLOADER__ {build.usb_flags} +#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_without_bootloader.ld +#mattairtech_mt_d21e_bl0k.build.mcu=cortex-m0plus +#mattairtech_mt_d21e_bl0k.build.f_cpu=48000000L +#mattairtech_mt_d21e_bl0k.build.usb_product="MT-D21E" +#mattairtech_mt_d21e_bl0k.build.usb_manufacturer="MattairTech" +#mattairtech_mt_d21e_bl0k.build.board=MT_D21E +#mattairtech_mt_d21e_bl0k.build.core=arduino +#mattairtech_mt_d21e_bl0k.build.variant=MT_D21E +#mattairtech_mt_d21e_bl0k.build.variant_system_lib= +#mattairtech_mt_d21e_bl0k.build.vid=0x16D0 +#mattairtech_mt_d21e_bl0k.build.pid=0x0856 diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index d3758b86b..53221a972 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -1,15 +1,29 @@ +# Begin Config +# __SAMD21J18A__, __SAMD21G18A__, __SAMD21E18A__ +# __SAMD21J17A__, __SAMD21G17A__, __SAMD21E17A__ +# __SAMD21J16A__, __SAMD21G16A__, __SAMD21E16A__ +# __SAMD21J15A__, __SAMD21G15A__, __SAMD21E15A__ +# __SAMD11D14AM__, __SAMD11C14A__, __SAMD11D14AS__ +BLD_EXTA_FLAGS=-D__SAMD21E18A__ +NAME=samd21e18a_sam_ba +LINKER_SCRIPT=samd21e18a_flash.ld + +STARTUP=startup_samd21.c +# STARTUP=startup_samd11.c + TOOLS_PATH="../../../arduino15/packages/arduino/tools" ARM_GCC_PATH=$(TOOLS_PATH)/arm-none-eabi-gcc/4.8.3-2014q1/bin +# End Config + CC=$(ARM_GCC_PATH)/arm-none-eabi-gcc CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -g -Os -w -std=gnu99 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 LDFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -BLD_EXTA_FLAGS=-D__SAMD21E18A__ + BUILD_PATH=build INCLUDES=-I$(TOOLS_PATH)/CMSIS/4.0.0-atmel/CMSIS/Include/ -I$(TOOLS_PATH)/CMSIS/4.0.0-atmel/Device/ATMEL/ -I./drivers/ -I./utils/ -I./utils/preprocessor/ -I./utils/interrupt -SOURCES=main.c sam_ba_monitor.c startup_samd21.c usart_sam_ba.c drivers/cdc_enumerate.c drivers/uart_driver.c utils/interrupt/interrupt_sam_nvic.c +SOURCES=main.c sam_ba_monitor.c $(STARTUP) usart_sam_ba.c drivers/cdc_enumerate.c drivers/uart_driver.c utils/interrupt/interrupt_sam_nvic.c OBJECTS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.o)) -NAME=samd21e18a_sam_ba EXECUTABLE=$(NAME).bin SLASH=/ @@ -18,7 +32,7 @@ BSLASH=$(EMPTY)\$(EMPTY) all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) - $(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tsamd21e18a_flash.ld -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group + $(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tlinker_scripts/$(LINKER_SCRIPT) -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group $(ARM_GCC_PATH)/arm-none-eabi-objcopy -O binary $(BUILD_PATH)/$(NAME).elf $@ $(BUILD_PATH)/%.o: %.c @@ -26,5 +40,7 @@ $(BUILD_PATH)/%.o: %.c $(CC) $(CFLAGS) $(BLD_EXTA_FLAGS) $(INCLUDES) $< -o $@ clean: +# Windows # del $(EXECUTABLE) $(subst /,\,$(OBJECTS)) $(subst /,\,$(BUILD_PATH)/$(NAME).*) +# Linux rm -f $(EXECUTABLE) $(OBJECTS) $(BUILD_PATH)/$(NAME).* diff --git a/bootloaders/zero/drivers/cdc_enumerate.c b/bootloaders/zero/drivers/cdc_enumerate.c index bd3873eb2..e8ed1053c 100644 --- a/bootloaders/zero/drivers/cdc_enumerate.c +++ b/bootloaders/zero/drivers/cdc_enumerate.c @@ -50,10 +50,10 @@ const char devDescriptor[] = { 0x00, // bDeviceSubclass: CDC class sub code 0x00, // bDeviceProtocol: CDC Device protocol 0x40, // bMaxPacketSize0 - 0x41, // idVendorL - 0x23, // - 0x4D, // idProductL - 0x00, // + USB_VENDOR_ID_L, // idVendorL + USB_VENDOR_ID_H, // + USB_PRODUCT_ID_L, // idProductL + USB_PRODUCT_ID_H, // 0x10, // bcdDeviceL 0x01, // 0x00, // iManufacturer // 0x01 diff --git a/bootloaders/zero/drivers/cdc_enumerate.h b/bootloaders/zero/drivers/cdc_enumerate.h index 41002626f..856f11d36 100644 --- a/bootloaders/zero/drivers/cdc_enumerate.h +++ b/bootloaders/zero/drivers/cdc_enumerate.h @@ -33,6 +33,11 @@ #include "sam.h" #include "stdbool.h" +#define USB_VENDOR_ID_H 0x16 +#define USB_VENDOR_ID_L 0xD0 +#define USB_PRODUCT_ID_H 0x05 +#define USB_PRODUCT_ID_L 0x57 + #define USB_EP_OUT 2 #define USB_EP_OUT_SIZE 0x40 #define USB_EP_IN 1 diff --git a/bootloaders/zero/linker_scripts/samd11c14a_flash.ld b/bootloaders/zero/linker_scripts/samd11c14a_flash.ld new file mode 100644 index 000000000..eb059bb25 --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd11c14a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD11C14A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd11d14am_flash.ld b/bootloaders/zero/linker_scripts/samd11d14am_flash.ld new file mode 100644 index 000000000..f04de8e4b --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd11d14am_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD11D14AM + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd11d14as_flash.ld b/bootloaders/zero/linker_scripts/samd11d14as_flash.ld new file mode 100644 index 000000000..ea5879ad1 --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd11d14as_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD11D14AS + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/samd21e15a_flash.ld b/bootloaders/zero/linker_scripts/samd21e15a_flash.ld similarity index 100% rename from bootloaders/zero/samd21e15a_flash.ld rename to bootloaders/zero/linker_scripts/samd21e15a_flash.ld diff --git a/bootloaders/zero/samd21e16a_flash.ld b/bootloaders/zero/linker_scripts/samd21e16a_flash.ld similarity index 100% rename from bootloaders/zero/samd21e16a_flash.ld rename to bootloaders/zero/linker_scripts/samd21e16a_flash.ld diff --git a/bootloaders/zero/samd21e17a_flash.ld b/bootloaders/zero/linker_scripts/samd21e17a_flash.ld similarity index 100% rename from bootloaders/zero/samd21e17a_flash.ld rename to bootloaders/zero/linker_scripts/samd21e17a_flash.ld diff --git a/bootloaders/zero/samd21e18a_flash.ld b/bootloaders/zero/linker_scripts/samd21e18a_flash.ld similarity index 100% rename from bootloaders/zero/samd21e18a_flash.ld rename to bootloaders/zero/linker_scripts/samd21e18a_flash.ld diff --git a/bootloaders/zero/linker_scripts/samd21g15a_flash.ld b/bootloaders/zero/linker_scripts/samd21g15a_flash.ld new file mode 100644 index 000000000..4e4379204 --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21g15a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21G15A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21g16a_flash.ld b/bootloaders/zero/linker_scripts/samd21g16a_flash.ld new file mode 100644 index 000000000..27ee71e1f --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21g16a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21G16A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x800; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21g17a_flash.ld b/bootloaders/zero/linker_scripts/samd21g17a_flash.ld new file mode 100644 index 000000000..7dcc41420 --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21g17a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21G17A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21g18a_flash.ld b/bootloaders/zero/linker_scripts/samd21g18a_flash.ld new file mode 100644 index 000000000..35bf2bfcd --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21g18a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21G18A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21j15a_flash.ld b/bootloaders/zero/linker_scripts/samd21j15a_flash.ld new file mode 100644 index 000000000..951d31cff --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21j15a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21J15A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21j16a_flash.ld b/bootloaders/zero/linker_scripts/samd21j16a_flash.ld new file mode 100644 index 000000000..c7e651175 --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21j16a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21J16A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x800; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21j17a_flash.ld b/bootloaders/zero/linker_scripts/samd21j17a_flash.ld new file mode 100644 index 000000000..07e7c9f8b --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21j17a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21J17A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/linker_scripts/samd21j18a_flash.ld b/bootloaders/zero/linker_scripts/samd21j18a_flash.ld new file mode 100644 index 000000000..d0168d78a --- /dev/null +++ b/bootloaders/zero/linker_scripts/samd21j18a_flash.ld @@ -0,0 +1,157 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAMD21J18A + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* The stack size used by the application. NOTE: you need to adjust according to your application. */ +STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + STACK_SIZE; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 8232238ee..94a8030d8 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -84,20 +84,36 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL 64 static void check_start_application(void); +void portable_delay_cycles(unsigned long n); static volatile bool main_b_cdc_enable = false; +// Delay loop is put to SRAM so that FWS will not affect delay time +OPTIMIZE_HIGH +RAMFUNC +void portable_delay_cycles(unsigned long n) +{ + UNUSED(n); + + __asm ( + "loop: DMB \n" + #ifdef __ICCARM__ + "SUBS r0, r0, #1 \n" + #else + "SUB r0, r0, #1 \n" + #endif + "CMP r0, #0 \n" + "BNE loop " + ); +} + /** * \brief Check the application startup condition * */ static void check_start_application(void) { - volatile PortGroup *led_port = (volatile PortGroup *)&PORT->Group[1]; - led_port->DIRSET.reg = (1<<30); - led_port->OUTCLR.reg = (1<<30); - -#if defined(BOOT_DOUBLE_TAP_ADDRESS) +#if defined(BOOT_DOUBLE_TAP) #define DOUBLE_TAP_MAGIC 0x07738135 if (PM->RCAUSE.bit.POR) { @@ -148,6 +164,10 @@ static void check_start_application(void) boot_port->DIRCLR.reg = BOOT_PIN_MASK; boot_port->PINCFG[BOOT_LOAD_PIN & 0x1F].reg = PORT_PINCFG_INEN | PORT_PINCFG_PULLEN; boot_port->OUTSET.reg = BOOT_PIN_MASK; + + /* Allow time for debouncing capacitor to charge (6ms, 1MHz clock is default after reset) */ + portable_delay_cycles(((uint64_t)6 * 1000000ul + (uint64_t)(7e3-1ul)) / (uint64_t)7e3); + /* Read the BOOT_LOAD_PIN status */ boot_en = (boot_port->IN.reg) & BOOT_PIN_MASK; @@ -158,8 +178,6 @@ static void check_start_application(void) } #endif - led_port->OUTSET.reg = (1<<30); - /* Rebase the Stack Pointer */ __set_MSP(*(uint32_t *) APP_START_ADDRESS); @@ -242,7 +260,6 @@ void system_init() #endif } - #if DEBUG_ENABLE # define DEBUG_PIN_HIGH port_pin_set_output_level(BOOT_LED, 1) # define DEBUG_PIN_LOW port_pin_set_output_level(BOOT_LED, 0) @@ -270,8 +287,14 @@ int main(void) /* System initialization */ system_init(); cpu_irq_enable(); - - #if SAM_BA_INTERFACE == SAM_BA_UART_ONLY || SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES + +#if defined(LED_PIN) + volatile PortGroup *led_port = (volatile PortGroup *)(&(PORT->Group[LED_PIN / 32])); + led_port->DIRSET.reg = LED_PIN_MASK; + led_port->OUTSET.reg = LED_PIN_MASK; +#endif + +#if SAM_BA_INTERFACE == SAM_BA_UART_ONLY || SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES /* UART is enabled in all cases */ usart_open(); #endif diff --git a/bootloaders/zero/main.h b/bootloaders/zero/main.h index bcff3a546..66871ee9e 100644 --- a/bootloaders/zero/main.h +++ b/bootloaders/zero/main.h @@ -30,12 +30,31 @@ #pragma once /* - * If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by + * If LED_PIN is defined, it will turn on during bootloader operation. + */ +#define LED_PIN PIN_PA28 // Pin 28 +#define LED_PIN_MASK (1U << (LED_PIN & 0x1f)) + +/* + * If BOOT_DOUBLE_TAP 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 0x20007FFC +#define BOOT_DOUBLE_TAP 1 + +#if defined(__SAMD21J18A__) || defined(__SAMD21G18A__) || defined(__SAMD21E18A__) + #define BOOT_DOUBLE_TAP_ADDRESS 0x20007FFC +#elif defined(__SAMD21J17A__) || defined(__SAMD21G17A__) || defined(__SAMD21E17A__) + #define BOOT_DOUBLE_TAP_ADDRESS 0x20003FFC +#elif defined(__SAMD21J16A__) || defined(__SAMD21G16A__) || defined(__SAMD21E16A__) + #define BOOT_DOUBLE_TAP_ADDRESS 0x20001FFC +#elif defined(__SAMD21J15A__) || defined(__SAMD21G15A__) || defined(__SAMD21E15A__) + #define BOOT_DOUBLE_TAP_ADDRESS 0x20000FFC +#elif defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + #define BOOT_DOUBLE_TAP_ADDRESS 0x20000FFC +#endif + #define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS)) /* diff --git a/bootloaders/zero/readme.txt b/bootloaders/zero/readme.txt index 28ea8d431..1c711a7ce 100644 --- a/bootloaders/zero/readme.txt +++ b/bootloaders/zero/readme.txt @@ -1,26 +1,57 @@ 1- Prerequisites -gcc-arm-none-eabi-4.8.3-2014q1 - -2- Selecting between USB and UART interface - -Set the define SAM_BA_INTERFACE to -SAM_BA_UART_ONLY for only UART interface -SAM_BA_USBCDC_ONLY for only USB CDC interface -SAM_BA_BOTH_INTERFACES for enabling both the interfaces - -SAM_BA_INTERFACE value should be modified in -Project Options -> C/C++ Compiler -> Preprocessor -> Defined symbols -Project Options -> Assembler -> Preprocessor -> Defined symbols -The default value of SAM_BA_BOTH_INTERFACES is defined in sam_ba_monitor.h - -Additionally, you must select the cpu in the makefile (3 locations) -as well as the TOOLS_PATH variable (and possibly other include paths). -On Windows, change 'rm -f' to 'del' in the makefile (uncomment line 29, comment line 30). - -3- Start application check - -Bootloader checks for the state of BOOT_LOAD_PIN (configurable by the user from main.h). If BOOT_LOAD_PIN is pulled low, bootloader execution is resumed. -Else, the first location of application is fetched and checked. If it is empty (0xFFFFFFFF), then bootloader execution is resumed. Else it jumps to application and starts execution from there. - -BOOT_LOAD_PIN is PA27 of SAMD21ExxA, Arduino pin 27 of MT-D21E board. +gcc-arm-none-eabi 4.8.3-2014q1 from Arduino samd package +CMSIS 4.0.0-atmel from Arduino samd package +bossac 1.5-arduino-mattairtech-1 from MattairTech SAMD package or: + * https://www.mattairtech.com/software/arduino/bossac-1.5-arduino-mattairtech-1-mingw32.zip (Windows 32 bit and 64 bit) + * https://www.mattairtech.com/software/arduino/bossac-1.5-arduino-mattairtech-1-x86_64-linux-gnu.tar.bz2 (Linux 64 bit) + * https://www.mattairtech.com/software/arduino/bossac-1.5-arduino-mattairtech-1-i686-linux-gnu.tar.bz2 (Linux 32 bit) + * Use the bossac command from the Arduino SAMD package for OS X support. Only the 256 KB chip versions are supported + +2- Selecting bootloader options + +Set the define SAM_BA_INTERFACE in sam_ba_monitor.h to: + * SAM_BA_UART_ONLY for only UART interface + * SAM_BA_USBCDC_ONLY for only USB CDC interface + * SAM_BA_BOTH_INTERFACES for enabling both the interfaces + +All of these options will build an 8KB bootloader. +If you want to build a 4KB bootloader, you will need to: + * Choose only one interface from above + * Disable ARDUINO_EXTENDED_CAPABILITIES (sam_ba_monitor.h) + * Disable BOOT_DOUBLE_TAP (main.h) + +3- Makefile configuration + +In the makefile, you must modify BLD_EXTA_FLAGS, NAME, +LINKER_SCRIPT, and STARTUP to match your cpu, as well as +the TOOLS_PATH variable (and possibly other include paths). +On Windows, you may need to change 'rm -f' to 'del' at the bottom of the makefile. + +4- Boot Process + +First, if BOOT_DOUBLE_TAP is defined, the bootloader checks if the reset button was pressed +twice in quick succession. If so, bootloader execution is resumed Second, the bootloader +checks the state of BOOT_LOAD_PIN (configurable by the user from main.h). If BOOT_LOAD_PIN +is pulled low, bootloader execution is resumed. Finally, the first location of application +is fetched and checked. If it is empty (0xFFFFFFFF), then bootloader execution is resumed. +Otherwise, it jumps to application and starts execution from there. The LED will light +during bootloader execution. + +BOOT_LOAD_PIN is PA27 of SAMD21ExxA (arduino pin 27), which corresponds to Button A on the +MT-D21E board. LED_PIN is PA28 of SAMD21ExxA (arduino pin 28), which corresponds to the LED +on the MT-D21E board. It will turn on during bootloader operation (after the boot process). +If BOOT_DOUBLE_TAP is defined (default), the bootloader can be 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. + +5- Useful Info + +When modifying this bootloader, pay close attention to SRAM usage. On the 4KB SRAM versions, +DATA + BSS must be less than 1KB, so avoid increasing buffers and watch stack usage. This +bootloader places the stack (grows down) in the middle of the SRAM (normally, the stack +starts at the end of SRAM). This is so that an applet can be placed immediately after the top +of the system stack. The applet in this case is a very simple word copy function. However, +1KB is reserved for the applet, and there are two 64 byte data buffers placed after it. The +applet has its own stack at the top of RAM, but the word copy applet uses little/none of this. +The bossac tool is responsible for loading the applet. See Devices.h from the Bossa source. diff --git a/bootloaders/zero/sam_ba_monitor.c b/bootloaders/zero/sam_ba_monitor.c index 29c9d8566..3924e487f 100644 --- a/bootloaders/zero/sam_ba_monitor.c +++ b/bootloaders/zero/sam_ba_monitor.c @@ -36,7 +36,9 @@ #include "cdc_enumerate.h" const char RomBOOT_Version[] = SAM_BA_VERSION; +#if defined ARDUINO_EXTENDED_CAPABILITIES const char RomBOOT_ExtendedCapabilities[] = "[Arduino:XYZ]"; +#endif /* Provides one common interface to handle both USART and USB-CDC */ typedef struct @@ -167,6 +169,7 @@ uint8_t command, *ptr_data, *ptr, data[SIZEBUFMAX]; uint8_t j; uint32_t u32tmp; +#if defined ARDUINO_EXTENDED_CAPABILITIES uint32_t PAGE_SIZE, PAGES, MAX_FLASH; /** @@ -185,6 +188,16 @@ void sam_ba_monitor_run(void) sam_ba_monitor_loop(); } } +#else +void sam_ba_monitor_run(void) +{ + ptr_data = NULL; + command = 'z'; + while (1) { + sam_ba_monitor_loop(); + } +} +#endif // Prints a 32-bit integer in hex. void put_uint32(uint32_t n) { @@ -295,10 +308,12 @@ void sam_ba_monitor_loop(void) { ptr_monitor_if->putdata("v", 1); ptr_monitor_if->putdata((uint8_t *) RomBOOT_Version, - strlen(RomBOOT_Version)); + strlen(RomBOOT_Version)); +#if defined ARDUINO_EXTENDED_CAPABILITIES ptr_monitor_if->putdata(" ", 1); ptr_monitor_if->putdata((uint8_t *) RomBOOT_ExtendedCapabilities, - strlen(RomBOOT_ExtendedCapabilities)); + strlen(RomBOOT_ExtendedCapabilities)); +#endif ptr_monitor_if->putdata(" ", 1); ptr = (uint8_t*) &(__DATE__); i = 0; @@ -313,6 +328,7 @@ void sam_ba_monitor_loop(void) ptr_monitor_if->putdata((uint8_t *) &(__TIME__), i); ptr_monitor_if->putdata("\n\r", 2); } +#if defined ARDUINO_EXTENDED_CAPABILITIES else if (command == 'X') { // Syntax: X[ADDR]# @@ -412,7 +428,7 @@ void sam_ba_monitor_loop(void) put_uint32(crc); ptr_monitor_if->putdata("#\n\r", 3); } - +#endif command = 'z'; current_number = 0; diff --git a/bootloaders/zero/sam_ba_monitor.h b/bootloaders/zero/sam_ba_monitor.h index c70ddb187..e1b5e2f53 100644 --- a/bootloaders/zero/sam_ba_monitor.h +++ b/bootloaders/zero/sam_ba_monitor.h @@ -41,6 +41,9 @@ #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES #endif +/* disable for 4KB bootloaders */ +#define ARDUINO_EXTENDED_CAPABILITIES 1 + /* Selects USART as the communication interface of the monitor */ #define SAM_BA_INTERFACE_USART 1 /* Selects USB as the communication interface of the monitor */ diff --git a/bootloaders/zero/samd21e15a_sam_ba.bin b/bootloaders/zero/samd21e15a_sam_ba.bin index 1a6726c9501d85fa425c21f25924dbe0188d704f..7d832e5b2feae14366a2b5d59fd01ad5b1733439 100755 GIT binary patch delta 1116 zcmZvbUr1Yb6vxl+Uhk5tNz*icnwUhdH+B`3HPJ}bjnxj(Xj+g`XqkiF{(;$9m~L%R z*idT*85FAiWY$z4q#bk*wn*ASOU3rBkET%Q_T*SsTgD(@#i7}5zduFTgBL#coZmU$ zd(QcBxG$r*=&suq(!RG6^=~rj44kK}1I*^LmDm>SY=v+q-ByL2bNyB{V>EiFME!zD z6Vma~7gg%GkH|n^oU82ZKuv;le;*6`n<9zAtgkE5KJppM`i=cd#l}bNtdT17*Tsiq)$_>c7x@H_<$5jeE1LL9 zMWMg4l>2FeDwY?SMmaw+v&hsJP*dJPTHVmMmiQY+1sbl_Oouzc=Q8}iY3U>`*vH>W zrS=pf?U{#Y2oX2;$X_di@KXFoIjjiPRX!&lV5!XS^2hRk5I2JgPz^o-LT>dEMc|Ks zBp3(f;3^PBMDbT>Vu$WEYy|cV>^l&HrU_6J9hQDJ&3_U54*F*J1%N@T0E?F-D&o_Y zFP+s`-vXi6p0 zCSj+520z57)d}_~uPf|SLpY}qFX5Ag-7LhFB6BlVBI4X`h1E6(QG=ammOC8>*;J;@@rQI&s7%wmb_+GjW%!3EH;mXM2#T3R zf55Om36yC>=b)P@gRkS-xS0*wG`N!K-y<{S3fvApn~VGhPit&iC3*_xz$$PQVuMB4J|?`3MYmtNphau7nn<*cB9X@0 z`o?H%%dxQHHtELa6j_m*wQM7;s2V9|R*;T^u1#_mb+WD9$2w9*2@+;iBe_-9x> NRjg-wT6xOX@g8E-24?^O delta 1091 zcmchU+e=hY6vo#+XC~+9Ow(~LopGi-&U96)8Jj^f!V6~NC`9xi_0ZT$QdV}+CQux+ zU>@?;F1$pL4?cAxhI$F9m);7TLI@%-BJ2tiJ)|{s`gSGs7j)pa*V=1+XRWnanb3=n zZ7hfMJ_}KgU}U7QS2#=G@8DAM|5zE5jND$W>?YF17|D^@5+$h-?L{ET752V&Yc%11 zW}b-cYYjDOJ~ht#YIQJ5e%hFu_O)$pyj;uDp4hs%f>>!ItEA#=x*%2(^|VEOzL{eD zTildyUbc2$Y;DIxtM~BXdM|rve}3ZmSt_y4BmytZ{jG_>jcRXO|5r;=hyD_qh*@?S z-}V@*qRd~gyyM~5149SzQzra_WzO*)X;t(31DN}&V zZDbzRC+euC!bH{CUeY6dr*azJF*1oaBEBEcXPRrmBis2~snFKVNPprY>O@52s(jph z8eTWQAP3AsmEgDJEv!5BO5QH_3ULMS0UZQ^kXzkEYv7*;agYQWNB~hp6n}>%Ds&%U z!?2%V7r+K+!hou&Mw&7VhFk~qb?{BVjJpEz+$52mkLMgxm)eMyVg#M5mZ;|@iiskk zSSb*N#V~7lrzPsTlKnX^){9RUD;9en_9hk+Bm%Ey&aR?9=V`xO=U zLB#X!3!R;T{R0&OQmgg#)kRpSMcyZdC z>v2Y$qlS9#d8m8c6VZR|Xz zmzC>f!BB+CLY2WtWpEqMx-`#}gJ>Gef<@qR{;@k!o7`T>R1;_>-lT<1cd;&hUEBQ& D3{(1& diff --git a/bootloaders/zero/samd21e16a_sam_ba.bin b/bootloaders/zero/samd21e16a_sam_ba.bin index 7dd3244d063f65e6906b2afe386675d5f109ba2f..a9c7610117b2caf78e80caa0472d7d9393197db1 100755 GIT binary patch delta 1116 zcmZvbUuaWz6vxl+-d>a2CdQaQCQZ`Z-c&8N=#6QysiIX%8yg2@43s(8bsMa+g7q&g zC~a+o2!hsMu{O33MFo9uqeKP8((P@JjUc!^IdrQcLcmFfjoy8KEd?KX;d9UVo%6l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_`FP%5b)k)DDMm23YKwWVqnIcn zime5ruoz|q@3zIV#Q+bV|>@aY_SNXUy%IbMIf0v@- zejf2cekp%HQ#mUzf5!?%oGW(zk7CL`sGLRRVepKH9ha@b)6*G;ld)m`a&b^;brNlH z5Z&euXC)g>Z*{(sT7}9q&7m>W)MfZJls$piIj}^`B>Dp;6G@=NAZmkdvIKqrtNr`3 z^U(LCy9;Gz?Sb3C`?O+~;8(Pz-URO2^nu2_NQs{Xq;2Mxqd6ntxtHLNwIDQ~G#^ff zYZcC@s}koy*9O+cuee5;hezEtj^k*uK!Ojrn<1> zqoUHN2!*3m5v~qxs*Z+u&aHc=G@^T87JLJ4*B`qjz0Tv4EOo(F;w^f_avSU7SM}|` E06vxan*aa+ diff --git a/bootloaders/zero/samd21e18a_sam_ba.bin b/bootloaders/zero/samd21e18a_sam_ba.bin index 64d284a95a0412d92d50171b85c480e4368b9399..b30c653d6e655aa41ee31382b04db68659931688 100755 GIT binary patch delta 1116 zcmZvbU1$?o6vxk<>6lEL7-K$6nxvghsuo+;#5CAc(JG~ljY1JYSr;5XVCz<}e$v7& zZEY5^AZWeC+Soo6U2q>%N>orR)i)m-L2&oUMb|1K1XQ}%==i@a1s^)_n{)0t|2gMe z4)Z)(h%UboCha#XQO`Vs&cIPxIKa$53yDR+(pCtU(k)b2I@e=GGe(2AD%78dG$9=t zd{(Ot`G^bzhPcY!_HIa#?(b${e^Vq?n)h`?+AeNqdB3stMY-`q8*8L>#eBI@mkM=s z21C=eJL}r|!U1Jj)nQ{@(%E(GASeDZ=tWncy&h9fSQ%o=Kn)-0y!l8RUWOmz>tdTuPh1eV`^z&XRlv?vY6&`#p&WJ+q z@>IAyM>R9kOrwGynVZNolu%Q#m$Z2QDNFJVqY@2QYo=}c!H+Wh_w-^PF4)cAN|p8u zBkhTYs2>qG_sGYUK6n}aha6Uf>O7y2*RxFSUwM<AM5mEdVn%JRx4I6=d1N#xwL(>GPiMC09n&ub8eucgnehFaED!}3;iOTqxY`k6h%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ders/zero/startup_samd11.c b/bootloaders/zero/startup_samd11.c new file mode 100644 index 000000000..2308ceb2b --- /dev/null +++ b/bootloaders/zero/startup_samd11.c @@ -0,0 +1,201 @@ +/** + * \file + * + * \brief gcc starttup file for SAMD11 + * + * Copyright (c) 2014 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * 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. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * + * \asf_license_stop + * + */ + +#include "sam.h" + +/* Initialize segments */ +extern uint32_t _sfixed; +extern uint32_t _efixed; +extern uint32_t _etext; +extern uint32_t _srelocate; +extern uint32_t _erelocate; +extern uint32_t _szero; +extern uint32_t _ezero; +extern uint32_t _sstack; +extern uint32_t _estack; + +/** \cond DOXYGEN_SHOULD_SKIP_THIS */ +int main(void); +/** \endcond */ + +void __libc_init_array(void); + +/* Default empty handler */ +void Dummy_Handler(void); + +/* Cortex-M0+ core handlers */ +void NMI_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void SVC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void PendSV_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void SysTick_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); + +/* Peripherals handlers */ +void PM_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void SYSCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void WDT_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void RTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void EIC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void NVMCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void DMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#ifdef USB_IRQn +void USB_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +void EVSYS_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#ifdef SERCOM2_IRQn +void SERCOM2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +void TCC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void ADC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +void AC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#ifdef DAC_IRQn +void DAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); + +/* Exception Table */ +__attribute__ ((section(".vectors"))) +const DeviceVectors exception_table = { + + /* Configure Initial Stack Pointer, using linker-generated symbols */ + (void*) (&_estack), + + (void*) Reset_Handler, + (void*) NMI_Handler, + (void*) HardFault_Handler, + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) SVC_Handler, + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) PendSV_Handler, + (void*) SysTick_Handler, + + /* Configurable interrupts */ + (void*) PM_Handler, /* 0 Power Manager */ + (void*) SYSCTRL_Handler, /* 1 System Control */ + (void*) WDT_Handler, /* 2 Watchdog Timer */ + (void*) RTC_Handler, /* 3 Real-Time Counter */ + (void*) EIC_Handler, /* 4 External Interrupt Controller */ + (void*) NVMCTRL_Handler, /* 5 Non-Volatile Memory Controller */ + (void*) DMAC_Handler, /* 6 Direct Memory Access Controller */ +#ifdef USB_IRQn + (void*) USB_Handler, /* 7 Universal Serial Bus */ +#else + (void*) (0UL), /* Reserved */ +#endif + (void*) EVSYS_Handler, /* 8 Event System Interface */ + (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ + (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ +#ifdef SERCOM2_IRQn + (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ +#else + (void*) (0UL), /* Reserved */ +#endif + (void*) TCC0_Handler, /* 12 Timer Counter Control */ + (void*) TC1_Handler, /* 13 Basic Timer Counter 0 */ + (void*) TC2_Handler, /* 14 Basic Timer Counter 1 */ + (void*) ADC_Handler, /* 15 Analog Digital Converter */ + (void*) AC_Handler, /* 16 Analog Comparators */ +#ifdef DAC_IRQn + (void*) DAC_Handler, /* 17 Digital Analog Converter */ +#else + (void*) (0UL), /* Reserved */ +#endif + (void*) PTC_Handler /* 18 Peripheral Touch Controller */ +}; + +/** + * \brief This is the code that gets called on processor reset. + * To initialize the device, and call the main() routine. + */ +void Reset_Handler(void) +{ + uint32_t *pSrc, *pDest; + + /* Initialize the relocate segment */ + pSrc = &_etext; + pDest = &_srelocate; + + if (pSrc != pDest) { + for (; pDest < &_erelocate;) { + *pDest++ = *pSrc++; + } + } + + /* Clear the zero segment */ + for (pDest = &_szero; pDest < &_ezero;) { + *pDest++ = 0; + } + + /* Set the vector table base address */ + pSrc = (uint32_t *) & _sfixed; + SCB->VTOR = ((uint32_t) pSrc & SCB_VTOR_TBLOFF_Msk); + + /* Initialize the C library */ + __libc_init_array(); + + /* Branch to main function */ + main(); + + /* Infinite loop */ + while (1); +} + +/** + * \brief Default interrupt handler for unused IRQs. + */ +void Dummy_Handler(void) +{ + while (1) { + } +} diff --git a/bootloaders/zero/startup_samd21.c b/bootloaders/zero/startup_samd21.c index 0f45ae3f9..6e04bee45 100644 --- a/bootloaders/zero/startup_samd21.c +++ b/bootloaders/zero/startup_samd21.c @@ -3,7 +3,7 @@ * * \brief gcc starttup file for SAMD21 * - * Copyright (c) 2013-2014 Atmel Corporation. All rights reserved. + * Copyright (c) 2014 Atmel Corporation. All rights reserved. * * \asf_license_start * @@ -78,27 +78,50 @@ void RTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler void EIC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void NVMCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void DMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#ifdef USB_IRQn void USB_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif void EVSYS_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#ifdef SERCOM4_IRQn void SERCOM4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef SERCOM5_IRQn void SERCOM5_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif void TCC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC5_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#ifdef TC6_IRQn void TC6_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef TC7_IRQn void TC7_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef ADC_IRQn void ADC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef AC_IRQn void AC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef DAC_IRQn void DAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef PTC_IRQn void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef I2S_IRQn void I2S_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif +#ifdef AC1_IRQn +void AC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); +#endif /* Exception Table */ __attribute__ ((section(".vectors"))) @@ -131,27 +154,72 @@ const DeviceVectors exception_table = { (void*) EIC_Handler, /* 4 External Interrupt Controller */ (void*) NVMCTRL_Handler, /* 5 Non-Volatile Memory Controller */ (void*) DMAC_Handler, /* 6 Direct Memory Access Controller */ +#ifdef USB_IRQn (void*) USB_Handler, /* 7 Universal Serial Bus */ +#else + (void*) (0UL), /* Reserved */ +#endif (void*) EVSYS_Handler, /* 8 Event System Interface */ (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ (void*) SERCOM3_Handler, /* 12 Serial Communication Interface 3 */ +#ifdef SERCOM4_IRQn (void*) SERCOM4_Handler, /* 13 Serial Communication Interface 4 */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef SERCOM5_IRQn (void*) SERCOM5_Handler, /* 14 Serial Communication Interface 5 */ +#else + (void*) (0UL), /* Reserved */ +#endif (void*) TCC0_Handler, /* 15 Timer Counter Control 0 */ (void*) TCC1_Handler, /* 16 Timer Counter Control 1 */ (void*) TCC2_Handler, /* 17 Timer Counter Control 2 */ (void*) TC3_Handler, /* 18 Basic Timer Counter 0 */ (void*) TC4_Handler, /* 19 Basic Timer Counter 1 */ (void*) TC5_Handler, /* 20 Basic Timer Counter 2 */ +#ifdef TC6_IRQn (void*) TC6_Handler, /* 21 Basic Timer Counter 3 */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef TC7_IRQn (void*) TC7_Handler, /* 22 Basic Timer Counter 4 */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef ADC_IRQn (void*) ADC_Handler, /* 23 Analog Digital Converter */ - (void*) AC_Handler, /* 24 Analog Comparators */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef AC_IRQn + (void*) AC_Handler, /* 24 Analog Comparators 0 */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef DAC_IRQn (void*) DAC_Handler, /* 25 Digital Analog Converter */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef PTC_IRQn (void*) PTC_Handler, /* 26 Peripheral Touch Controller */ - (void*) I2S_Handler /* 27 Inter-IC Sound Interface */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef I2S_IRQn + (void*) I2S_Handler, /* 27 Inter-IC Sound Interface */ +#else + (void*) (0UL), /* Reserved */ +#endif +#ifdef AC1_IRQn + (void*) AC1_Handler /* 28 Analog Comparators 1 */ +#else + (void*) (0UL) /* Reserved */ +#endif }; /** diff --git a/cores/arduino/Reset.cpp b/cores/arduino/Reset.cpp index 8809907e8..1ea9f9716 100644 --- a/cores/arduino/Reset.cpp +++ b/cores/arduino/Reset.cpp @@ -24,7 +24,19 @@ extern "C" { #endif #define NVM_MEMORY ((volatile uint16_t *)0x000000) -#define APP_START 0x00002004 + +#if defined(__NO_BOOTLODAER__) + #define APP_START 0x00000004 +#elif defined(__4KB_BOOTLODAER__) + #define APP_START 0x00001004 +#elif defined(__8KB_BOOTLODAER__) + #define APP_START 0x00002004 +#elif defined(__16KB_BOOTLODAER__) + #define APP_START 0x00004004 +#else + // default of 8KB + #define APP_START 0x00002004 +#endif static inline bool nvmReady(void) { return NVMCTRL->INTFLAG.reg & NVMCTRL_INTFLAG_READY; diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index d54c755a0..442370754 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -30,8 +30,8 @@ SERCOM::SERCOM(Sercom* s) */ void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint32_t baudrate) { - resetUART(); initClockNVIC(); + resetUART(); //Setting the CTRLA register sercom->USART.CTRLA.reg = SERCOM_USART_CTRLA_MODE(mode) | @@ -127,6 +127,16 @@ bool SERCOM::availableDataUART() return sercom->USART.INTFLAG.bit.RXC; } +bool SERCOM::isUARTError() +{ + return sercom->USART.INTFLAG.bit.ERROR; +} + +void SERCOM::acknowledgeUARTError() +{ + sercom->USART.INTFLAG.bit.ERROR = 1; +} + bool SERCOM::isBufferOverflowErrorUART() { //BUFOVF : Buffer Overflow @@ -628,6 +638,8 @@ void SERCOM::initClockNVIC( void ) clockId = GCM_SERCOM3_CORE; IdNvic = SERCOM3_IRQn; } +#if defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ + defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) else if(sercom == SERCOM4) { clockId = GCM_SERCOM4_CORE; @@ -638,6 +650,7 @@ void SERCOM::initClockNVIC( void ) clockId = GCM_SERCOM5_CORE; IdNvic = SERCOM5_IRQn; } +#endif if ( IdNvic == PendSV_IRQn ) { diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index d64214522..fbd27e624 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -162,6 +162,8 @@ class SERCOM bool isDataRegisterEmptyUART( void ) ; uint8_t readDataUART( void ) ; int writeDataUART(uint8_t data) ; + bool isUARTError() ; + void acknowledgeUARTError() ; /* ========== SPI ========== */ void initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize charSize, SercomDataOrder dataOrder) ; diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 84b8bae10..1dff8ab37 100644 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -34,6 +34,7 @@ volatile bool toneIsActive = false; #define TONE_TC_IRQn TC5_IRQn #define TONE_TC_TOP 0xFFFF #define TONE_TC_CHANNEL 0 +void TC5_Handler (void) __attribute__ ((weak, alias("Tone_Handler"))); static inline void resetTC (Tc* TCx) { @@ -183,8 +184,6 @@ void Tone_Handler (void) } } -void TC5_Handler (void) __attribute__ ((weak, alias("Tone_Handler"))); - #ifdef __cplusplus } #endif diff --git a/cores/arduino/USB/samd21_device.c b/cores/arduino/USB/samd21_device.c index 271243a3d..d28774915 100644 --- a/cores/arduino/USB/samd21_device.c +++ b/cores/arduino/USB/samd21_device.c @@ -79,12 +79,14 @@ void UDD_Init(void) PM->APBBMASK.reg |= PM_APBBMASK_USB; /* Set up the USB DP/DN pins */ - PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; - PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg &= ~(0xF << (4 * (PIN_PA24G_USB_DM & 0x01u))); - PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg |= MUX_PA24G_USB_DM << (4 * (PIN_PA24G_USB_DM & 0x01u)); - PORT->Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PMUXEN = 1; - PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg &= ~(0xF << (4 * (PIN_PA25G_USB_DP & 0x01u))); - PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); + pinPeripheral( PIN_USB_DM, PIO_COM ); + pinPeripheral( PIN_USB_DP, PIO_COM ); +// PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; +// PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg &= ~(0xF << (4 * (PIN_PA24G_USB_DM & 0x01u))); +// PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg |= MUX_PA24G_USB_DM << (4 * (PIN_PA24G_USB_DM & 0x01u)); +// PORT->Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PMUXEN = 1; +// PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg &= ~(0xF << (4 * (PIN_PA25G_USB_DP & 0x01u))); +// PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); /* ---------------------------------------------------------------------------------------------- * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index 0ad323134..9e302f2a8 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -15,64 +15,64 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -#include -#include -#include - -#include "../Arduino.h" -#include "../wiring_private.h" -#include "USB_host.h" -#include "samd21_host.h" - -#define HOST_DEFINED -#ifdef HOST_DEFINED - -//#define TRACE_UOTGHS_HOST(x) x -#define TRACE_UOTGHS_HOST(x) - -//extern void (*gpf_isr)(void); - -// Handle UOTGHS Host driver state -static uhd_vbus_state_t uhd_state = UHD_STATE_NO_VBUS; - -__attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EPT_NUM]; - -extern void (*gpf_isr)(void); - -void UHD_SetStack(void (*pf_isr)(void)) -{ - gpf_isr = pf_isr; -} - -// NVM Software Calibration Area Mapping -// USB TRANSN calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRANSN_POS 45 -#define NVM_USB_PAD_TRANSN_SIZE 5 -// USB TRANSP calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRANSP_POS 50 -#define NVM_USB_PAD_TRANSP_SIZE 5 -// USB TRIM calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRIM_POS 55 -#define NVM_USB_PAD_TRIM_SIZE 3 - -/** - * \brief Initialize the SAMD21 host driver. - */ -void UHD_Init(void) -{ - uint32_t pad_transn; - uint32_t pad_transp; - uint32_t pad_trim; - uint32_t i; - + + +#include +#include +#include + +#include "../Arduino.h" +#include "../wiring_private.h" +#include "USB_host.h" +#include "samd21_host.h" + +#define HOST_DEFINED +#ifdef HOST_DEFINED + +//#define TRACE_UOTGHS_HOST(x) x +#define TRACE_UOTGHS_HOST(x) + +//extern void (*gpf_isr)(void); + +// Handle UOTGHS Host driver state +static uhd_vbus_state_t uhd_state = UHD_STATE_NO_VBUS; + +__attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EPT_NUM]; + +extern void (*gpf_isr)(void); + +void UHD_SetStack(void (*pf_isr)(void)) +{ + gpf_isr = pf_isr; +} + +// NVM Software Calibration Area Mapping +// USB TRANSN calibration value. Should be written to the USB PADCAL register. +#define NVM_USB_PAD_TRANSN_POS 45 +#define NVM_USB_PAD_TRANSN_SIZE 5 +// USB TRANSP calibration value. Should be written to the USB PADCAL register. +#define NVM_USB_PAD_TRANSP_POS 50 +#define NVM_USB_PAD_TRANSP_SIZE 5 +// USB TRIM calibration value. Should be written to the USB PADCAL register. +#define NVM_USB_PAD_TRIM_POS 55 +#define NVM_USB_PAD_TRIM_SIZE 3 + +/** + * \brief Initialize the SAMD21 host driver. + */ +void UHD_Init(void) +{ + uint32_t pad_transn; + uint32_t pad_transp; + uint32_t pad_trim; + uint32_t i; + UHD_SetStack(&UHD_Handler); - - /* Enable USB clock */ - PM->APBBMASK.reg |= PM_APBBMASK_USB; - - /* Set up the USB DP/DM pins */ + + /* Enable USB clock */ + PM->APBBMASK.reg |= PM_APBBMASK_USB; + + /* Set up the USB DP/DM pins */ pinPeripheral( PIN_USB_DM, PIO_COM ); pinPeripheral( PIN_USB_DP, PIO_COM ); // PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; @@ -81,439 +81,439 @@ void UHD_Init(void) // PORT->Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PMUXEN = 1; // PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg &= ~(0xF << (4 * (PIN_PA25G_USB_DP & 0x01u))); // PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); - - /* ---------------------------------------------------------------------------------------------- - * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) - */ - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(6) | // Generic Clock Multiplexer 6 - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN; - - while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) - { - /* Wait for synchronization */ - } - - /* Reset */ - USB->HOST.CTRLA.bit.SWRST = 1; - while (USB->HOST.SYNCBUSY.bit.SWRST) - { - /* Sync wait */ - } - - // uhd_enable(); + + /* ---------------------------------------------------------------------------------------------- + * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) + */ + GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(6) | // Generic Clock Multiplexer 6 + GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source + GCLK_CLKCTRL_CLKEN; + + while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) + { + /* Wait for synchronization */ + } + + /* Reset */ + USB->HOST.CTRLA.bit.SWRST = 1; + while (USB->HOST.SYNCBUSY.bit.SWRST) + { + /* Sync wait */ + } + + // uhd_enable(); USB->DEVICE.CTRLA.reg |= USB_CTRLA_ENABLE | USB_CTRLA_MODE; - uhd_force_host_mode(); + uhd_force_host_mode(); while (USB->HOST.SYNCBUSY.reg == USB_SYNCBUSY_ENABLE); - - /* Load Pad Calibration */ - pad_transn = (*((uint32_t *)(NVMCTRL_OTP4) // Non-Volatile Memory Controller - + (NVM_USB_PAD_TRANSN_POS / 32)) - >> (NVM_USB_PAD_TRANSN_POS % 32)) - & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); - - if (pad_transn == 0x1F) // maximum value (31) - { - pad_transn = 5; - } - - USB->HOST.PADCAL.bit.TRANSN = pad_transn; - - pad_transp = (*((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRANSP_POS / 32)) - >> (NVM_USB_PAD_TRANSP_POS % 32)) - & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); - - if (pad_transp == 0x1F) // maximum value (31) - { - pad_transp = 29; - } - - USB->HOST.PADCAL.bit.TRANSP = pad_transp; - - pad_trim = (*((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRIM_POS / 32)) - >> (NVM_USB_PAD_TRIM_POS % 32)) - & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); - - if (pad_trim == 0x7) // maximum value (7) - { - pad_trim = 3; - } - - USB->HOST.PADCAL.bit.TRIM = pad_trim; - - - /* Set the configuration */ - uhd_run_in_standby(); - // Set address of USB SRAM - USB->HOST.DESCADD.reg = (uint32_t)(&usb_pipe_table[0]); - // For USB_SPEED_FULL - uhd_force_full_speed(); - for (i = 0; i < sizeof(usb_pipe_table); i++) - { - (*(uint32_t *)(&usb_pipe_table[0] + i)) = 0; - } - - uhd_state = UHD_STATE_NO_VBUS; - - // Put VBUS on USB port - pinMode( PIN_USB_HOST_ENABLE, OUTPUT ); - digitalWrite( PIN_USB_HOST_ENABLE, HIGH ); - - uhd_enable_connection_int(); - - USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DCONN; - USB->HOST.INTENSET.reg = USB_HOST_INTENSET_WAKEUP; - USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DDISC; - - USB->HOST.CTRLB.bit.VBUSOK = 1; - - // Configure interrupts - NVIC_SetPriority((IRQn_Type)USB_IRQn, 0UL); - NVIC_EnableIRQ((IRQn_Type)USB_IRQn); -} - - -/** - * \brief Interrupt sub routine for USB Host state machine management. - */ -//static void UHD_ISR(void) -void UHD_Handler(void) -{ - uint16_t flags; - + + /* Load Pad Calibration */ + pad_transn = (*((uint32_t *)(NVMCTRL_OTP4) // Non-Volatile Memory Controller + + (NVM_USB_PAD_TRANSN_POS / 32)) + >> (NVM_USB_PAD_TRANSN_POS % 32)) + & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); + + if (pad_transn == 0x1F) // maximum value (31) + { + pad_transn = 5; + } + + USB->HOST.PADCAL.bit.TRANSN = pad_transn; + + pad_transp = (*((uint32_t *)(NVMCTRL_OTP4) + + (NVM_USB_PAD_TRANSP_POS / 32)) + >> (NVM_USB_PAD_TRANSP_POS % 32)) + & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); + + if (pad_transp == 0x1F) // maximum value (31) + { + pad_transp = 29; + } + + USB->HOST.PADCAL.bit.TRANSP = pad_transp; + + pad_trim = (*((uint32_t *)(NVMCTRL_OTP4) + + (NVM_USB_PAD_TRIM_POS / 32)) + >> (NVM_USB_PAD_TRIM_POS % 32)) + & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); + + if (pad_trim == 0x7) // maximum value (7) + { + pad_trim = 3; + } + + USB->HOST.PADCAL.bit.TRIM = pad_trim; + + + /* Set the configuration */ + uhd_run_in_standby(); + // Set address of USB SRAM + USB->HOST.DESCADD.reg = (uint32_t)(&usb_pipe_table[0]); + // For USB_SPEED_FULL + uhd_force_full_speed(); + for (i = 0; i < sizeof(usb_pipe_table); i++) + { + (*(uint32_t *)(&usb_pipe_table[0] + i)) = 0; + } + + uhd_state = UHD_STATE_NO_VBUS; + + // Put VBUS on USB port + pinMode( PIN_USB_HOST_ENABLE, OUTPUT ); + digitalWrite( PIN_USB_HOST_ENABLE, PIN_USB_HOST_ENABLE_VALUE ); + + uhd_enable_connection_int(); + + USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DCONN; + USB->HOST.INTENSET.reg = USB_HOST_INTENSET_WAKEUP; + USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DDISC; + + USB->HOST.CTRLB.bit.VBUSOK = 1; + + // Configure interrupts + NVIC_SetPriority((IRQn_Type)USB_IRQn, 0UL); + NVIC_EnableIRQ((IRQn_Type)USB_IRQn); +} + + +/** + * \brief Interrupt sub routine for USB Host state machine management. + */ +//static void UHD_ISR(void) +void UHD_Handler(void) +{ + uint16_t flags; + if (USB->HOST.CTRLA.bit.MODE) { /*host mode ISR */ - - /* get interrupt flags */ - flags = USB->HOST.INTFLAG.reg; - - /* host SOF interrupt */ - if (flags & USB_HOST_INTFLAG_HSOF) - { - /* clear the flag */ - USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_HSOF; - uhd_state = UHD_STATE_CONNECTED; - return; - } - - /* host reset interrupt */ - if (flags & USB_HOST_INTFLAG_RST) - { - /* clear the flag */ - USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RST; - uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; - return; - } - - /* host upstream resume interrupts */ - if (flags & USB_HOST_INTFLAG_UPRSM) - { - /* clear the flags */ - USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_UPRSM; - uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; - return; - } - - /* host downstream resume interrupts */ - if (flags & USB_HOST_INTFLAG_DNRSM) - { - /* clear the flags */ - USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DNRSM; - uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; - return; - } - - /* host wakeup interrupts */ - if (flags & USB_HOST_INTFLAG_WAKEUP) - { - /* clear the flags */ - USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_WAKEUP; - uhd_state = UHD_STATE_CONNECTED; //UHD_STATE_ERROR; - return; - } - - /* host ram access interrupt */ - if (flags & USB_HOST_INTFLAG_RAMACER) - { - /* clear the flag */ - USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RAMACER; - uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; - return; - } - - /* host connect interrupt */ - if (flags & USB_HOST_INTFLAG_DCONN) - { - TRACE_UOTGHS_HOST(printf(">>> UHD_ISR : Connection INT\r\n"); - ) - /* clear the flag */ - uhd_ack_connection(); - uhd_disable_connection_int(); - uhd_ack_disconnection(); - uhd_enable_disconnection_int(); - //uhd_enable_sof(); - uhd_state = UHD_STATE_CONNECTED; - return; - } - - /* host disconnect interrupt */ - if (flags & USB_HOST_INTFLAG_DDISC) - { - TRACE_UOTGHS_HOST(printf(">>> UHD_ISR : Disconnection INT\r\n"); - ) - /* clear the flag */ - uhd_ack_disconnection(); - uhd_disable_disconnection_int(); - // Stop reset signal, in case of disconnection during reset - uhd_stop_reset(); - // Disable wakeup/resumes interrupts, - // in case of disconnection during suspend mode - uhd_ack_connection(); - uhd_enable_connection_int(); - uhd_state = UHD_STATE_DISCONNECTED; - return; - } - } - else { - while(1); - } -} - - - -/** - * \brief Get VBUS state. - * - * \return VBUS status. - */ -uhd_vbus_state_t UHD_GetVBUSState(void) -{ - return uhd_state; -} - - -/** - * \brief Allocate FIFO for pipe 0. - * - * \param ul_add Address of remote device for pipe 0. - * \param ul_ep_size Actual size of the FIFO in bytes. - * - * \retval 0 success. - * \retval 1 error. - */ -uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size) -{ + + /* get interrupt flags */ + flags = USB->HOST.INTFLAG.reg; + + /* host SOF interrupt */ + if (flags & USB_HOST_INTFLAG_HSOF) + { + /* clear the flag */ + USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_HSOF; + uhd_state = UHD_STATE_CONNECTED; + return; + } + + /* host reset interrupt */ + if (flags & USB_HOST_INTFLAG_RST) + { + /* clear the flag */ + USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RST; + uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; + return; + } + + /* host upstream resume interrupts */ + if (flags & USB_HOST_INTFLAG_UPRSM) + { + /* clear the flags */ + USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_UPRSM; + uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; + return; + } + + /* host downstream resume interrupts */ + if (flags & USB_HOST_INTFLAG_DNRSM) + { + /* clear the flags */ + USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DNRSM; + uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; + return; + } + + /* host wakeup interrupts */ + if (flags & USB_HOST_INTFLAG_WAKEUP) + { + /* clear the flags */ + USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_WAKEUP; + uhd_state = UHD_STATE_CONNECTED; //UHD_STATE_ERROR; + return; + } + + /* host ram access interrupt */ + if (flags & USB_HOST_INTFLAG_RAMACER) + { + /* clear the flag */ + USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RAMACER; + uhd_state = UHD_STATE_DISCONNECTED; //UHD_STATE_ERROR; + return; + } + + /* host connect interrupt */ + if (flags & USB_HOST_INTFLAG_DCONN) + { + TRACE_UOTGHS_HOST(printf(">>> UHD_ISR : Connection INT\r\n"); + ) + /* clear the flag */ + uhd_ack_connection(); + uhd_disable_connection_int(); + uhd_ack_disconnection(); + uhd_enable_disconnection_int(); + //uhd_enable_sof(); + uhd_state = UHD_STATE_CONNECTED; + return; + } + + /* host disconnect interrupt */ + if (flags & USB_HOST_INTFLAG_DDISC) + { + TRACE_UOTGHS_HOST(printf(">>> UHD_ISR : Disconnection INT\r\n"); + ) + /* clear the flag */ + uhd_ack_disconnection(); + uhd_disable_disconnection_int(); + // Stop reset signal, in case of disconnection during reset + uhd_stop_reset(); + // Disable wakeup/resumes interrupts, + // in case of disconnection during suspend mode + uhd_ack_connection(); + uhd_enable_connection_int(); + uhd_state = UHD_STATE_DISCONNECTED; + return; + } + } + else { + while(1); + } +} + + + +/** + * \brief Get VBUS state. + * + * \return VBUS status. + */ +uhd_vbus_state_t UHD_GetVBUSState(void) +{ + return uhd_state; +} + + +/** + * \brief Allocate FIFO for pipe 0. + * + * \param ul_add Address of remote device for pipe 0. + * \param ul_ep_size Actual size of the FIFO in bytes. + * + * \retval 0 success. + * \retval 1 error. + */ +uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size) +{ if( USB->HOST.STATUS.reg & USB_HOST_STATUS_SPEED(1) ) - ul_ep_size = USB_PCKSIZE_SIZE_8_BYTES; // Low Speed - else - ul_ep_size = USB_PCKSIZE_SIZE_64_BYTES; // Full Speed - - USB->HOST.HostPipe[0].PCFG.bit.PTYPE = 1; //USB_HOST_PCFG_PTYPE_CTRL; - usb_pipe_table[0].HostDescBank[0].CTRL_PIPE.bit.PEPNUM = 0; - usb_pipe_table[0].HostDescBank[0].PCKSIZE.bit.SIZE = ul_ep_size; - - return 0; -} - - -/** - * \brief Allocate a new pipe. - * - * \note UOTGHS maximum pipe number is limited to 10, meaning that only a limited - * amount of devices can be connected. Unfortunately, using only one pipe shared accross - * various endpoints and devices is not possible because the UOTGHS IP does not allow to - * change the data toggle value through register interface. - * - * \param ul_dev_addr Address of remote device. - * \param ul_dev_ep Targeted endpoint of remote device. - * \param ul_type Pipe type. - * \param ul_dir Pipe direction. - * \param ul_maxsize Pipe size. - * \param ul_interval Polling interval (if applicable to pipe type). - * \param ul_nb_bank Number of banks associated with this pipe. - * - * \return 1. - */ -uint32_t UHD_Pipe_Alloc(uint32_t ul_dev_addr, uint32_t ul_dev_ep, uint32_t ul_type, uint32_t ul_dir, uint32_t ul_maxsize, uint32_t ul_interval, uint32_t ul_nb_bank) -{ - /* set pipe config */ - USB->HOST.HostPipe[ul_dev_ep].PCFG.bit.BK = ul_nb_bank; - // PTYPE: - USB->HOST.HostPipe[ul_dev_ep].PCFG.reg &= ~USB_HOST_PCFG_MASK; // USB->HOST.HostPipe[0].PCFG.bit.PTYPE = 1; //USB_HOST_PCFG_PTYPE_CTRL; - USB->HOST.HostPipe[ul_dev_ep].PCFG.reg |= ul_type; - USB->HOST.HostPipe[ul_dev_ep].BINTERVAL.reg = ul_interval; - - if (ul_dir & USB_EP_DIR_IN) - { - USB->HOST.HostPipe[ul_dev_ep].PCFG.bit.PTOKEN = USB_HOST_PCFG_PTOKEN_IN; - USB->HOST.HostPipe[ul_dev_ep].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; - } - else - { - USB->HOST.HostPipe[ul_dev_ep].PCFG.bit.PTOKEN = USB_HOST_PCFG_PTOKEN_OUT; - USB->HOST.HostPipe[ul_dev_ep].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; - } - + ul_ep_size = USB_PCKSIZE_SIZE_8_BYTES; // Low Speed + else + ul_ep_size = USB_PCKSIZE_SIZE_64_BYTES; // Full Speed + + USB->HOST.HostPipe[0].PCFG.bit.PTYPE = 1; //USB_HOST_PCFG_PTYPE_CTRL; + usb_pipe_table[0].HostDescBank[0].CTRL_PIPE.bit.PEPNUM = 0; + usb_pipe_table[0].HostDescBank[0].PCKSIZE.bit.SIZE = ul_ep_size; + + return 0; +} + + +/** + * \brief Allocate a new pipe. + * + * \note UOTGHS maximum pipe number is limited to 10, meaning that only a limited + * amount of devices can be connected. Unfortunately, using only one pipe shared accross + * various endpoints and devices is not possible because the UOTGHS IP does not allow to + * change the data toggle value through register interface. + * + * \param ul_dev_addr Address of remote device. + * \param ul_dev_ep Targeted endpoint of remote device. + * \param ul_type Pipe type. + * \param ul_dir Pipe direction. + * \param ul_maxsize Pipe size. + * \param ul_interval Polling interval (if applicable to pipe type). + * \param ul_nb_bank Number of banks associated with this pipe. + * + * \return 1. + */ +uint32_t UHD_Pipe_Alloc(uint32_t ul_dev_addr, uint32_t ul_dev_ep, uint32_t ul_type, uint32_t ul_dir, uint32_t ul_maxsize, uint32_t ul_interval, uint32_t ul_nb_bank) +{ + /* set pipe config */ + USB->HOST.HostPipe[ul_dev_ep].PCFG.bit.BK = ul_nb_bank; + // PTYPE: + USB->HOST.HostPipe[ul_dev_ep].PCFG.reg &= ~USB_HOST_PCFG_MASK; // USB->HOST.HostPipe[0].PCFG.bit.PTYPE = 1; //USB_HOST_PCFG_PTYPE_CTRL; + USB->HOST.HostPipe[ul_dev_ep].PCFG.reg |= ul_type; + USB->HOST.HostPipe[ul_dev_ep].BINTERVAL.reg = ul_interval; + + if (ul_dir & USB_EP_DIR_IN) + { + USB->HOST.HostPipe[ul_dev_ep].PCFG.bit.PTOKEN = USB_HOST_PCFG_PTOKEN_IN; + USB->HOST.HostPipe[ul_dev_ep].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; + } + else + { + USB->HOST.HostPipe[ul_dev_ep].PCFG.bit.PTOKEN = USB_HOST_PCFG_PTOKEN_OUT; + USB->HOST.HostPipe[ul_dev_ep].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; + } + if( USB->HOST.STATUS.reg & USB_HOST_STATUS_SPEED(1) ) - ul_maxsize = USB_PCKSIZE_SIZE_8_BYTES; // Low Speed - else - ul_maxsize = USB_PCKSIZE_SIZE_64_BYTES; // Full Speed - - memset((uint8_t *)&usb_pipe_table[ul_dev_ep], 0, sizeof(usb_pipe_table[ul_dev_ep])); - - usb_pipe_table[ul_dev_ep].HostDescBank[0].CTRL_PIPE.bit.PDADDR = ul_dev_addr; - usb_pipe_table[ul_dev_ep].HostDescBank[0].CTRL_PIPE.bit.PEPNUM = ul_dev_ep; - usb_pipe_table[ul_dev_ep].HostDescBank[0].PCKSIZE.bit.SIZE = ul_maxsize; - - return 1; -} - - -void UHD_Pipe_CountZero(uint32_t ul_pipe) -{ + ul_maxsize = USB_PCKSIZE_SIZE_8_BYTES; // Low Speed + else + ul_maxsize = USB_PCKSIZE_SIZE_64_BYTES; // Full Speed + + memset((uint8_t *)&usb_pipe_table[ul_dev_ep], 0, sizeof(usb_pipe_table[ul_dev_ep])); + + usb_pipe_table[ul_dev_ep].HostDescBank[0].CTRL_PIPE.bit.PDADDR = ul_dev_addr; + usb_pipe_table[ul_dev_ep].HostDescBank[0].CTRL_PIPE.bit.PEPNUM = ul_dev_ep; + usb_pipe_table[ul_dev_ep].HostDescBank[0].PCKSIZE.bit.SIZE = ul_maxsize; + + return 1; +} + + +void UHD_Pipe_CountZero(uint32_t ul_pipe) +{ usb_pipe_table[ul_pipe].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; -} - -/** - * \brief Free a pipe. - * - * \param ul_pipe Pipe number to free. - */ -void UHD_Pipe_Free(uint32_t ul_pipe) -{ - // The Pipe is frozen and no additional requests will be sent to the device on this pipe address. - USB->HOST.HostPipe[ul_pipe].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE; -} - - -/** - * \brief Read from a pipe. - * - * \param ul_pipe Pipe number. - * \param ul_size Maximum number of data to read. - * \param data Buffer to store the data. - * - * \return number of data read. - */ -uint32_t UHD_Pipe_Read(uint32_t pipe_num, uint32_t buf_size, uint8_t *buf) -{ - if (USB->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == USB_HOST_PTYPE_DIS) - { - return 0; - } - - /* get pipe config from setting register */ - usb_pipe_table[pipe_num].HostDescBank[0].ADDR.reg = (uint32_t)buf; - usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = buf_size; - USB->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = USB_HOST_PCFG_PTOKEN_IN; - - /* Start transfer */ - USB->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; - - // Unfreeze pipe - USB->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_PFREEZE; - - return buf_size; -} - - -/** - * \brief Write into a pipe. - * - * \param ul_pipe Pipe number. - * \param ul_size Maximum number of data to read. - * \param data Buffer containing data to write. - */ -void UHD_Pipe_Write(uint32_t ul_pipe, uint32_t ul_size, uint8_t *buf) -{ - /* get pipe config from setting register */ - usb_pipe_table[ul_pipe].HostDescBank[0].ADDR.reg = (uint32_t)buf; - usb_pipe_table[ul_pipe].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = ul_size; - usb_pipe_table[ul_pipe].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = 0; -} - -/** - * \brief Send a pipe content. - * - * \param ul_pipe Pipe number. - * \param ul_token_type Token type. - */ -void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type) -{ - USB->HOST.HostPipe[ul_pipe].PCFG.bit.PTOKEN = ul_token_type; - - /* Start transfer */ - if(ul_token_type == USB_HOST_PCFG_PTOKEN_SETUP ) - { +} + +/** + * \brief Free a pipe. + * + * \param ul_pipe Pipe number to free. + */ +void UHD_Pipe_Free(uint32_t ul_pipe) +{ + // The Pipe is frozen and no additional requests will be sent to the device on this pipe address. + USB->HOST.HostPipe[ul_pipe].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE; +} + + +/** + * \brief Read from a pipe. + * + * \param ul_pipe Pipe number. + * \param ul_size Maximum number of data to read. + * \param data Buffer to store the data. + * + * \return number of data read. + */ +uint32_t UHD_Pipe_Read(uint32_t pipe_num, uint32_t buf_size, uint8_t *buf) +{ + if (USB->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == USB_HOST_PTYPE_DIS) + { + return 0; + } + + /* get pipe config from setting register */ + usb_pipe_table[pipe_num].HostDescBank[0].ADDR.reg = (uint32_t)buf; + usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; + usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = buf_size; + USB->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = USB_HOST_PCFG_PTOKEN_IN; + + /* Start transfer */ + USB->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; + + // Unfreeze pipe + USB->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_PFREEZE; + + return buf_size; +} + + +/** + * \brief Write into a pipe. + * + * \param ul_pipe Pipe number. + * \param ul_size Maximum number of data to read. + * \param data Buffer containing data to write. + */ +void UHD_Pipe_Write(uint32_t ul_pipe, uint32_t ul_size, uint8_t *buf) +{ + /* get pipe config from setting register */ + usb_pipe_table[ul_pipe].HostDescBank[0].ADDR.reg = (uint32_t)buf; + usb_pipe_table[ul_pipe].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = ul_size; + usb_pipe_table[ul_pipe].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = 0; +} + +/** + * \brief Send a pipe content. + * + * \param ul_pipe Pipe number. + * \param ul_token_type Token type. + */ +void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type) +{ + USB->HOST.HostPipe[ul_pipe].PCFG.bit.PTOKEN = ul_token_type; + + /* Start transfer */ + if(ul_token_type == USB_HOST_PCFG_PTOKEN_SETUP ) + { USB->HOST.HostPipe[ul_pipe].PINTFLAG.reg = USB_HOST_PINTFLAG_TXSTP; - USB->HOST.HostPipe[ul_pipe].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; - } - else if(ul_token_type == USB_HOST_PCFG_PTOKEN_IN ) - { - USB->HOST.HostPipe[ul_pipe].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; - } - else - { - USB->HOST.HostPipe[ul_pipe].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1); // Transfer Complete 0 - USB->HOST.HostPipe[ul_pipe].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; - } - - // Unfreeze pipe - uhd_unfreeze_pipe(ul_pipe); -} - -#define USB_HOST_PINTFLAG_TRCPT_Pos 0 /**< \brief (USB_HOST_PINTFLAG) Transfer Complete 0/1 Interrupt Flag */ -#define USB_HOST_PINTFLAG_TRCPT_Msk (0x3u << USB_HOST_PINTFLAG_TRCPT_Pos) -#define USB_HOST_PINTFLAG_TRCPT(value) ((USB_HOST_PINTFLAG_TRCPT_Msk & ((value) << USB_HOST_PINTFLAG_TRCPT_Pos))) - -/** - * \brief Check for pipe transfer completion. - * - * \param ul_pipe Pipe number. - * \param ul_token_type Token type. - * - * \retval 0 transfer is not complete. - * \retval 1 transfer is complete. - */ -uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type) -{ - // Check for transfer completion depending on token type - switch (ul_token_type) - { - case USB_HOST_PCFG_PTOKEN_SETUP: - if (Is_uhd_setup_ready(ul_pipe)) - { - uhd_ack_setup_ready(ul_pipe); - uhd_freeze_pipe(ul_pipe); - return 1; - } - break; - - case USB_HOST_PCFG_PTOKEN_IN: - if (Is_uhd_in_received(ul_pipe)) - { - // IN packet received - uhd_ack_in_received(ul_pipe); - // Freeze will stop after the transfer - uhd_freeze_pipe(ul_pipe); - return 1; - } - break; - - case USB_HOST_PCFG_PTOKEN_OUT: - if (Is_uhd_out_ready(ul_pipe)) - { - // OUT packet sent - uhd_ack_out_ready(ul_pipe); - uhd_freeze_pipe(ul_pipe); - return 1; - } - break; - } - - return 0; -} -#endif // HOST_DEFINED + USB->HOST.HostPipe[ul_pipe].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; + } + else if(ul_token_type == USB_HOST_PCFG_PTOKEN_IN ) + { + USB->HOST.HostPipe[ul_pipe].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; + } + else + { + USB->HOST.HostPipe[ul_pipe].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1); // Transfer Complete 0 + USB->HOST.HostPipe[ul_pipe].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; + } + + // Unfreeze pipe + uhd_unfreeze_pipe(ul_pipe); +} + +#define USB_HOST_PINTFLAG_TRCPT_Pos 0 /**< \brief (USB_HOST_PINTFLAG) Transfer Complete 0/1 Interrupt Flag */ +#define USB_HOST_PINTFLAG_TRCPT_Msk (0x3u << USB_HOST_PINTFLAG_TRCPT_Pos) +#define USB_HOST_PINTFLAG_TRCPT(value) ((USB_HOST_PINTFLAG_TRCPT_Msk & ((value) << USB_HOST_PINTFLAG_TRCPT_Pos))) + +/** + * \brief Check for pipe transfer completion. + * + * \param ul_pipe Pipe number. + * \param ul_token_type Token type. + * + * \retval 0 transfer is not complete. + * \retval 1 transfer is complete. + */ +uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type) +{ + // Check for transfer completion depending on token type + switch (ul_token_type) + { + case USB_HOST_PCFG_PTOKEN_SETUP: + if (Is_uhd_setup_ready(ul_pipe)) + { + uhd_ack_setup_ready(ul_pipe); + uhd_freeze_pipe(ul_pipe); + return 1; + } + break; + + case USB_HOST_PCFG_PTOKEN_IN: + if (Is_uhd_in_received(ul_pipe)) + { + // IN packet received + uhd_ack_in_received(ul_pipe); + // Freeze will stop after the transfer + uhd_freeze_pipe(ul_pipe); + return 1; + } + break; + + case USB_HOST_PCFG_PTOKEN_OUT: + if (Is_uhd_out_ready(ul_pipe)) + { + // OUT packet sent + uhd_ack_out_ready(ul_pipe); + uhd_freeze_pipe(ul_pipe); + return 1; + } + break; + } + + return 0; +} +#endif // HOST_DEFINED diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 094fb71ba..fb5f69af4 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -36,8 +36,8 @@ void Uart::begin(unsigned long baudrate) void Uart::begin(unsigned long baudrate, uint8_t config) { - pinPeripheral(uc_pinRX, g_APinDescription[uc_pinRX].ulPinType); - pinPeripheral(uc_pinTX, g_APinDescription[uc_pinTX].ulPinType); + pinPeripheral(uc_pinRX, PIO_SERCOM); + pinPeripheral(uc_pinTX, PIO_SERCOM); sercom->initUART(UART_INT_CLOCK, SAMPLE_RATE_x16, baudrate); sercom->initFrame(extractCharSize(config), LSB_FIRST, extractParity(config), extractNbStopBit(config)); @@ -59,17 +59,17 @@ void Uart::flush() void Uart::IrqHandler() { - if(sercom->availableDataUART()) - { - rxBuffer.store_char(sercom->readDataUART()); - } - - if( sercom->isBufferOverflowErrorUART() || - sercom->isFrameErrorUART() || - sercom->isParityErrorUART()) - { - sercom->clearStatusUART(); - } + if (sercom->availableDataUART()) { + rxBuffer.store_char(sercom->readDataUART()); + } + + if (sercom->isUARTError()) { + sercom->acknowledgeUARTError(); + // TODO: if (sercom->isBufferOverflowErrorUART()) .... + // TODO: if (sercom->isFrameErrorUART()) .... + // TODO: if (sercom->isParityErrorUART()) .... + sercom->clearStatusUART(); + } } int Uart::available() diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index a28b9df64..fdda0c81e 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -75,10 +75,11 @@ void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, uint32_t ulMode ) static int enabled = 0 ; uint32_t ulConfig ; uint32_t ulPos ; - - if ( digitalPinToInterrupt( ulPin ) == NOT_AN_INTERRUPT ) + + // Assign pin to EIC + if ( pinPeripheral(ulPin, PIO_EXTINT) != RET_STATUS_OK ) { - return ; + return ; } if ( !enabled ) @@ -87,15 +88,12 @@ void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, uint32_t ulMode ) enabled = 1 ; } - // Assign pin to EIC - pinPeripheral( ulPin, PIO_EXTINT ) ; - // Assign callback to interrupt callbacksInt[digitalPinToInterrupt( ulPin )]._ulPin = ulPin ; callbacksInt[digitalPinToInterrupt( ulPin )]._callback = callback ; // Check if normal interrupt or NMI - if ( ulPin != 2 ) + if ( digitalPinToInterrupt( ulPin ) != EXTERNAL_INT_NMI ) { // Look for right CONFIG register to be addressed if ( digitalPinToInterrupt( ulPin ) > EXTERNAL_INT_7 ) @@ -139,7 +137,7 @@ void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, uint32_t ulMode ) // Enable the interrupt EIC->INTENSET.reg = EIC_INTENSET_EXTINT( 1 << digitalPinToInterrupt( ulPin ) ) ; } - else // Handles NMI on pin 2 + else // Handles NMI { // Configure the interrupt mode switch ( ulMode ) diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index bce4575ab..ac605b385 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -26,6 +26,7 @@ extern "C" { #endif /* Definitions and types for pins */ +/* ADC channels 2, 3, and 10 not present in ATSAMD21ExxA */ typedef enum _EAnalogChannel { No_ADC_Channel=-1, @@ -59,13 +60,21 @@ typedef enum _ETCChannel TCC0_CH7 = (0<<8)|(3), // Channel 7 is 3! TCC1_CH0 = (1<<8)|(0), TCC1_CH1 = (1<<8)|(1), + TCC1_CH2 = (1<<8)|(0), // Channel 2 is 0! + TCC1_CH3 = (1<<8)|(1), // Channel 3 is 1! 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! 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__ +#if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) + TC6_CH0 = (6<<8)|(0), + TC6_CH1 = (6<<8)|(1), TC7_CH0 = (7<<8)|(0), TC7_CH1 = (7<<8)|(1) #endif // __SAMD21J18A__ @@ -77,32 +86,6 @@ 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, - PWM2_CH0=TCC2_CH0, - PWM2_CH1=TCC2_CH1, - PWM3_CH0=TC3_CH0, - PWM3_CH1=TC3_CH1, - PWM5_CH0=TC5_CH0, - PWM5_CH1=TC5_CH1, -#if defined __SAMD21J18A__ - PWM7_CH0=TC7_CH0, - PWM7_CH1=TC7_CH1 -#endif // __SAMD21J18A__ -} EPWMChannel ; - typedef enum _EPortType { NOT_A_PORT=-1, @@ -113,73 +96,131 @@ typedef enum _EPortType typedef enum _EExt_Interrupts { - EXTERNAL_INT_0 = 0, // Available on pin 11 - EXTERNAL_INT_1, // Available on pin 13 - EXTERNAL_INT_2, // Available on pins 10, A0, A5 - EXTERNAL_INT_3, // Available on pin 12 - EXTERNAL_INT_4, // Available on pin 6, 8, A3 - EXTERNAL_INT_5, // Available on pin 7, 9, A4 - EXTERNAL_INT_6, // Available on pin 16 - EXTERNAL_INT_7, // Available on pin 17 - EXTERNAL_INT_8, // Available on pin A1 - EXTERNAL_INT_9, // Available on pin 3, A2 - EXTERNAL_INT_10, // Available on pin 0, 21 - EXTERNAL_INT_11, // Available on pin 1, 20 - EXTERNAL_INT_12, // Available on pin 18 - EXTERNAL_INT_13, // Available on pin EDBG_GPIO0 (43) - EXTERNAL_INT_14, // Available on pin 4 - EXTERNAL_INT_15, // Available on pin 5 - EXTERNAL_INT_NMI, // Available on pin 2 + EXTERNAL_INT_0 = 0, + EXTERNAL_INT_1, + EXTERNAL_INT_2, + EXTERNAL_INT_3, + EXTERNAL_INT_4, + EXTERNAL_INT_5, + EXTERNAL_INT_6, + EXTERNAL_INT_7, + EXTERNAL_INT_8, + EXTERNAL_INT_9, + EXTERNAL_INT_10, + EXTERNAL_INT_11, + EXTERNAL_INT_12, + EXTERNAL_INT_13, + EXTERNAL_INT_14, + EXTERNAL_INT_15, + EXTERNAL_INT_NMI, EXTERNAL_NUM_INTERRUPTS, NOT_AN_INTERRUPT = -1, EXTERNAL_INT_NONE = NOT_AN_INTERRUPT, } EExt_Interrupts ; -//A B C D E F G H -//EIC REF ADC AC PTC DAC SERCOM SERCOM_ALT TC/TCC TCC COM AC/GCLK +/* Copied from wiring_constants.h */ +#define INPUT (0x0) +#define OUTPUT (0x1) +#define INPUT_PULLUP (0x2) +#define INPUT_PULLDOWN (0x3) typedef enum _EPioType { - PIO_NOT_A_PIN=-1, /* Not under control of a peripheral. */ - PIO_EXTINT=0, /* The pin is controlled by the associated signal of peripheral A. */ - PIO_ANALOG, /* The pin is controlled by the associated signal of peripheral B. */ - PIO_SERCOM, /* The pin is controlled by the associated signal of peripheral C. */ - PIO_SERCOM_ALT, /* The pin is controlled by the associated signal of peripheral D. */ - PIO_TIMER, /* The pin is controlled by the associated signal of peripheral E. */ - PIO_TIMER_ALT, /* The pin is controlled by the associated signal of peripheral F. */ - PIO_COM, /* The pin is controlled by the associated signal of peripheral G. */ - PIO_AC_CLK, /* The pin is controlled by the associated signal of peripheral H. */ - PIO_DIGITAL, /* The pin is controlled by PORT. */ - PIO_INPUT, /* The pin is controlled by PORT and is an input. */ - PIO_INPUT_PULLUP, /* The pin is controlled by PORT and is an input with internal pull-up resistor enabled. */ - PIO_OUTPUT, /* The pin is controlled by PORT and is an output. */ - - PIO_PWM=PIO_TIMER, - PIO_PWM_ALT=PIO_TIMER_ALT, + PIO_NOT_A_PIN=-1, /* Not under control of a peripheral. */ + + PIO_INPUT=INPUT, /* The pin is controlled by PORT and is an input. */ + PIO_OUTPUT=OUTPUT, /* The pin is controlled by PORT and is an output. */ + PIO_INPUT_PULLUP=INPUT_PULLUP, /* The pin is controlled by PORT and is an input with internal pull-up resistor enabled. */ + PIO_INPUT_PULLDOWN=INPUT_PULLDOWN, /* The pin is controlled by PORT and is an input with internal pull-down resistor enabled. */ + + PIO_EXTINT=4, /* The pin is controlled by the EXTINT peripheral and is an input with interrupt. */ + + PIO_ANALOG_ADC=5, /* The pin is controlled by the ANALOG peripheral and is an ADC input. */ + PIO_ANALOG_DAC=6, /* The pin is controlled by the ANALOG peripheral and is a DAC output. */ + PIO_ANALOG_REF=7, /* The pin is controlled by the ANALOG peripheral and is a voltage reference input (3.3V MAX). */ + + PIO_TIMER_PWM=8, /* The pin is controlled by a TIMER peripheral and is a PWM output. */ + PIO_TIMER_CAPTURE=9, /* The pin is controlled by a TIMER peripheral and is a capture input. */ + + PIO_SERCOM=10, /* The pin is controlled by a SERCOM peripheral (UART, SPI, or I2C). */ + PIO_COM=11, /* The pin is controlled by the COM peripheral (USB or I2S). */ + PIO_AC_GCLK=12, /* The pin is controlled by the AC_GCLK peripheral (output). */ + + PIO_MULTI, /* The pin can be configured to any type based on the attributes. */ } EPioType ; /** * Pin Attributes to be OR-ed */ -#define PIN_ATTR_NONE (0UL<<0) -#define PIN_ATTR_COMBO (1UL<<0) -#define PIN_ATTR_ANALOG (1UL<<1) -#define PIN_ATTR_DIGITAL (1UL<<2) -#define PIN_ATTR_PWM (1UL<<3) -#define PIN_ATTR_TIMER (1UL<<4) -#define PIN_ATTR_EXTINT (1UL<<5) - -/* Types used for the table below */ +#define PIN_ATTR_NONE (0UL << 0) + + #define PIN_ATTR_INPUT (1UL << PIO_INPUT) + #define PIN_ATTR_OUTPUT (1UL << PIO_OUTPUT) + #define PIN_ATTR_INPUT_PULLUP (1UL << PIO_INPUT_PULLUP) + #define PIN_ATTR_INPUT_PULLDOWN (1UL << PIO_INPUT_PULLDOWN) +#define PIN_ATTR_DIGITAL (PIN_ATTR_INPUT|PIN_ATTR_INPUT_PULLUP|PIN_ATTR_INPUT_PULLDOWN|PIN_ATTR_OUTPUT) + +#define PIN_ATTR_EXTINT (1UL << PIO_EXTINT) + +#define PIN_ATTR_ADC (1UL << PIO_ANALOG_ADC) +#define PIN_ATTR_DAC (1UL << PIO_ANALOG_DAC) +#define PIN_ATTR_REF (1UL << PIO_ANALOG_REF) + #define PIN_ATTR_ANALOG PIN_ATTR_ADC + + #define PIN_ATTR_TIMER_PWM (1UL << PIO_TIMER_PWM) + #define PIN_ATTR_TIMER_CAPTURE (1UL << PIO_TIMER_CAPTURE) +#define PIN_ATTR_TIMER (PIN_ATTR_TIMER_PWM|PIN_ATTR_TIMER_CAPTURE) + +#define PIN_ATTR_SERCOM (1UL << PIO_SERCOM) +#define PIN_ATTR_COM (1UL << PIO_COM) +#define PIN_ATTR_AC_CLK (1UL << PIO_AC_GCLK) + + +//A B C D E F G H +//EIC REF ADC AC PTC DAC SERCOM SERCOM_ALT TC/TCC TCC COM AC/GCLK +typedef enum _EPioPeripheral +{ + PER_PORT=-1, /* The pin is controlled by PORT. */ + PER_EXTINT=0, /* The pin is controlled by the associated signal of peripheral A. */ + PER_ANALOG=1, /* The pin is controlled by the associated signal of peripheral B. */ + PER_SERCOM=2, /* The pin is controlled by the associated signal of peripheral C. */ + PER_SERCOM_ALT=3, /* The pin is controlled by the associated signal of peripheral D. */ + PER_TIMER=4, /* The pin is controlled by the associated signal of peripheral E. */ + PER_TIMER_ALT=5, /* The pin is controlled by the associated signal of peripheral F. */ + PER_COM=6, /* The pin is controlled by the associated signal of peripheral G. */ + PER_AC_CLK=7, /* The pin is controlled by the associated signal of peripheral H. */ +} EPioPeripheral ; + +/** + * Peripheral Attributes to be OR-ed + */ +#define PER_ATTR_NONE (0UL<<0) + +#define PER_ATTR_SERCOM_STD (0UL<<0) +#define PER_ATTR_SERCOM_ALT (1UL<<0) +#define PER_ATTR_SERCOM_MASK (1UL<<0) + +#define PER_ATTR_TIMER_STD (0UL<<1) +#define PER_ATTR_TIMER_ALT (1UL<<1) +#define PER_ATTR_TIMER_MASK (1UL<<1) + +#define PER_ATTR_DRIVE_STD (0UL<<2) +#define PER_ATTR_DRIVE_STRONG (1UL<<2) +#define PER_ATTR_DRIVE_MASK (1UL<<2) + +/* Types used for the table below + * This struct MUST be 12 bytes long (elements are ordered to prevent unaligned access). + */ typedef struct _PinDescription { - EPortType ulPort ; - uint32_t ulPin ; - EPioType ulPinType ; - uint32_t ulPinAttribute ; - EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */ - EPWMChannel ulPWMChannel ; - ETCChannel ulTCChannel ; - EExt_Interrupts ulExtInt ; + uint8_t ulPort ; // Must be 8 bits + uint8_t ulPin ; // Must be 8 bits + uint8_t ulPinType ; // Must be 8 bits + uint8_t ulPeripheralAttribute ; // Must be 8 bit bitfield + uint32_t ulPinAttribute ; // Must be 32 bit bitfield + uint16_t ulTCChannel ; // Must be 16 bits + uint8_t ulADCChannelNumber ; // Must be 8 bits + uint8_t ulExtInt ; // Must be 8 bits } PinDescription ; /* Pins table to be instantiated into variant.cpp */ diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c new file mode 100644 index 000000000..fed128c44 --- /dev/null +++ b/cores/arduino/cortex_handlers.c @@ -0,0 +1,178 @@ +/* + Copyright (c) 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 +*/ + +#include "sam.h" +#include "variant.h" + +/* RTOS Hooks */ +extern void svcHook(void); +extern void pendSVHook(void); +extern int sysTickHook(void); + +/* Default empty handler */ + +void Dummy_Handler(void) +{ +#if defined DEBUG + __BKPT(3); +#endif + for (;;) { } +} + +/* Cortex-M0+ core handlers */ +void HardFault_Handler(void) __attribute__ ((weak, alias("Dummy_Handler"))); +void Reest_Handler (void); +void NMI_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SVC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void PendSV_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SysTick_Handler (void); + +/* Peripherals handlers */ +void PM_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SYSCTRL_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void WDT_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void RTC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void EIC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void NVMCTRL_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void DMAC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void USB_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void EVSYS_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM3_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM4_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SERCOM5_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TCC0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TCC1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TCC2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC3_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC4_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC5_Handler (void) __attribute__ ((weak)); // Used in Tone.cpp +void TC6_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC7_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void ADC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void AC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void DAC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void PTC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void I2S_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); + +/* Initialize segments */ +extern uint32_t __etext; +extern uint32_t __data_start__; +extern uint32_t __data_end__; +extern uint32_t __bss_start__; +extern uint32_t __bss_end__; +extern uint32_t __StackTop; + +/* Exception Table */ +__attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = +{ + /* Configure Initial Stack Pointer, using linker-generated symbols */ + (void*) (&__StackTop), + + (void*) Reset_Handler, + (void*) NMI_Handler, + (void*) HardFault_Handler, + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) SVC_Handler, + (void*) (0UL), /* Reserved */ + (void*) (0UL), /* Reserved */ + (void*) PendSV_Handler, + (void*) SysTick_Handler, + + /* Configurable interrupts */ + (void*) PM_Handler, /* 0 Power Manager */ + (void*) SYSCTRL_Handler, /* 1 System Control */ + (void*) WDT_Handler, /* 2 Watchdog Timer */ + (void*) RTC_Handler, /* 3 Real-Time Counter */ + (void*) EIC_Handler, /* 4 External Interrupt Controller */ + (void*) NVMCTRL_Handler, /* 5 Non-Volatile Memory Controller */ + (void*) DMAC_Handler, /* 6 Direct Memory Access Controller */ + (void*) USB_Handler, /* 7 Universal Serial Bus */ + (void*) EVSYS_Handler, /* 8 Event System Interface */ + (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ + (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ + (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ + (void*) SERCOM3_Handler, /* 12 Serial Communication Interface 3 */ + (void*) SERCOM4_Handler, /* 13 Serial Communication Interface 4 */ + (void*) SERCOM5_Handler, /* 14 Serial Communication Interface 5 */ + (void*) TCC0_Handler, /* 15 Timer Counter Control 0 */ + (void*) TCC1_Handler, /* 16 Timer Counter Control 1 */ + (void*) TCC2_Handler, /* 17 Timer Counter Control 2 */ + (void*) TC3_Handler, /* 18 Basic Timer Counter 0 */ + (void*) TC4_Handler, /* 19 Basic Timer Counter 1 */ + (void*) TC5_Handler, /* 20 Basic Timer Counter 2 */ + (void*) TC6_Handler, /* 21 Basic Timer Counter 3 */ + (void*) TC7_Handler, /* 22 Basic Timer Counter 4 */ + (void*) ADC_Handler, /* 23 Analog Digital Converter */ + (void*) AC_Handler, /* 24 Analog Comparators */ + (void*) DAC_Handler, /* 25 Digital Analog Converter */ + (void*) PTC_Handler, /* 26 Peripheral Touch Controller */ + (void*) I2S_Handler /* 27 Inter-IC Sound Interface */ +}; + +extern int main(void); +extern void __libc_init_array(void); + +/* This is called on processor reset to initialize the device and call main() */ +void Reset_Handler(void) +{ + uint32_t *pSrc, *pDest; + + /* Initialize the initialized data section */ + pSrc = &__etext; + pDest = &__data_start__; + + if ((&__data_start__ != &__data_end__) && (pSrc != pDest)) { + for (; pDest < &__data_end__; pDest++, pSrc++) + *pDest = *pSrc; + } + + /* Clear the zero section */ + if ((&__data_start__ != &__data_end__) && (pSrc != pDest)) { + for (pDest = &__bss_start__; pDest < &__bss_end__; pDest++) + *pDest = 0; + } + + /* Initialize the C library */ + __libc_init_array(); + + SystemInit(); + + main(); + + while (1) + ; +} + +/* Default Arduino systick handler */ +extern void SysTick_DefaultHandler(void); + +void SysTick_Handler(void) +{ + if (sysTickHook()) + return; + SysTick_DefaultHandler(); +} diff --git a/cores/arduino/delay.c b/cores/arduino/delay.c index 98aa097ef..e43131f21 100644 --- a/cores/arduino/delay.c +++ b/cores/arduino/delay.c @@ -78,10 +78,10 @@ void delay( uint32_t ms ) #include "Reset.h" // for tickReset() -void SysTick_Handler( void ) +void SysTick_DefaultHandler(void) { // Increment tick count each ms - _ulTickCount++ ; + _ulTickCount++; tickReset(); } diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index a62cb08ca..9a43b4a8e 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -19,123 +19,6 @@ #include "sam.h" #include "variant.h" -/* Initialize segments */ -extern uint32_t __etext ; -extern uint32_t __data_start__ ; -extern uint32_t __data_end__ ; -extern uint32_t __bss_start__ ; -extern uint32_t __bss_end__ ; -extern uint32_t __StackTop; - -extern int main( void ) ; -extern void __libc_init_array(void); - -/* Default empty handler */ -void Dummy_Handler(void); - -/* Cortex-M0+ core handlers */ -#if defined DEBUG -void HardFault_Handler( void ) -{ - __BKPT( 3 ) ; - - while ( 1 ) - { - } -} -#else -void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif //DEBUG - -void NMI_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SVC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void PendSV_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SysTick_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); - -/* Peripherals handlers */ -void PM_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SYSCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void WDT_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void RTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void EIC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void NVMCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void DMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void USB_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void EVSYS_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SERCOM0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SERCOM1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SERCOM2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SERCOM3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SERCOM4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void SERCOM5_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TCC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TCC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TCC2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TC3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TC4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TC5_Handler ( void ) __attribute__ ((weak)); -void TC6_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void TC7_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void ADC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void AC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void DAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -void I2S_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); - -/* Exception Table */ -__attribute__ ((section(".isr_vector"))) -const DeviceVectors exception_table= -{ - /* Configure Initial Stack Pointer, using linker-generated symbols */ - (void*) (&__StackTop), - - (void*) Reset_Handler, - (void*) NMI_Handler, - (void*) HardFault_Handler, - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) SVC_Handler, - (void*) (0UL), /* Reserved */ - (void*) (0UL), /* Reserved */ - (void*) PendSV_Handler, - (void*) SysTick_Handler, - - /* Configurable interrupts */ - (void*) PM_Handler, /* 0 Power Manager */ - (void*) SYSCTRL_Handler, /* 1 System Control */ - (void*) WDT_Handler, /* 2 Watchdog Timer */ - (void*) RTC_Handler, /* 3 Real-Time Counter */ - (void*) EIC_Handler, /* 4 External Interrupt Controller */ - (void*) NVMCTRL_Handler, /* 5 Non-Volatile Memory Controller */ - (void*) DMAC_Handler, /* 6 Direct Memory Access Controller */ - (void*) USB_Handler, /* 7 Universal Serial Bus */ - (void*) EVSYS_Handler, /* 8 Event System Interface */ - (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ - (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ - (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ - (void*) SERCOM3_Handler, /* 12 Serial Communication Interface 3 */ - (void*) SERCOM4_Handler, /* 13 Serial Communication Interface 4 */ - (void*) SERCOM5_Handler, /* 14 Serial Communication Interface 5 */ - (void*) TCC0_Handler, /* 15 Timer Counter Control 0 */ - (void*) TCC1_Handler, /* 16 Timer Counter Control 1 */ - (void*) TCC2_Handler, /* 17 Timer Counter Control 2 */ - (void*) TC3_Handler, /* 18 Basic Timer Counter 0 */ - (void*) TC4_Handler, /* 19 Basic Timer Counter 1 */ - (void*) TC5_Handler, /* 20 Basic Timer Counter 2 */ - (void*) TC6_Handler, /* 21 Basic Timer Counter 3 */ - (void*) TC7_Handler, /* 22 Basic Timer Counter 4 */ - (void*) ADC_Handler, /* 23 Analog Digital Converter */ - (void*) AC_Handler, /* 24 Analog Comparators */ - (void*) DAC_Handler, /* 25 Digital Analog Converter */ - (void*) PTC_Handler, /* 26 Peripheral Touch Controller */ - (void*) I2S_Handler /* 27 Inter-IC Sound Interface */ -} ; - /** * \brief SystemInit() configures the needed clocks and according Flash Read Wait States. * At reset: @@ -340,59 +223,3 @@ void SystemInit( void ) ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); } -/** - * \brief This is the code that gets called on processor reset. - * To initialize the device, and call the main() routine. - */ -void Reset_Handler( void ) -{ - uint32_t *pSrc, *pDest; - - /* Initialize the initialized data section */ - pSrc = &__etext; - pDest = &__data_start__; - - if ( (&__data_start__ != &__data_end__) && (pSrc != pDest) ) - { - for (; pDest < &__data_end__ ; pDest++, pSrc++ ) - { - *pDest = *pSrc ; - } - } - - /* Clear the zero section */ - if ( (&__data_start__ != &__data_end__) && (pSrc != pDest) ) - { - for ( pDest = &__bss_start__ ; pDest < &__bss_end__ ; pDest++ ) - { - *pDest = 0 ; - } - } - - /* Initialize the C library */ - __libc_init_array(); - - SystemInit() ; - - /* Branch to main function */ - main() ; - - /* Infinite loop */ - while ( 1 ) - { - } -} - -/** - * \brief Default interrupt handler for unused IRQs. - */ -void Dummy_Handler( void ) -{ -#if defined DEBUG - __BKPT( 3 ) ; -#endif // DEBUG - - while ( 1 ) - { - } -} diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index 0a1395d75..145512081 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -73,10 +73,19 @@ void init( void ) // PM->APBAMASK.reg |= PM_APBAMASK_EIC ; // Clock SERCOM for Serial +#if defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ + defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ; +#else + PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 ; +#endif // Clock TC/TCC for Pulse and Analog +#if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) + PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 | PM_APBCMASK_TC6 | PM_APBCMASK_TC7 ; +#else PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ; +#endif // Clock ADC/DAC for Analog PM->APBCMASK.reg |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ; @@ -110,7 +119,7 @@ void init( void ) ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 | // 1 sample only (no oversampling nor averaging) ADC_AVGCTRL_ADJRES(0x0ul); // Adjusting result by 0 - analogReference( AR_DEFAULT ) ; // Analog Reference is AREF pin (3.3v) + analogReference( VARIANT_AR_DEFAULT ) ; // Use default reference from variant.h // Initialize DAC // Setting clock diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 37f1fa045..0eeb49c1a 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -97,7 +97,7 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to } /* - * Internal Reference is at 1.0v + * Default Internal Reference is at 1.65V (with ADC gain of 1/2) * External Reference should be between 1v and VDDANA-0.6v=2.7v * * Warning : On Arduino Zero board the input/output voltage for SAMD21G18 is 3.3 volts maximum @@ -114,8 +114,11 @@ void analogReference( eAnalogReference ulMode ) break; case AR_EXTERNAL: - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection - ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val; + if ( pinPeripheral(REFA_PIN, PIO_ANALOG_REF) == RET_STATUS_OK ) + { + ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection + ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val; + } break; case AR_INTERNAL1V0: @@ -130,7 +133,7 @@ void analogReference( eAnalogReference ulMode ) case AR_DEFAULT: default: - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val; + ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val; // This allows values up to VDDANA (3.3V) on the pin ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V break; } @@ -140,57 +143,56 @@ uint32_t analogRead( uint32_t ulPin ) { uint32_t valueRead = 0; - if ( ulPin < A0 ) - { - ulPin += A0 ; - } - - pinPeripheral(ulPin, g_APinDescription[ulPin].ulPinType); + REMAP_ANALOG_PIN_ID ; - if (ulPin == A0) // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled + if ( pinPeripheral(ulPin, PIO_ANALOG_ADC) == RET_STATUS_OK ) { - syncDAC(); - DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC - //DAC->CTRLB.bit.EOEN = 0x00; // The DAC output is turned off. - syncDAC(); - } - - syncADC(); - ADC->INPUTCTRL.bit.MUXPOS = g_APinDescription[ulPin].ulADCChannelNumber; // Selection for the positive ADC input - - // Control A - /* - * Bit 1 ENABLE: Enable - * 0: The ADC is disabled. - * 1: The ADC is enabled. - * Due to synchronization, there is a delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The - * value written to CTRL.ENABLE will read back immediately and the Synchronization Busy bit in the Status register - * (STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete. - * - * Before enabling the ADC, the asynchronous clock source must be selected and enabled, and the ADC reference must be - * configured. The first conversion after the reference is changed must not be used. - */ - syncADC(); - ADC->CTRLA.bit.ENABLE = 0x01; // Enable ADC - - // Start conversion - syncADC(); - ADC->SWTRIG.bit.START = 1; - - // Clear the Data Ready flag - ADC->INTFLAG.bit.RESRDY = 1; - - // Start conversion again, since The first conversion after the reference is changed must not be used. - syncADC(); - ADC->SWTRIG.bit.START = 1; - - // Store the value - while ( ADC->INTFLAG.bit.RESRDY == 0 ); // Waiting for conversion to complete - valueRead = ADC->RESULT.reg; + // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled + if ( (g_APinDescription[ulPin].ulPinAttribute & PIN_ATTR_DAC) == PIN_ATTR_DAC ) + { + syncDAC(); + DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC + //DAC->CTRLB.bit.EOEN = 0x00; // The DAC output is turned off. + syncDAC(); + } - syncADC(); - ADC->CTRLA.bit.ENABLE = 0x00; // Disable ADC - syncADC(); + syncADC(); + ADC->INPUTCTRL.bit.MUXPOS = g_APinDescription[ulPin].ulADCChannelNumber; // Selection for the positive ADC input + + // Control A + /* + * Bit 1 ENABLE: Enable + * 0: The ADC is disabled. + * 1: The ADC is enabled. + * Due to synchronization, there is a delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The + * value written to CTRL.ENABLE will read back immediately and the Synchronization Busy bit in the Status register + * (STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete. + * + * Before enabling the ADC, the asynchronous clock source must be selected and enabled, and the ADC reference must be + * configured. The first conversion after the reference is changed must not be used. + */ + syncADC(); + ADC->CTRLA.bit.ENABLE = 0x01; // Enable ADC + + // Start conversion + syncADC(); + ADC->SWTRIG.bit.START = 1; + + // Clear the Data Ready flag + ADC->INTFLAG.bit.RESRDY = 1; + + // Start conversion again, since The first conversion after the reference is changed must not be used. + syncADC(); + ADC->SWTRIG.bit.START = 1; + + // Store the value + while ( ADC->INTFLAG.bit.RESRDY == 0 ); // Waiting for conversion to complete + valueRead = ADC->RESULT.reg; + + syncADC(); + ADC->CTRLA.bit.ENABLE = 0x00; // Disable ADC + syncADC(); + } return mapResolution(valueRead, _ADCResolution, _readResolution); } @@ -202,15 +204,8 @@ uint32_t analogRead( uint32_t ulPin ) // to digital output. void analogWrite( uint32_t ulPin, uint32_t ulValue ) { - uint32_t attr = g_APinDescription[ulPin].ulPinAttribute ; - - if ( (attr & PIN_ATTR_ANALOG) == PIN_ATTR_ANALOG ) + if ( pinPeripheral(ulPin, PIO_ANALOG_DAC) == RET_STATUS_OK ) { - if ( ulPin != PIN_A0 ) // Only 1 DAC on A0 (PA02) - { - return; - } - ulValue = mapResolution(ulValue, _writeResolution, 10); syncDAC(); @@ -220,28 +215,22 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) syncDAC(); return ; } - - if ( (attr & PIN_ATTR_PWM) == PIN_ATTR_PWM ) + else if ( pinPeripheral(ulPin, PIO_TIMER_PWM) == RET_STATUS_OK ) { - if ( (g_APinDescription[ulPin].ulPinType == PIO_TIMER) || g_APinDescription[ulPin].ulPinType == PIO_TIMER_ALT ) - { - pinPeripheral( ulPin, g_APinDescription[ulPin].ulPinType ) ; - } - Tc* TCx = 0 ; Tcc* TCCx = 0 ; - uint8_t Channelx = GetTCChannelNumber( g_APinDescription[ulPin].ulPWMChannel ) ; - if ( GetTCNumber( g_APinDescription[ulPin].ulPWMChannel ) >= TCC_INST_NUM ) + uint8_t Channelx = GetTCChannelNumber( g_APinDescription[ulPin].ulTCChannel ) ; + if ( GetTCNumber( g_APinDescription[ulPin].ulTCChannel ) >= TCC_INST_NUM ) { - TCx = (Tc*) GetTC( g_APinDescription[ulPin].ulPWMChannel ) ; + TCx = (Tc*) GetTC( g_APinDescription[ulPin].ulTCChannel ) ; } else { - TCCx = (Tcc*) GetTC( g_APinDescription[ulPin].ulPWMChannel ) ; + TCCx = (Tcc*) GetTC( g_APinDescription[ulPin].ulTCChannel ) ; } // Enable clocks according to TCCx instance to use - switch ( GetTCNumber( g_APinDescription[ulPin].ulPWMChannel ) ) + switch ( GetTCNumber( g_APinDescription[ulPin].ulTCChannel ) ) { case 0: // TCC0 case 1: // TCC1 @@ -261,11 +250,13 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC4_TC5 )); break ; +#if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) case 6: // TC6 (not available on Zero) case 7: // TC7 (not available on Zero) // Enable GCLK for TC6 and TC7 (timer counter input clock) GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC6_TC7 )); break ; +#endif } while ( GCLK->STATUS.bit.SYNCBUSY == 1 ) ; @@ -313,20 +304,19 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) TCCx->CTRLA.reg |= TCC_CTRLA_ENABLE ; syncTCC(TCCx); } - - return ; } - // -- Defaults to digital write - pinMode( ulPin, OUTPUT ) ; - ulValue = mapResolution(ulValue, _writeResolution, 8); - if ( ulValue < 128 ) + else if ( pinPeripheral(ulPin, PIO_OUTPUT) == RET_STATUS_OK ) { - digitalWrite( ulPin, LOW ) ; - } - else - { - digitalWrite( ulPin, HIGH ) ; + ulValue = mapResolution(ulValue, _writeResolution, 8); + if ( ulValue < 128 ) + { + digitalWrite( ulPin, LOW ) ; + } + else + { + digitalWrite( ulPin, HIGH ) ; + } } } diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 59f9e4f1d..52b9f442d 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -24,49 +24,8 @@ void pinMode( uint32_t ulPin, uint32_t ulMode ) { - // Handle the case the pin isn't usable as PIO - if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN ) - { - return ; - } - // Set pin mode according to chapter '22.6.3 I/O Pin Configuration' - switch ( ulMode ) - { - case INPUT: - // Set pin to input mode - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].OUTSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg&=~(uint8_t)(PORT_PINCFG_INEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_PULLEN) ; + // Enable pull resistor if pin attributes allow + uint32_t pinAttribute = g_APinDescription[ulPin].ulPinAttribute; + if ( (ulVal == HIGH && (pinAttribute & PIN_ATTR_INPUT_PULLUP)) || (ulVal == LOW && (pinAttribute & PIN_ATTR_INPUT_PULLDOWN)) ) + { + PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= (uint8_t)(PORT_PINCFG_PULLEN) ; + } + else + { + PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg &= ~(uint8_t)(PORT_PINCFG_PULLEN) ; + } switch ( ulVal ) { diff --git a/cores/arduino/wiring_private.c b/cores/arduino/wiring_private.c index a5aaba42c..3b7b2c8cd 100644 --- a/cores/arduino/wiring_private.c +++ b/cores/arduino/wiring_private.c @@ -19,56 +19,142 @@ #include "Arduino.h" #include "wiring_private.h" -int pinPeripheral( uint32_t ulPin, EPioType ulPeripheral ) +int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) { + uint32_t pinAttribute = g_APinDescription[ulPin].ulPinAttribute; + uint8_t peripheralAttribute = g_APinDescription[ulPin].ulPeripheralAttribute; + EPioType pinType = g_APinDescription[ulPin].ulPinType; + // Handle the case the pin isn't usable as PIO - if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN ) + if ( pinType == PIO_NOT_A_PIN ) + { + return -1 ; + } + + // If pinType is not PIO_MULTI in the pinDescription table, then it must match ulPeripheral + if ( pinType != PIO_MULTI && pinType != ulPeripheral ) { return -1 ; } + // Make sure ulPeripheral is listed in the attributes + if ( !(pinAttribute & (1UL << ulPeripheral)) ) + { + return -1 ; + } + + // Determine hardware peripheral to use + EPioPeripheral peripheral = PER_PORT; switch ( ulPeripheral ) { - case PIO_DIGITAL: - case PIO_INPUT: - case PIO_INPUT_PULLUP: - case PIO_OUTPUT: - // Disable peripheral muxing, done in pinMode -// PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].bit.PMUXEN = 0 ; + case PIO_EXTINT: + if ( digitalPinToInterrupt( ulPin ) == NOT_AN_INTERRUPT ) + { + return -1 ; + } + peripheral = PER_EXTINT; + break ; + + case PIO_ANALOG_ADC: + if ( g_APinDescription[ulPin].ulADCChannelNumber == No_ADC_Channel ) + { + return -1 ; + } + peripheral = PER_ANALOG; + break ; + + case PIO_ANALOG_DAC: + case PIO_ANALOG_REF: + peripheral = PER_ANALOG; + break ; - // Configure pin mode, if requested - if ( ulPeripheral == PIO_INPUT ) + case PIO_TIMER_PWM: + case PIO_TIMER_CAPTURE: + if ( g_APinDescription[ulPin].ulTCChannel == NOT_ON_TIMER ) { - pinMode( ulPin, INPUT ) ; + return -1 ; + } + + if ( (peripheralAttribute & PER_ATTR_TIMER_MASK) == PER_ATTR_TIMER_STD ) + { + peripheral = PER_TIMER; } else { - if ( ulPeripheral == PIO_INPUT_PULLUP ) - { - pinMode( ulPin, INPUT_PULLUP ) ; - } - else - { - if ( ulPeripheral == PIO_OUTPUT ) - { - pinMode( ulPin, OUTPUT ) ; - } - else - { - // PIO_DIGITAL, do we have to do something as all cases are covered? - } - } + peripheral = PER_TIMER_ALT; } break ; - case PIO_ANALOG: case PIO_SERCOM: - case PIO_SERCOM_ALT: - case PIO_TIMER: - case PIO_TIMER_ALT: + if ( (peripheralAttribute & PER_ATTR_SERCOM_MASK) == PER_ATTR_SERCOM_STD ) + { + peripheral = PER_SERCOM; + } + else + { + peripheral = PER_SERCOM_ALT; + } + break ; + + case PIO_COM: + peripheral = PER_COM; + break ; + + case PIO_AC_GCLK: + peripheral = PER_AC_CLK; + break ; + + default: + break ; + } + + switch ( ulPeripheral ) + { + // Set pin mode according to chapter '22.6.3 I/O Pin Configuration' + case PIO_INPUT: + // Set pin to input mode, disable the port mux + PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN) ; + PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg &= ~(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PMUXEN) ; + if ( (peripheralAttribute & PER_ATTR_DRIVE_MASK) == PER_ATTR_DRIVE_STRONG ) + { + PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= (uint8_t)(PORT_PINCFG_DRVSTR) ; + } + PORT->Group[g_APinDescription[ulPin].ulPort].DIRSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ; + PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].OUTSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ; + PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg) & PORT_PMUX_PMUXE( 0xF ) ; // Set new muxing - PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg = temp|PORT_PMUX_PMUXO( ulPeripheral ) ; + PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg = temp|PORT_PMUX_PMUXO( peripheral ) ; // Enable port mux PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= PORT_PINCFG_PMUXEN ; } @@ -102,13 +188,15 @@ int pinPeripheral( uint32_t ulPin, EPioType ulPeripheral ) uint32_t temp ; temp = (PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg) & PORT_PMUX_PMUXO( 0xF ) ; - PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg = temp|PORT_PMUX_PMUXE( ulPeripheral ) ; + PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg = temp|PORT_PMUX_PMUXE( peripheral ) ; PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= PORT_PINCFG_PMUXEN ; // Enable port mux } #endif break ; case PIO_NOT_A_PIN: + case PIO_MULTI: + default: return -1l ; break ; } diff --git a/cores/arduino/wiring_private.h b/cores/arduino/wiring_private.h index ce64e2def..fc1f4501e 100644 --- a/cores/arduino/wiring_private.h +++ b/cores/arduino/wiring_private.h @@ -31,7 +31,9 @@ extern "C" { #include "wiring_constants.h" -int pinPeripheral( uint32_t ulPin, EPioType ulPeripheral ); +#define RET_STATUS_OK 0 + +int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ); #ifdef __cplusplus } // extern "C" diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index e4af0464a..74714a476 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -44,10 +44,10 @@ void SPIClass::begin() init(); // PIO init - pinPeripheral(_uc_pinMiso, g_APinDescription[_uc_pinMiso].ulPinType); - pinPeripheral(_uc_pinSCK, g_APinDescription[_uc_pinSCK].ulPinType); - pinPeripheral(_uc_pinMosi, g_APinDescription[_uc_pinMosi].ulPinType); - + pinPeripheral(_uc_pinMiso, PIO_SERCOM); + pinPeripheral(_uc_pinSCK, PIO_SERCOM); + pinPeripheral(_uc_pinMosi, PIO_SERCOM); + config(DEFAULT_SPI_SETTINGS); } @@ -197,4 +197,6 @@ void SPIClass::detachInterrupt() { // Should be disableInterrupt() } -SPIClass SPI( &sercom4, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI ); +#if SPI_INTERFACES_COUNT > 0 +SPIClass SPI( SERCOM_INSTANCE_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI ); +#endif diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index 6259d2d76..e9ff8e4f3 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -21,6 +21,7 @@ #define _SPI_H_INCLUDED #include +#include // SPI_HAS_TRANSACTION means SPI has // - beginTransaction() diff --git a/libraries/USBHost/src/Usb.cpp b/libraries/USBHost/src/Usb.cpp index 6c1570b82..70d1b754b 100644 --- a/libraries/USBHost/src/Usb.cpp +++ b/libraries/USBHost/src/Usb.cpp @@ -21,7 +21,7 @@ e-mail : support@circuitsathome.com #include "Usb.h" -#ifdef ARDUINO_SAMD_ZERO +#ifdef ARDUINO_ARCH_SAMD static uint32_t usb_error = 0; static uint32_t usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; @@ -143,7 +143,7 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t if (rcode) { TRACE_USBHOST(printf("/!\\ USBHost::ctrlReq : EP0 allocation error: %lu\r\n", rcode);) - //USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode"); + //USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode"); return rcode; } @@ -854,4 +854,6 @@ uint32_t USBHost::setConf(uint32_t addr, uint32_t ep, uint32_t conf_value) { return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL)); } -#endif //ARDUINO_SAMD_ZERO +#else +#error This library is only compatible with ARDUINO_ARCH_SAMD +#endif //ARDUINO_ARCH_SAMD diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 08f066695..a0d486da0 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -36,9 +36,13 @@ void TwoWire::begin(void) { //Master Mode sercom->initMasterWIRE(TWI_CLOCK); sercom->enableWIRE(); + + pinPeripheral(PIN_WIRE_SDA, PIO_SERCOM); + pinPeripheral(PIN_WIRE_SCL, PIO_SERCOM); +} - pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType); - pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType); +void TwoWire::end(void) { + sercom->disableWIRE(); } void TwoWire::begin(uint8_t address) { @@ -342,10 +346,8 @@ void TwoWire::onService(void) }*/ -TwoWire Wire(&sercom3); +TwoWire Wire(SERCOM_INSTANCE_WIRE); -void SERCOM3_Handler(void) { - Wire.onService(); -} +SERCOM_WIRE_HANDLER_MACRO #endif diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index d5c98cd30..9d30a2963 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -22,6 +22,7 @@ #include "Stream.h" #include "variant.h" +#include #include "SERCOM.h" #include "RingBuffer.h" @@ -34,6 +35,7 @@ class TwoWire : public Stream TwoWire(SERCOM *s); void begin(); void begin(uint8_t); + void end(); void beginTransmission(uint8_t); uint8_t endTransmission(bool stopBit); @@ -98,6 +100,8 @@ class TwoWire : public Stream //static const uint32_t XMIT_TIMEOUT = 100000; }; +#if WIRE_INTERFACES_COUNT > 0 extern TwoWire Wire; +#endif #endif diff --git a/platform.txt b/platform.txt index 59a4b6b9c..06d4dba9c 100644 --- a/platform.txt +++ b/platform.txt @@ -14,11 +14,6 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* - * Modified 23 June 2015 by Justin Mattair - * for the MattairTech MT-D21E board (www.mattairtech.com) - */ - # Arduino SAMD Core and platform. # # For more info: @@ -115,7 +110,7 @@ recipe.size.regex=\.text\s+([0-9]+).* # # BOSSA # -tools.bossac.path={runtime.tools.bossac-1.5-arduino.path} +tools.bossac.path={runtime.tools.bossac-1.5-arduino-mattairtech-1.path} tools.bossac.cmd=bossac tools.bossac.cmd.windows=bossac.exe @@ -143,7 +138,7 @@ tools.openocd.erase.params.verbose=-d3 tools.openocd.erase.params.quiet=-d0 tools.openocd.erase.pattern= -tools.openocd.bootloader.params.verbose=-d2 +tools.openocd.bootloader.params.verbose=-d3 tools.openocd.bootloader.params.quiet=-d0 tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown" diff --git a/programmers.txt b/programmers.txt deleted file mode 100644 index 93a928fc4..000000000 --- a/programmers.txt +++ /dev/null @@ -1,30 +0,0 @@ -# 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 - - -atmel_ice.name=Atmel-ICE -atmel_ice.communication=USB -atmel_ice.protocol= -atmel_ice.program.protocol= -atmel_ice.program.tool=openocd -atmel_ice.program.extra_params= - -sam_ice.name=Atmel SAM-ICE -sam_ice.communication=USB -sam_ice.protocol= -sam_ice.program.protocol= -sam_ice.program.tool=openocd -sam_ice.program.extra_params= diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index 9ab048009..887e79a86 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -17,29 +17,60 @@ */ /* - Modified 21 June 2015 by Justin Mattair - for the MattairTech MT-D21E board (www.mattairtech.com) + Modified 20 July 2015 by Justin Mattair + for MattairTech MT-D21E boards (www.mattairtech.com) +*/ + +/* +============================================ MattairTech MT-D21E (ATsamd21eXXa) ======================================== +Comm/Other INT PWM Digital Analog Digital PWM INT Comm/other +======================================================================================================================== + ----------------------- +Xin32 | A0 RST | Reset +Xout32 | A1 NC | + 2 2 (ADC0, DAC) | A2 NC | + 3 3 (ADC1, REF) | A3 A31 | 31 TCC1/WO[1] INT11 Button B / SWD IO + INT4 4 4 (ADC4) | A4 A30 | 30 TCC1/WO[0] INT10 SWD CLK + INT5 5 5 (ADC5) | A5 NC | + 6 6 (ADC6) | A6 A28 | 28 INT8 LED +VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A + INTNMI TCC0/WO[0] 8 8 (ADC16) | A8 A23 | 23 TC4/WO[1] INT7 SPI SS + INT9 TCC0/WO[1] 9 9 (ADC17) | A9 A22 | 22 TC4/WO[0] INT6 SPI MISO +TX (1) TCC0/WO[2] 10 10 (ADC18) | A10 A19 | 19 INT3 SPI SCK +RX (1) TCC0/WO[3] 11 11 (ADC19) | A11 A18 | 18 INT2 SPI MOSI +TX (2) INT14 TC3/WO[0] 14 | A14 A17 | 17 TCC2/WO[1] INT1 I2C/SCL +RX (2) TC3/WO[1] 15 | A15 A16 | 16 TCC2/WO[0] INT0 I2C/SDA + | NC NC | + | NC NC | + | Vbus 3.3V | +USB D- | A24- _____ Vcc | +USB D+ | A25+ | | Vin | + | Gnd | USB | Gnd | + ----------------------- + Most pins have multiple configurations available (even analog pins). For example, pin A10 can be an analog input, a + PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board but + without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! */ /* Pins descriptions for the MattairTech MT-D21E * - * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (* is for default peripheral in use, () means unavailable) + * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (* is for default peripheral in use, ! means unavailable with this variant) * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- * | 0 | -- | A0 | PA00 | Xin32 | *Xin32 * | 1 | -- | A1 | PA01 | Xout32 | *Xout32 - * | 2 | 2 | A2 | PA02 | | EIC/EXTINT[2] *ADC/AIN[0] PTC/Y[0] DAC/VOUT - * | 3 | 3 | A3 | PA03 | REFA | EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFP *ADC/AIN[1] PTC/Y[1] - * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFP *ADC/AIN[4] AC/AIN[0] PTC/Y[2] (SERCOM0/PAD[0]) (TCC0/WO[0]) - * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[3] (SERCOM0/PAD[1]) (TCC0/WO[1]) - * | 6 | 6 | A6 | PA06 | | EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] (SERCOM0/PAD[2]) (TCC1/WO[0]) - * | 7 | 7 | A7 | PA07 | Voltage Divider | EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] (SERCOM0/PAD[3]) (TCC1/WO[1]) - * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] (SERCOM0/PAD[0]) (SERCOM2/PAD[0]) *TCC0/WO[0] (TCC1/WO[2]) - * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] (SERCOM0/PAD[1]) (SERCOM2/PAD[1]) *TCC0/WO[1] (TCC1/WO[3]) - * | 10 | 10 | A10 | PA10 | TX | EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] (SERCOM2/PAD[2]) (TCC1/WO[0]) TCC0/WO[2] - * | 11 | 11 | A11 | PA11 | RX | EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] (SERCOM2/PAD[3]) (TCC1/WO[1]) TCC0/WO[3] - * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] (SERCOM4/PAD[2]) *TC3/WO[0] (TCC0/WO[4]) Xin, HOST_ENABLE - * | 13 | 15 | A15 | PA15 | Xout, ATN | EIC/EXTINT[15] SERCOM2/PAD[3] (SERCOM4/PAD[3]) *TC3/WO[1] (TCC0/WO[5]) Xout, ATN + * | 2 | 2 | A2 | PA02 | | !EIC/EXTINT[2] *ADC/AIN[0] PTC/Y[0] DAC/VOUT + * | 3 | 3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA *ADC/AIN[1] PTC/Y[1] + * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFB *ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[0] !TCC0/WO[0] + * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] + * | 6 | 6 | A6 | PA06 | | !EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] + * | 7 | 7 | A7 | PA07 | Voltage Divider | !EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] + * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] *TCC0/WO[0] !TCC1/WO[2] + * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] *TCC0/WO[1] !TCC1/WO[3] + * | 10 | 10 | A10 | PA10 | TX | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] + * | 11 | 11 | A11 | PA11 | RX | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] + * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] *TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE + * | 13 | 15 | A15 | PA15 | Xout | !EIC/EXTINT[15] SERCOM2/PAD[3] *TC3/WO[1] !TCC0/WO[5] Xout * | 14 | -- | NC | ---- | | Not Connected * | 15 | -- | NC | ---- | | Not Connected * | 16 | -- | Vbus | ---- | | USB Vbus @@ -52,17 +83,17 @@ * | 23 | -- | 3.3V | ---- | | 3.3V * | 24 | -- | NC | ---- | | Not Connected * | 25 | -- | NC | ---- | | Not Connected - * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] (SERCOM3/PAD[0]) TCC2/WO[0] (TCC0/WO[6]) - * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] (SERCOM3/PAD[1]) TCC2/WO[1] (TCC0/WO[7]) - * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] (SERCOM1/PAD[2]) *SERCOM3/PAD[2] (TC3/WO[0]) (TCC0/WO[2]) - * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] (SERCOM1/PAD[3]) *SERCOM3/PAD[3] (TC3/WO[1]) (TCC0/WO[3]) - * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] (SERCOM5/PAD[0]) TC4/WO[0] (TCC0/WO[4]) - * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] (SERCOM5/PAD[1]) TC4/WO[1] (TCC0/WO[5]) + * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] + * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] + * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] *SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] + * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] *SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] + * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] + * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] * | 32 | 27 | A27 | PA27 | Button A | EIC/EXTINT[15] *Button A * | 33 | 28 | A28 | PA28 | LED | EIC/EXTINT[8] *LED * | 34 | -- | NC | ---- | | Not Connected - * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] (SERCOM1/PAD[2]) *TCC1/WO[0] SWD CLK - * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] (SERCOM1/PAD[3]) *TCC1/WO[1] Button B SWD IO + * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] *TCC1/WO[0] SWD CLK + * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] *TCC1/WO[1] Button B SWD IO * | 37 | -- | NC | ---- | | Not Connected * | 38 | -- | NC | ---- | | Not Connected * | 39 | -- | RST | ---- | | Reset @@ -71,11 +102,66 @@ * You may use Arduino pin numbers ranging from 0 to 31. The Arduino pin corresponds to the silkscreen (without the 'A'). * For example, use pinMode(28, OUTPUT) to set the LED pin (marked as A28) as an output. * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 12, 13, 20, 21, 24, 25, 26, and 29. - * Note that pins 0 and 1 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). - * Note also that pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). + * Pins 0 and 1 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). + * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). + * When using pins 22 and/or 23 as pwm outputs, it will use Timer TC4, which conflicts with the servo library. + * The tone library uses TC5. */ +/* The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple + * functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures + * which functions can be used for each pin. This table is mainly accessed by the pinPeripheral function in + * wiring_private.c, which is used to attach a pin to a particular peripheral function. The communications drivers + * (ie: SPI, I2C, and UART), analogRead(), analogWrite(), analogReference(), attachInterrupt(), and pinMode() all + * call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for + * that function. Most of the contents of pinMode() are now in pinPeripheral(). + * + * Explanation of PinDescription table: + * + * Port This is the port (ie: PORTA). + * Pin This is the pin (bit) within the port. Valid values are 0 through 31. + * PinType This indicates what peripheral function the pin can be attached to. In most cases, this + * is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. + * It can also be set to a specific peripheral. In this case, any attempt to configure the + * pin (using pinPeripheral or pinMode) as anything else will fail (and pinPeripheral will + * return -1). This can be used to prevent accidental re-configuration of a pin that is + * configured for only one function (ie: USB D- and D+ pins). If a pin is not used or does + * not exist, PIO_NOT_A_PIN must be entered in this field. See WVariant.h for valid + * entries. These entries are also used as a parameter to pinPeripheral() with the + * exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function now calls pinPeripheral() + * with the desired mode. Note that this field is not used to select between the two + * peripherals possible with each of the SERCOM and TIMER functions. PeripheralAttribute + * is now used for this. + * PeripheralAttribute This is an 8-bit bitfield used for various peripheral configuration. It is primarily + * used to select between the two peripherals possible with each of the SERCOM and TIMER + * functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. + * This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) uses + * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. Both TIMER and + * SERCOM can exist for each pin. This bitfield is also used to set the pin drive strength. + * In the future, other attributes (like input buffer configuration) may be added. + * See WVariant.h for valid entries. + * PinAttribute This is a 32-bit bitfield used to list all of the valid peripheral functions that a pin + * can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain attributes + * are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL includes all of + * the GPIO functions, while PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and + * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). PIN_ATTR_ANALOG is an alias to + * PIN_ATTR_ANALOG_ADC. There is only one DAC channel, so PIN_ATTR_DAC appears only once. + * This bitfield is useful for limiting a pin to only input related functions or output + * functions. This allows a pin to have a more flexible configuration, while restricting + * the direction (ie: to avoid contention). See WVariant.h for valid entries. + * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some TC channels are available + * on multiple pins (ie: TCC0/WO[0] is available on pin A4 or pin A8). In general, only + * one pin should be configured (in the pinDescription table) per TC channel. + * See WVariant.h for valid entries. The tone library uses TC5. + * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See WVariant.h for valid entries. + * ExtInt This is the interrupt (if any) assigned to the pin. Some interrupt numbers are available + * on multiple pins (ie: EIC/EXTINT[2] is available on pin A2 or pin A18). In general, only + * one pin should be configured (in the pinDescription table) per interrupt number. Thus, + * if an interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. + * See WVariant.h for valid entries. + */ + #include "variant.h" /* @@ -84,61 +170,56 @@ const PinDescription g_APinDescription[]= { // 0..1 are unused (pins in use by 32.768KHz crystal, which in turn is used by the Arduino core) - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused // 2..9 - Analog capable pins (DAC avalable on 2) - { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC - { PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel1, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[1] - { PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4] - { PORTA, 5, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5] - { PORTA, 6, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL), ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[6] - { PORTA, 7, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL), ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_TIMER, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), ADC_Channel16, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NMI }, // TCC0/WO[0] - { PORTA, 9, PIO_TIMER, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), ADC_Channel17, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_9 }, // TCC0/WO[1] + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // ADC/AIN[1] + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4 }, // ADC/AIN[4] + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5 }, // ADC/AIN[5] + { PORTA, 6, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NONE }, // ADC/AIN[6] + { PORTA, 7, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9 }, // TCC0/WO[1] // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions - { PORTA, 10, PIO_SERCOM, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel18, PWM0_CH2, TCC0_CH2, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2], PIO_TIMER_ALT - { PORTA, 11, PIO_SERCOM, (PIN_ATTR_ANALOG|PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel19, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3], PIO_TIMER_ALT + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2] (PIN_ATTR_TIMER_ALT) + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3] (PIN_ATTR_TIMER_ALT) // 12..13 pins don't exist - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused // 14..15 - Digital functions - { PORTA, 14, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM3_CH0, TC3_CH0, EXTERNAL_INT_14 }, // TC3/WO[0], HOST_ENABLE - { PORTA, 15, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_NONE }, // TC3/WO[1], ATN + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14 }, // TC3/WO[0], HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // TC3/WO[1], ATN // 16..17 I2C pins (SDA/SCL) or Digital functions - { PORTA, 16, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // SDA: SERCOM1/PAD[0] - { PORTA, 17, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM2_CH1, TCC2_CH1, EXTERNAL_INT_1 }, // SCL: SERCOM1/PAD[1] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // SDA: SERCOM1/PAD[0] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // SCL: SERCOM1/PAD[1] // 18..23 - SPI Pins or Digital functions (pins 20..21 do not exist) - { PORTA, 18, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // SPI MOSI: SERCOM3/PAD[2], PIO_SERCOM_ALT - { PORTA, 19, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // SPI SCK: SERCOM3/PAD[3], PIO_SERCOM_ALT - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused -// { PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM4_CH0, TC4_CH0, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] -// { PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] - { PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] - { PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2 }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3 }, // SPI SCK: SERCOM3/PAD[3] (PIN_ATTR_SERCOM_ALT) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] // 24..26 are unused (25 and 26 in use by USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist) - { PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM - { PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DM + { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused // 27..29 Button A and LED (pin 29 does not exist) - { PORTA, 27, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // Button A - { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // LED - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Unused + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_INPUT_PULLUP|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_15 }, // Button A + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_OUTPUT|PIN_ATTR_INPUT|PIN_ATTR_INPUT_PULLDOWN|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_8 }, // LED + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_10 }, // TCC1/WO[0] / SWD CLK - { PORTA, 31, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_11 }, // TCC1/WO[1] / SWD IO - - // 32 - Alternate use of pin 2 (DAC output) - //{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, DAC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VOUT + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH0, No_ADC_Channel, EXTERNAL_INT_10 }, // TCC1/WO[0] / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH1, No_ADC_Channel, EXTERNAL_INT_11 }, // TCC1/WO[1] / SWD IO } ; const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; @@ -148,13 +229,17 @@ SERCOM sercom0( SERCOM0 ) ; SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; SERCOM sercom3( SERCOM3 ) ; -SERCOM sercom4( SERCOM4 ) ; -SERCOM sercom5( SERCOM5 ) ; -Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; void SERCOM0_Handler() { Serial1.IrqHandler(); } +void SERCOM2_Handler() +{ + Serial2.IrqHandler(); +} + diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index e3eb01e92..2b2daa86a 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -17,8 +17,8 @@ */ /* - Modified 21 June 2015 by Justin Mattair - for the MattairTech MT-D21E board (www.mattairtech.com) + Modified 20 July 2015 by Justin Mattair + for MattairTech MT-D21E boards (www.mattairtech.com) */ #ifndef _VARIANT_MATTAIRTECH_MT_D21E_ @@ -66,7 +66,7 @@ extern "C" #define portOutputRegister(port) ( &(port->OUT.reg) ) #define portInputRegister(port) ( &(port->IN.reg) ) #define portModeRegister(port) ( &(port->DIR.reg) ) -#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) /* * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD @@ -80,11 +80,13 @@ extern "C" // Interrupts #define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) -// LEDs -// None of these defines are currently used by the core. -// The MT-D21E onboard LED is on pin 28. -// The RX and TX LEDs are not present. -// You may optionally add them to any free pins. + +/* LEDs + * None of these defines are currently used by the core. + * The MT-D21E onboard LED is on pin 28. + * The RX and TX LEDs are not present. + * You may optionally add them to any free pins. + */ #define PIN_LED_13 (28u) #define PIN_LED_RXL (30u) #define PIN_LED_TXL (31u) @@ -93,37 +95,61 @@ extern "C" #define PIN_LED3 PIN_LED_TXL #define LED_BUILTIN PIN_LED_13 +/* Buttons + * Note that Button B is connected to Reset by default. + * A solder jumper can be changed to route Button B to pin 31 instead. + * If the debouncing capacitor is connected (default), delay reading the + * pin at least 6ms after turning on the pullup to allow the capacitor to charge. + */ +#define BUTTON_A (27u) +#define BUTTON_B (31u) +#define BUTTON_BUILTIN BUTTON_A + + /* * Analog pins */ -#define PIN_A0 (2ul) -#define PIN_A1 (3ul) -#define PIN_A2 (4ul) -#define PIN_A3 (5ul) -#define PIN_A4 (6ul) -#define PIN_A5 (7ul) -#define PIN_A6 (8ul) -#define PIN_A7 (9ul) -#define PIN_A8 (10ul) -#define PIN_A9 (11ul) - -static const uint8_t A0 = PIN_A0 ; -static const uint8_t A1 = PIN_A1 ; -static const uint8_t A2 = PIN_A2 ; -static const uint8_t A3 = PIN_A3 ; -static const uint8_t A4 = PIN_A4 ; -static const uint8_t A5 = PIN_A5 ; -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 ; +#define PIN_A2 (2ul) +#define PIN_A3 (3ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A6 (6ul) +#define PIN_A7 (7ul) +#define PIN_A8 (8ul) +#define PIN_A9 (9ul) +#define PIN_A10 (10ul) +#define PIN_A11 (11ul) + +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +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 ; #define ADC_RESOLUTION 12 -// Other pins +#define REMAP_ANALOG_PIN_ID while(0) +// #define REMAP_ANALOG_PIN_ID if ( ulPin < A0 ) ulPin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#define REFA_PIN (3ul) +#define REFB_PIN (4ul) + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. #define PIN_ATN (15ul) static const uint8_t ATN = PIN_ATN; + /* * Serial interfaces */ @@ -133,6 +159,17 @@ static const uint8_t ATN = PIN_ATN; #define PAD_SERIAL1_TX (UART_TX_PAD_2) #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) +#define SERCOM_INSTANCE_SERIAL1 &sercom0 + +// Serial2 +#define PIN_SERIAL2_RX (15ul) +#define PIN_SERIAL2_TX (14ul) +#define PAD_SERIAL2_TX (UART_TX_PAD_2) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL2 &sercom2 + + /* * SPI Interfaces */ @@ -152,6 +189,9 @@ static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; +#define SERCOM_INSTANCE_SPI &sercom3 + + /* * Wire Interfaces */ @@ -162,17 +202,27 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PIN_WIRE_SDA PIN_WIRE1_SDA #define PIN_WIRE_SCL PIN_WIRE1_SCL +#define SERCOM_INSTANCE_WIRE &sercom1 + +#define SERCOM_WIRE_HANDLER_MACRO \ +void SERCOM3_Handler(void) { \ + Wire.onService(); \ +} + + /* * USB */ -#define PIN_USB_HOST_ENABLE (14ul) -#define PIN_USB_DM (24ul) -#define PIN_USB_DP (25ul) +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +#define PIN_USB_HOST_ENABLE (14ul) +#define PIN_USB_HOST_ENABLE_VALUE HIGH #ifdef __cplusplus } #endif + /*---------------------------------------------------------------------------- * Arduino objects - C++ only *----------------------------------------------------------------------------*/ @@ -187,10 +237,9 @@ extern SERCOM sercom0; extern SERCOM sercom1; extern SERCOM sercom2; extern SERCOM sercom3; -extern SERCOM sercom4; -extern SERCOM sercom5; extern Uart Serial1; +extern Uart Serial2; #endif @@ -210,7 +259,12 @@ extern Uart Serial1; // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX // pins are NOT connected to anything by default. #define SERIAL_PORT_USBVIRTUAL SerialUSB -#define SERIAL_PORT_MONITOR SerialUSB +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#define SERIAL_PORT_MONITOR Serial1 // Serial has no physical pins broken out, so it's not listed as HARDWARE port #define SERIAL_PORT_HARDWARE Serial1 #define SERIAL_PORT_HARDWARE_OPEN Serial1 @@ -220,7 +274,7 @@ extern Uart Serial1; // So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. // Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. // Remember to use while(!Serial); to wait for a connection before Serial printing. -#define Serial SerialUSB +#define Serial SerialUSB #endif /* _VARIANT_ARDUINO_ZERO_ */ From d5ee5bacd242a848ad4cadef72985d18134c12ca Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 20 Jul 2015 13:07:42 +0000 Subject: [PATCH 008/124] Re-added PIN_ATTR_DIGITAL to A2 and A3 --- variants/MT_D21E/variant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index 887e79a86..5c8667d2f 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -174,8 +174,8 @@ const PinDescription g_APinDescription[]= { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused // 2..9 - Analog capable pins (DAC avalable on 2) - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC - { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // ADC/AIN[1] + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // ADC/AIN[1] { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4 }, // ADC/AIN[4] { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5 }, // ADC/AIN[5] { PORTA, 6, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NONE }, // ADC/AIN[6] From cee24bdded408a28de673529ceb0f60bf324823d Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 21 Jul 2015 05:48:47 +0000 Subject: [PATCH 009/124] Documentation formatting changes --- README.md | 189 +++++++++++++++++++---------------- variants/MT_D21E/variant.cpp | 182 ++++++++++++++++++--------------- 2 files changed, 205 insertions(+), 166 deletions(-) diff --git a/README.md b/README.md index 0bad69d63..d739d7a2e 100644 --- a/README.md +++ b/README.md @@ -33,71 +33,72 @@ PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! ``` -============================================ MattairTech MT-D21E (ATsamd21eXXa) ======================================= -Comm/Other INT PWM Digital Analog Digital PWM INT Comm/other -======================================================================================================================= - ----------------------- -Xin32 | A0 RST | Reset -Xout32 | A1 NC | - 2 2 (ADC0, DAC) | A2 NC | - 3 3 (ADC1, REF) | A3 A31 | 31 TCC1/WO[1] INT11 Button B / SWD IO - INT4 4 4 (ADC4) | A4 A30 | 30 TCC1/WO[0] INT10 SWD CLK - INT5 5 5 (ADC5) | A5 NC | - 6 6 (ADC6) | A6 A28 | 28 INT8 LED -VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A - INTNMI TCC0/WO[0] 8 8 (ADC16) | A8 A23 | 23 TC4/WO[1] INT7 SPI SS - INT9 TCC0/WO[1] 9 9 (ADC17) | A9 A22 | 22 TC4/WO[0] INT6 SPI MISO -TX (1) TCC0/WO[2] 10 10 (ADC18) | A10 A19 | 19 INT3 SPI SCK -RX (1) TCC0/WO[3] 11 11 (ADC19) | A11 A18 | 18 INT2 SPI MOSI -TX (2) INT14 TC3/WO[0] 14 | A14 A17 | 17 TCC2/WO[1] INT1 I2C/SCL -RX (2) TC3/WO[1] 15 | A15 A16 | 16 TCC2/WO[0] INT0 I2C/SDA - | NC NC | - | NC NC | - | Vbus 3.3V | -USB D- | A24- _____ Vcc | -USB D+ | A25+ | | Vin | - | Gnd | USB | Gnd | - ----------------------- +============================= MattairTech MT-D21E (ATsamd21eXXa) ======================== +Other INT PWM Digital Analog Digital PWM INT Other +========================================================================================= + ------------------- +Xin32 | A0 RST | Reset +Xout32 | A1 NC | +DAC 2 2 (ADC0) | A2 NC | +REF 3 3 (ADC1) | A3 A31 | 31 TCC1[1] INT11 SWD IO * + INT4 4 4 (ADC4) | A4 A30 | 30 TCC1[0] INT10 SWD CLK + INT5 5 5 (ADC5) | A5 NC | + 6 6 (ADC6) | A6 A28 | 28 INT8 LED +VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A + INTNMI TCC0[0] 8 8 (ADC16) | A8 A23 | 23 TC4[1] INT7 SPI SS + INT9 TCC0[1] 9 9 (ADC17) | A9 A22 | 22 TC4[0] INT6 SPI MISO +TX (1) TCC0[2] 10 10 (ADC18)| A10 A19 | 19 INT3 SPI SCK +RX (1) TCC0[3] 11 11 (ADC19)| A11 A18 | 18 INT2 SPI MOSI +TX (2) INT14 TC3[0] 14 | A14 A17 | 17 TCC2[1] INT1 I2C/SCL +RX (2) TC3[1] 15 | A15 A16 | 16 TCC2[0] INT0 I2C/SDA + | NC NC | + | NC NC | + | Vbus 3.3V| * Button B available on 31 +USB D- | A24- _____ Vcc | +USB D+ | A25+ | | Vin | + | Gnd | USB | Gnd | + ------------------- ``` #### All pins operate at 3.3 volts. DO NOT connect voltages higher than 3.3V! -* Digital: All 22 pins can be used for general purpose I/O (INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN). +* **Digital: All 22 pins can be used for general purpose I/O** + * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). * Use the pinMode(), digitalWrite(), and digitalRead() functions. -* Analog Inputs: 10 pins can be configured as ADC analog inputs. +* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** * These are available on pins 2 through 11 using the analogRead() function. * These pins can be used for GPIO and other digital functions (ie. pwm and serial) as well. * Each pin provides 10 bits of resolution (1024 values) by default. * 12-bit resolution supported by using the analogReadResolution() function. * Each pin measures from ground to 3.3 volts. * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. -* DAC: One analog output is available on pin 2. +* **DAC: One analog output is available on pin 2.** * Provides a 10-bit voltage output with the analogWrite() function. -* PWM: 12 pins can be configured as PWM outputs. +* **PWM: 12 pins can be configured as PWM outputs.** * Available on pins 8, 9, 10, 11, 14, 15, 16, 17, 22, 23, 30, and 31 using the analogWrite() function. * Each pin provides 8 bits of resolution (256 values) by default. * 12-bit resolution supported by using the analogWriteResolution() function. -* External Interrupts: 15 pins can be configured with external interrupts. +* **External Interrupts: 15 pins can be configured with external interrupts.** * Available on all the pins except pins 2, 3, 6, 7, 10, 11, and 15 using the attachInterrupt() function. -* Serial: 2 pairs of pins can be configured for TTL serial I/O. +* **Serial: 2 pairs of pins can be configured for TTL serial I/O.** * Serial1: pin 11 (RX) and pin 10 (TX). * Serial2: pin 15 (RX) and pin 14 (TX). -* SPI: 3 or 4 pins can be configured for SPI I/O. +* **SPI: 3 or 4 pins can be configured for SPI I/O.** * Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). * SPI communication using the SPI library. -* TWI (I2C): 2 pins can be configured for TWI I/O. +* **TWI (I2C): 2 pins can be configured for TWI I/O.** * Pin 16 (SDA) and pin 17 (SCL). * TWI communication using the Wire library. -* LED: One pin can be configured to light the onboard LED. +* **LED: One pin can be configured to light the onboard LED.** * Pin 28 (LED_BUILTIN). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* Button: One pin can be configured to read the onboard Button A. +* **Button: One pin can be configured to read the onboard Button A.** * Pin 27 (BUTTON_BUILTIN). Pressing the button will bring the pin LOW. The pullup must be enabled first. * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. -* AREF: One pin can be configured as an AREF analog input. +* **AREF: One pin can be configured as an AREF analog input.** * The upper end of the analog measurement range can be changed using the analogReference() function. -* Reset: Bring this line LOW to reset the microcontroller. +* **Reset: Bring this line LOW to reset the microcontroller.** #### MT-D21E Board Configuration @@ -255,7 +256,7 @@ and 0x00001000 for 4 KB bootloaders. This is because the bootloader resides at 0 by passing the following flag to the linker (typically LDFLAGS in your makefile; adjust for your bootloader size): ``` -­Wl,­­section­start=.text=0x2000 +Wl,sectionstart=.text=0x2000 ``` You may also use a linker script. See the MattairTech SAMD package for examples. @@ -286,56 +287,74 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## New PinDescription Table ``` -/* The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple - * functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures - * which functions can be used for each pin. This table is mainly accessed by the pinPeripheral function in - * wiring_private.c, which is used to attach a pin to a particular peripheral function. The communications drivers - * (ie: SPI, I2C, and UART), analogRead(), analogWrite(), analogReference(), attachInterrupt(), and pinMode() all - * call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for +/* The PinDescription table describes how each of the pins can be used by the Arduino + * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, + * communications, etc.), and the PinDescription table configures which functions can + * be used for each pin. This table is mainly accessed by the pinPeripheral function in + * wiring_private.c, which is used to attach a pin to a particular peripheral function. + * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), + * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to + * verify that the pin can perform the function requested, and to configure the pin for * that function. Most of the contents of pinMode() are now in pinPeripheral(). * * Explanation of PinDescription table: * - * Port This is the port (ie: PORTA). - * Pin This is the pin (bit) within the port. Valid values are 0 through 31. - * PinType This indicates what peripheral function the pin can be attached to. In most cases, this - * is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. - * It can also be set to a specific peripheral. In this case, any attempt to configure the - * pin (using pinPeripheral or pinMode) as anything else will fail (and pinPeripheral will - * return -1). This can be used to prevent accidental re-configuration of a pin that is - * configured for only one function (ie: USB D- and D+ pins). If a pin is not used or does - * not exist, PIO_NOT_A_PIN must be entered in this field. See WVariant.h for valid - * entries. These entries are also used as a parameter to pinPeripheral() with the - * exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function now calls pinPeripheral() - * with the desired mode. Note that this field is not used to select between the two - * peripherals possible with each of the SERCOM and TIMER functions. PeripheralAttribute - * is now used for this. - * PeripheralAttribute This is an 8-bit bitfield used for various peripheral configuration. It is primarily - * used to select between the two peripherals possible with each of the SERCOM and TIMER - * functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. - * This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) uses - * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. Both TIMER and - * SERCOM can exist for each pin. This bitfield is also used to set the pin drive strength. - * In the future, other attributes (like input buffer configuration) may be added. - * See WVariant.h for valid entries. - * PinAttribute This is a 32-bit bitfield used to list all of the valid peripheral functions that a pin - * can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain attributes - * are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL includes all of - * the GPIO functions, while PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and - * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). PIN_ATTR_ANALOG is an alias to - * PIN_ATTR_ANALOG_ADC. There is only one DAC channel, so PIN_ATTR_DAC appears only once. - * This bitfield is useful for limiting a pin to only input related functions or output - * functions. This allows a pin to have a more flexible configuration, while restricting - * the direction (ie: to avoid contention). See WVariant.h for valid entries. - * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some TC channels are available - * on multiple pins (ie: TCC0/WO[0] is available on pin A4 or pin A8). In general, only - * one pin should be configured (in the pinDescription table) per TC channel. - * See WVariant.h for valid entries. The tone library uses TC5. - * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See WVariant.h for valid entries. - * ExtInt This is the interrupt (if any) assigned to the pin. Some interrupt numbers are available - * on multiple pins (ie: EIC/EXTINT[2] is available on pin A2 or pin A18). In general, only - * one pin should be configured (in the pinDescription table) per interrupt number. Thus, - * if an interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. - * See WVariant.h for valid entries. + * Port This is the port (ie: PORTA). + * Pin This is the pin (bit) within the port. Valid values are 0-31. + * PinType This indicates what peripheral function the pin can be + * attached to. In most cases, this is PIO_MULTI, which means + * that the pin can be anything listed in the PinAttribute field. + * It can also be set to a specific peripheral. In this case, any + * attempt to configure the pin (using pinPeripheral or pinMode) + * as anything else will fail (and pinPeripheral will return -1). + * This can be used to prevent accidental re-configuration of a + * pin that is configured for only one function (ie: USB D- and + * D+ pins). If a pin is not used or does not exist, + * PIO_NOT_A_PIN must be entered in this field. See WVariant.h + * for valid entries. These entries are also used as a parameter + * to pinPeripheral() with the exception of PIO_NOT_A_PIN and + * PIO_MULTI. The pinMode function now calls pinPeripheral() with + * the desired mode. Note that this field is not used to select + * between the two peripherals possible with each of the SERCOM + * and TIMER functions. PeripheralAttribute is now used for this. + * PeripheralAttribute This is an 8-bit bitfield used for various peripheral + * configuration. It is primarily used to select between the two + * peripherals possible with each of the SERCOM and TIMER + * functions. TIMER pins are individual, while SERCOM uses a + * group of two to four pins. This group of pins can span both + * peripherals. For example, pin 19 (SPI1 SCK) uses + * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses + * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each + * pin. This bitfield is also used to set the pin drive strength. + * In the future, other attributes (like input buffer + * configuration) may be added. See WVariant.h for valid entries. + * PinAttribute This is a 32-bit bitfield used to list all of the valid + * peripheral functions that a pin can attach to. This includes + * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are + * shorthand for a combination of other attributes. + * PIN_ATTR_DIGITAL includes all of the GPIO functions, while + * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and + * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). + * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is + * only one DAC channel, so PIN_ATTR_DAC appears only once. This + * bitfield is useful for limiting a pin to only input related + * functions or output functions. This allows a pin to have a + * more flexible configuration, while restricting the direction + * (ie: to avoid contention). See WVariant.h for valid entries. + * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some + * TC channels are available on multiple pins (ie: TCC0/WO[0] is + * available on pin A4 or pin A8). In general, only one pin + * should be configured (in the pinDescription table) per TC + * channel. See WVariant.h for valid entries. The tone library + * uses TC5. + * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See + * WVariant.h for valid entries. + * ExtInt This is the interrupt (if any) assigned to the pin. Some + * interrupt numbers are available on multiple pins (ie: + * EIC/EXTINT[2] is available on pin A2 or pin A18). In general, + * only one pin should be configured (in the pinDescription + * table) per interrupt number. Thus, if an interrupt was needed + * on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See + * WVariant.h for valid entries. */ ``` diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index 5c8667d2f..605e9f62d 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -22,37 +22,110 @@ */ /* -============================================ MattairTech MT-D21E (ATsamd21eXXa) ======================================== -Comm/Other INT PWM Digital Analog Digital PWM INT Comm/other -======================================================================================================================== - ----------------------- -Xin32 | A0 RST | Reset -Xout32 | A1 NC | - 2 2 (ADC0, DAC) | A2 NC | - 3 3 (ADC1, REF) | A3 A31 | 31 TCC1/WO[1] INT11 Button B / SWD IO - INT4 4 4 (ADC4) | A4 A30 | 30 TCC1/WO[0] INT10 SWD CLK - INT5 5 5 (ADC5) | A5 NC | - 6 6 (ADC6) | A6 A28 | 28 INT8 LED -VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A - INTNMI TCC0/WO[0] 8 8 (ADC16) | A8 A23 | 23 TC4/WO[1] INT7 SPI SS - INT9 TCC0/WO[1] 9 9 (ADC17) | A9 A22 | 22 TC4/WO[0] INT6 SPI MISO -TX (1) TCC0/WO[2] 10 10 (ADC18) | A10 A19 | 19 INT3 SPI SCK -RX (1) TCC0/WO[3] 11 11 (ADC19) | A11 A18 | 18 INT2 SPI MOSI -TX (2) INT14 TC3/WO[0] 14 | A14 A17 | 17 TCC2/WO[1] INT1 I2C/SCL -RX (2) TC3/WO[1] 15 | A15 A16 | 16 TCC2/WO[0] INT0 I2C/SDA - | NC NC | - | NC NC | - | Vbus 3.3V | -USB D- | A24- _____ Vcc | -USB D+ | A25+ | | Vin | - | Gnd | USB | Gnd | - ----------------------- - Most pins have multiple configurations available (even analog pins). For example, pin A10 can be an analog input, a - PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board but - without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! +============================= MattairTech MT-D21E (ATsamd21eXXa) ======================== +Other INT PWM Digital Analog Digital PWM INT Other +========================================================================================= + ------------------- +Xin32 | A0 RST | Reset +Xout32 | A1 NC | +DAC 2 2 (ADC0) | A2 NC | +REF 3 3 (ADC1) | A3 A31 | 31 TCC1[1] INT11 SWD IO * + INT4 4 4 (ADC4) | A4 A30 | 30 TCC1[0] INT10 SWD CLK + INT5 5 5 (ADC5) | A5 NC | + 6 6 (ADC6) | A6 A28 | 28 INT8 LED +VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A + INTNMI TCC0[0] 8 8 (ADC16) | A8 A23 | 23 TC4[1] INT7 SPI SS + INT9 TCC0[1] 9 9 (ADC17) | A9 A22 | 22 TC4[0] INT6 SPI MISO +TX (1) TCC0[2] 10 10 (ADC18)| A10 A19 | 19 INT3 SPI SCK +RX (1) TCC0[3] 11 11 (ADC19)| A11 A18 | 18 INT2 SPI MOSI +TX (2) INT14 TC3[0] 14 | A14 A17 | 17 TCC2[1] INT1 I2C/SCL +RX (2) TC3[1] 15 | A15 A16 | 16 TCC2[0] INT0 I2C/SDA + | NC NC | + | NC NC | + | Vbus 3.3V| * Button B available on 31 +USB D- | A24- _____ Vcc | +USB D+ | A25+ | | Vin | + | Gnd | USB | Gnd | + ------------------- +Most pins have multiple configurations available (even analog pins). For example, pin +10 can be an analog input, a PWM output, Digital I/O, or the TX pin of 'Serial1'. These +always reference the pin number printed on the board but without the 'A' (with the +usable pins starting at 2). DO NOT connect voltages higher than 3.3V! */ +/* The PinDescription table describes how each of the pins can be used by the Arduino + * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, + * communications, etc.), and the PinDescription table configures which functions can + * be used for each pin. This table is mainly accessed by the pinPeripheral function in + * wiring_private.c, which is used to attach a pin to a particular peripheral function. + * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), + * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to + * verify that the pin can perform the function requested, and to configure the pin for + * that function. Most of the contents of pinMode() are now in pinPeripheral(). + * + * Explanation of PinDescription table: + * + * Port This is the port (ie: PORTA). + * Pin This is the pin (bit) within the port. Valid values are 0-31. + * PinType This indicates what peripheral function the pin can be + * attached to. In most cases, this is PIO_MULTI, which means + * that the pin can be anything listed in the PinAttribute field. + * It can also be set to a specific peripheral. In this case, any + * attempt to configure the pin (using pinPeripheral or pinMode) + * as anything else will fail (and pinPeripheral will return -1). + * This can be used to prevent accidental re-configuration of a + * pin that is configured for only one function (ie: USB D- and + * D+ pins). If a pin is not used or does not exist, + * PIO_NOT_A_PIN must be entered in this field. See WVariant.h + * for valid entries. These entries are also used as a parameter + * to pinPeripheral() with the exception of PIO_NOT_A_PIN and + * PIO_MULTI. The pinMode function now calls pinPeripheral() with + * the desired mode. Note that this field is not used to select + * between the two peripherals possible with each of the SERCOM + * and TIMER functions. PeripheralAttribute is now used for this. + * PeripheralAttribute This is an 8-bit bitfield used for various peripheral + * configuration. It is primarily used to select between the two + * peripherals possible with each of the SERCOM and TIMER + * functions. TIMER pins are individual, while SERCOM uses a + * group of two to four pins. This group of pins can span both + * peripherals. For example, pin 19 (SPI1 SCK) uses + * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses + * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each + * pin. This bitfield is also used to set the pin drive strength. + * In the future, other attributes (like input buffer + * configuration) may be added. See WVariant.h for valid entries. + * PinAttribute This is a 32-bit bitfield used to list all of the valid + * peripheral functions that a pin can attach to. This includes + * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are + * shorthand for a combination of other attributes. + * PIN_ATTR_DIGITAL includes all of the GPIO functions, while + * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and + * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). + * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is + * only one DAC channel, so PIN_ATTR_DAC appears only once. This + * bitfield is useful for limiting a pin to only input related + * functions or output functions. This allows a pin to have a + * more flexible configuration, while restricting the direction + * (ie: to avoid contention). See WVariant.h for valid entries. + * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some + * TC channels are available on multiple pins (ie: TCC0/WO[0] is + * available on pin A4 or pin A8). In general, only one pin + * should be configured (in the pinDescription table) per TC + * channel. See WVariant.h for valid entries. The tone library + * uses TC5. + * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See + * WVariant.h for valid entries. + * ExtInt This is the interrupt (if any) assigned to the pin. Some + * interrupt numbers are available on multiple pins (ie: + * EIC/EXTINT[2] is available on pin A2 or pin A18). In general, + * only one pin should be configured (in the pinDescription + * table) per interrupt number. Thus, if an interrupt was needed + * on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See + * WVariant.h for valid entries. + */ + + /* Pins descriptions for the MattairTech MT-D21E * * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (* is for default peripheral in use, ! means unavailable with this variant) @@ -109,59 +182,6 @@ USB D+ | A25+ | | Vin | */ -/* The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple - * functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures - * which functions can be used for each pin. This table is mainly accessed by the pinPeripheral function in - * wiring_private.c, which is used to attach a pin to a particular peripheral function. The communications drivers - * (ie: SPI, I2C, and UART), analogRead(), analogWrite(), analogReference(), attachInterrupt(), and pinMode() all - * call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for - * that function. Most of the contents of pinMode() are now in pinPeripheral(). - * - * Explanation of PinDescription table: - * - * Port This is the port (ie: PORTA). - * Pin This is the pin (bit) within the port. Valid values are 0 through 31. - * PinType This indicates what peripheral function the pin can be attached to. In most cases, this - * is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. - * It can also be set to a specific peripheral. In this case, any attempt to configure the - * pin (using pinPeripheral or pinMode) as anything else will fail (and pinPeripheral will - * return -1). This can be used to prevent accidental re-configuration of a pin that is - * configured for only one function (ie: USB D- and D+ pins). If a pin is not used or does - * not exist, PIO_NOT_A_PIN must be entered in this field. See WVariant.h for valid - * entries. These entries are also used as a parameter to pinPeripheral() with the - * exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function now calls pinPeripheral() - * with the desired mode. Note that this field is not used to select between the two - * peripherals possible with each of the SERCOM and TIMER functions. PeripheralAttribute - * is now used for this. - * PeripheralAttribute This is an 8-bit bitfield used for various peripheral configuration. It is primarily - * used to select between the two peripherals possible with each of the SERCOM and TIMER - * functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. - * This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) uses - * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. Both TIMER and - * SERCOM can exist for each pin. This bitfield is also used to set the pin drive strength. - * In the future, other attributes (like input buffer configuration) may be added. - * See WVariant.h for valid entries. - * PinAttribute This is a 32-bit bitfield used to list all of the valid peripheral functions that a pin - * can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain attributes - * are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL includes all of - * the GPIO functions, while PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and - * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). PIN_ATTR_ANALOG is an alias to - * PIN_ATTR_ANALOG_ADC. There is only one DAC channel, so PIN_ATTR_DAC appears only once. - * This bitfield is useful for limiting a pin to only input related functions or output - * functions. This allows a pin to have a more flexible configuration, while restricting - * the direction (ie: to avoid contention). See WVariant.h for valid entries. - * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some TC channels are available - * on multiple pins (ie: TCC0/WO[0] is available on pin A4 or pin A8). In general, only - * one pin should be configured (in the pinDescription table) per TC channel. - * See WVariant.h for valid entries. The tone library uses TC5. - * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See WVariant.h for valid entries. - * ExtInt This is the interrupt (if any) assigned to the pin. Some interrupt numbers are available - * on multiple pins (ie: EIC/EXTINT[2] is available on pin A2 or pin A18). In general, only - * one pin should be configured (in the pinDescription table) per interrupt number. Thus, - * if an interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. - * See WVariant.h for valid entries. - */ - #include "variant.h" /* From 24abb334d210174cc7ee59502304c7dc2e5e28ba Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 10 Aug 2015 02:32:34 +0000 Subject: [PATCH 010/124] Added MT-D11 (ATSAMD11D14AM) support. Code size reduction. Other changes. --- README.md | 299 +++++++++++++----- boards.txt | 220 ++++++++++++- bootloaders/zero/main.h | 41 ++- bootloaders/zero/readme.txt | 2 +- bootloaders/zero/sam_ba_monitor.h | 2 +- bootloaders/zero/samd11c14a_sam_ba.bin | Bin 0 -> 4072 bytes bootloaders/zero/samd11d14am_sam_ba.bin | Bin 0 -> 4080 bytes bootloaders/zero/samd11d14as_sam_ba.bin | Bin 0 -> 4080 bytes bootloaders/zero/startup_samd11.c | 18 -- bootloaders/zero/startup_samd21.c | 66 ---- cores/arduino/Reset.cpp | 13 +- cores/arduino/SERCOM.cpp | 49 ++- cores/arduino/SERCOM.h | 2 +- cores/arduino/Tone.cpp | 14 +- cores/arduino/USB/HID.cpp | 12 +- cores/arduino/USB/USBDesc.h | 15 +- cores/arduino/USB/samd21_device.c | 7 +- cores/arduino/USB/samd21_host.c | 6 +- cores/arduino/Uart.cpp | 22 +- cores/arduino/WInterrupts.c | 4 +- cores/arduino/WString.cpp | 6 +- cores/arduino/WString.h | 16 +- cores/arduino/WVariant.h | 44 ++- cores/arduino/cortex_handlers.c | 37 ++- cores/arduino/delay.c | 2 +- cores/arduino/main.cpp | 3 + cores/arduino/startup.c | 66 ++-- cores/arduino/wiring.c | 6 + cores/arduino/wiring_analog.c | 36 ++- cores/arduino/wiring_digital.c | 16 +- cores/arduino/wiring_private.c | 87 ++--- libraries/SPI/SPI.cpp | 8 + libraries/SPI/SPI.h | 8 + libraries/USBHost/library.properties | 4 +- libraries/Wire/Wire.cpp | 15 +- libraries/Wire/Wire.h | 6 +- platform.txt | 16 +- variants/MT_D11/debug_scripts/SAMD11C14A.gdb | 31 ++ variants/MT_D11/debug_scripts/SAMD11D14AM.gdb | 31 ++ variants/MT_D11/debug_scripts/SAMD11D14AS.gdb | 31 ++ .../gcc/SAMD11C14A_with_4KB_bootloader.ld | 212 +++++++++++++ .../gcc/SAMD11D14AM_with_4KB_bootloader.ld | 212 +++++++++++++ .../gcc/SAMD11D14AS_with_4KB_bootloader.ld | 212 +++++++++++++ .../MT_D11/openocd_scripts/SAMD11C14A.cfg | 30 ++ .../MT_D11/openocd_scripts/SAMD11D14AM.cfg | 30 ++ .../MT_D11/openocd_scripts/SAMD11D14AS.cfg | 30 ++ variants/MT_D11/pins_arduino.h | 21 ++ variants/MT_D11/variant.cpp | 279 ++++++++++++++++ variants/MT_D11/variant.h | 280 ++++++++++++++++ .../gcc/flash_128KB_with_16KB_bootloader.ld | 1 + .../gcc/flash_128KB_with_8KB_bootloader.ld | 1 + .../gcc/flash_128KB_without_bootloader.ld | 1 + .../gcc/flash_256KB_with_16KB_bootloader.ld | 1 + .../gcc/flash_256KB_with_8KB_bootloader.ld | 1 + .../gcc/flash_256KB_without_bootloader.ld | 1 + .../gcc/flash_32KB_with_16KB_bootloader.ld | 1 + .../gcc/flash_32KB_with_8KB_bootloader.ld | 1 + .../gcc/flash_32KB_without_bootloader.ld | 1 + .../gcc/flash_64KB_with_16KB_bootloader.ld | 1 + .../gcc/flash_64KB_with_8KB_bootloader.ld | 1 + .../gcc/flash_64KB_without_bootloader.ld | 1 + variants/MT_D21E/variant.cpp | 99 +++--- variants/MT_D21E/variant.h | 4 +- .../gcc/flash_with_bootloader.ld | 1 + .../gcc/flash_without_bootloader.ld | 1 + variants/arduino_zero/variant.cpp | 239 +++++++++----- variants/arduino_zero/variant.h | 51 ++- 67 files changed, 2492 insertions(+), 482 deletions(-) create mode 100755 bootloaders/zero/samd11c14a_sam_ba.bin create mode 100755 bootloaders/zero/samd11d14am_sam_ba.bin create mode 100755 bootloaders/zero/samd11d14as_sam_ba.bin create mode 100644 variants/MT_D11/debug_scripts/SAMD11C14A.gdb create mode 100644 variants/MT_D11/debug_scripts/SAMD11D14AM.gdb create mode 100644 variants/MT_D11/debug_scripts/SAMD11D14AS.gdb create mode 100644 variants/MT_D11/linker_scripts/gcc/SAMD11C14A_with_4KB_bootloader.ld create mode 100644 variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld create mode 100644 variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld create mode 100644 variants/MT_D11/openocd_scripts/SAMD11C14A.cfg create mode 100644 variants/MT_D11/openocd_scripts/SAMD11D14AM.cfg create mode 100644 variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg create mode 100644 variants/MT_D11/pins_arduino.h create mode 100644 variants/MT_D11/variant.cpp create mode 100644 variants/MT_D11/variant.h diff --git a/README.md b/README.md index d739d7a2e..951924302 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,56 @@ # MattairTech Arduino SAMD Core -This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support -for SAMD boards including the MattairTech MT-D21E and the MT-D11 (see https://www.mattairtech.com/). -It primarily adds support for new devices as well as a more flexible pin configuration / mapping system. -This core is intended to be installed using the Boards Manager (see below). +This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain +Arduino support for SAMD boards including the MattairTech MT-D21E and the MT-D11 +(see https://www.mattairtech.com/). It primarily adds support for new devices as well +as a more flexible pin configuration / mapping system. It also adds some size +optimizations, including the ability to select any combination of CDC, HID, or UART +through the menu (~7.5KB for blink sketch with CDC+HID+UART, ~2.5KB without USB or UART). + +This core is intended to be installed using Boards Manager (see below). To update from a +previous version, click on MattairTech SAMD Boards in Boards Manager, then click Update. + + +## What's New + +* Added support for the MT-D11 (ATSAMD11D14AM). +* Reduced code size (see 'Code Size and RAM Usage' below). +* Any combination of CDC, HID, or UART can be used (or no combination), by using the Tools->Communication menu. +* Note that switching between CDC and CDC+HID will require re-selecting the COM port. +* More detailed memory usage at end of compilation (see below). +* Merged in upstream updates. Fixed Wire interrupt. +* Tested all ADC, DAC, external interrupts, PWM outputs, serial, SPI, and Wire instances/pins. ## Summary -Feature | Value -------------------------|------------------------------------------------------------------------------ -Microcontroller | ATSAMD21ExxA, 32-Bit ARM Cortex M0+ -Clock Speed | 48 MHz -Flash Memory | 256 KB (D21E18A) / 128 KB (D21E17A) / 64 KB (D21E16A) / 32 KB (D21E15A) -SRAM | 32 KB (D21E18A) / 16 KB (D21E17A) / 8 KB (D21E16A) / 4 KB (D21E15A) -EEPROM | None (emulation may be available in the future) -Digital Pins | 22 -Analog Input Pins | 10, 12-bit ADC channels -Analog Output Pins | 1, 10-bit DAC -PWM Output Pins | 12 -External Interrupts | 15 (1 NMI) -UART (Serial) | 2 -SPI | 1 -I2C (TWI) | 1 -Operating Voltage | 3.3V (Do not connect voltages higher than 3.3V!) -DC Current per I/O Pin | 7 mA + +Feature | MT-D21E | MT-D11 +------------------------|---------------------------------------------------------------------------------------|------------------------------------------------------ +Microcontroller | ATSAMD21ExxA, 32-Bit ARM Cortex M0+ | ATSAMD11D14AM, 32-Bit ARM Cortex M0+ +Clock Speed | 48 MHz | 48 MHz +Flash Memory | 256 KB (D21E18A) / 128 KB (D21E17A) / 64 KB (D21E16A) / 32 KB (D21E15A) | 16 KB (4KB used by USB SAM-BA bootloader) +SRAM | 32 KB (D21E18A) / 16 KB (D21E17A) / 8 KB (D21E16A) / 4 KB (D21E15A) | 4 KB +EEPROM | None (emulation may be available in the future) | None (emulation may be available in the future) +Digital Pins | 22 | 17 +Analog Input Pins | 10, 12-bit ADC channels | 10, 12-bit ADC channels +Analog Output Pins | 1, 10-bit DAC | 1, 10-bit DAC +PWM Output Pins | 12 | 8 +External Interrupts | 15 (1 NMI) | 9 (1 NMI) +USB | Device and Host (CDC and HID) | Device and Host (CDC and HID) +UART (Serial) | 2 | 1 +SPI | 1 | 1 +I2C (TWI) | 1 | 1 +Operating Voltage | 3.3V (Do not connect voltages higher than 3.3V!) | 3.3V (Do not connect voltages higher than 3.3V!) +DC Current per I/O Pin | 7 mA | 7 mA ## Pin Configurations -Most pins have multiple configurations available (even analog pins). For example, pin A10 can be an analog input, a -PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board but -without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! +Most pins have multiple configurations available (even analog pins). For example, pin A10 on the MT-D21E can be an analog +input, a PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board +but without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! + +### SAMD21 (MT-D21E) ``` ============================= MattairTech MT-D21E (ATsamd21eXXa) ======================== @@ -60,47 +80,71 @@ USB D+ | A25+ | | Vin | ------------------- ``` +### SAMD11 (MT-D11) + +``` +============================= MattairTech MT-D11 (ATsamd11D14AM) ======================== +Other INT PWM Digital Analog Digital PWM INT Other +========================================================================================= + ------------------- +DAC 2 2 (ADC0) | A2 | USB | Gnd | +REF 3 3 (ADC1) | A3 | | Vcc | +VDIV INT4 TCC0[0] 4 4 (ADC2) | A4 ----- A31 | 31 TC2[1] INT3 RX / SWDIO + INT5 TCC0[1] 5 5 (ADC3) | A5 A30 | 30 TC2[0] TX / SWDCLK + TCC0[2] 6 6 (ADC4) | A6 A27 | 27 INT7 + TCC0[3] 7 7 (ADC5) | A7 A23 | 23 I2C/SCL +SPI MOSI INT2 10 10 (ADC8) | A10 A22 | 22 INT6 I2C/SDA +SPI SCK 11 11 (ADC9) | A11 A17 | 17 TC1[1] +SPI MISO INTNMI 14 14 (ADC6) | A14 A16 | 16 TC1[0] INT0 LED +Button INT1 15 15 (ADC7) | A15 RST | Reset + ------------------- +``` + #### All pins operate at 3.3 volts. DO NOT connect voltages higher than 3.3V! -* **Digital: All 22 pins can be used for general purpose I/O** - * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. - * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). - * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). - * Use the pinMode(), digitalWrite(), and digitalRead() functions. +### Pin Capabilities + +* **Digital: All pins can be used for general purpose I/O** +* Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. +* Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). +* Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). +* Use the pinMode(), digitalWrite(), and digitalRead() functions. * **Analog Inputs: 10 pins can be configured as ADC analog inputs.** - * These are available on pins 2 through 11 using the analogRead() function. - * These pins can be used for GPIO and other digital functions (ie. pwm and serial) as well. - * Each pin provides 10 bits of resolution (1024 values) by default. - * 12-bit resolution supported by using the analogReadResolution() function. - * Each pin measures from ground to 3.3 volts. - * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. +* These are available using the analogRead() function. +* All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). +* Each pin provides 10 bits of resolution (1024 values) by default. +* 12-bit resolution supported by using the analogReadResolution() function. +* Each pin measures from ground to 3.3 volts. +* The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. * **DAC: One analog output is available on pin 2.** - * Provides a 10-bit voltage output with the analogWrite() function. -* **PWM: 12 pins can be configured as PWM outputs.** - * Available on pins 8, 9, 10, 11, 14, 15, 16, 17, 22, 23, 30, and 31 using the analogWrite() function. - * Each pin provides 8 bits of resolution (256 values) by default. - * 12-bit resolution supported by using the analogWriteResolution() function. -* **External Interrupts: 15 pins can be configured with external interrupts.** - * Available on all the pins except pins 2, 3, 6, 7, 10, 11, and 15 using the attachInterrupt() function. -* **Serial: 2 pairs of pins can be configured for TTL serial I/O.** - * Serial1: pin 11 (RX) and pin 10 (TX). - * Serial2: pin 15 (RX) and pin 14 (TX). -* **SPI: 3 or 4 pins can be configured for SPI I/O.** - * Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). - * SPI communication using the SPI library. -* **TWI (I2C): 2 pins can be configured for TWI I/O.** - * Pin 16 (SDA) and pin 17 (SCL). - * TWI communication using the Wire library. -* **LED: One pin can be configured to light the onboard LED.** - * Pin 28 (LED_BUILTIN). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* **Button: One pin can be configured to read the onboard Button A.** - * Pin 27 (BUTTON_BUILTIN). Pressing the button will bring the pin LOW. The pullup must be enabled first. - * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. +* Provides a 10-bit voltage output with the analogWrite() function. +* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** +* Available using the analogWrite() function. +* Each pin provides 8 bits of resolution (256 values) by default. +* 12-bit resolution supported by using the analogWriteResolution() function. +* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** +* Available using the attachInterrupt() function. +* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** +* MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). +* MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). +* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** +* MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). +* MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). +* SPI communication using the SPI library. +* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** +* MT-D21E: Pin 16 (SDA) and pin 17 (SCL). +* MT-D11: Pin 22 (SDA) and pin 23 (SCL). +* TWI communication using the Wire library. +* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** +* Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. +* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** +* Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. +* If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. * **AREF: One pin can be configured as an AREF analog input.** - * The upper end of the analog measurement range can be changed using the analogReference() function. +* The upper end of the analog measurement range can be changed using the analogReference() function. * **Reset: Bring this line LOW to reset the microcontroller.** -#### MT-D21E Board Configuration +### MT-D21E and MT-D11 Board Configuration * The 32.768KHz crystal is used by the Arduino core, so it MUST be connected via the solder jumpers. * Note that the sketch may still run without the crystal attached, but the clock speed will be very inaccurate. @@ -108,13 +152,13 @@ USB D+ | A25+ | | Vin | * The I2C (TWI) pullup resistors should be enabled via the solder jumpers. * The LED should be enabled via the solder jumper. * Button A should be connected via the solder jumper. The debouncing capacitor should also be connected. -* Button B is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. +* Button B (MT-D21E only) is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. * A reference voltage can be connected to AREF. In this case, the capacitors should be enabled via the solder jumper. ## Serial Monitor -To print to the Serial Monitor over USB, use 'Serial'. Serial points to SerialUSB (Serial1 and Serial2 are UARTS). +To print to the Serial Monitor over USB, use 'Serial'. Serial points to SerialUSB (Serial1 and Serial2 are UARTs). Unlike most Arduino boards (ie. Uno), SAMD boards do not automatically reset when the serial monitor is opened. To see what your sketch outputs to the serial monitor from the beginning, the sketch must wait for the SerialUSB port to open first. Add the following to setup(): @@ -130,6 +174,42 @@ the Reset button will reset the SAMD chip, which in turn will reset USB communic that if the serial monitor is open, it will be necessary to close and re-open it to restart communication. +## Code Size and RAM Usage + +Sketch and Configuration | MT-D21E (Code + RAM) | MT-D11 (Code + RAM) +----------------------------|----------------------|----------------------- +Blink (CDC + HID + UART) | 7564 + 1524 | 7452 + 1424 +Blink (CDC + UART) | 6588 + 1496 | 6484 + 1396 +Blink (CDC Only) | 5248 + 1304 | 5192 + 1300 +Blink (UART Only) | 3828 + 336 | 3716 + 236 +Blink (No USB or UART) | 2472 + 144 | 2416 + 140 +Datalogger (No USB or UART) | 10340 + 948 | 10260 + 944 + +* 180 bytes of flash can be saved on the MT-D11 by using PIN_MAP_COMPACT (see 'New PinDescription Table' below). +* Datalogger compiled without USB or UART support, but with SPI and SD (with FAT filesystem) support. Serial output was disabled. +* Note that USB CDC is required for auto-reset into the bootloader to work (otherwise, manually press reset twice in quick succession). +* USB uses primarily 3 buffers totaling 1024 bytes. The UART uses a 96 byte buffer. The banzai() function (used for auto-reset) resides in RAM and uses 72 bytes. +* Any combination of CDC, HID, or UART can be used (or no combination), by using the Tools->Communication menu. + + +### Detailed Memory Usage Output After Compilation + +The flash used message at the end of compilation is not correct. The number shown +represents the .text segment only. However, Flash usage = .text + .data segments +(RAM usage = .data + .bss segments). In this release, two programs are run at the +end of compilation to provide more detailed memory usage. + +Just above the normal flash usage message, is the output from the size utility. +However, this output is also incorrect, as it shows .text+.data in the .text field, +but 0 in the .data field. However, the .text field does show the total flash used. +The .data field can be determined by subtracting the value from the normal flash +usage message (.text) from the value in the .text field (.text+.data). The .bss +field is correct. + +Above the size utility output is the output from the nm utility. The values on the +left are in bytes. The letters stand for: T(t)=.text, D(d)=.data, B(b)=.bss, and +everything else (ie: W) resides in flash (in most cases). + ## Installation @@ -163,13 +243,16 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 1. As of this writing, only the 256 KB chip variants work with the OS X version of the upload tool, bossac. 2. First, you will need to open boards.txt and change mattairtech_mt_d21e_bl8k.upload.tool to equal arduino:bossac. -3. No driver installation is needed. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: +3. Open platform.txt and change tools.bossac.path to equal{runtime.tools.bossac-1.5-arduino.path}. +4. No driver installation is needed. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: * Click the "Network Preferences..." button, then click "Apply". * The board will show up as “Not Configuredâ€, but it will work fine. -4. Continue with SAMD Core Installation below. +5. Continue with SAMD Core Installation below. ### SAMD Core Installation +* To update from a previous version, click on MattairTech SAMD Boards in Boards Manager, then click Update. + 1. The MattairTech SAMD Core requires Arduino 1.6.5+. 2. In the Arduino IDE 1.6.5+, click File->Preferences. 3. Click the button next to Additional Boards Manager URLs. @@ -177,7 +260,7 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 5. Save preferences, then open the Boards Manager. 6. Install the Arduino SAMD Boards package. 7. Install the MattairTech SAMD Boards package. -8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E. +8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E (or MT-D11). 9. Select the processor with the now visible Tools->Processor menu. 10. If you do not already have the bootloader or blink sketch installed, see SAM-BA USB CDC Bootloader below. 11. Plug in the board. The blink sketch should be running. @@ -185,10 +268,9 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 13. You can now upload your own sketch. - ## SAM-BA USB CDC Bootloader (Arduino Zero compatible) -The SAM-BA bootloader has both a CDC USB interface, and a UART interface (TX: pin 10, RX: pin 11). It is +The SAM-BA bootloader has both a CDC USB interface, and a UART interface (MT-D21E: TX: pin 10, RX: pin 11). It is compatible with the Arduino IDE (Zero compatible), or it can be used with the Bossac tool standalone. Under Arduino, auto-reset is supported (automatically runs the bootloader while the sketch is running) as well as automatic return freom reset. The SAM-BA bootloader described here adds to the Arduino version, which in @@ -219,12 +301,13 @@ The bootloader can be started by: Otherwise, it jumps to application and starts execution from there. The LED will light during bootloader execution. Note that the 4KB bootloader does not support the Arduino Extended Capabilities or BOOT_DOUBLE_TAP. +However, BOOT_DOUBLE_TAP does fit into the SAMD11 4KB bootloader. When the Arduino IDE initiates the bootloader, the following procedure is used: 1. The IDE opens and closes the USB serial port at a baud rate of 1200bps. This triggers a “soft erase†procedure. -2. The flash memory is erased by the MCU. If it is interrupted for any reason, the erase procedure will likely fail. -3. The board is reset. The bootloader (which always runs first) detects a blank FLASH, so bootloader operation resumes. +2. The first row of application section flash memory is erased by the MCU. If it is interrupted for any reason, the erase procedure will likely fail. +3. The board is reset. The bootloader (which always runs first) detects the blank flah row, so bootloader operation resumes. 4. Opening and closing the port at a baud rate other than 1200bps will not erase or reset the SAMD. ### Bootloader Firmware Installation @@ -234,7 +317,7 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: 1. If you do not already have the MattairTech SAMD core installed, see SAMD Core Installation above. 2. Plug an Atmel ICE into USB, then connect it to the powered SAMD board. A green LED should light on the Atmel ICE. 3. Click Tools->Programmer->Atmel ICE. -4. Click Tools->Board->MattairTech MT-D21E. +4. Click Tools->Board->MattairTech MT-D21E (or MT-D11). 5. Click Tools->Burn Bootloader. Ignore any messages about not supporting shutdown or reset. 6. Continue with driver installation above. @@ -245,7 +328,7 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: 3. Follow the procedures for your upload tool to upload the firmware. * Perform a chip erase first. Be sure no BOOTPROT bits are set. * Install the binary file to 0x00000000 of the FLASH. - * You can optionally set the BOOTPROT bits to 8KB. The Arduino installation method does not set these. + * You can optionally set the BOOTPROT bits to 8KB (or 4KB for the MT-D11). The Arduino installation method does not set these. * You can optionally set the EEPROM bits or anything else. The Arduino installation method uses factory defaults. 4. Continue with driver installation above. @@ -297,6 +380,14 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R * verify that the pin can perform the function requested, and to configure the pin for * that function. Most of the contents of pinMode() are now in pinPeripheral(). * + * There are two ways that pins can be mapped. The first is to map pins contiguously + * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space + * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps + * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). + * This only works when there is one port. Because not all port pins are available, + * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. + * For an example of both types, see variant.cpp from the MT-D11 variant. + * * Explanation of PinDescription table: * * Port This is the port (ie: PORTA). @@ -322,8 +413,8 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R * peripherals possible with each of the SERCOM and TIMER * functions. TIMER pins are individual, while SERCOM uses a * group of two to four pins. This group of pins can span both - * peripherals. For example, pin 19 (SPI1 SCK) uses - * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses + * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E + * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each * pin. This bitfield is also used to set the pin drive strength. * In the future, other attributes (like input buffer @@ -343,18 +434,66 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R * (ie: to avoid contention). See WVariant.h for valid entries. * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some * TC channels are available on multiple pins (ie: TCC0/WO[0] is - * available on pin A4 or pin A8). In general, only one pin - * should be configured (in the pinDescription table) per TC - * channel. See WVariant.h for valid entries. The tone library - * uses TC5. + * available on pin A4 or pin A8 on the MT-D21E). In general, + * only one pin should be configured (in the pinDescription + * table) per TC channel. See WVariant.h for valid entries. + * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See * WVariant.h for valid entries. * ExtInt This is the interrupt (if any) assigned to the pin. Some * interrupt numbers are available on multiple pins (ie: - * EIC/EXTINT[2] is available on pin A2 or pin A18). In general, - * only one pin should be configured (in the pinDescription - * table) per interrupt number. Thus, if an interrupt was needed - * on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See - * WVariant.h for valid entries. + * EIC/EXTINT[2] is available on pin A2 or pin A18 on the + * MT-D21E). In general, only one pin should be configured (in + * the pinDescription table) per interrupt number. Thus, if an + * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved + * from pin 18. See WVariant.h for valid entries. */ ``` + + +## Possible Future Additions + +* Port Servo library +* Replace pulse with timer capture +* MIDI USB Device Class +* MSC (Mass Storage) USB Device Class +* More detailed memory usage statistics +* Some kind of stack overflow detection. Estimation on stack usage. +* Analog calibration +* Polyphonic tone +* Better OS X support +* Drivers for some hardware I plan on using (TFT LCD, motor controller, IR decoder, several I2C (Wire) sensor devices, I2S device, etc.) + + +## ChangeLog + +* 1.6.5-mt2: + * See 'What's New' above. + +* 1.6.5-mt1: + * Initial release + + +## License and credits + +This core has been developed by Arduino LLC in collaboration with Atmel. +This fork developed by Justin Mattair of MattairTech LLC. + +``` +Copyright (c) 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 +``` + diff --git a/boards.txt b/boards.txt index baf3dd41c..1362c6f08 100644 --- a/boards.txt +++ b/boards.txt @@ -15,6 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA menu.cpu=Processor +menu.com=Communications # MattairTech MT-D21E (default 8KB bootloader) mattairtech_mt_d21e_bl8k.name=MattairTech MT-D21E (SAM-BA bootloader) @@ -52,12 +53,35 @@ mattairtech_mt_d21e_bl8k.build.mcu=cortex-m0plus mattairtech_mt_d21e_bl8k.build.f_cpu=48000000L mattairtech_mt_d21e_bl8k.build.usb_product="MT-D21E" mattairtech_mt_d21e_bl8k.build.usb_manufacturer="MattairTech" -mattairtech_mt_d21e_bl8k.build.board=MT_D21E +mattairtech_mt_d21e_bl8k.build.board=CDC_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart=CDC_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.menu.com.cdc_uart=CDC_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.board=CDC_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.pid=0x0557 +mattairtech_mt_d21e_bl8k.menu.com.hid_uart=HID_UART +mattairtech_mt_d21e_bl8k.menu.com.hid_uart.build.board=HID_UART +mattairtech_mt_d21e_bl8k.menu.com.hid_uart.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid=CDC_HID +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.board=CDC_HID +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.menu.com.cdc=CDC_ONLY +mattairtech_mt_d21e_bl8k.menu.com.cdc.build.board=CDC_ONLY +mattairtech_mt_d21e_bl8k.menu.com.cdc.build.pid=0x0557 +mattairtech_mt_d21e_bl8k.menu.com.hid=HID_ONLY +mattairtech_mt_d21e_bl8k.menu.com.hid.build.board=HID_ONLY +mattairtech_mt_d21e_bl8k.menu.com.hid.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.menu.com.uart=UART_ONLY +mattairtech_mt_d21e_bl8k.menu.com.uart.build.board=UART_ONLY +mattairtech_mt_d21e_bl8k.menu.com.uart.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.menu.com.none=USB_UART_DISABLED +mattairtech_mt_d21e_bl8k.menu.com.none.build.board=USB_UART_DISABLED +mattairtech_mt_d21e_bl8k.menu.com.none.build.pid=0x0856 mattairtech_mt_d21e_bl8k.build.core=arduino mattairtech_mt_d21e_bl8k.build.variant=MT_D21E mattairtech_mt_d21e_bl8k.build.variant_system_lib= mattairtech_mt_d21e_bl8k.build.vid=0x16D0 -mattairtech_mt_d21e_bl8k.build.pid=0x0856 mattairtech_mt_d21e_bl8k.bootloader.tool=arduino:openocd mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.bootloader.file=zero/samd21e18a_sam_ba.bin mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.bootloader.file=zero/samd21e17a_sam_ba.bin @@ -91,7 +115,31 @@ mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam #mattairtech_mt_d21e_bl16k.build.f_cpu=48000000L #mattairtech_mt_d21e_bl16k.build.usb_product="MT-D21E" #mattairtech_mt_d21e_bl16k.build.usb_manufacturer="MattairTech" -#mattairtech_mt_d21e_bl16k.build.board=MT_D21E +#mattairtech_mt_d21e_bl16k.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart=CDC_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.menu.com.cdc_uart=CDC_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.board=CDC_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.pid=0x0557 +#mattairtech_mt_d21e_bl16k.menu.com.hid_uart=HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.hid_uart.build.board=HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.hid_uart.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid=CDC_HID +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.board=CDC_HID +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.menu.com.cdc=CDC_ONLY +#mattairtech_mt_d21e_bl16k.menu.com.cdc.build.board=CDC_ONLY +#mattairtech_mt_d21e_bl16k.menu.com.cdc.build.pid=0x0557 +#mattairtech_mt_d21e_bl16k.menu.com.hid=HID_ONLY +#mattairtech_mt_d21e_bl16k.menu.com.hid.build.board=HID_ONLY +#mattairtech_mt_d21e_bl16k.menu.com.hid.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.menu.com.uart=UART_ONLY +#mattairtech_mt_d21e_bl16k.menu.com.uart.build.board=UART_ONLY +#mattairtech_mt_d21e_bl16k.menu.com.uart.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.menu.com.none=USB_UART_DISABLED +#mattairtech_mt_d21e_bl16k.menu.com.none.build.board=USB_UART_DISABLED +#mattairtech_mt_d21e_bl16k.menu.com.none.build.pid=0x0856 #mattairtech_mt_d21e_bl16k.build.core=arduino #mattairtech_mt_d21e_bl16k.build.variant=MT_D21E #mattairtech_mt_d21e_bl16k.build.variant_system_lib= @@ -130,9 +178,173 @@ mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam #mattairtech_mt_d21e_bl0k.build.f_cpu=48000000L #mattairtech_mt_d21e_bl0k.build.usb_product="MT-D21E" #mattairtech_mt_d21e_bl0k.build.usb_manufacturer="MattairTech" -#mattairtech_mt_d21e_bl0k.build.board=MT_D21E +#mattairtech_mt_d21e_bl0k.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.menu.com.cdc_uart=CDC_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.board=CDC_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.pid=0x0557 +#mattairtech_mt_d21e_bl0k.menu.com.hid_uart=HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.hid_uart.build.board=HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.hid_uart.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid=CDC_HID +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.board=CDC_HID +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.menu.com.cdc=CDC_ONLY +#mattairtech_mt_d21e_bl0k.menu.com.cdc.build.board=CDC_ONLY +#mattairtech_mt_d21e_bl0k.menu.com.cdc.build.pid=0x0557 +#mattairtech_mt_d21e_bl0k.menu.com.hid=HID_ONLY +#mattairtech_mt_d21e_bl0k.menu.com.hid.build.board=HID_ONLY +#mattairtech_mt_d21e_bl0k.menu.com.hid.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.menu.com.uart=UART_ONLY +#mattairtech_mt_d21e_bl0k.menu.com.uart.build.board=UART_ONLY +#mattairtech_mt_d21e_bl0k.menu.com.uart.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.menu.com.none=USB_UART_DISABLED +#mattairtech_mt_d21e_bl0k.menu.com.none.build.board=USB_UART_DISABLED +#mattairtech_mt_d21e_bl0k.menu.com.none.build.pid=0x0856 #mattairtech_mt_d21e_bl0k.build.core=arduino #mattairtech_mt_d21e_bl0k.build.variant=MT_D21E #mattairtech_mt_d21e_bl0k.build.variant_system_lib= #mattairtech_mt_d21e_bl0k.build.vid=0x16D0 #mattairtech_mt_d21e_bl0k.build.pid=0x0856 + + + +# MattairTech MT-D11 (4KB bootloader) +mattairtech_mt_d11.name=MattairTech MT-D11 (SAM-BA bootloader) +mattairtech_mt_d11.vid.0=0x16D0 +mattairtech_mt_d11.pid.0=0x0557 +mattairtech_mt_d11.vid.1=0x16D0 +mattairtech_mt_d11.pid.1=0x0856 +mattairtech_mt_d11.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d11.upload.protocol=sam-ba +mattairtech_mt_d11.upload.use_1200bps_touch=true +mattairtech_mt_d11.upload.wait_for_upload_port=true +mattairtech_mt_d11.upload.native_usb=true +mattairtech_mt_d11.upload.maximum_size=12288 +mattairtech_mt_d11.build.extra_flags=-D__SAMD11D14AM__ -D__4KB_BOOTLOADER__ {build.usb_flags} +mattairtech_mt_d11.build.ldscript=linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld +mattairtech_mt_d11.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg +mattairtech_mt_d11.build.mcu=cortex-m0plus +mattairtech_mt_d11.build.f_cpu=48000000L +mattairtech_mt_d11.build.usb_product="MT-D11" +mattairtech_mt_d11.build.usb_manufacturer="MattairTech" +mattairtech_mt_d11.build.board=CDC_HID_UART +mattairtech_mt_d11.menu.com.cdc_hid_uart=CDC_HID_UART +mattairtech_mt_d11.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +mattairtech_mt_d11.menu.com.cdc_hid_uart.build.pid=0x0856 +mattairtech_mt_d11.menu.com.cdc_uart=CDC_UART +mattairtech_mt_d11.menu.com.cdc_uart.build.board=CDC_UART +mattairtech_mt_d11.menu.com.cdc_uart.build.pid=0x0557 +mattairtech_mt_d11.menu.com.hid_uart=HID_UART +mattairtech_mt_d11.menu.com.hid_uart.build.board=HID_UART +mattairtech_mt_d11.menu.com.hid_uart.build.pid=0x0856 +mattairtech_mt_d11.menu.com.cdc_hid=CDC_HID +mattairtech_mt_d11.menu.com.cdc_hid.build.board=CDC_HID +mattairtech_mt_d11.menu.com.cdc_hid.build.pid=0x0856 +mattairtech_mt_d11.menu.com.cdc=CDC_ONLY +mattairtech_mt_d11.menu.com.cdc.build.board=CDC_ONLY +mattairtech_mt_d11.menu.com.cdc.build.pid=0x0557 +mattairtech_mt_d11.menu.com.hid=HID_ONLY +mattairtech_mt_d11.menu.com.hid.build.board=HID_ONLY +mattairtech_mt_d11.menu.com.hid.build.pid=0x0856 +mattairtech_mt_d11.menu.com.uart=UART_ONLY +mattairtech_mt_d11.menu.com.uart.build.board=UART_ONLY +mattairtech_mt_d11.menu.com.uart.build.pid=0x0856 +mattairtech_mt_d11.menu.com.none=USB_UART_DISABLED +mattairtech_mt_d11.menu.com.none.build.board=USB_UART_DISABLED +mattairtech_mt_d11.menu.com.none.build.pid=0x0856 +mattairtech_mt_d11.build.core=arduino +mattairtech_mt_d11.build.variant=MT_D11 +mattairtech_mt_d11.build.variant_system_lib= +mattairtech_mt_d11.build.vid=0x16D0 +mattairtech_mt_d11.build.pid=0x0856 +mattairtech_mt_d11.bootloader.tool=arduino:openocd +mattairtech_mt_d11.bootloader.file=zero/samd11d14am_sam_ba.bin + + + +# MattairTech Core for Arduino Zero (8KB bootloader, Native USB Port) +arduino_zero_native.name=Arduino Zero (Native USB Port) +arduino_zero_native.vid.0=0x2341 +arduino_zero_native.pid.0=0x804d +arduino_zero_native.vid.1=0x2341 +arduino_zero_native.pid.1=0x004d +arduino_zero_native.upload.tool=MattairTech_Arduino:bossac +arduino_zero_native.upload.protocol=sam-ba +arduino_zero_native.upload.maximum_size=262144 +arduino_zero_native.upload.use_1200bps_touch=true +arduino_zero_native.upload.wait_for_upload_port=true +arduino_zero_native.upload.native_usb=true +arduino_zero_native.build.mcu=cortex-m0plus +arduino_zero_native.build.f_cpu=48000000L +arduino_zero_native.build.usb_product="Arduino Zero" +arduino_zero_native.build.usb_manufacturer="Arduino LLC" +arduino_zero_native.build.board=SAMD_ZERO +arduino_zero_native.menu.com.cdc_hid_uart=CDC_HID_UART +arduino_zero_native.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +arduino_zero_native.menu.com.cdc_uart=CDC_UART +arduino_zero_native.menu.com.cdc_uart.build.board=CDC_UART +arduino_zero_native.menu.com.hid_uart=HID_UART +arduino_zero_native.menu.com.hid_uart.build.board=HID_UART +arduino_zero_native.menu.com.cdc_hid=CDC_HID +arduino_zero_native.menu.com.cdc_hid.build.board=CDC_HID +arduino_zero_native.menu.com.cdc=CDC_ONLY +arduino_zero_native.menu.com.cdc.build.board=CDC_ONLY +arduino_zero_native.menu.com.hid=HID_ONLY +arduino_zero_native.menu.com.hid.build.board=HID_ONLY +arduino_zero_native.menu.com.uart=UART_ONLY +arduino_zero_native.menu.com.uart.build.board=UART_ONLY +arduino_zero_native.menu.com.none=USB_UART_DISABLED +arduino_zero_native.menu.com.none.build.board=USB_UART_DISABLED +arduino_zero_native.build.core=arduino +arduino_zero_native.build.extra_flags=-D__SAMD21G18A__ -D__8KB_BOOTLOADER__ {build.usb_flags} +arduino_zero_native.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld +arduino_zero_native.build.openocdscript=openocd_scripts/arduino_zero.cfg +arduino_zero_native.build.variant=arduino_zero +arduino_zero_native.build.variant_system_lib= +arduino_zero_native.build.vid=0x2341 +arduino_zero_native.build.pid=0x804d + +# MattairTech Core for Arduino Zero (8KB bootloader, Programming Port) +#arduino_zero_edbg.name=Arduino Zero (Programming Port) +#arduino_zero_edbg.vid.0=0x03eb +#arduino_zero_edbg.pid.0=0x2157 +#arduino_zero_edbg.upload.tool=arduino:openocd +#arduino_zero_edbg.upload.protocol=sam-ba +#arduino_zero_edbg.upload.maximum_size=262144 +#arduino_zero_edbg.upload.use_1200bps_touch=false +#arduino_zero_edbg.upload.wait_for_upload_port=false +#arduino_zero_edbg.upload.native_usb=false +#arduino_zero_edbg.build.mcu=cortex-m0plus +#arduino_zero_edbg.build.f_cpu=48000000L +#arduino_zero_edbg.build.usb_product="Arduino Zero" +#arduino_zero_edbg.build.usb_manufacturer="Arduino LLC" +#arduino_zero_edbg.build.board=SAMD_ZERO +#arduino_zero_edbg.menu.com.cdc_hid_uart=CDC_HID_UART +#arduino_zero_edbg.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +#arduino_zero_edbg.menu.com.cdc_uart=CDC_UART +#arduino_zero_edbg.menu.com.cdc_uart.build.board=CDC_UART +#arduino_zero_edbg.menu.com.hid_uart=HID_UART +#arduino_zero_edbg.menu.com.hid_uart.build.board=HID_UART +#arduino_zero_edbg.menu.com.cdc_hid=CDC_HID +#arduino_zero_edbg.menu.com.cdc_hid.build.board=CDC_HID +#arduino_zero_edbg.menu.com.cdc=CDC_ONLY +#arduino_zero_edbg.menu.com.cdc.build.board=CDC_ONLY +#arduino_zero_edbg.menu.com.hid=HID_ONLY +#arduino_zero_edbg.menu.com.hid.build.board=HID_ONLY +#arduino_zero_edbg.menu.com.uart=UART_ONLY +#arduino_zero_edbg.menu.com.uart.build.board=UART_ONLY +#arduino_zero_edbg.menu.com.none=USB_UART_DISABLED +#arduino_zero_edbg.menu.com.none.build.board=USB_UART_DISABLED +#arduino_zero_edbg.build.core=arduino +#arduino_zero_edbg.build.extra_flags=-D__SAMD21G18A__ -D__8KB_BOOTLOADER__ {build.usb_flags} +#arduino_zero_edbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld +#arduino_zero_edbg.build.openocdscript=openocd_scripts/arduino_zero.cfg +#arduino_zero_edbg.build.variant=arduino_zero +#arduino_zero_edbg.build.variant_system_lib= +#arduino_zero_edbg.build.vid=0x2341 +#arduino_zero_edbg.build.pid=0x804d +#arduino_zero_edbg.bootloader.tool=arduino:openocd +#arduino_zero_edbg.bootloader.file=zero/samd21g18a_sam_ba.bin diff --git a/bootloaders/zero/main.h b/bootloaders/zero/main.h index 66871ee9e..33170b58e 100644 --- a/bootloaders/zero/main.h +++ b/bootloaders/zero/main.h @@ -29,10 +29,28 @@ #pragma once + +/* + * Starting address for the application section. + * For example, with an 8KB bootloader, APP_START_ADDRESS = 0x00002000. + * SAMD11 devices should probably use a 4KB bootloader. + */ +#define APP_START_ADDRESS 0x00002000 +//#define APP_START_ADDRESS 0x00001000 + +/* + * If BOOT_LOAD_PIN is defined the bootloader is started if the selected + * pin is tied LOW. + */ +#define BOOT_LOAD_PIN PIN_PA27 +//#define BOOT_LOAD_PIN PIN_PA15 +#define BOOT_PIN_MASK (1U << (BOOT_LOAD_PIN & 0x1f)) + /* * If LED_PIN is defined, it will turn on during bootloader operation. */ -#define LED_PIN PIN_PA28 // Pin 28 +#define LED_PIN PIN_PA28 +//#define LED_PIN PIN_PA16 #define LED_PIN_MASK (1U << (LED_PIN & 0x1f)) /* @@ -53,28 +71,25 @@ #define BOOT_DOUBLE_TAP_ADDRESS 0x20000FFC #elif defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) #define BOOT_DOUBLE_TAP_ADDRESS 0x20000FFC +#else + #error "main.h: Unsupported MCU" #endif #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. + * If bootloader UART support is compiled in (see sam_ba_monitor.h), configure it here. */ -#define BOOT_LOAD_PIN PIN_PA27 // Pin 27 -#define BOOT_PIN_MASK (1U << (BOOT_LOAD_PIN & 0x1f)) - -#define CPU_FREQUENCY 8000000 -#define APP_START_ADDRESS 0x00002000 -#define FLASH_WAIT_STATES 1 - #define BOOT_USART_MODULE SERCOM0 -//#define BOOT_USART_MODULE SERCOM5 #define BOOT_USART_MUX_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_PAD3 PINMUX_PA11C_SERCOM0_PAD3 #define BOOT_USART_PAD2 PINMUX_PA10C_SERCOM0_PAD2 +//#define BOOT_USART_PAD3 PINMUX_UNUSED +//#define BOOT_USART_PAD2 PINMUX_UNUSED #define BOOT_USART_PAD1 PINMUX_UNUSED #define BOOT_USART_PAD0 PINMUX_UNUSED + +#define CPU_FREQUENCY 8000000 +#define FLASH_WAIT_STATES 1 + diff --git a/bootloaders/zero/readme.txt b/bootloaders/zero/readme.txt index 1c711a7ce..4f9f94912 100644 --- a/bootloaders/zero/readme.txt +++ b/bootloaders/zero/readme.txt @@ -19,7 +19,7 @@ All of these options will build an 8KB bootloader. If you want to build a 4KB bootloader, you will need to: * Choose only one interface from above * Disable ARDUINO_EXTENDED_CAPABILITIES (sam_ba_monitor.h) - * Disable BOOT_DOUBLE_TAP (main.h) + * Disable BOOT_DOUBLE_TAP (main.h) for SAMD21 only (there is enough room on the SAMD11) 3- Makefile configuration diff --git a/bootloaders/zero/sam_ba_monitor.h b/bootloaders/zero/sam_ba_monitor.h index e1b5e2f53..101c20cff 100644 --- a/bootloaders/zero/sam_ba_monitor.h +++ b/bootloaders/zero/sam_ba_monitor.h @@ -41,7 +41,7 @@ #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES #endif -/* disable for 4KB bootloaders */ +/* comment out for 4KB bootloaders */ #define ARDUINO_EXTENDED_CAPABILITIES 1 /* Selects USART as the communication interface of the monitor */ diff --git a/bootloaders/zero/samd11c14a_sam_ba.bin b/bootloaders/zero/samd11c14a_sam_ba.bin new file mode 100755 index 0000000000000000000000000000000000000000..7318079abf1fecffd39d8be2469e4f6caf2c120f GIT binary patch literal 4072 zcmb_feQ+B`72mznx13nAn{blO&V4wxY^6oElg6=2a?uq_x^v<-nAUbaI41$lO@Nd6 zl0u=1oq`ga;@Gs~xFv04%A}oU$OHrf)YAa%&_aii0%g)T%$!=l`~!6-fStz4@z!=q z2L}E^Ge7U{+xN9^-@UgUaUkwf4utxbf&Ryj@Z9>{;{Sh+zPzJDOrwaiXjf5$D%cXp zL@#1dG<;LL5aNjK;c|prc^B-{1!uyQBpl8Jt&_C_sHiX=cTHVrzs0M89FZZvX#RG! zn(x)ixnnZLd*p^>ujYB6L9LX$d+XI+eNgVzdee1@9p_QQyVG~;L&6S9kYhk2l^*U$H@Ag9CiiB0a#`Ub_P`AM015^_h*fuT$!bDhp-{5&p3NvZi-fi!7m}<6%R*&H zs?oA246tZ~ER0b0CvZ3?MjP{C6$ybf76VeP>M1gMtuhkB#ei042DKUmx1xrHVo(#* zD*XUkRp2`WB`by~2ft6_5`JT{56yn>rtrXl_6pm@^2;e_a|mw3UC4?%aY!G!>dG-{ zR@i|jv~b*->$X;@SO^*~Uj5iN_Wl6PK7Yf;PU;*x9`~szj0_#j4H zG#^wSK1cM{7i{&oNa;3{B4ZAjR62=lXJp3PwktRp^A^fEpX3fxm!fOKGBP(t8Kc6D z+uoVMXQCo)q(#~A2r@HatPn06cGcDx(y>XaA$?jOkK4~hr!wFJu{rPqaz@B5IMLfz zT|+jdQll5+A?r-sh!cOaz&D$JuH(6FqAu~F{;!=2LnO{5ETE)8+3G)AjtpV>C4 zMDz-MEQWs5Ryy6;qEl(B0TtJk#0FHbm!3>|;bgXgsDCRltyBDX{0TLb{z#;y_$cIF zgFX^t-*{BTO(DHO3$UXqZVYITs)NChJ`qE21lcilY#Rf6Xm;p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8)QLbm7gt9!}wJX8wI|qApUEQC7I`PT#;BBdEQ|bOitJS6Z z7X4@_b#%7n4y1%qQx5JKO~hQqwp@iU7Q>fXbED_O?6#zDaqn^1LxqY`TTXu8Zaj%g zaQkytZZ670o=l&g9B`ECtHLZ6{$@(aFzd}y!rSJDlHTm<+&yBobeCFfd>~g|yIEQd z6#9;>mq-_M6e@GB=AHNt%w*SI%R} zpKZ(`xRIA(560q8VWjKP8&f9H>H@7%p6Gpx>CGIIIo=7H-%s(8H*4y&Ih2VCV=^a@ zO#hC#l;h-!8ix9JtHyi<@_rC-1aJ!QAOOQVj{@)DG-xDhqlc33h+s_;&K#;CM^Ei@xg!7lt+~H0cubNDzq{cut@V@d#d9(h&fJ_LF}Md};mg}qdxr>brrH}E%fs8~ z42-@hQpa+z@62NXkKku1c-2{RFD+nhINAg~gl4FEFk26$GWFCY$W z{ro36u8C`kHf}(Tn_8PUv~IW)ZAOiEG$Mp5un$uRNrlz-+kF@afcgA|_W2iFFPv&O z;&~vwe+^57zfUEOwBr}FIQ)kTF+C16@?QpSLE(3cM%+!wh{EUsa@&BJ0`>M9A_GMRgnmYxaS?aWKLHEHzhVFY literal 0 HcmV?d00001 diff --git a/bootloaders/zero/samd11d14am_sam_ba.bin b/bootloaders/zero/samd11d14am_sam_ba.bin new file mode 100755 index 0000000000000000000000000000000000000000..965cf77d00733b1d03b86b55dabc351a23ca6458 GIT binary patch literal 4080 zcmaJEZEzb`@x42J%ZVks4JYaB-02)!w$fJqNaNTgx#)@|-8pd@OlvzIoRa|OCIct8 z1t~35vD2c2v~}#Z@HSsUWgHiRBn2K0YEB6Iz_F8}{9k-d@s@%eS$b-E{K>l9Kb zY%f?96sGc)I5N=dSP*p2)J}vrBKKrDLXMmR_;lVLcO-~}Jx*(6ZUZXHkH;KS(;e4k zRai&XkS~(EMXBcdv~upKMDZ@EAK={eQ*%-}diXcmP4b^@ zSKjs|3VV+82{f|j_~E|nCjO|@m+8%Bg6FUcMqmd}FxWwMbta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%X3E`}5K9GrVR*9-3MZtn z^43|O?#Y((SoCHZvj`&cGgt#$_%UF*9=$td5UCE38sUlD_nE%*QHkU2Ao-IN4|%^P zPa4DNNN`Nzf+W+wYb@nBxlxCq{#~yz_e0))9Uuc>0s1!pV|eFL06YgzKd42|^Dqt~ zv<-Sl8LZoY?*YI|mT&qG%LfX??mP3u>b)gT)GT}Aeda`(60)}Lcf8q1t)nr4`x!_2 zjKtMOBu5hXxh2|L>4X!DzNiQ?)MdUmflsUzmc2+MVc}P{TmDUw=f6k_{F@}A@y%pK z*3q;bpJXbNZlf*h_&5t(5Mv~m^M6@%86+2ed(~!`>n1<;=VUUJzBWaCunoYIvntk3 z0p3itS2>o4x6vuUo+(nt9N;T^4hQiFevyJ#ojL!;BIZ_35qf3rK!<%D4_QUU&H2Ga zF14ye_vGxIMC&V8X%=zAQENV^#RaoDzY`0L=vn5W*)r%tK9-JSu=K5xO$;a(Vfa!7#pME;jM-{{88muEdwG&{tMMX9_`$ITzj>M?{0D-ilK0A7jE8i4j? zJOJ3W0(}*6sQtdXIIf9niZrfAjT>8=n_Aa3qD`pr=0Hq)$ literal 0 HcmV?d00001 diff --git a/bootloaders/zero/startup_samd11.c b/bootloaders/zero/startup_samd11.c index 2308ceb2b..d8f57bcd2 100644 --- a/bootloaders/zero/startup_samd11.c +++ b/bootloaders/zero/startup_samd11.c @@ -78,23 +78,17 @@ void RTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler void EIC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void NVMCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void DMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#ifdef USB_IRQn void USB_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif void EVSYS_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#ifdef SERCOM2_IRQn void SERCOM2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif void TCC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void ADC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void AC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#ifdef DAC_IRQn void DAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); /* Exception Table */ @@ -128,29 +122,17 @@ const DeviceVectors exception_table = { (void*) EIC_Handler, /* 4 External Interrupt Controller */ (void*) NVMCTRL_Handler, /* 5 Non-Volatile Memory Controller */ (void*) DMAC_Handler, /* 6 Direct Memory Access Controller */ -#ifdef USB_IRQn (void*) USB_Handler, /* 7 Universal Serial Bus */ -#else - (void*) (0UL), /* Reserved */ -#endif (void*) EVSYS_Handler, /* 8 Event System Interface */ (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ -#ifdef SERCOM2_IRQn (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ -#else - (void*) (0UL), /* Reserved */ -#endif (void*) TCC0_Handler, /* 12 Timer Counter Control */ (void*) TC1_Handler, /* 13 Basic Timer Counter 0 */ (void*) TC2_Handler, /* 14 Basic Timer Counter 1 */ (void*) ADC_Handler, /* 15 Analog Digital Converter */ (void*) AC_Handler, /* 16 Analog Comparators */ -#ifdef DAC_IRQn (void*) DAC_Handler, /* 17 Digital Analog Converter */ -#else - (void*) (0UL), /* Reserved */ -#endif (void*) PTC_Handler /* 18 Peripheral Touch Controller */ }; diff --git a/bootloaders/zero/startup_samd21.c b/bootloaders/zero/startup_samd21.c index 6e04bee45..92465844c 100644 --- a/bootloaders/zero/startup_samd21.c +++ b/bootloaders/zero/startup_samd21.c @@ -78,50 +78,28 @@ void RTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler void EIC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void NVMCTRL_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void DMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#ifdef USB_IRQn void USB_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif void EVSYS_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#ifdef SERCOM4_IRQn void SERCOM4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef SERCOM5_IRQn void SERCOM5_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif void TCC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); void TC5_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#ifdef TC6_IRQn void TC6_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef TC7_IRQn void TC7_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef ADC_IRQn void ADC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef AC_IRQn void AC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef DAC_IRQn void DAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef PTC_IRQn void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef I2S_IRQn void I2S_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif -#ifdef AC1_IRQn void AC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler"))); -#endif /* Exception Table */ __attribute__ ((section(".vectors"))) @@ -154,72 +132,28 @@ const DeviceVectors exception_table = { (void*) EIC_Handler, /* 4 External Interrupt Controller */ (void*) NVMCTRL_Handler, /* 5 Non-Volatile Memory Controller */ (void*) DMAC_Handler, /* 6 Direct Memory Access Controller */ -#ifdef USB_IRQn (void*) USB_Handler, /* 7 Universal Serial Bus */ -#else - (void*) (0UL), /* Reserved */ -#endif (void*) EVSYS_Handler, /* 8 Event System Interface */ (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ (void*) SERCOM3_Handler, /* 12 Serial Communication Interface 3 */ -#ifdef SERCOM4_IRQn (void*) SERCOM4_Handler, /* 13 Serial Communication Interface 4 */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef SERCOM5_IRQn (void*) SERCOM5_Handler, /* 14 Serial Communication Interface 5 */ -#else - (void*) (0UL), /* Reserved */ -#endif (void*) TCC0_Handler, /* 15 Timer Counter Control 0 */ (void*) TCC1_Handler, /* 16 Timer Counter Control 1 */ (void*) TCC2_Handler, /* 17 Timer Counter Control 2 */ (void*) TC3_Handler, /* 18 Basic Timer Counter 0 */ (void*) TC4_Handler, /* 19 Basic Timer Counter 1 */ (void*) TC5_Handler, /* 20 Basic Timer Counter 2 */ -#ifdef TC6_IRQn (void*) TC6_Handler, /* 21 Basic Timer Counter 3 */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef TC7_IRQn (void*) TC7_Handler, /* 22 Basic Timer Counter 4 */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef ADC_IRQn (void*) ADC_Handler, /* 23 Analog Digital Converter */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef AC_IRQn (void*) AC_Handler, /* 24 Analog Comparators 0 */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef DAC_IRQn (void*) DAC_Handler, /* 25 Digital Analog Converter */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef PTC_IRQn (void*) PTC_Handler, /* 26 Peripheral Touch Controller */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef I2S_IRQn (void*) I2S_Handler, /* 27 Inter-IC Sound Interface */ -#else - (void*) (0UL), /* Reserved */ -#endif -#ifdef AC1_IRQn (void*) AC1_Handler /* 28 Analog Comparators 1 */ -#else - (void*) (0UL) /* Reserved */ -#endif }; /** diff --git a/cores/arduino/Reset.cpp b/cores/arduino/Reset.cpp index 1ea9f9716..42ebb1d1e 100644 --- a/cores/arduino/Reset.cpp +++ b/cores/arduino/Reset.cpp @@ -25,17 +25,16 @@ extern "C" { #define NVM_MEMORY ((volatile uint16_t *)0x000000) -#if defined(__NO_BOOTLODAER__) +#if defined(__NO_BOOTLOADER__) #define APP_START 0x00000004 -#elif defined(__4KB_BOOTLODAER__) +#elif defined(__4KB_BOOTLOADER__) #define APP_START 0x00001004 -#elif defined(__8KB_BOOTLODAER__) +#elif defined(__8KB_BOOTLOADER__) #define APP_START 0x00002004 -#elif defined(__16KB_BOOTLODAER__) +#elif defined(__16KB_BOOTLOADER__) #define APP_START 0x00004004 #else - // default of 8KB - #define APP_START 0x00002004 + #error "Reset.cpp: You must define bootloader size in boards.txt build.extra_flags (ie: -D__8KB_BOOTLOADER__)" #endif static inline bool nvmReady(void) { @@ -43,7 +42,7 @@ static inline bool nvmReady(void) { } __attribute__ ((long_call, section (".ramfunc"))) -static void banzai() { +void banzai() { // Disable all interrupts __disable_irq(); diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index 442370754..77822e3ea 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -24,6 +24,29 @@ SERCOM::SERCOM(Sercom* s) sercom = s; } +// From https://en.wikipedia.org/wiki/Division_algorithm +static uint64_t divide64(uint64_t n, uint64_t d) +{ + uint64_t q = 0, r = 0; + + for (int8_t i = 63; i >= 0; i--) { + r = r << 1; + + // set the LSB of r equal to bit i of n + // because r was just shifted right by one, we don't need to explicitly set r to 0 if bit i of n is 0. + if (n & ((uint64_t)1 << i)) { + r |= 0x01; + } + + if (r >= d) { + r = r - d; + q |= ((uint64_t)1 << i); + } + } + + return q; +} + /* ========================= * ===== Sercom UART * ========================= @@ -64,7 +87,13 @@ void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint // Asynchronous arithmetic mode // 65535 * ( 1 - sampleRateValue * baudrate / SystemCoreClock); // 65535 - 65535 * (sampleRateValue * baudrate / SystemCoreClock)); - sercom->USART.BAUD.reg = 65535.0f * ( 1.0f - (float)(sampleRateValue) * (float)(baudrate) / (float)(SystemCoreClock)); + // sercom->USART.BAUD.reg = 65535.0f * ( 1.0f - (float)(sampleRateValue) * (float)(baudrate) / (float)(SystemCoreClock)); // this pulls in 3KB of floating point math code + // make numerator much larger than denominator so result is integer (avoid floating point). + uint64_t numerator = ((sampleRateValue * (uint64_t)baudrate) << 32); // 32 bits of shifting ensures no loss of precision. + uint64_t ratio = divide64(numerator, SystemCoreClock); + uint64_t scale = ((uint64_t)1 << 32) - ratio; + uint64_t baudValue = (65536 * scale) >> 32; + sercom->USART.BAUD.reg = baudValue; } } void SERCOM::initFrame(SercomUartCharSize charSize, SercomDataOrder dataOrder, SercomParityMode parityMode, SercomNumberStopBit nbStopBits) @@ -129,12 +158,12 @@ bool SERCOM::availableDataUART() bool SERCOM::isUARTError() { - return sercom->USART.INTFLAG.bit.ERROR; + return sercom->USART.INTFLAG.bit.ERROR; } void SERCOM::acknowledgeUARTError() { - sercom->USART.INTFLAG.bit.ERROR = 1; + sercom->USART.INTFLAG.bit.ERROR = 1; } bool SERCOM::isBufferOverflowErrorUART() @@ -271,7 +300,7 @@ void SERCOM::setBaudrateSPI(uint8_t divider) //Register enable-protected disableSPI(); - sercom->SPI.BAUD.reg = calculateBaudrateSynchronous( SERCOM_FREQ_REF / divider ); + sercom->SPI.BAUD.reg = calculateBaudrateSynchronous( SystemCoreClock / divider ); enableSPI(); } @@ -346,9 +375,9 @@ bool SERCOM::isDataRegisterEmptySPI() // return sercom->SPI.INTFLAG.bit.RXC; //} -uint8_t SERCOM::calculateBaudrateSynchronous(uint32_t baudrate) +uint32_t SERCOM::calculateBaudrateSynchronous(uint32_t baudrate) { - return SERCOM_FREQ_REF / (2 * baudrate) - 1; + return ((SystemCoreClock / (2 * baudrate)) - 1); } @@ -445,7 +474,7 @@ void SERCOM::initMasterWIRE( uint32_t baudrate ) // sercom->I2CM.INTENSET.reg = SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB | SERCOM_I2CM_INTENSET_ERROR ; // Synchronous arithmetic baudrate - sercom->I2CM.BAUD.bit.BAUD = SystemCoreClock / ( 2 * baudrate) - 1 ; + sercom->I2CM.BAUD.bit.BAUD = calculateBaudrateSynchronous(baudrate) ; } void SERCOM::prepareNackBitWIRE( void ) @@ -628,18 +657,22 @@ void SERCOM::initClockNVIC( void ) clockId = GCM_SERCOM1_CORE; IdNvic = SERCOM1_IRQn; } +#if !defined(__SAMD11C14A__) else if(sercom == SERCOM2) { clockId = GCM_SERCOM2_CORE; IdNvic = SERCOM2_IRQn; } +#endif +#if !defined(__SAMD11D14AM__) && !defined(__SAMD11C14A__) && !defined(__SAMD11D14AS__) else if(sercom == SERCOM3) { clockId = GCM_SERCOM3_CORE; IdNvic = SERCOM3_IRQn; } +#endif #if defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ - defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) + defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) else if(sercom == SERCOM4) { clockId = GCM_SERCOM4_CORE; diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index fbd27e624..772715d09 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -209,7 +209,7 @@ class SERCOM private: Sercom* sercom; - uint8_t calculateBaudrateSynchronous(uint32_t baudrate) ; + uint32_t calculateBaudrateSynchronous(uint32_t baudrate) ; uint32_t division(uint32_t dividend, uint32_t divisor) ; void initClockNVIC( void ) ; }; diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 1dff8ab37..5d135e70b 100644 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -30,8 +30,15 @@ volatile uint32_t portBitMask; volatile int64_t toggleCount; volatile bool toneIsActive = false; +/* TC5 does not exist on the D11. Using TC2 instead. It will conflict with the 2 TC2 PWM pins */ +#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) +#define TONE_TC TC2 +#define TONE_TC_IRQn TC2_IRQn +#else #define TONE_TC TC5 #define TONE_TC_IRQn TC5_IRQn +#endif + #define TONE_TC_TOP 0xFFFF #define TONE_TC_CHANNEL 0 void TC5_Handler (void) __attribute__ ((weak, alias("Tone_Handler"))); @@ -112,8 +119,13 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration) toggleCount = (duration > 0 ? frequency * duration * 2 / 1000UL : -1); - // Enable GCLK for TC4 and TC5 (timer counter input clock) + // Enable GCLK for timer used +#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC1_TC2)); +#else GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC4_TC5)); +#endif + while (GCLK->STATUS.bit.SYNCBUSY); resetTC(TONE_TC); diff --git a/cores/arduino/USB/HID.cpp b/cores/arduino/USB/HID.cpp index f5d561e0e..d8ce454b9 100644 --- a/cores/arduino/USB/HID.cpp +++ b/cores/arduino/USB/HID.cpp @@ -461,10 +461,14 @@ size_t Keyboard_::press(uint8_t k) // Add k to the key report only if it's not already present // and if there is an empty slot. - if (_keyReport.keys[0] != k && _keyReport.keys[1] != k && - _keyReport.keys[2] != k && _keyReport.keys[3] != k && - _keyReport.keys[4] != k && _keyReport.keys[5] != k) { - + uint8_t keyAlreadyPresent = 0; + for (i=0; i<6; i++) { + if (_keyReport.keys[i] == k) { + keyAlreadyPresent = 1; + } + } + + if (keyAlreadyPresent) { for (i=0; i<6; i++) { if (_keyReport.keys[i] == 0x00) { _keyReport.keys[i] = k; diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index 9b1cdf8c1..2f34bbc2e 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -20,8 +20,19 @@ #define __USBDESC_H__ // CDC or HID can be enabled together. -#define CDC_ENABLED -#define HID_ENABLED +// These are now controlled by the boards.txt menu system +#if defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) + #define CDC_ENABLED + #define HID_ENABLED +#elif defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) + #define CDC_ENABLED +#elif defined(ARDUINO_HID_ONLY) || defined(ARDUINO_HID_UART) + #define HID_ENABLED +#elif defined(ARDUINO_USB_UART_DISABLED) || defined(ARDUINO_UART_ONLY) + // do nothing +#else + #error "USBDesc.h: CDC_ENABLED and HID_ENABLED are now controlled by the boards.txt menu system" +#endif // CDC #define CDC_ACM_INTERFACE 0 // CDC ACM diff --git a/cores/arduino/USB/samd21_device.c b/cores/arduino/USB/samd21_device.c index d28774915..24f90d710 100644 --- a/cores/arduino/USB/samd21_device.c +++ b/cores/arduino/USB/samd21_device.c @@ -145,13 +145,12 @@ void UDD_Init(void) /* Set the configuration */ udd_force_device_mode(); udd_device_run_in_standby(); - // Set address of USB SRAM + // Set address of USB SRAM USB->DEVICE.DESCADD.reg = (uint32_t)(&usb_endpoint_table[0]); // For USB_SPEED_FULL udd_force_full_speed(); - for (i = 0; i < sizeof(usb_endpoint_table); i++) { - (*(uint32_t *)(&usb_endpoint_table[0]+i)) = 0; - } + + memset(&usb_endpoint_table[0], 0, sizeof(usb_endpoint_table)); // Configure interrupts NVIC_SetPriority((IRQn_Type) USB_IRQn, 0UL); diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index 9e302f2a8..b1aeccf82 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -150,10 +150,8 @@ void UHD_Init(void) USB->HOST.DESCADD.reg = (uint32_t)(&usb_pipe_table[0]); // For USB_SPEED_FULL uhd_force_full_speed(); - for (i = 0; i < sizeof(usb_pipe_table); i++) - { - (*(uint32_t *)(&usb_pipe_table[0] + i)) = 0; - } + + memset(&usb_pipe_table[0], 0, sizeof(usb_pipe_table)); uhd_state = UHD_STATE_NO_VBUS; diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index fb5f69af4..3bf278228 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -59,17 +59,17 @@ void Uart::flush() void Uart::IrqHandler() { - if (sercom->availableDataUART()) { - rxBuffer.store_char(sercom->readDataUART()); - } - - if (sercom->isUARTError()) { - sercom->acknowledgeUARTError(); - // TODO: if (sercom->isBufferOverflowErrorUART()) .... - // TODO: if (sercom->isFrameErrorUART()) .... - // TODO: if (sercom->isParityErrorUART()) .... - sercom->clearStatusUART(); - } + if (sercom->availableDataUART()) { + rxBuffer.store_char(sercom->readDataUART()); + } + + if (sercom->isUARTError()) { + sercom->acknowledgeUARTError(); + // TODO: if (sercom->isBufferOverflowErrorUART()) .... + // TODO: if (sercom->isFrameErrorUART()) .... + // TODO: if (sercom->isParityErrorUART()) .... + sercom->clearStatusUART(); + } } int Uart::available() diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index fdda0c81e..9294fc780 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -193,8 +193,8 @@ void EIC_Handler( void ) { uint32_t ul ; - // Test the 16 normal interrupts - for ( ul = EXTERNAL_INT_0 ; ul <= EXTERNAL_INT_15 ; ul++ ) + // Test the normal interrupts + for ( ul = EXTERNAL_INT_0 ; ul < (EXTERNAL_NUM_INTERRUPTS - 1) ; ul++ ) { if ( (EIC->INTFLAG.reg & ( 1 << ul ) ) != 0 ) { diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp index 53f16cdc0..e1d60f471 100644 --- a/cores/arduino/WString.cpp +++ b/cores/arduino/WString.cpp @@ -45,7 +45,7 @@ String::String(const __FlashStringHelper *pstr) *this = pstr; } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String::String(String &&rval) { init(); @@ -191,7 +191,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length) return *this; } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) void String::move(String &rhs) { if (buffer) { @@ -223,7 +223,7 @@ String & String::operator = (const String &rhs) return *this; } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String & String::operator = (String &&rval) { if (this != &rval) move(rval); diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index 6f3d09b80..ca692d45d 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -1,5 +1,9 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + WString.h - String library for Wiring & Arduino + ...mostly rewritten by Paul Stoffregen... + Copyright (c) 2009-10 Hernando Barragan. All right reserved. + Copyright 2011, Paul Stoffregen, paul@pjrc.com + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -8,8 +12,8 @@ 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. + 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 @@ -56,7 +60,7 @@ class String String(const char *cstr = ""); String(const String &str); String(const __FlashStringHelper *str); - #ifdef __GXX_EXPERIMENTAL_CXX0X__ + #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String(String &&rval); String(StringSumHelper &&rval); #endif @@ -83,7 +87,7 @@ class String String & operator = (const String &rhs); String & operator = (const char *cstr); String & operator = (const __FlashStringHelper *str); - #ifdef __GXX_EXPERIMENTAL_CXX0X__ + #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String & operator = (String &&rval); String & operator = (StringSumHelper &&rval); #endif @@ -197,7 +201,7 @@ class String // copy and move String & copy(const char *cstr, unsigned int length); String & copy(const __FlashStringHelper *pstr, unsigned int length); - #ifdef __GXX_EXPERIMENTAL_CXX0X__ + #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) void move(String &rhs); #endif }; diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index ac605b385..84ad85c7b 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -26,7 +26,9 @@ extern "C" { #endif /* Definitions and types for pins */ -/* ADC channels 2, 3, and 10 not present in ATSAMD21ExxA */ +/* ADC channels for ATSAMD21GxxA and ATSAMD21JxxA: All but 8 and 9 */ +/* ADC channels for ATSAMD21ExxA: All but 2, 3, 8, 9, and 10 */ +/* ADC channels for ATSAMD11D14AM: 0 through 9 */ typedef enum _EAnalogChannel { No_ADC_Channel=-1, @@ -38,6 +40,8 @@ typedef enum _EAnalogChannel ADC_Channel5=5, ADC_Channel6=6, ADC_Channel7=7, + ADC_Channel8=8, + ADC_Channel9=9, ADC_Channel10=10, ADC_Channel16=16, ADC_Channel17=17, @@ -66,6 +70,12 @@ typedef enum _ETCChannel 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(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + TC1_CH0 = (1<<8)|(0), + TC1_CH1 = (1<<8)|(1), + TC2_CH0 = (2<<8)|(0), + TC2_CH1 = (2<<8)|(1), +#endif TC3_CH0 = (3<<8)|(0), TC3_CH1 = (3<<8)|(1), TC4_CH0 = (4<<8)|(0), @@ -77,7 +87,7 @@ typedef enum _ETCChannel TC6_CH1 = (6<<8)|(1), TC7_CH0 = (7<<8)|(0), TC7_CH1 = (7<<8)|(1) -#endif // __SAMD21J18A__ +#endif } ETCChannel ; extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; @@ -86,6 +96,7 @@ extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; #define GetTCChannelNumber( x ) ( (x) & 0xff ) #define GetTC( x ) ( g_apTCInstances[(x) >> 8] ) +/* Only PORTA on D21E and D11 */ typedef enum _EPortType { NOT_A_PORT=-1, @@ -94,6 +105,7 @@ typedef enum _EPortType PORTC=2, } EPortType ; +/* The D11 has only INT 0 though 7 (the SAMD11C14A lacks INT 0 as well */ typedef enum _EExt_Interrupts { EXTERNAL_INT_0 = 0, @@ -104,6 +116,7 @@ typedef enum _EExt_Interrupts EXTERNAL_INT_5, EXTERNAL_INT_6, EXTERNAL_INT_7, +#if !defined(__SAMD11D14AM__) && !defined(__SAMD11C14A__) && !defined(__SAMD11D14AS__) EXTERNAL_INT_8, EXTERNAL_INT_9, EXTERNAL_INT_10, @@ -112,6 +125,7 @@ typedef enum _EExt_Interrupts EXTERNAL_INT_13, EXTERNAL_INT_14, EXTERNAL_INT_15, +#endif EXTERNAL_INT_NMI, EXTERNAL_NUM_INTERRUPTS, NOT_AN_INTERRUPT = -1, @@ -208,6 +222,13 @@ typedef enum _EPioPeripheral #define PER_ATTR_DRIVE_STRONG (1UL<<2) #define PER_ATTR_DRIVE_MASK (1UL<<2) +#define PER_ATTR_OUTPUT_TYPE_STD (0UL<<3) +#define PER_ATTR_OUTPUT_TYPE_OPEN_DRAIN (1UL<<3) +#define PER_ATTR_OUTPUT_TYPE_OPEN_SOURCE (2UL<<3) +#define PER_ATTR_OUTPUT_TYPE_BUSKEEPER (3UL<<3) +#define PER_ATTR_OUTPUT_TYPE_MASK (3UL<<3) + + /* Types used for the table below * This struct MUST be 12 bytes long (elements are ordered to prevent unaligned access). */ @@ -240,6 +261,23 @@ extern const PinDescription g_APinDescription[] ; #define GCM_EVSYS_CHANNEL_3 (0x0AU) #define GCM_EVSYS_CHANNEL_4 (0x0BU) #define GCM_EVSYS_CHANNEL_5 (0x0CU) + +#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + +#define GCM_SERCOMx_SLOW (0x0DU) +#define GCM_SERCOM0_CORE (0x0EU) +#define GCM_SERCOM1_CORE (0x0FU) +#define GCM_SERCOM2_CORE (0x10U) +#define GCM_TCC0 (0x11U) +#define GCM_TC1_TC2 (0x12U) +#define GCM_ADC (0x13U) +#define GCM_AC_DIG (0x14U) +#define GCM_AC_ANA (0x15U) +#define GCM_DAC (0x16U) +#define GCM_PTC (0x17U) + +#else + #define GCM_EVSYS_CHANNEL_6 (0x0DU) #define GCM_EVSYS_CHANNEL_7 (0x0EU) #define GCM_EVSYS_CHANNEL_8 (0x0FU) @@ -265,6 +303,8 @@ extern const PinDescription g_APinDescription[] ; #define GCM_I2S_0 (0x23U) #define GCM_I2S_1 (0x24U) +#endif + #ifdef __cplusplus } // extern "C" #endif diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c index fed128c44..f602a2041 100644 --- a/cores/arduino/cortex_handlers.c +++ b/cores/arduino/cortex_handlers.c @@ -61,6 +61,8 @@ void SERCOM5_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC3_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC4_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC5_Handler (void) __attribute__ ((weak)); // Used in Tone.cpp @@ -115,22 +117,37 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ +#if defined(__SAMD21E15A__) || defined(__SAMD21E16A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || \ + defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ + defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) (void*) SERCOM3_Handler, /* 12 Serial Communication Interface 3 */ (void*) SERCOM4_Handler, /* 13 Serial Communication Interface 4 */ (void*) SERCOM5_Handler, /* 14 Serial Communication Interface 5 */ - (void*) TCC0_Handler, /* 15 Timer Counter Control 0 */ +#endif + (void*) TCC0_Handler, /* 15 / 12 Timer Counter Control 0 */ +#if defined(__SAMD21E15A__) || defined(__SAMD21E16A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || \ + defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ + defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) (void*) TCC1_Handler, /* 16 Timer Counter Control 1 */ (void*) TCC2_Handler, /* 17 Timer Counter Control 2 */ - (void*) TC3_Handler, /* 18 Basic Timer Counter 0 */ - (void*) TC4_Handler, /* 19 Basic Timer Counter 1 */ - (void*) TC5_Handler, /* 20 Basic Timer Counter 2 */ - (void*) TC6_Handler, /* 21 Basic Timer Counter 3 */ - (void*) TC7_Handler, /* 22 Basic Timer Counter 4 */ - (void*) ADC_Handler, /* 23 Analog Digital Converter */ - (void*) AC_Handler, /* 24 Analog Comparators */ - (void*) DAC_Handler, /* 25 Digital Analog Converter */ - (void*) PTC_Handler, /* 26 Peripheral Touch Controller */ + (void*) TC3_Handler, /* 18 Basic Timer Counter 3 */ + (void*) TC4_Handler, /* 19 Basic Timer Counter 4 */ + (void*) TC5_Handler, /* 20 Basic Timer Counter 5 */ + (void*) TC6_Handler, /* 21 Basic Timer Counter 6 */ + (void*) TC7_Handler, /* 22 Basic Timer Counter 7 */ +#else + (void*) TC1_Handler, /* 13 Basic Timer Counter 1 */ + (void*) TC2_Handler, /* 14 Basic Timer Counter 2 */ +#endif + (void*) ADC_Handler, /* 23 / 15 Analog Digital Converter */ + (void*) AC_Handler, /* 24 / 16 Analog Comparators */ + (void*) DAC_Handler, /* 25 / 17 Digital Analog Converter */ + (void*) PTC_Handler, /* 26 / 18 Peripheral Touch Controller */ +#if defined(__SAMD21E15A__) || defined(__SAMD21E16A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || \ + defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ + defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) (void*) I2S_Handler /* 27 Inter-IC Sound Interface */ +#endif }; extern int main(void); diff --git a/cores/arduino/delay.c b/cores/arduino/delay.c index e43131f21..ea000abb0 100644 --- a/cores/arduino/delay.c +++ b/cores/arduino/delay.c @@ -73,7 +73,7 @@ void delay( uint32_t ms ) do { yield() ; - } while ( _ulTickCount - start <= ms ) ; + } while ( _ulTickCount - start < ms ) ; } #include "Reset.h" // for tickReset() diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 8af01b573..c50254845 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -35,8 +35,10 @@ int main( void ) delay(1); #if defined(USBCON) + #if !defined(ARDUINO_USB_UART_DISABLED) && !defined(ARDUINO_UART_ONLY) USBDevice.init(); USBDevice.attach(); + #endif #endif setup(); @@ -44,6 +46,7 @@ int main( void ) for (;;) { loop(); + if (serialEventRun) serialEventRun(); } diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index 9a43b4a8e..243aa9626 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -41,6 +41,22 @@ // Constants for Clock multiplexers #define GENERIC_CLOCK_MULTIPLEXER_DFLL48M (0u) +void waitForSync( void ) +{ + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) + { + /* Wait for synchronization */ + } +} + +void waitForDFLL( void ) +{ + while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ) + { + /* Wait for synchronization */ + } +} + void SystemInit( void ) { /* Set 1 Flash Wait State for 48MHz, cf tables 20.9 and 35.27 in SAMD21 Datasheet */ @@ -77,10 +93,7 @@ void SystemInit( void ) */ GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_XOSC32K ) ; // Generic Clock Generator 1 - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } + waitForSync(); /* Write Generic Clock Generator 1 configuration */ GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_XOSC32K ) | // Generic Clock Generator 1 @@ -88,10 +101,7 @@ void SystemInit( void ) // GCLK_GENCTRL_OE | // Output clock to a pin for tests GCLK_GENCTRL_GENEN ; - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } + waitForSync(); /* ---------------------------------------------------------------------------------------------- * 3) Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 0 (DFLL48M reference) @@ -100,10 +110,7 @@ void SystemInit( void ) GCLK_CLKCTRL_GEN_GCLK1 | // Generic Clock Generator 1 is source GCLK_CLKCTRL_CLKEN ; - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } + waitForSync(); /* ---------------------------------------------------------------------------------------------- * 4) Enable DFLL48M clock @@ -114,29 +121,20 @@ void SystemInit( void ) /* Remove the OnDemand mode, Bug http://avr32.icgroup.norway.atmel.com/bugzilla/show_bug.cgi?id=9905 */ SYSCTRL->DFLLCTRL.bit.ONDEMAND = 0 ; - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ) - { - /* Wait for synchronization */ - } + waitForDFLL(); SYSCTRL->DFLLMUL.reg = SYSCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value SYSCTRL_DFLLMUL_FSTEP( 511 ) | // Fine step is 511, half of the max value SYSCTRL_DFLLMUL_MUL( (VARIANT_MCK/VARIANT_MAINOSC) ) ; // External 32KHz is the reference - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ) - { - /* Wait for synchronization */ - } + waitForDFLL(); /* Write full configuration to DFLL control register */ SYSCTRL->DFLLCTRL.reg |= SYSCTRL_DFLLCTRL_MODE | /* Enable the closed loop mode */ SYSCTRL_DFLLCTRL_WAITLOCK | SYSCTRL_DFLLCTRL_QLDIS ; /* Disable Quick lock */ - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ) - { - /* Wait for synchronization */ - } + waitForDFLL(); /* Enable the DFLL */ SYSCTRL->DFLLCTRL.reg |= SYSCTRL_DFLLCTRL_ENABLE ; @@ -147,20 +145,14 @@ void SystemInit( void ) /* Wait for locks flags */ } - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ) - { - /* Wait for synchronization */ - } + waitForDFLL(); /* ---------------------------------------------------------------------------------------------- * 5) Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz. */ GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) ; // Generic Clock Generator 0 - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } + waitForSync(); /* Write Generic Clock Generator 0 configuration */ GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | // Generic Clock Generator 0 @@ -169,10 +161,7 @@ void SystemInit( void ) GCLK_GENCTRL_IDC | // Set 50/50 duty cycle GCLK_GENCTRL_GENEN ; - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } + waitForSync(); /* ---------------------------------------------------------------------------------------------- * 6) Modify PRESCaler value of OSC8M to have 8MHz @@ -191,10 +180,7 @@ void SystemInit( void ) // GCLK_GENCTRL_OE | // Output clock to a pin for tests GCLK_GENCTRL_GENEN ; - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } + waitForSync(); /* * Now that all system clocks are configured, we can set CPU and APBx BUS clocks. diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index 145512081..e8361f7fb 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -76,6 +76,10 @@ void init( void ) #if defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ; +#elif defined(__SAMD11D14AM__) || defined(__SAMD11D14AS__) + PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 ; +#elif defined(__SAMD11C14A__) + PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 ; #else PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 ; #endif @@ -83,6 +87,8 @@ void init( void ) // Clock TC/TCC for Pulse and Analog #if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 | PM_APBCMASK_TC6 | PM_APBCMASK_TC7 ; +#elif defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TC1 | PM_APBCMASK_TC2 ; #else PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ; #endif diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 0eeb49c1a..d26ff08c1 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -104,39 +104,41 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to */ void analogReference( eAnalogReference ulMode ) { + uint32_t gain = ADC_INPUTCTRL_GAIN_1X_Val; // Default Gain Factor Selection + uint32_t refsel; + syncADC(); switch ( ulMode ) { case AR_INTERNAL: case AR_INTERNAL2V23: - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection - ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/1.48 VDDANA = 1/1.48* 3V3 = 2.2297 + refsel = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/1.48 VDDANA = 1/1.48* 3V3 = 2.2297 break; case AR_EXTERNAL: if ( pinPeripheral(REFA_PIN, PIO_ANALOG_REF) == RET_STATUS_OK ) { - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection - ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val; + refsel = ADC_REFCTRL_REFSEL_AREFA_Val; } break; case AR_INTERNAL1V0: - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection - ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INT1V_Val; // 1.0V voltage reference + refsel = ADC_REFCTRL_REFSEL_INT1V_Val; // 1.0V voltage reference break; case AR_INTERNAL1V65: - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection - ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V + refsel = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V break; case AR_DEFAULT: default: - ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val; // This allows values up to VDDANA (3.3V) on the pin - ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V + gain = ADC_INPUTCTRL_GAIN_DIV2_Val; // This allows values up to VDDANA (3.3V) on the pin + refsel = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V break; } + + ADC->INPUTCTRL.bit.GAIN = gain; + ADC->REFCTRL.bit.REFSEL = refsel; } uint32_t analogRead( uint32_t ulPin ) @@ -232,6 +234,18 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) // Enable clocks according to TCCx instance to use switch ( GetTCNumber( g_APinDescription[ulPin].ulTCChannel ) ) { +#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + case 0: // TCC0 + // Enable GCLK for TCC0 and TCC1 (timer counter input clock) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0 )) ; + break ; + + case 1: // TC1 + case 2: // TC2 + // Enable GCLK for TCC2 and TC3 (timer counter input clock) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC1_TC2 )) ; + break ; +#else case 0: // TCC0 case 1: // TCC1 // Enable GCLK for TCC0 and TCC1 (timer counter input clock) @@ -249,7 +263,7 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) // Enable GCLK for TC4 and TC5 (timer counter input clock) GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC4_TC5 )); break ; - +#endif #if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) case 6: // TC6 (not available on Zero) case 7: // TC7 (not available on Zero) diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 52b9f442d..80d12b00d 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -36,25 +36,31 @@ void digitalWrite( uint32_t ulPin, uint32_t ulVal ) return ; } - // Enable pull resistor if pin attributes allow uint32_t pinAttribute = g_APinDescription[ulPin].ulPinAttribute; + uint8_t pinPort = g_APinDescription[ulPin].ulPort; + uint8_t pinNum = g_APinDescription[ulPin].ulPin; + uint8_t pullConfig = PORT->Group[pinPort].PINCFG[pinNum].reg; + + // Enable pull resistor if pin attributes allow if ( (ulVal == HIGH && (pinAttribute & PIN_ATTR_INPUT_PULLUP)) || (ulVal == LOW && (pinAttribute & PIN_ATTR_INPUT_PULLDOWN)) ) { - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= (uint8_t)(PORT_PINCFG_PULLEN) ; + pullConfig |= (uint8_t)(PORT_PINCFG_PULLEN) ; } else { - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg &= ~(uint8_t)(PORT_PINCFG_PULLEN) ; + pullConfig &= ~(uint8_t)(PORT_PINCFG_PULLEN) ; } + PORT->Group[pinPort].PINCFG[pinNum].reg = pullConfig ; + switch ( ulVal ) { case LOW: - PORT->Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (1ul << g_APinDescription[ulPin].ulPin) ; + PORT->Group[pinPort].OUTCLR.reg = (1ul << pinNum) ; break ; case HIGH: - PORT->Group[g_APinDescription[ulPin].ulPort].OUTSET.reg = (1ul << g_APinDescription[ulPin].ulPin) ; + PORT->Group[pinPort].OUTSET.reg = (1ul << pinNum) ; break ; default: diff --git a/cores/arduino/wiring_private.c b/cores/arduino/wiring_private.c index 3b7b2c8cd..9cae69ce8 100644 --- a/cores/arduino/wiring_private.c +++ b/cores/arduino/wiring_private.c @@ -21,9 +21,15 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) { + // Prevent out of bounds access + if (ulPin >= NUM_PIN_DESCRIPTION_ENTRIES) + { + return -1 ; + } + uint32_t pinAttribute = g_APinDescription[ulPin].ulPinAttribute; uint8_t peripheralAttribute = g_APinDescription[ulPin].ulPeripheralAttribute; - EPioType pinType = g_APinDescription[ulPin].ulPinType; + uint8_t pinType = g_APinDescription[ulPin].ulPinType; // Handle the case the pin isn't usable as PIO if ( pinType == PIO_NOT_A_PIN ) @@ -104,45 +110,55 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) peripheral = PER_AC_CLK; break ; + case PIO_NOT_A_PIN: + case PIO_MULTI: + return -1l ; + break ; + default: break ; } + noInterrupts(); // Avoid possible invalid interim pin state + + uint8_t pinPort = g_APinDescription[ulPin].ulPort; + uint8_t pinNum = g_APinDescription[ulPin].ulPin; + uint8_t pinCfg = PORT_PINCFG_INEN; + switch ( ulPeripheral ) { // Set pin mode according to chapter '22.6.3 I/O Pin Configuration' case PIO_INPUT: - // Set pin to input mode, disable the port mux - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[pinPort].PINCFG[pinNum].reg=(uint8_t)pinCfg ; + PORT->Group[pinPort].DIRCLR.reg = (uint32_t)(1<Group[pinPort].OUTSET.reg = (uint32_t)(1<Group[pinPort].OUTCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg &= ~(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PMUXEN) ; + pinCfg = 0; if ( (peripheralAttribute & PER_ATTR_DRIVE_MASK) == PER_ATTR_DRIVE_STRONG ) { - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= (uint8_t)(PORT_PINCFG_DRVSTR) ; + pinCfg |= PORT_PINCFG_DRVSTR; } - PORT->Group[g_APinDescription[ulPin].ulPort].DIRSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].OUTSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ; - PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (uint32_t)(1<Group[pinPort].PINCFG[pinNum].reg = (uint8_t)pinCfg ; + PORT->Group[pinPort].DIRSET.reg = (uint32_t)(1<Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg) & PORT_PMUX_PMUXE( 0xF ) ; + temp = (PORT->Group[pinPort].PMUX[pinNum >> 1].reg) & PORT_PMUX_PMUXE( 0xF ) ; // Set new muxing - PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg = temp|PORT_PMUX_PMUXO( peripheral ) ; + PORT->Group[pinPort].PMUX[pinNum >> 1].reg = temp|PORT_PMUX_PMUXO( peripheral ) ; // Enable port mux - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= PORT_PINCFG_PMUXEN ; + PORT->Group[pinPort].PINCFG[pinNum].reg |= PORT_PINCFG_PMUXEN ; } else // even pin { uint32_t temp ; - temp = (PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg) & PORT_PMUX_PMUXO( 0xF ) ; - PORT->Group[g_APinDescription[ulPin].ulPort].PMUX[g_APinDescription[ulPin].ulPin >> 1].reg = temp|PORT_PMUX_PMUXE( peripheral ) ; - PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg |= PORT_PINCFG_PMUXEN ; // Enable port mux + temp = (PORT->Group[pinPort].PMUX[pinNum >> 1].reg) & PORT_PMUX_PMUXO( 0xF ) ; + PORT->Group[pinPort].PMUX[pinNum >> 1].reg = temp|PORT_PMUX_PMUXE( peripheral ) ; + PORT->Group[pinPort].PINCFG[pinNum].reg |= PORT_PINCFG_PMUXEN ; // Enable port mux } #endif break ; - case PIO_NOT_A_PIN: - case PIO_MULTI: default: - return -1l ; break ; } + interrupts(); return 0l ; } - diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 74714a476..b419b0dad 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -200,3 +200,11 @@ void SPIClass::detachInterrupt() { #if SPI_INTERFACES_COUNT > 0 SPIClass SPI( SERCOM_INSTANCE_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI ); #endif + +#if SPI_INTERFACES_COUNT > 1 +SPIClass SPI1( SERCOM_INSTANCE_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI ); +#endif + +#if SPI_INTERFACES_COUNT > 2 +SPIClass SPI2( SERCOM_INSTANCE_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI ); +#endif diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index e9ff8e4f3..03fd02635 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -139,6 +139,14 @@ void SPIClass::transfer(void *buf, size_t count) extern SPIClass SPI; #endif +#if SPI_INTERFACES_COUNT > 1 + extern SPIClass SPI1; +#endif + +#if SPI_INTERFACES_COUNT > 2 + extern SPIClass SPI2; +#endif + // For compatibility with sketches designed for AVR @ 16 MHz // New programs should use SPI.beginTransaction to set the SPI clock #if F_CPU == 48000000 diff --git a/libraries/USBHost/library.properties b/libraries/USBHost/library.properties index 72798950e..240f951e4 100644 --- a/libraries/USBHost/library.properties +++ b/libraries/USBHost/library.properties @@ -2,7 +2,7 @@ name=USBHost version=1.0 author=Arduino maintainer=Arduino -sentence=Allows the communication with USB peripherals like mice, keyboards, and thumbdrives. For Arduino DUE only. -paragraph=The USBHost library allows an Arduino Due board to appear as a USB host, enabling it to communicate with peripherals like USB mice and keyboards. USBHost does not support devices that are connected through USB hubs. This includes some keyboards that have an internal hub. +sentence=Allows the communication with USB peripherals like mice, keyboards, and thumbdrives. For Arduino Due and Zero. +paragraph=The USBHost library allows the board to appear as a USB host, enabling it to communicate with peripherals like USB mice and keyboards. USBHost does not support devices that are connected through USB hubs. This includes some keyboards that have an internal hub. url=http://arduino.cc/en/Reference/USBHost architectures=samd diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index a0d486da0..1d6767042 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -41,15 +41,15 @@ void TwoWire::begin(void) { pinPeripheral(PIN_WIRE_SCL, PIO_SERCOM); } -void TwoWire::end(void) { - sercom->disableWIRE(); -} - void TwoWire::begin(uint8_t address) { //Slave mode sercom->initSlaveWIRE(address); sercom->enableWIRE(); } + +void TwoWire::setClock(uint32_t frequency) { + // dummy funtion +} uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) { @@ -351,3 +351,10 @@ TwoWire Wire(SERCOM_INSTANCE_WIRE); SERCOM_WIRE_HANDLER_MACRO #endif + +#if WIRE_INTERFACES_COUNT > 1 +TwoWire Wire1(SERCOM_INSTANCE_WIRE1); + +SERCOM_WIRE1_HANDLER_MACRO + +#endif diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index 9d30a2963..7d8df9d0e 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -35,7 +35,7 @@ class TwoWire : public Stream TwoWire(SERCOM *s); void begin(); void begin(uint8_t); - void end(); + void setClock(uint32_t); // dummy function void beginTransmission(uint8_t); uint8_t endTransmission(bool stopBit); @@ -104,4 +104,8 @@ class TwoWire : public Stream extern TwoWire Wire; #endif +#if WIRE_INTERFACES_COUNT > 1 +extern TwoWire Wire1; +#endif + #endif diff --git a/platform.txt b/platform.txt index 06d4dba9c..1aa1b7dcb 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=MattairTech SAMD Boards -version=1.6.5-mt1 +version=1.6.5-mt2 # Compile variables @@ -34,13 +34,13 @@ compiler.warning_flags.all=-Wall -Wextra compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ compiler.c.cmd=arm-none-eabi-gcc -compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD compiler.c.elf.cmd=arm-none-eabi-gcc compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps compiler.S.cmd=arm-none-eabi-gcc compiler.S.flags=-c -g -x assembler-with-cpp compiler.cpp.cmd=arm-none-eabi-g++ -compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD compiler.ar.cmd=arm-none-eabi-ar compiler.ar.flags=rcs compiler.objcopy.cmd=arm-none-eabi-objcopy @@ -49,6 +49,8 @@ compiler.elf2hex.flags=-O binary compiler.elf2hex.cmd=arm-none-eabi-objcopy compiler.ldflags=-mcpu={build.mcu} -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align compiler.size.cmd=arm-none-eabi-size +compiler.nm.cmd=arm-none-eabi-nm +compiler.nm.flags=-B --size-sort --demangle -t d compiler.define=-DARDUINO= # this can be overriden in boards.txt @@ -95,6 +97,12 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" ## Create output (bin file) recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" +## Display Detailed Object Size Info +recipe.objcopy.nm.pattern="{compiler.path}{compiler.nm.cmd}" {compiler.nm.flags} "{build.path}/{build.project_name}.elf" + +## Compute size and memory use info (Flash usage = .text + .data segments) +recipe.objcopy.size.pattern="{compiler.path}{compiler.size.cmd}" -B "{build.path}/{build.project_name}.elf" + ## Save hex recipe.output.tmp_file={build.project_name}.bin recipe.output.save_file={build.project_name}.{build.variant}.bin @@ -103,13 +111,13 @@ recipe.output.save_file={build.project_name}.{build.variant}.bin recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex=\.text\s+([0-9]+).* - # Uploader tools # -------------- # # BOSSA # +# tools.bossac.path={runtime.tools.bossac-1.5-arduino.path} tools.bossac.path={runtime.tools.bossac-1.5-arduino-mattairtech-1.path} tools.bossac.cmd=bossac tools.bossac.cmd.windows=bossac.exe diff --git a/variants/MT_D11/debug_scripts/SAMD11C14A.gdb b/variants/MT_D11/debug_scripts/SAMD11C14A.gdb new file mode 100644 index 000000000..ff7008e6e --- /dev/null +++ b/variants/MT_D11/debug_scripts/SAMD11C14A.gdb @@ -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 at91samd11c14a" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D11/debug_scripts/SAMD11D14AM.gdb b/variants/MT_D11/debug_scripts/SAMD11D14AM.gdb new file mode 100644 index 000000000..ebd381b55 --- /dev/null +++ b/variants/MT_D11/debug_scripts/SAMD11D14AM.gdb @@ -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 at91samd11d14am" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D11/debug_scripts/SAMD11D14AS.gdb b/variants/MT_D11/debug_scripts/SAMD11D14AS.gdb new file mode 100644 index 000000000..1daf3ccc2 --- /dev/null +++ b/variants/MT_D11/debug_scripts/SAMD11D14AS.gdb @@ -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 at91samd11d14as" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_with_4KB_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_with_4KB_bootloader.ld new file mode 100644 index 000000000..984eb4113 --- /dev/null +++ b/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_with_4KB_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld new file mode 100644 index 000000000..984eb4113 --- /dev/null +++ b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld new file mode 100644 index 000000000..984eb4113 --- /dev/null +++ b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/openocd_scripts/SAMD11C14A.cfg b/variants/MT_D11/openocd_scripts/SAMD11C14A.cfg new file mode 100644 index 000000000..2e1525a73 --- /dev/null +++ b/variants/MT_D11/openocd_scripts/SAMD11C14A.cfg @@ -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 at91samd11c14a +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D11/openocd_scripts/SAMD11D14AM.cfg b/variants/MT_D11/openocd_scripts/SAMD11D14AM.cfg new file mode 100644 index 000000000..5cbf9770f --- /dev/null +++ b/variants/MT_D11/openocd_scripts/SAMD11D14AM.cfg @@ -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 at91samd11d14am +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg b/variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg new file mode 100644 index 000000000..2b1d4c72f --- /dev/null +++ b/variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg @@ -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 at91samd11d14as +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D11/pins_arduino.h b/variants/MT_D11/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/MT_D11/pins_arduino.h @@ -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" + diff --git a/variants/MT_D11/variant.cpp b/variants/MT_D11/variant.cpp new file mode 100644 index 000000000..f69bc5810 --- /dev/null +++ b/variants/MT_D11/variant.cpp @@ -0,0 +1,279 @@ +/* + 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 + */ + +/* + * Modified 8 August 2015 by Justin Mattair + * for MattairTech MT-D11 boards (www.mattairtech.com) + */ + +/* +============================= MattairTech MT-D11 (ATsamd11D14AM) ======================== +Other INT PWM Digital Analog Digital PWM INT Other +========================================================================================= + ------------------- +DAC 2 2 (ADC0) | A2 | USB | Gnd | +REF 3 3 (ADC1) | A3 | | Vcc | +VDIV INT4 TCC0[0] 4 4 (ADC2) | A4 ----- A31 | 31 TC2[1] INT3 RX / SWDIO + INT5 TCC0[1] 5 5 (ADC3) | A5 A30 | 30 TC2[0] TX / SWDCLK + TCC0[2] 6 6 (ADC4) | A6 A27 | 27 INT7 + TCC0[3] 7 7 (ADC5) | A7 A23 | 23 I2C/SCL +SPI MOSI INT2 10 10 (ADC8) | A10 A22 | 22 INT6 I2C/SDA +SPI SCK 11 11 (ADC9) | A11 A17 | 17 TC1[1] +SPI MISO INTNMI 14 14 (ADC6) | A14 A16 | 16 TC1[0] INT0 LED +Button INT1 15 15 (ADC7) | A15 RST | Reset + ------------------- +Most pins have multiple configurations available (even analog pins). For example, pin +4 can be an analog input, a PWM output, Digital I/O, or interrupt input. These +always reference the pin number printed on the board but without the 'A' (with the +usable pins starting at 2). Tone available on TC2. +DO NOT connect voltages higher than 3.3V! +*/ + + +/* The PinDescription table describes how each of the pins can be used by the Arduino + * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, + * communications, etc.), and the PinDescription table configures which functions can + * be used for each pin. This table is mainly accessed by the pinPeripheral function in + * wiring_private.c, which is used to attach a pin to a particular peripheral function. + * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), + * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to + * verify that the pin can perform the function requested, and to configure the pin for + * that function. Most of the contents of pinMode() are now in pinPeripheral(). + * + * There are two ways that pins can be mapped. The first is to map pins contiguously + * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space + * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps + * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). + * This only works when there is one port. Because not all port pins are available, + * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. + * For an example of both types, see variant.cpp from the MT-D11 variant. + * + * Explanation of PinDescription table: + * + * Port This is the port (ie: PORTA). + * Pin This is the pin (bit) within the port. Valid values are 0-31. + * PinType This indicates what peripheral function the pin can be + * attached to. In most cases, this is PIO_MULTI, which means + * that the pin can be anything listed in the PinAttribute field. + * It can also be set to a specific peripheral. In this case, any + * attempt to configure the pin (using pinPeripheral or pinMode) + * as anything else will fail (and pinPeripheral will return -1). + * This can be used to prevent accidental re-configuration of a + * pin that is configured for only one function (ie: USB D- and + * D+ pins). If a pin is not used or does not exist, + * PIO_NOT_A_PIN must be entered in this field. See WVariant.h + * for valid entries. These entries are also used as a parameter + * to pinPeripheral() with the exception of PIO_NOT_A_PIN and + * PIO_MULTI. The pinMode function now calls pinPeripheral() with + * the desired mode. Note that this field is not used to select + * between the two peripherals possible with each of the SERCOM + * and TIMER functions. PeripheralAttribute is now used for this. + * PeripheralAttribute This is an 8-bit bitfield used for various peripheral + * configuration. It is primarily used to select between the two + * peripherals possible with each of the SERCOM and TIMER + * functions. TIMER pins are individual, while SERCOM uses a + * group of two to four pins. This group of pins can span both + * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E + * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses + * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each + * pin. This bitfield is also used to set the pin drive strength. + * In the future, other attributes (like input buffer + * configuration) may be added. See WVariant.h for valid entries. + * PinAttribute This is a 32-bit bitfield used to list all of the valid + * peripheral functions that a pin can attach to. This includes + * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are + * shorthand for a combination of other attributes. + * PIN_ATTR_DIGITAL includes all of the GPIO functions, while + * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and + * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). + * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is + * only one DAC channel, so PIN_ATTR_DAC appears only once. This + * bitfield is useful for limiting a pin to only input related + * functions or output functions. This allows a pin to have a + * more flexible configuration, while restricting the direction + * (ie: to avoid contention). See WVariant.h for valid entries. + * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some + * TC channels are available on multiple pins (ie: TCC0/WO[0] is + * available on pin A4 or pin A8 on the MT-D21E). In general, + * only one pin should be configured (in the pinDescription + * table) per TC channel. See WVariant.h for valid entries. + * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). + * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See + * WVariant.h for valid entries. + * ExtInt This is the interrupt (if any) assigned to the pin. Some + * interrupt numbers are available on multiple pins (ie: + * EIC/EXTINT[2] is available on pin A2 or pin A18 on the + * MT-D21E). In general, only one pin should be configured (in + * the pinDescription table) per interrupt number. Thus, if an + * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved + * from pin 18. See WVariant.h for valid entries. + */ + + +/* Pins descriptions for the MattairTech MT-D11 + * + * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (! means unavailable with this variant) + * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- + * | 0 | 2 | A2 | PA02 | DAC | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT + * | 1 | 3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] + * | 2 | 4 | A4 | PA04 | REFB / VM | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[2] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] + * | 3 | 5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] + * | 4 | 6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] + * | 5 | 7 | A7 | PA07 | | !EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] + * | -- | -- | -- | PA08 | Xin32 / Xin | Xin32 + * | -- | -- | -- | PA09 | Xout32 / Xout | Xout32 + * | 6 | 10 | A10 | PA10 | SPI MOSI | EIC/EXTINT[2] ADC/AIN[8] PTC/X[2] PTC/Y[8] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TC2/WO[0] !TCC0/WO[2] + * | 7 | 11 | A11 | PA11 | SPI SCK | !EIC/EXTINT[3] ADC/AIN[9] PTC/X[3] PTC/Y[9] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TC2/WO[1] !TCC0/WO[3] + * | 8 | 14 | A14 | PA14 | SPI MISO | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] + * | 9 | 15 | A15 | PA15 | Button / SPI SS | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[1] Button + * | 10 | -- | RST | PA28 | Reset | Reset + * | 11 | 16 | A16 | PA16 | LED | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] LED + * | 12 | 17 | A17 | PA17 | HOST_ENABLE | !EIC/EXTINT[1] PTC/X[5] PTC/Y[11] !SERCOM1/PAD[3] !SERCOM2/PAD[3] TC1/WO[1] !TCC0/WO[7] HOST_ENABLE + * | 13 | 22 | A22 | PA22 | I2C/SDA w/pullup | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] + * | 14 | 23 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[0] !TC1/WO[1] !TCC0/WO[5] + * | -- | -- | --- | PA24 | USB_NEGATIVE | USB/DM + * | -- | -- | --- | PA25 | USB_POSITIVE | USB/DP + * | 15 | 27 | A27 | PA27 | | EIC/EXTINT[7] PTC/X[10] + * | 16 | 30 | A30 | PA30 | TX / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK + * | 17 | 31 | A31 | PA31 | RX / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO + * | 18 | -- | Vcc | ---- | | Vcc + * | 19 | -- | Gnd | ---- | | Ground + * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- + * + * You may use Arduino pin numbers ranging from 0 to 31. The Arduino pin corresponds to the silkscreen (without the 'A'). + * For example, use pinMode(16, OUTPUT) to set the LED pin (marked as A16) as an output. + * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 8, 9, 12, 13, 18, 19, 20, 21, 24, 25, 26, 28, and 29. + * Pins 8 and 9 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). + * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). + * The tone library uses TC2. + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +#if defined PIN_MAP_STANDARD +const PinDescription g_APinDescription[]= +{ + // 0..1 pins don't exist + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + + // 2..7 - Analog capable pins (DAC available on 2) + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4 }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5 }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_NONE }, + + // 8..9 are unused (pins in use by 32.768KHz crystal, which in turn is used by the Arduino core) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + + // 10..11 - SERCOM/SPI (SPI) or Analog or Digital functions + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_2 }, // SPI MOSI + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE }, // SPI SCK + + // 12..13 pins don't exist + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + + // 14..15 - SERCOM/SPI (SPI) or Analog or Digital functions (Button available on pin 15) + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI }, // SPI MISO + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_1 }, // Button / SPI SS (unused) + + // 16..17 Digital functions (LED available on pin 16) + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // LED + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, + + // 18..21 pins don't exist + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + + // 22..23 SERCOM/I2C (Wire) or Digital functions + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCL + + // 24..26 are unused (25 and 26 in use by USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist) + { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DM + { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + + // 27..29 Digital functions (pin 28 is Reset and pin 29 does not exist) + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7 }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused (Reset) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + + // 30..31 SERCOM/UART (Serial1) or Digital functions or Debug interface (SWD CLK and SWD IO) + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // TX / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3 }, // RX / SWD IO +} ; +#elif defined PIN_MAP_COMPACT +const PinDescription g_APinDescription[]= +{ + // 0..5 - Analog capable pins (DAC available on 0) + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4 }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5 }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_NONE }, + + // 6..9 - SERCOM/SPI (SPI) or Analog or Digital functions (Button available on pin 9) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_2 }, // SPI MOSI + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE }, // SPI SCK + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI }, // SPI MISO + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_1 }, // Button / SPI SS (unused) + + // 10..11 Digital functions (LED available on pin 10) + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // LED + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, + + // 12..13 SERCOM/I2C (Wire) or Digital functions + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCL + + // 14 Digital functions + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7 }, + + // 15..16 SERCOM/UART (Serial1) or Digital functions or Debug interface (SWD CLK and SWD IO) + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // TX / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3 }, // RX / SWD IO +} ; +#endif + +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TC1, TC2 } ; + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; + +#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM1_Handler() +{ + Serial1.IrqHandler(); +} +#endif diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h new file mode 100644 index 000000000..339c48077 --- /dev/null +++ b/variants/MT_D11/variant.h @@ -0,0 +1,280 @@ +/* + 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 +*/ + +/* + * Modified 4 August 2015 by Justin Mattair + * for MattairTech MT-D11 boards (www.mattairtech.com) + */ + +#ifndef _VARIANT_MATTAIRTECH_MT_D11_ +#define _VARIANT_MATTAIRTECH_MT_D11_ + +/*---------------------------------------------------------------------------- + * Definitions + *----------------------------------------------------------------------------*/ + +/** Frequency of the board main oscillator */ +#define VARIANT_MAINOSC (32768ul) + +/** Master clock frequency */ +#define VARIANT_MCK (48000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define PIN_MAP_STANDARD +//#define PIN_MAP_COMPACT + +#if defined PIN_MAP_STANDARD + #define NUM_PIN_DESCRIPTION_ENTRIES (32u) +#elif defined PIN_MAP_COMPACT + #define NUM_PIN_DESCRIPTION_ENTRIES (17u) +#else + #error "variant.h: You must set PIN_MAP_STANDARD or PIN_MAP_COMPACT" +#endif + +#define PINS_COUNT (32u) +#define NUM_DIGITAL_PINS (32u) +#define NUM_ANALOG_INPUTS (10u) +#define NUM_ANALOG_OUTPUTS (1u) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +// Interrupts +#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) + + +/* LEDs + * None of these defines are currently used by the core. + * The MT-D11 onboard LED is on pin 16. + * The RX and TX LEDs are not present. + * You may optionally add them to any free pins. + */ +#define PIN_LED_13 (16u) +#define PIN_LED_RXL (10u) +#define PIN_LED_TXL (11u) +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + +/* Buttons + * Note that Button A is connected to Reset by default. + * A solder jumper can be changed to route Button A to pin 15 instead. + * Thre is a debouncing capacitor connected, so delay reading the pin + * at least 6ms after turning on the pullup to allow the capacitor to charge. + */ +#define BUTTON (15u) +#define BUTTON_BUILTIN BUTTON + + +/* + * Analog pins + */ +#define PIN_A2 (2ul) +#define PIN_A3 (3ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A6 (6ul) +#define PIN_A7 (7ul) +#define PIN_A10 (10ul) +#define PIN_A11 (11ul) +#define PIN_A14 (14ul) +#define PIN_A15 (15ul) + +static const uint8_t A2 = PIN_A2 ; +static const uint8_t A3 = PIN_A3 ; +static const uint8_t A4 = PIN_A4 ; +static const uint8_t A5 = PIN_A5 ; +static const uint8_t A6 = PIN_A6 ; +static const uint8_t A7 = PIN_A7 ; +static const uint8_t A10 = PIN_A10 ; +static const uint8_t A11 = PIN_A11 ; +static const uint8_t A14 = PIN_A14 ; +static const uint8_t A15 = PIN_A15 ; + +#define ADC_RESOLUTION 12 + +#define REMAP_ANALOG_PIN_ID while(0) +// #define REMAP_ANALOG_PIN_ID if ( ulPin < A0 ) ulPin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#define REFA_PIN (3ul) +#define REFB_PIN (4ul) + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#define PIN_ATN (15ul) +static const uint8_t ATN = PIN_ATN; + + +/* + * Serial interfaces + */ +// Serial1 +#define PIN_SERIAL1_RX (31ul) +#define PIN_SERIAL1_TX (30ul) +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL1 &sercom1 + + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI1_MISO (14u) +#define PIN_SPI1_MOSI (10u) +#define PIN_SPI1_SCK (11u) +#define PIN_SPI1_SS (15u) +#define PIN_SPI_MISO PIN_SPI1_MISO +#define PIN_SPI_MOSI PIN_SPI1_MOSI +#define PIN_SPI_SCK PIN_SPI1_SCK +#define PIN_SPI_SS PIN_SPI1_SS + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + +#define SERCOM_INSTANCE_SPI &sercom0 + + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE1_SDA (22u) +#define PIN_WIRE1_SCL (23u) +#define PIN_WIRE_SDA PIN_WIRE1_SDA +#define PIN_WIRE_SCL PIN_WIRE1_SCL + +#define SERCOM_INSTANCE_WIRE &sercom2 + +#define SERCOM_WIRE_HANDLER_MACRO \ +void SERCOM2_Handler(void) { \ + Wire.onService(); \ +} + + +/* + * USB + */ +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +#define PIN_USB_HOST_ENABLE (17ul) +#define PIN_USB_HOST_ENABLE_VALUE HIGH + +#ifdef __cplusplus +} +#endif + + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; + +extern Uart Serial1; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#define SERIAL_PORT_MONITOR Serial1 +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. +#define Serial SerialUSB + +#endif /* _VARIANT_ARDUINO_ZERO_ */ + diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld index 717073abe..497c7d1ac 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld index 61ad501ed..234181a93 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld index 3a172e3ae..fc8be6591 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld @@ -143,6 +143,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld index 710c8664c..3bded2906 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld index 4475f9511..fa207ff27 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld index 0162f0774..ca391b2b1 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld @@ -143,6 +143,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld index d4fa67a05..9f4943b59 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld index 475b359e4..418992b15 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld index 4155e0791..8c0eea088 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld @@ -143,6 +143,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld index 6a6cc4ab0..c578a262e 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld index a692b2ce1..e0313532a 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld index 5ed72842d..6b0d2a661 100644 --- a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld +++ b/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld @@ -143,6 +143,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index 605e9f62d..fa835c7c5 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -17,7 +17,7 @@ */ /* - Modified 20 July 2015 by Justin Mattair + Modified 8 August 2015 by Justin Mattair for MattairTech MT-D21E boards (www.mattairtech.com) */ @@ -64,6 +64,14 @@ usable pins starting at 2). DO NOT connect voltages higher than 3.3V! * verify that the pin can perform the function requested, and to configure the pin for * that function. Most of the contents of pinMode() are now in pinPeripheral(). * + * There are two ways that pins can be mapped. The first is to map pins contiguously + * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space + * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps + * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). + * This only works when there is one port. Because not all port pins are available, + * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. + * For an example of both types, see variant.cpp from the MT-D11 variant. + * * Explanation of PinDescription table: * * Port This is the port (ie: PORTA). @@ -89,8 +97,8 @@ usable pins starting at 2). DO NOT connect voltages higher than 3.3V! * peripherals possible with each of the SERCOM and TIMER * functions. TIMER pins are individual, while SERCOM uses a * group of two to four pins. This group of pins can span both - * peripherals. For example, pin 19 (SPI1 SCK) uses - * PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses + * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E + * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each * pin. This bitfield is also used to set the pin drive strength. * In the future, other attributes (like input buffer @@ -110,45 +118,45 @@ usable pins starting at 2). DO NOT connect voltages higher than 3.3V! * (ie: to avoid contention). See WVariant.h for valid entries. * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some * TC channels are available on multiple pins (ie: TCC0/WO[0] is - * available on pin A4 or pin A8). In general, only one pin - * should be configured (in the pinDescription table) per TC - * channel. See WVariant.h for valid entries. The tone library - * uses TC5. + * available on pin A4 or pin A8 on the MT-D21E). In general, + * only one pin should be configured (in the pinDescription + * table) per TC channel. See WVariant.h for valid entries. + * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See * WVariant.h for valid entries. * ExtInt This is the interrupt (if any) assigned to the pin. Some * interrupt numbers are available on multiple pins (ie: - * EIC/EXTINT[2] is available on pin A2 or pin A18). In general, - * only one pin should be configured (in the pinDescription - * table) per interrupt number. Thus, if an interrupt was needed - * on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See - * WVariant.h for valid entries. + * EIC/EXTINT[2] is available on pin A2 or pin A18 on the + * MT-D21E). In general, only one pin should be configured (in + * the pinDescription table) per interrupt number. Thus, if an + * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved + * from pin 18. See WVariant.h for valid entries. */ /* Pins descriptions for the MattairTech MT-D21E * - * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (* is for default peripheral in use, ! means unavailable with this variant) + * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (! means unavailable with this variant) * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- - * | 0 | -- | A0 | PA00 | Xin32 | *Xin32 - * | 1 | -- | A1 | PA01 | Xout32 | *Xout32 - * | 2 | 2 | A2 | PA02 | | !EIC/EXTINT[2] *ADC/AIN[0] PTC/Y[0] DAC/VOUT - * | 3 | 3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA *ADC/AIN[1] PTC/Y[1] - * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFB *ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[0] !TCC0/WO[0] - * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] - * | 6 | 6 | A6 | PA06 | | !EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] - * | 7 | 7 | A7 | PA07 | Voltage Divider | !EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] - * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] *TCC0/WO[0] !TCC1/WO[2] - * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] *TCC0/WO[1] !TCC1/WO[3] - * | 10 | 10 | A10 | PA10 | TX | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] - * | 11 | 11 | A11 | PA11 | RX | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] - * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] *TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE - * | 13 | 15 | A15 | PA15 | Xout | !EIC/EXTINT[15] SERCOM2/PAD[3] *TC3/WO[1] !TCC0/WO[5] Xout + * | 0 | -- | A0 | PA00 | Xin32 | Xin32 + * | 1 | -- | A1 | PA01 | Xout32 | Xout32 + * | 2 | 2 | A2 | PA02 | | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT + * | 3 | 3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] + * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[0] !TCC0/WO[0] + * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] + * | 6 | 6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] + * | 7 | 7 | A7 | PA07 | Voltage Divider | !EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] + * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] + * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] + * | 10 | 10 | A10 | PA10 | TX | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] + * | 11 | 11 | A11 | PA11 | RX | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] + * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE + * | 13 | 15 | A15 | PA15 | Xout | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout * | 14 | -- | NC | ---- | | Not Connected * | 15 | -- | NC | ---- | | Not Connected * | 16 | -- | Vbus | ---- | | USB Vbus - * | 17 | -- | A24- | PA24 | USB_NEGATIVE | *USB/DM - * | 18 | -- | A25+ | PA25 | USB_POSITIVE | *USB/DP + * | 17 | -- | A24- | PA24 | USB_NEGATIVE | USB/DM + * | 18 | -- | A25+ | PA25 | USB_POSITIVE | USB/DP * | 19 | -- | Gnd | ---- | | Ground * | 20 | -- | Gnd | ---- | | Ground * | 21 | -- | Vin | ---- | | Vin @@ -156,17 +164,17 @@ usable pins starting at 2). DO NOT connect voltages higher than 3.3V! * | 23 | -- | 3.3V | ---- | | 3.3V * | 24 | -- | NC | ---- | | Not Connected * | 25 | -- | NC | ---- | | Not Connected - * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] - * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] - * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] *SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] - * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] *SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] - * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] - * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] - * | 32 | 27 | A27 | PA27 | Button A | EIC/EXTINT[15] *Button A - * | 33 | 28 | A28 | PA28 | LED | EIC/EXTINT[8] *LED + * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] + * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] + * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] + * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] + * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] + * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] + * | 32 | 27 | A27 | PA27 | Button A | EIC/EXTINT[15] Button A + * | 33 | 28 | A28 | PA28 | LED | EIC/EXTINT[8] LED * | 34 | -- | NC | ---- | | Not Connected - * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] *TCC1/WO[0] SWD CLK - * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] *TCC1/WO[1] Button B SWD IO + * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] TCC1/WO[0] SWD CLK + * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO * | 37 | -- | NC | ---- | | Not Connected * | 38 | -- | NC | ---- | | Not Connected * | 39 | -- | RST | ---- | | Reset @@ -177,7 +185,6 @@ usable pins starting at 2). DO NOT connect voltages higher than 3.3V! * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 12, 13, 20, 21, 24, 25, 26, and 29. * Pins 0 and 1 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). - * When using pins 22 and/or 23 as pwm outputs, it will use Timer TC4, which conflicts with the servo library. * The tone library uses TC5. */ @@ -193,7 +200,7 @@ const PinDescription g_APinDescription[]= { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - // 2..9 - Analog capable pins (DAC avalable on 2) + // 2..9 - Analog capable pins (DAC available on 2) { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // ADC/AIN[1] { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4 }, // ADC/AIN[4] @@ -204,8 +211,8 @@ const PinDescription g_APinDescription[]= { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9 }, // TCC0/WO[1] // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2] (PIN_ATTR_TIMER_ALT) - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3] (PIN_ATTR_TIMER_ALT) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3] // 12..13 pins don't exist { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused @@ -215,11 +222,11 @@ const PinDescription g_APinDescription[]= { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14 }, // TC3/WO[0], HOST_ENABLE { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // TC3/WO[1], ATN - // 16..17 I2C pins (SDA/SCL) or Digital functions + // 16..17 SERCOM/I2C (Wire) or Digital functions { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // SDA: SERCOM1/PAD[0] { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // SCL: SERCOM1/PAD[1] - // 18..23 - SPI Pins or Digital functions (pins 20..21 do not exist) + // 18..23 - SERCOM/SPI (SPI) or Digital functions (pins 20..21 do not exist) { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2 }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3 }, // SPI SCK: SERCOM3/PAD[3] (PIN_ATTR_SERCOM_ALT) { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused @@ -250,6 +257,7 @@ SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; SERCOM sercom3( SERCOM3 ) ; +#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; @@ -262,4 +270,5 @@ void SERCOM2_Handler() { Serial2.IrqHandler(); } +#endif diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index 2b2daa86a..f81124c20 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -55,6 +55,8 @@ extern "C" *----------------------------------------------------------------------------*/ // Number of pins defined in PinDescription array +#define NUM_PIN_DESCRIPTION_ENTRIES (32u) + #define PINS_COUNT (32u) #define NUM_DIGITAL_PINS (32u) #define NUM_ANALOG_INPUTS (10u) @@ -205,7 +207,7 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define SERCOM_INSTANCE_WIRE &sercom1 #define SERCOM_WIRE_HANDLER_MACRO \ -void SERCOM3_Handler(void) { \ +void SERCOM1_Handler(void) { \ Wire.onService(); \ } diff --git a/variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld index 4475f9511..fa207ff27 100644 --- a/variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld +++ b/variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld @@ -142,6 +142,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld index 0162f0774..ca391b2b1 100644 --- a/variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld +++ b/variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld @@ -143,6 +143,7 @@ SECTIONS { __data_start__ = .; *(vtable) + *(.ramfunc*) *(.data*) . = ALIGN(4); diff --git a/variants/arduino_zero/variant.cpp b/variants/arduino_zero/variant.cpp index 84df4033e..4377a2fbb 100644 --- a/variants/arduino_zero/variant.cpp +++ b/variants/arduino_zero/variant.cpp @@ -15,50 +15,130 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* The PinDescription table describes how each of the pins can be used by the Arduino + * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, + * communications, etc.), and the PinDescription table configures which functions can + * be used for each pin. This table is mainly accessed by the pinPeripheral function in + * wiring_private.c, which is used to attach a pin to a particular peripheral function. + * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), + * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to + * verify that the pin can perform the function requested, and to configure the pin for + * that function. Most of the contents of pinMode() are now in pinPeripheral(). + * + * There are two ways that pins can be mapped. The first is to map pins contiguously + * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space + * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps + * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). + * This only works when there is one port. Because not all port pins are available, + * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. + * For an example of both types, see variant.cpp from the MT-D11 variant. + * + * Explanation of PinDescription table: + * + * Port This is the port (ie: PORTA). + * Pin This is the pin (bit) within the port. Valid values are 0-31. + * PinType This indicates what peripheral function the pin can be + * attached to. In most cases, this is PIO_MULTI, which means + * that the pin can be anything listed in the PinAttribute field. + * It can also be set to a specific peripheral. In this case, any + * attempt to configure the pin (using pinPeripheral or pinMode) + * as anything else will fail (and pinPeripheral will return -1). + * This can be used to prevent accidental re-configuration of a + * pin that is configured for only one function (ie: USB D- and + * D+ pins). If a pin is not used or does not exist, + * PIO_NOT_A_PIN must be entered in this field. See WVariant.h + * for valid entries. These entries are also used as a parameter + * to pinPeripheral() with the exception of PIO_NOT_A_PIN and + * PIO_MULTI. The pinMode function now calls pinPeripheral() with + * the desired mode. Note that this field is not used to select + * between the two peripherals possible with each of the SERCOM + * and TIMER functions. PeripheralAttribute is now used for this. + * PeripheralAttribute This is an 8-bit bitfield used for various peripheral + * configuration. It is primarily used to select between the two + * peripherals possible with each of the SERCOM and TIMER + * functions. TIMER pins are individual, while SERCOM uses a + * group of two to four pins. This group of pins can span both + * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E + * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses + * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each + * pin. This bitfield is also used to set the pin drive strength. + * In the future, other attributes (like input buffer + * configuration) may be added. See WVariant.h for valid entries. + * PinAttribute This is a 32-bit bitfield used to list all of the valid + * peripheral functions that a pin can attach to. This includes + * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are + * shorthand for a combination of other attributes. + * PIN_ATTR_DIGITAL includes all of the GPIO functions, while + * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and + * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). + * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is + * only one DAC channel, so PIN_ATTR_DAC appears only once. This + * bitfield is useful for limiting a pin to only input related + * functions or output functions. This allows a pin to have a + * more flexible configuration, while restricting the direction + * (ie: to avoid contention). See WVariant.h for valid entries. + * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some + * TC channels are available on multiple pins (ie: TCC0/WO[0] is + * available on pin A4 or pin A8 on the MT-D21E). In general, + * only one pin should be configured (in the pinDescription + * table) per TC channel. See WVariant.h for valid entries. + * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). + * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See + * WVariant.h for valid entries. + * ExtInt This is the interrupt (if any) assigned to the pin. Some + * interrupt numbers are available on multiple pins (ie: + * EIC/EXTINT[2] is available on pin A2 or pin A18 on the + * MT-D21E). In general, only one pin should be configured (in + * the pinDescription table) per interrupt number. Thus, if an + * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved + * from pin 18. See WVariant.h for valid entries. + */ + /* * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * + Pin number + ZERO Board pin | PIN | Label/Name | Comments (* is for default peripheral in use) + * + Pin number + ZERO Board pin | PIN | Label/Name | Comments (* is for available peripherals with this configuration) * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | | Digital Low | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 0 | 0 -> RX | PA11 | | EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] SERCOM2/PAD[3] TCC0/WO[3] TCC1/WO[1] - * | 1 | 1 <- TX | PA10 | | EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] TCC0/WO[2] TCC1/WO[0] - * | 2 | 2 | PA14 | | EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] TC3/WO[0] TCC0/WO[4] - * | 3 | ~3 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] SERCOM0/PAD[1] SERCOM2/PAD[1] *TCC0/WO[1] TCC1/WO[3] - * | 4 | ~4 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] SERCOM0/PAD[0] SERCOM2/PAD[0] *TCC0/WO[0] TCC1/WO[2] - * | 5 | ~5 | PA15 | | EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] *TC3/WO[1] TCC0/WO[5] - * | 6 | ~6 | PA20 | | EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TCC0/WO[6] - * | 7 | 7 | PA21 | | EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] TCC0/WO[7] + * | 0 | 0 -> RX | PA11 | | *EIC/EXTINT[11] *ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] SERCOM2/PAD[3] TCC0/WO[3] TCC1/WO[1] + * | 1 | 1 <- TX | PA10 | | *EIC/EXTINT[10] *ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] TCC0/WO[2] TCC1/WO[0] + * | 2 | 2 | PA14 | | *EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] TC3/WO[0] TCC0/WO[4] + * | 3 | ~3 | PA09 | | *EIC/EXTINT[9] *ADC/AIN[17] PTC/X[1] SERCOM0/PAD[1] *SERCOM2/PAD[1] *TCC0/WO[1] TCC1/WO[3] + * | 4 | ~4 | PA08 | | *EIC/NMI *ADC/AIN[16] PTC/X[0] SERCOM0/PAD[0] *SERCOM2/PAD[0] *TCC0/WO[0] TCC1/WO[2] + * | 5 | ~5 | PA15 | | *EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] *TC3/WO[1] TCC0/WO[5] + * | 6 | ~6 | PA20 | | *EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TCC0/WO[6] + * | 7 | 7 | PA21 | | *EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] TCC0/WO[7] * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | | Digital High | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 8 | ~8 | PA06 | | EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[2] *TCC1/WO[0] - * | 9 | ~9 | PA07 | | EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[3] *TCC1/WO[1] - * | 10 | ~10 | PA18 | | EIC/EXTINT[2] PTC/X[6] +SERCOM1/PAD[2] SERCOM3/PAD[2] *TC3/WO[0] TCC0/WO[2] - * | 11 | ~11 | PA16 | | EIC/EXTINT[0] PTC/X[4] +SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6] - * | 12 | ~12 | PA19 | | EIC/EXTINT[3] PTC/X[7] +SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] *TCC0/WO[3] - * | 13 | ~13 | PA17 | LED | EIC/EXTINT[1] PTC/X[5] +SERCOM1/PAD[1] SERCOM3/PAD[1] *TCC2/WO[1] TCC0/WO[7] + * | 8 | ~8 | PA06 | | EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[2] *TCC1/WO[0] + * | 9 | ~9 | PA07 | | EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[3] *TCC1/WO[1] + * | 10 | ~10 | PA18 | | *EIC/EXTINT[2] PTC/X[6] *SERCOM1/PAD[2] SERCOM3/PAD[2] *TC3/WO[0] TCC0/WO[2] + * | 11 | ~11 | PA16 | | *EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6] + * | 12 | ~12 | PA19 | | *EIC/EXTINT[3] PTC/X[7] *SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] *TCC0/WO[3] + * | 13 | ~13 | PA17 | LED | *EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] SERCOM3/PAD[1] *TCC2/WO[1] TCC0/WO[7] * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | | Analog Connector | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 14 | A0 | PA02 | A0 | EIC/EXTINT[2] *ADC/AIN[0] DAC/VOUT PTC/Y[0] - * | 15 | A1 | PB08 | A1 | EIC/EXTINT[8] *ADC/AIN[2] PTC/Y[14] SERCOM4/PAD[0] TC4/WO[0] - * | 16 | A2 | PB09 | A2 | EIC/EXTINT[9] *ADC/AIN[3] PTC/Y[15] SERCOM4/PAD[1] TC4/WO[1] - * | 17 | A3 | PA04 | A3 | EIC/EXTINT[4] *ADC/AIN[4] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[0] TCC0/WO[0] - * | 18 | A4 | PA05 | A4 | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[5] SERCOM0/PAD[1] TCC0/WO[1] - * | 19 | A5 | PB02 | A5 | EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0] + * | 14 | A0 | PA02 | A0 | EIC/EXTINT[2] *ADC/AIN[0] *DAC/VOUT PTC/Y[0] + * | 15 | A1 | PB08 | A1 | *EIC/EXTINT[8] *ADC/AIN[2] PTC/Y[14] SERCOM4/PAD[0] TC4/WO[0] + * | 16 | A2 | PB09 | A2 | EIC/EXTINT[9] *ADC/AIN[3] PTC/Y[15] SERCOM4/PAD[1] TC4/WO[1] + * | 17 | A3 | PA04 | A3 | EIC/EXTINT[4] *ADC/AIN[4] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[0] TCC0/WO[0] + * | 18 | A4 | PA05 | A4 | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[5] SERCOM0/PAD[1] TCC0/WO[1] + * | 19 | A5 | PB02 | A5 | EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0] * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | | Wire | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 20 | SDA | PA22 | SDA | EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] SERCOM5/PAD[0] TC4/WO[0] TCC0/WO[4] - * | 21 | SCL | PA23 | SCL | EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] SERCOM5/PAD[1] TC4/WO[1] TCC0/WO[5] + * | 20 | SDA | PA22 | SDA | *EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] SERCOM5/PAD[0] *TC4/WO[0] TCC0/WO[4] + * | 21 | SCL | PA23 | SCL | *EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] SERCOM5/PAD[1] *TC4/WO[1] TCC0/WO[5] * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | |SPI (Legacy ICSP) | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 22 | 1 | PA12 | MISO | EIC/EXTINT[12] SERCOM2/PAD[0] *SERCOM4/PAD[0] TCC2/WO[0] TCC0/WO[6] + * | 22 | 1 | PA12 | MISO | *EIC/EXTINT[12] SERCOM2/PAD[0] *SERCOM4/PAD[0] TCC2/WO[0] TCC0/WO[6] * | | 2 | | 5V0 | - * | 23 | 4 | PB10 | MOSI | EIC/EXTINT[10] *SERCOM4/PAD[2] TC5/WO[0] TCC0/WO[4] - * | 24 | 3 | PB11 | SCK | EIC/EXTINT[11] *SERCOM4/PAD[3] TC5/WO[1] TCC0/WO[5] + * | 23 | 4 | PB10 | MOSI | EIC/EXTINT[10] *SERCOM4/PAD[2] *TC5/WO[0] TCC0/WO[4] + * | 24 | 3 | PB11 | SCK | EIC/EXTINT[11] *SERCOM4/PAD[3] *TC5/WO[1] TCC0/WO[5] * | | 5 | | RESET | * | | 6 | | GND | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- @@ -86,7 +166,7 @@ * | 36 | | PA18 | EDBG_SS | EIC/EXTINT[2] *SERCOM1/PAD[2] SERCOM3/PAD[2] TC3/WO[0] TCC0/WO[2] * | 37 | | PA17 | EDBG_SCK | EIC/EXTINT[1] *SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] TCC0/WO[7] * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 38 | ATN | PA13 | EDBG_GPIO0 | EIC/EXTINT[13] SERCOM2/PAD[1] SERCOM4/PAD[1] *TCC2/WO[1] TCC0/WO[7] + * | 38 | ATN | PA13 | EDBG_GPIO0 | *EIC/EXTINT[13] SERCOM2/PAD[1] SERCOM4/PAD[1] TCC2/WO[1] TCC0/WO[7] * | 39 | | PA21 | EDBG_GPIO1 | Pin 7 * | 40 | | PA06 | EDBG_GPIO2 | Pin 8 * | 41 | | PA07 | EDBG_GPIO3 | Pin 9 @@ -94,7 +174,7 @@ * | | | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | | GND | | | - * | 42 | AREF | PA03 | | EIC/EXTINT[3] *[ADC|DAC]/VREFA ADC/AIN[1] PTC/Y[1] + * | 42 | AREF | PA03 | | EIC/EXTINT[3] *[ADC|DAC]/VREFA *ADC/AIN[1] PTC/Y[1] * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- * | |32.768KHz Crystal | | | * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- @@ -114,87 +194,88 @@ const PinDescription g_APinDescription[]= // 0..13 - Digital pins // ---------------------- // 0/1 - SERCOM/UART (Serial1) - { PORTA, 11, PIO_SERCOM, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // RX: SERCOM0/PAD[3] - { PORTA, 10, PIO_SERCOM, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel19, EXTERNAL_INT_11 }, // RX: SERCOM0/PAD[3] + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel18, EXTERNAL_INT_10 }, // TX: SERCOM0/PAD[2] // 2..12 // Digital Low - { PORTA, 14, PIO_DIGITAL, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_14 }, - { PORTA, 9, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_9 }, // TCC0/WO[1] - { PORTA, 8, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NMI }, // TCC0/WO[0] - { PORTA, 15, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_15 }, // TC3/WO[1] - { PORTA, 20, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH6, TCC0_CH6, EXTERNAL_INT_4 }, // TCC0/WO[6] - { PORTA, 21, PIO_DIGITAL, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_14 }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9 }, // TCC0/WO[1] SCL: SERCOM2/PAD[1] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI }, // TCC0/WO[0] SDA: SERCOM2/PAD[0] + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_15 }, // TC3/WO[1] + { PORTA, 20, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH6, No_ADC_Channel, EXTERNAL_INT_4 }, // TCC0/WO[6] + { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5 }, // Digital High - { PORTA, 6, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_4 }, // TCC1/WO[0] - { PORTA, 7, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_5 }, // TCC1/WO[1] - { PORTA, 18, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH0, TC3_CH0, EXTERNAL_INT_2 }, // TC3/WO[0] - { PORTA, 16, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // TCC2/WO[0] - { PORTA, 19, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_3 }, // TCC0/WO[3] + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE }, // TCC1/WO[0] ADC/AIN[6] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE }, // TCC1/WO[1] ADC/AIN[7] + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2 }, // TC3/WO[0] SS: SERCOM1/PAD[2] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // TCC2/WO[0] MOSI: SERCOM1/PAD[0] + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3 }, // TCC0/WO[3] MISO: SERCOM1/PAD[3] // 13 (LED) - { PORTA, 17, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM2_CH1, NOT_ON_TIMER, EXTERNAL_INT_1 }, // TCC2/WO[1] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // TCC2/WO[1] SCK: SERCOM1/PAD[1] // 14..19 - Analog pins // -------------------- - { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[0] - { PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // ADC/AIN[2] - { PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // ADC/AIN[3] - { PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4] - { PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5] - { PORTB, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel10, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[10] + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC + { PORTB, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel2, EXTERNAL_INT_8 }, // ADC/AIN[2] + { PORTB, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel3, EXTERNAL_INT_NONE }, // ADC/AIN[3] + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_NONE }, // ADC/AIN[4] + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_NONE }, // ADC/AIN[5] + { PORTB, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel10, EXTERNAL_INT_NONE }, // ADC/AIN[10] // 20..21 I2C pins (SDA/SCL and also EDBG:SDA/SCL) // ---------------------- - { PORTA, 22, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // SDA: SERCOM3/PAD[0] - { PORTA, 23, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // SCL: SERCOM3/PAD[1] + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7 }, // SCL: SERCOM3/PAD[1] // 22..24 - SPI pins (ICSP:MISO,SCK,MOSI) // ---------------------- - { PORTA, 12, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_12 }, // MISO: SERCOM4/PAD[0] - { PORTB, 10, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // MOSI: SERCOM4/PAD[2] - { PORTB, 11, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // SCK: SERCOM4/PAD[3] + { PORTA, 12, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_12 }, // MISO: SERCOM4/PAD[0] + { PORTB, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // MOSI: SERCOM4/PAD[2] + { PORTB, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCK: SERCOM4/PAD[3] // 25..26 - RX/TX LEDS (PB03/PA27) // -------------------- - { PORTB, 3, PIO_OUTPUT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // used as output only - { PORTA, 27, PIO_OUTPUT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // used as output only + { PORTB, 3, PIO_OUTPUT, PER_ATTR_DRIVE_STRONG, PIN_ATTR_OUTPUT, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // used as output only + { PORTA, 27, PIO_OUTPUT, PER_ATTR_DRIVE_STRONG, PIN_ATTR_OUTPUT, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // used as output only // 27..29 - USB // -------------------- - { PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB Host enable - { PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM - { PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB Host enable + { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DM + { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DP // 30..41 - EDBG // ---------------------- // 30/31 - EDBG/UART - { PORTB, 22, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // TX: SERCOM5/PAD[2] - { PORTB, 23, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RX: SERCOM5/PAD[3] + { PORTB, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // TX: SERCOM5/PAD[2] + { PORTB, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // RX: SERCOM5/PAD[3] - // 32/33 I2C (SDA/SCL and also EDBG:SDA/SCL) - { PORTA, 22, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SDA: SERCOM3/PAD[0] - { PORTA, 23, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCL: SERCOM3/PAD[1] + // 32/33 I2C (SDA/SCL and also EDBG:SDA/SCL). These are duplicate entries of pins 20 and 21 + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7 }, // SCL: SERCOM3/PAD[1] - // 34..37 - EDBG/SPI - { PORTA, 19, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM1/PAD[3] - { PORTA, 16, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MOSI: SERCOM1/PAD[0] - { PORTA, 18, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: SERCOM1/PAD[2] - { PORTA, 17, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCK: SERCOM1/PAD[1] + // 34..37 - EDBG/SPI. These are duplicate entries of pins 12, 11, 10, and 13. + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3 }, // MISO: SERCOM1/PAD[3] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // MOSI: SERCOM1/PAD[0] + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2 }, // SS: SERCOM1/PAD[2] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // SCK: SERCOM1/PAD[1] // 38..41 - EDBG/Digital - { PORTA, 13, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH5, NOT_ON_TIMER, EXTERNAL_INT_13 }, // EIC/EXTINT[13] *TCC2/WO[1] TCC0/WO[7] - { PORTA, 21, PIO_PWM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH7, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Pin 7 - { PORTA, 6, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM1_CH0, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Pin 8 - { PORTA, 7, PIO_PWM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM1_CH1, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // Pin 9 + { PORTA, 13, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_13 }, // EIC/EXTINT[13] PIN_ATN + + // 39..41 These are duplicate entries of pins 7, 8, and 9 so that AREF and DAC are still available on pins 42 and 43 + { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5 }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE }, // TCC1/WO[0] ADC/AIN[6] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE }, // TCC1/WO[1] ADC/AIN[7] // 42 (AREF) - { PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VREFP + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // VREF ADC/AIN[1] - // ---------------------- - // 43 - Alternate use of A0 (DAC output) - { PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, DAC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // DAC/VOUT + // 43 - Alternate use of A0 (DAC output). This is a duplicate entry of pin + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC } ; const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; @@ -207,8 +288,9 @@ SERCOM sercom3( SERCOM3 ) ; SERCOM sercom4( SERCOM4 ) ; SERCOM sercom5( SERCOM5 ) ; -Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; -Uart Serial( &sercom5, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ; +#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; +Uart Serial( SERCOM_INSTANCE_SERIAL, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ; void SERCOM0_Handler() { Serial1.IrqHandler(); @@ -218,4 +300,5 @@ void SERCOM5_Handler() { Serial.IrqHandler(); } +#endif diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index a1f1506e4..d09f51545 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -50,9 +50,11 @@ extern "C" *----------------------------------------------------------------------------*/ // Number of pins defined in PinDescription array +#define NUM_PIN_DESCRIPTION_ENTRIES (44u) + #define PINS_COUNT (26u) #define NUM_DIGITAL_PINS (14u) -#define NUM_ANALOG_INPUTS (6u) +#define NUM_ANALOG_INPUTS (13u) #define NUM_ANALOG_OUTPUTS (1u) #define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) @@ -61,7 +63,7 @@ extern "C" #define portOutputRegister(port) ( &(port->OUT.reg) ) #define portInputRegister(port) ( &(port->IN.reg) ) #define portModeRegister(port) ( &(port->DIR.reg) ) -#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) /* * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD @@ -102,6 +104,15 @@ static const uint8_t A4 = PIN_A4 ; static const uint8_t A5 = PIN_A5 ; #define ADC_RESOLUTION 12 +// #define REMAP_ANALOG_PIN_ID while(0) +#define REMAP_ANALOG_PIN_ID if ( ulPin < A0 ) ulPin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#define REFA_PIN (42ul) + // Other pins #define PIN_ATN (38ul) static const uint8_t ATN = PIN_ATN; @@ -115,16 +126,20 @@ static const uint8_t ATN = PIN_ATN; #define PAD_SERIAL_TX (UART_TX_PAD_2) #define PAD_SERIAL_RX (SERCOM_RX_PAD_3) +#define SERCOM_INSTANCE_SERIAL &sercom5 + // 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 SERCOM_INSTANCE_SERIAL1 &sercom0 + /* * SPI Interfaces */ -#define SPI_INTERFACES_COUNT 1 +#define SPI_INTERFACES_COUNT 2 #define PIN_SPI_MISO (22u) #define PIN_SPI_MOSI (23u) @@ -135,20 +150,46 @@ static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; +#define SERCOM_INSTANCE_SPI &sercom4 + +#define PIN_SPI1_MISO (19u) +#define PIN_SPI1_MOSI (16u) +#define PIN_SPI1_SCK (17u) + +#define SERCOM_INSTANCE_SPI1 &sercom1 + /* * Wire Interfaces */ -#define WIRE_INTERFACES_COUNT 1 +#define WIRE_INTERFACES_COUNT 2 #define PIN_WIRE_SDA (20u) #define PIN_WIRE_SCL (21u) +#define SERCOM_INSTANCE_WIRE &sercom3 + +#define SERCOM_WIRE_HANDLER_MACRO \ +void SERCOM3_Handler(void) { \ + Wire.onService(); \ +} + +#define PIN_WIRE_SDA1 (4u) +#define PIN_WIRE_SCL1 (3u) + +#define SERCOM_INSTANCE_WIRE1 &sercom2 + +#define SERCOM_WIRE1_HANDLER_MACRO \ +void SERCOM2_Handler(void) { \ + Wire1.onService(); \ +} + /* * USB */ -#define PIN_USB_HOST_ENABLE (27ul) #define PIN_USB_DM (28ul) #define PIN_USB_DP (29ul) +#define PIN_USB_HOST_ENABLE (27ul) +#define PIN_USB_HOST_ENABLE_VALUE HIGH #ifdef __cplusplus } From 11306d6d9a575561828cb899011b8c5f8925dd0e Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 11 Aug 2015 07:55:33 +0000 Subject: [PATCH 011/124] Minor documentation update --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 951924302..1577f0ee1 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Other INT PWM Digital Analog Digital PWM INT DAC 2 2 (ADC0) | A2 | USB | Gnd | REF 3 3 (ADC1) | A3 | | Vcc | VDIV INT4 TCC0[0] 4 4 (ADC2) | A4 ----- A31 | 31 TC2[1] INT3 RX / SWDIO - INT5 TCC0[1] 5 5 (ADC3) | A5 A30 | 30 TC2[0] TX / SWDCLK + INT5 TCC0[1] 5 5 (ADC3) | A5 A30 | 30 TC2[0] TX / SWDCLK TCC0[2] 6 6 (ADC4) | A6 A27 | 27 INT7 TCC0[3] 7 7 (ADC5) | A7 A23 | 23 I2C/SCL SPI MOSI INT2 10 10 (ADC8) | A10 A22 | 22 INT6 I2C/SDA @@ -168,7 +168,6 @@ while (!Serial) ; ``` Remember that if the sketch needs to run without SerialUSB connected, another approach must be used. - You can also reset the board manually with the Reset button if you wish to restart your sketch. However, pressing the Reset button will reset the SAMD chip, which in turn will reset USB communication. This interruption means that if the serial monitor is open, it will be necessary to close and re-open it to restart communication. @@ -176,14 +175,14 @@ that if the serial monitor is open, it will be necessary to close and re-open it ## Code Size and RAM Usage -Sketch and Configuration | MT-D21E (Code + RAM) | MT-D11 (Code + RAM) -----------------------------|----------------------|----------------------- -Blink (CDC + HID + UART) | 7564 + 1524 | 7452 + 1424 -Blink (CDC + UART) | 6588 + 1496 | 6484 + 1396 -Blink (CDC Only) | 5248 + 1304 | 5192 + 1300 -Blink (UART Only) | 3828 + 336 | 3716 + 236 -Blink (No USB or UART) | 2472 + 144 | 2416 + 140 -Datalogger (No USB or UART) | 10340 + 948 | 10260 + 944 +Sketch and Configuration | MT-D21E (Flash + RAM) | MT-D11 (Flash + RAM) +----------------------------|-----------------------|----------------------- +Blink (CDC + HID + UART) | 7564 + 1524 | 7452 + 1424 +Blink (CDC + UART) | 6588 + 1496 | 6484 + 1396 +Blink (CDC Only) | 5248 + 1304 | 5192 + 1300 +Blink (UART Only) | 3828 + 336 | 3716 + 236 +Blink (No USB or UART) | 2472 + 144 | 2416 + 140 +Datalogger (No USB or UART) | 10340 + 948 | 10260 + 944 * 180 bytes of flash can be saved on the MT-D11 by using PIN_MAP_COMPACT (see 'New PinDescription Table' below). * Datalogger compiled without USB or UART support, but with SPI and SD (with FAT filesystem) support. Serial output was disabled. @@ -273,7 +272,7 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP The SAM-BA bootloader has both a CDC USB interface, and a UART interface (MT-D21E: TX: pin 10, RX: pin 11). It is compatible with the Arduino IDE (Zero compatible), or it can be used with the Bossac tool standalone. Under Arduino, auto-reset is supported (automatically runs the bootloader while the sketch is running) as well as -automatic return freom reset. The SAM-BA bootloader described here adds to the Arduino version, which in +automatic return from reset. The SAM-BA bootloader described here adds to the Arduino version, which in turn is based on the bootloader from Atmel. The Arduino version added several features, including three new commands (Arduino Extended Capabilities) that increase upload speed. The bootloader normally requires 8 KB FLASH, however, a 4 KB version can be used for the D11 chips. @@ -454,6 +453,7 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## Possible Future Additions * Port Servo library +* Features for lower power consumption * Replace pulse with timer capture * MIDI USB Device Class * MSC (Mass Storage) USB Device Class From 5d04db2cdcd71e09831a217d0cfb3929b5f6f4c1 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 12 Nov 2015 04:08:36 +0000 Subject: [PATCH 012/124] Fix deprecated recipe.ar.pattern warning and minor documentation update. --- README.md | 5 +++-- platform.txt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1577f0ee1..37ea5401d 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,8 @@ Datalogger (No USB or UART) | 10340 + 948 | 10260 + 944 The flash used message at the end of compilation is not correct. The number shown represents the .text segment only. However, Flash usage = .text + .data segments (RAM usage = .data + .bss segments). In this release, two programs are run at the -end of compilation to provide more detailed memory usage. +end of compilation to provide more detailed memory usage. To enable this output, go +to File->Preferences and beside "Show verbose output during:", check "compilation". Just above the normal flash usage message, is the output from the size utility. However, this output is also incorrect, as it shows .text+.data in the .text field, @@ -267,7 +268,7 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 13. You can now upload your own sketch. -## SAM-BA USB CDC Bootloader (Arduino Zero compatible) +## SAM-BA USB CDC Bootloader (Arduino compatible) The SAM-BA bootloader has both a CDC USB interface, and a UART interface (MT-D21E: TX: pin 10, RX: pin 11). It is compatible with the Arduino IDE (Zero compatible), or it can be used with the Bossac tool standalone. Under diff --git a/platform.txt b/platform.txt index 1aa1b7dcb..6ab1cdde2 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=MattairTech SAMD Boards -version=1.6.5-mt2 +version=1.6.6-mt1 # Compile variables @@ -89,7 +89,7 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -D recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" ## Create archives -recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}" +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group @@ -111,6 +111,7 @@ recipe.output.save_file={build.project_name}.{build.variant}.bin recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex=\.text\s+([0-9]+).* + # Uploader tools # -------------- From 8822a24903c5efa774d340816b5ed2cea8103224 Mon Sep 17 00:00:00 2001 From: Erin Tomson Date: Fri, 24 Jul 2015 23:08:36 -0700 Subject: [PATCH 013/124] Fix two bugs that can cause deadlock conditions when i2c bus errors occur. The first occurs when starting a read transaction from a slave that doesn't respond. The code would wait until the SB (slave on bus) bit is set in the INTFLAGS register, but when a nack occurs that never happens so we're stuck in an infinite loop. The fix is to also look for the MB flag to be set. If it is, issue a stop condition and return. The second happens when a bus error (ie, an illegal stop condition) occurs while sending data as a master. In that case we are waiting for the MB (master on bus) flag to be set. When a bus error occurs that never happens, so again we end up in an infinite loop. The fix here is to also look for the BUSERR flag to be set. If it is, return an error condition. --- cores/arduino/SERCOM.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index 77822e3ea..c7a829284 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -522,6 +522,12 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag { while( !sercom->I2CM.INTFLAG.bit.SB ) { + // If the slave NACKS the address, the MB bit will be set. + // In that case, send a stop condition and return false. + if (sercom->I2CM.INTFLAG.bit.MB) { + sercom->I2CM.CTRLB.bit.CMD = 3; // Stop condition + return false; + } // Wait transmission complete } @@ -547,7 +553,14 @@ bool SERCOM::sendDataMasterWIRE(uint8_t data) sercom->I2CM.DATA.bit.DATA = data; //Wait transmission successful - while(!sercom->I2CM.INTFLAG.bit.MB); + while(!sercom->I2CM.INTFLAG.bit.MB) { + + // If a bus error occurs, the MB bit may never be set. + // Check the bus error bit and bail if it's set. + if (sercom->I2CM.STATUS.bit.BUSERR) { + return false; + } + } //Problems on line? nack received? if(sercom->I2CM.STATUS.bit.RXNACK) From d36b39e6a7117910f3f55e04d4d97371b1f9f6b9 Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Mon, 10 Aug 2015 13:36:31 +0200 Subject: [PATCH 014/124] [zero] prepare variant for SPI and Wire board parameters --- variants/arduino_zero/variant.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index d09f51545..cba41051f 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -144,6 +144,9 @@ static const uint8_t ATN = PIN_ATN; #define PIN_SPI_MISO (22u) #define PIN_SPI_MOSI (23u) #define PIN_SPI_SCK (24u) +#define PERIPH_SPI sercom4 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 static const uint8_t SS = PIN_A2 ; // SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference. static const uint8_t MOSI = PIN_SPI_MOSI ; @@ -165,6 +168,8 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PIN_WIRE_SDA (20u) #define PIN_WIRE_SCL (21u) +#define PERIPH_WIRE sercom3 +#define WIRE_IT_HANDLER SERCOM3_Handler #define SERCOM_INSTANCE_WIRE &sercom3 From 4273307910e811d5f1c107f9bafd8c73db40993f Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Mon, 10 Aug 2015 13:39:31 +0200 Subject: [PATCH 015/124] [zero] Bring more customization to SPI class --- libraries/SPI/SPI.cpp | 21 +++++++++++++-------- libraries/SPI/SPI.h | 7 ++++++- variants/MT_D11/variant.h | 5 +++-- variants/MT_D21E/variant.h | 5 +++-- variants/arduino_zero/variant.h | 7 +++---- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index b419b0dad..89a28c6de 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -28,15 +28,20 @@ const SPISettings DEFAULT_SPI_SETTINGS = SPISettings(); -SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI) +SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, SercomSpiTXPad PadTx, SercomRXPad PadRx) { initialized = false; assert(p_sercom != NULL); _p_sercom = p_sercom; + // pins _uc_pinMiso = uc_pinMISO; _uc_pinSCK = uc_pinSCK; _uc_pinMosi = uc_pinMOSI; + + // SERCOM pads + _padTx=PadTx; + _padRx=PadRx; } void SPIClass::begin() @@ -65,7 +70,7 @@ void SPIClass::config(SPISettings settings) { _p_sercom->disableSPI(); - _p_sercom->initSPI(SPI_PAD_2_SCK_3, SERCOM_RX_PAD_0, SPI_CHAR_SIZE_8_BITS, settings.bitOrder); + _p_sercom->initSPI(_padTx, _padRx, SPI_CHAR_SIZE_8_BITS, settings.bitOrder); _p_sercom->initSPIClock(settings.dataMode, settings.clockFreq); _p_sercom->enableSPI(); @@ -198,13 +203,13 @@ void SPIClass::detachInterrupt() { } #if SPI_INTERFACES_COUNT > 0 -SPIClass SPI( SERCOM_INSTANCE_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI ); -#endif +SPIClass SPI( &PERIPH_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI, PAD_SPI_TX, PAD_SPI_RX ); +#endif // SPI_INTERFACES_COUNT > 0 #if SPI_INTERFACES_COUNT > 1 -SPIClass SPI1( SERCOM_INSTANCE_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI ); -#endif +SPIClass SPI1( &PERIPH_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI, PAD_SPI_TX, PAD_SPI_RX ); +#endif // SPI_INTERFACES_COUNT > 1 #if SPI_INTERFACES_COUNT > 2 -SPIClass SPI2( SERCOM_INSTANCE_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI ); -#endif +SPIClass SPI2( &PERIPH_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI, PAD_SPI_TX, PAD_SPI_RX ); +#endif // SPI_INTERFACES_COUNT > 2 diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index 03fd02635..cca53db01 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -92,7 +92,8 @@ class SPISettings { class SPIClass { public: - SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI); + SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, SercomSpiTXPad, SercomRXPad); + byte transfer(uint8_t data); inline void transfer(void *buf, size_t count); @@ -121,6 +122,10 @@ class SPIClass { uint8_t _uc_pinMiso; uint8_t _uc_pinMosi; uint8_t _uc_pinSCK; + + SercomSpiTXPad _padTx; + SercomRXPad _padRx; + bool initialized; uint8_t interruptMode; char interruptSave; diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index 339c48077..150011c6f 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -185,14 +185,15 @@ static const uint8_t ATN = PIN_ATN; #define PIN_SPI_MOSI PIN_SPI1_MOSI #define PIN_SPI_SCK PIN_SPI1_SCK #define PIN_SPI_SS PIN_SPI1_SS +#define PERIPH_SPI sercom0 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; -#define SERCOM_INSTANCE_SPI &sercom0 - /* * Wire Interfaces diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index f81124c20..36fa41600 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -185,14 +185,15 @@ static const uint8_t ATN = PIN_ATN; #define PIN_SPI_MOSI PIN_SPI1_MOSI #define PIN_SPI_SCK PIN_SPI1_SCK #define PIN_SPI_SS PIN_SPI1_SS +#define PERIPH_SPI sercom3 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; -#define SERCOM_INSTANCE_SPI &sercom3 - /* * Wire Interfaces diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index cba41051f..94e1464b3 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -153,13 +153,12 @@ static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; -#define SERCOM_INSTANCE_SPI &sercom4 - #define PIN_SPI1_MISO (19u) #define PIN_SPI1_MOSI (16u) #define PIN_SPI1_SCK (17u) - -#define SERCOM_INSTANCE_SPI1 &sercom1 +#define PERIPH_SPI sercom1 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 /* * Wire Interfaces From 8e1c95c4974d6792188604706042f5f8874dcaac Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Mon, 10 Aug 2015 13:39:47 +0200 Subject: [PATCH 016/124] [zero] Bring more customization to Wire class --- libraries/SPI/SPI.cpp | 4 +- libraries/Wire/Wire.cpp | 95 ++++++--------------------------- libraries/Wire/Wire.h | 5 +- variants/MT_D11/variant.h | 9 +--- variants/MT_D21E/variant.h | 9 +--- variants/arduino_zero/variant.h | 26 +++------ 6 files changed, 32 insertions(+), 116 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 89a28c6de..0cc2fb95b 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -207,9 +207,9 @@ SPIClass SPI( &PERIPH_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI, PAD_SPI_TX, #endif // SPI_INTERFACES_COUNT > 0 #if SPI_INTERFACES_COUNT > 1 -SPIClass SPI1( &PERIPH_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI, PAD_SPI_TX, PAD_SPI_RX ); +SPIClass SPI1( &PERIPH_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI, PAD_SPI1_TX, PAD_SPI1_RX ); #endif // SPI_INTERFACES_COUNT > 1 #if SPI_INTERFACES_COUNT > 2 -SPIClass SPI2( &PERIPH_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI, PAD_SPI_TX, PAD_SPI_RX ); +SPIClass SPI2( &PERIPH_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI, PAD_SPI2_TX, PAD_SPI2_RX ); #endif // SPI_INTERFACES_COUNT > 2 diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 1d6767042..99fcee84e 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -26,9 +26,11 @@ extern "C" { #include "Wire.h" -TwoWire::TwoWire(SERCOM * s) +TwoWire::TwoWire(SERCOM * s, uint8_t pinSDA, uint8_t pinSCL) { this->sercom = s; + this->_uc_pinSDA=pinSDA; + this->_uc_pinSCL=pinSCL; transmissionBegun = false; } @@ -37,8 +39,8 @@ void TwoWire::begin(void) { sercom->initMasterWIRE(TWI_CLOCK); sercom->enableWIRE(); - pinPeripheral(PIN_WIRE_SDA, PIO_SERCOM); - pinPeripheral(PIN_WIRE_SCL, PIO_SERCOM); + pinPeripheral(_uc_pinSDA, PIO_SERCOM); + pinPeripheral(_uc_pinSCL, PIO_SERCOM); } void TwoWire::begin(uint8_t address) { @@ -254,77 +256,6 @@ void TwoWire::onService(void) } } -/* -void TwoWire::onService(void) -{ - // Retrieve interrupt status - uint32_t sr = TWI_GetStatus(twi); - - if (status == SLAVE_IDLE && TWI_STATUS_SVACC(sr)) { - TWI_DisableIt(twi, TWI_IDR_SVACC); - TWI_EnableIt(twi, TWI_IER_RXRDY | TWI_IER_GACC | TWI_IER_NACK - | TWI_IER_EOSACC | TWI_IER_SCL_WS | TWI_IER_TXCOMP); - - srvBufferLength = 0; - srvBufferIndex = 0; - - // Detect if we should go into RECV or SEND status - // SVREAD==1 means *master* reading -> SLAVE_SEND - if (!TWI_STATUS_SVREAD(sr)) { - status = SLAVE_RECV; - } else { - status = SLAVE_SEND; - - // Alert calling program to generate a response ASAP - if (onRequestCallback) - onRequestCallback(); - else - // create a default 1-byte response - write((uint8_t) 0); - } - } - - if (status != SLAVE_IDLE) { - if (TWI_STATUS_TXCOMP(sr) && TWI_STATUS_EOSACC(sr)) { - if (status == SLAVE_RECV && onReceiveCallback) { - // Copy data into rxBuffer - // (allows to receive another packet while the - // user program reads actual data) - for (uint8_t i = 0; i < srvBufferLength; ++i) - rxBuffer[i] = srvBuffer[i]; - rxBufferIndex = 0; - rxBufferLength = srvBufferLength; - - // Alert calling program - onReceiveCallback( rxBufferLength); - } - - // Transfer completed - TWI_EnableIt(twi, TWI_SR_SVACC); - TWI_DisableIt(twi, TWI_IDR_RXRDY | TWI_IDR_GACC | TWI_IDR_NACK - | TWI_IDR_EOSACC | TWI_IDR_SCL_WS | TWI_IER_TXCOMP); - status = SLAVE_IDLE; - } - } - - if (status == SLAVE_RECV) { - if (TWI_STATUS_RXRDY(sr)) { - if (srvBufferLength < BUFFER_LENGTH) - srvBuffer[srvBufferLength++] = TWI_ReadByte(twi); - } - } - - if (status == SLAVE_SEND) { - if (TWI_STATUS_TXRDY(sr) && !TWI_STATUS_NACK(sr)) { - uint8_t c = 'x'; - if (srvBufferIndex < srvBufferLength) - c = srvBuffer[srvBufferIndex++]; - TWI_WriteByte(twi, c); - } - } -} -*/ - #if WIRE_INTERFACES_COUNT > 0 /*static void Wire_Init(void) { pmc_enable_periph_clk(WIRE_INTERFACE_ID); @@ -346,15 +277,19 @@ void TwoWire::onService(void) }*/ -TwoWire Wire(SERCOM_INSTANCE_WIRE); +TwoWire Wire(&PERIPH_WIRE, PIN_WIRE_SDA, PIN_WIRE_SCL); -SERCOM_WIRE_HANDLER_MACRO +void WIRE_IT_HANDLER(void) { + Wire.onService(); +} -#endif +#endif // WIRE_INTERFACES_COUNT > 0 #if WIRE_INTERFACES_COUNT > 1 -TwoWire Wire1(SERCOM_INSTANCE_WIRE1); +TwoWire Wire(&PERIPH_WIRE1, PIN_WIRE1_SDA, PIN_WIRE1_SCL); -SERCOM_WIRE1_HANDLER_MACRO +void WIRE1_IT_HANDLER1(void) { + Wire.onService(); +} -#endif +#endif // WIRE_INTERFACES_COUNT > 1 diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index 7d8df9d0e..ae7692c06 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -32,7 +32,7 @@ class TwoWire : public Stream { public: - TwoWire(SERCOM *s); + TwoWire(SERCOM *s, uint8_t pinSDA, uint8_t pinSCL); void begin(); void begin(uint8_t); void setClock(uint32_t); // dummy function @@ -60,6 +60,9 @@ class TwoWire : public Stream private: SERCOM * sercom; + uint8_t _uc_pinSDA; + uint8_t _uc_pinSCL; + bool transmissionBegun; // RX Buffer diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index 150011c6f..44b9e33fc 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -204,13 +204,8 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PIN_WIRE1_SCL (23u) #define PIN_WIRE_SDA PIN_WIRE1_SDA #define PIN_WIRE_SCL PIN_WIRE1_SCL - -#define SERCOM_INSTANCE_WIRE &sercom2 - -#define SERCOM_WIRE_HANDLER_MACRO \ -void SERCOM2_Handler(void) { \ - Wire.onService(); \ -} +#define PERIPH_WIRE sercom2 +#define WIRE_IT_HANDLER SERCOM2_Handler /* diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index 36fa41600..6e6bd5fc1 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -204,13 +204,8 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PIN_WIRE1_SCL (17u) #define PIN_WIRE_SDA PIN_WIRE1_SDA #define PIN_WIRE_SCL PIN_WIRE1_SCL - -#define SERCOM_INSTANCE_WIRE &sercom1 - -#define SERCOM_WIRE_HANDLER_MACRO \ -void SERCOM1_Handler(void) { \ - Wire.onService(); \ -} +#define PERIPH_WIRE sercom1 +#define WIRE_IT_HANDLER SERCOM1_Handler /* diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 94e1464b3..67f11eacb 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -156,9 +156,9 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PIN_SPI1_MISO (19u) #define PIN_SPI1_MOSI (16u) #define PIN_SPI1_SCK (17u) -#define PERIPH_SPI sercom1 -#define PAD_SPI_TX SPI_PAD_2_SCK_3 -#define PAD_SPI_RX SERCOM_RX_PAD_0 +#define PERIPH_SPI1 sercom1 +#define PAD_SPI1_TX SPI_PAD_2_SCK_3 +#define PAD_SPI1_RX SERCOM_RX_PAD_0 /* * Wire Interfaces @@ -170,22 +170,10 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PERIPH_WIRE sercom3 #define WIRE_IT_HANDLER SERCOM3_Handler -#define SERCOM_INSTANCE_WIRE &sercom3 - -#define SERCOM_WIRE_HANDLER_MACRO \ -void SERCOM3_Handler(void) { \ - Wire.onService(); \ -} - -#define PIN_WIRE_SDA1 (4u) -#define PIN_WIRE_SCL1 (3u) - -#define SERCOM_INSTANCE_WIRE1 &sercom2 - -#define SERCOM_WIRE1_HANDLER_MACRO \ -void SERCOM2_Handler(void) { \ - Wire1.onService(); \ -} +#define PIN_WIRE1_SDA (4u) +#define PIN_WIRE1_SCL (3u) +#define PERIPH_WIRE1 sercom2 +#define WIRE1_IT_HANDLER SERCOM2_Handler /* * USB From 864fef8023ae05aca66428958eff38bca8f23afa Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Tue, 11 Aug 2015 09:42:26 +0200 Subject: [PATCH 017/124] [zero/SPI] adding missing library properties --- libraries/SPI/library.properties | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 libraries/SPI/library.properties diff --git a/libraries/SPI/library.properties b/libraries/SPI/library.properties new file mode 100644 index 000000000..3aaa770b8 --- /dev/null +++ b/libraries/SPI/library.properties @@ -0,0 +1,8 @@ +name=SPI +version=1.0 +author=Jonathan BAUDIN, Thibaut VIARD, Arduino +maintainer=Arduino +sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. Specific implementation for Arduino Zero. +paragraph= +url=http://www.arduino.cc/en/Reference/SPI +architectures=samd From 5914e427c0954604c0b4cd5d0d1e7e485594246e Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Tue, 11 Aug 2015 09:42:44 +0200 Subject: [PATCH 018/124] [zero/Wire] adding missing library properties --- libraries/Wire/library.properties | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 libraries/Wire/library.properties diff --git a/libraries/Wire/library.properties b/libraries/Wire/library.properties new file mode 100644 index 000000000..eff193aa2 --- /dev/null +++ b/libraries/Wire/library.properties @@ -0,0 +1,9 @@ +name=Wire +version=1.0 +author=Jonathan BAUDIN, Thibaut VIARD, Arduino +maintainer=Arduino +sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. Specific implementation for Arduino Zero. +paragraph= +url=http://www.arduino.cc/en/Reference/Wire +architectures=samd + From c60f4399295be47face93e38e39f71cf1077d4a7 Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Thu, 13 Aug 2015 12:05:14 +0200 Subject: [PATCH 019/124] [zero/SPI] Adding default values for SPI custom definitions --- libraries/SPI/SPI.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 0cc2fb95b..7e2735c8c 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -203,6 +203,22 @@ void SPIClass::detachInterrupt() { } #if SPI_INTERFACES_COUNT > 0 + +/* In case new variant doesn't define these macros, + * we put here the ones for Arduino Zero. + * + * These values should be different on some variants! + * + * The SPI PAD values can be found in cores/arduino/SERCOM.h: + * - SercomSpiTXPad + * - SercomRXPad + */ +#ifndef PERIPH_SPI +#define PERIPH_SPI sercom4 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 +#endif // PERIPH_SPI + SPIClass SPI( &PERIPH_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI, PAD_SPI_TX, PAD_SPI_RX ); #endif // SPI_INTERFACES_COUNT > 0 From 32ea4079d97b019be444e6c7b38c13293ac6ad44 Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Thu, 13 Aug 2015 12:09:25 +0200 Subject: [PATCH 020/124] [zero/Wire] Adding default values for Wire custom definitions --- libraries/Wire/Wire.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 99fcee84e..c8761cc46 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -257,25 +257,17 @@ void TwoWire::onService(void) } #if WIRE_INTERFACES_COUNT > 0 -/*static void Wire_Init(void) { - pmc_enable_periph_clk(WIRE_INTERFACE_ID); - PIO_Configure( - g_APinDescription[PIN_WIRE_SDA].pPort, - g_APinDescription[PIN_WIRE_SDA].ulPinType, - g_APinDescription[PIN_WIRE_SDA].ulPin, - g_APinDescription[PIN_WIRE_SDA].ulPinConfiguration); - PIO_Configure( - g_APinDescription[PIN_WIRE_SCL].pPort, - g_APinDescription[PIN_WIRE_SCL].ulPinType, - g_APinDescription[PIN_WIRE_SCL].ulPin, - g_APinDescription[PIN_WIRE_SCL].ulPinConfiguration); - - NVIC_DisableIRQ(WIRE_ISR_ID); - NVIC_ClearPendingIRQ(WIRE_ISR_ID); - NVIC_SetPriority(WIRE_ISR_ID, 0); - NVIC_EnableIRQ(WIRE_ISR_ID); -}*/ +/* In case new variant doesn't define these macros, + * we put here the ones for Arduino Zero. + * + * These values should be different on some variants! + */ + +#ifndef PERIPH_WIRE +# define PERIPH_WIRE sercom3 +# define WIRE_IT_HANDLER SERCOM3_Handler +#endif // PERIPH_WIRE TwoWire Wire(&PERIPH_WIRE, PIN_WIRE_SDA, PIN_WIRE_SCL); From 18cb10f2010327ad6dd6d41cb425a00b0e50d9a9 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 13 Aug 2015 18:02:03 +0200 Subject: [PATCH 021/124] delay.h is included outside __cplusplus guards --- cores/arduino/Arduino.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 05eac732f..1be6d7171 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -62,7 +62,7 @@ void loop( void ) ; #ifdef __cplusplus } // extern "C" -#endif // __cplusplus +#endif // The following headers are for C++ only compilation #ifdef __cplusplus @@ -72,9 +72,11 @@ void loop( void ) ; #include "WMath.h" #include "HardwareSerial.h" #include "pulse.h" - #include "delay.h" +#endif +#include "delay.h" +#ifdef __cplusplus #include "Uart.h" -#endif // __cplusplus +#endif // Include board variant #include "variant.h" From 54a0c3de8dc5ae6cd5500f7fa41f530278406ee3 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 13 Aug 2015 18:07:53 +0200 Subject: [PATCH 022/124] [Wire] simplified coding unnecessarily complex (hfvogt) In the wire library there are several functions where an unnecessarily complex coding has been used: - endTransmission: the availability of data is already checked in while(...), therefore need not be checked again in the loop. - requestFrom: the for-loop has a predefined and fixed number of loops. Therefore a check whether the last element has been reached is unnecessary and does not add any benefit. Fixes #20 --- libraries/Wire/Wire.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index c8761cc46..419d6e802 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -68,22 +68,15 @@ uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) rxBuffer.store_char(sercom->readDataWIRE()); // Connected to slave - //while(toRead--) - for(byteRead = 0; byteRead < quantity; ++byteRead) + for (byteRead = 1; byteRead < quantity; ++byteRead) { - if( byteRead == quantity - 1) // Stop transmission - { - sercom->prepareNackBitWIRE(); // Prepare NACK to stop slave transmission - //sercom->readDataWIRE(); // Clear data register to send NACK - sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); // Send Stop - } - else // Continue transmission - { - sercom->prepareAckBitWIRE(); // Prepare Acknowledge - sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_READ); // Prepare the ACK command for the slave - rxBuffer.store_char( sercom->readDataWIRE() ); // Read data and send the ACK - } + sercom->prepareAckBitWIRE(); // Prepare Acknowledge + sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_READ); // Prepare the ACK command for the slave + rxBuffer.store_char(sercom->readDataWIRE()); // Read data and send the ACK } + sercom->prepareNackBitWIRE(); // Prepare NACK to stop slave transmission + //sercom->readDataWIRE(); // Clear data register to send NACK + sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); // Send Stop } return byteRead; @@ -134,12 +127,8 @@ uint8_t TwoWire::endTransmission(bool stopBit) sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); return 3 ; // Nack or error } - - if(txBuffer.available() == 0) - { - sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); - } } + sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); return 0; } From 42d69ea5751c47d8ad5ebef56c54325c4fb01510 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 14 Aug 2015 10:35:57 +0200 Subject: [PATCH 023/124] relax digitalWrite parameter check calling digitalWrite with any value different from 0 will end in performing digitalWrite(HIGH) --- cores/arduino/wiring_digital.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 80d12b00d..d31c83592 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -59,11 +59,8 @@ void digitalWrite( uint32_t ulPin, uint32_t ulVal ) PORT->Group[pinPort].OUTCLR.reg = (1ul << pinNum) ; break ; - case HIGH: - PORT->Group[pinPort].OUTSET.reg = (1ul << pinNum) ; - break ; - default: + PORT->Group[pinPort].OUTSET.reg = (1ul << pinNum) ; break ; } From 65f6d320b28d297b89dc94d1fc6c4fe57f8782da Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 24 Aug 2015 12:26:44 +0200 Subject: [PATCH 024/124] Updated IPAddress class to the latest version --- cores/arduino/IPAddress.cpp | 31 ++++++++++++++++--------------- cores/arduino/IPAddress.h | 24 +++++++++++++++--------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/cores/arduino/IPAddress.cpp b/cores/arduino/IPAddress.cpp index 6803110ea..899cbd4ed 100644 --- a/cores/arduino/IPAddress.cpp +++ b/cores/arduino/IPAddress.cpp @@ -1,5 +1,6 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + IPAddress.cpp - Base class that provides IPAddress + Copyright (c) 2011 Adrian McEwen. 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 @@ -8,8 +9,8 @@ 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. + 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 @@ -21,42 +22,42 @@ IPAddress::IPAddress() { - memset(_address, 0, sizeof(_address)); + _address.dword = 0; } IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) { - _address[0] = first_octet; - _address[1] = second_octet; - _address[2] = third_octet; - _address[3] = fourth_octet; + _address.bytes[0] = first_octet; + _address.bytes[1] = second_octet; + _address.bytes[2] = third_octet; + _address.bytes[3] = fourth_octet; } IPAddress::IPAddress(uint32_t address) { - memcpy(_address, &address, sizeof(_address)); + _address.dword = address; } IPAddress::IPAddress(const uint8_t *address) { - memcpy(_address, address, sizeof(_address)); + memcpy(_address.bytes, address, sizeof(_address.bytes)); } IPAddress& IPAddress::operator=(const uint8_t *address) { - memcpy(_address, address, sizeof(_address)); + memcpy(_address.bytes, address, sizeof(_address.bytes)); return *this; } IPAddress& IPAddress::operator=(uint32_t address) { - memcpy(_address, (const uint8_t *)&address, sizeof(_address)); + _address.dword = address; return *this; } bool IPAddress::operator==(const uint8_t* addr) const { - return memcmp(addr, _address, sizeof(_address)) == 0; + return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0; } size_t IPAddress::printTo(Print& p) const @@ -64,10 +65,10 @@ size_t IPAddress::printTo(Print& p) const size_t n = 0; for (int i =0; i < 3; i++) { - n += p.print(_address[i], DEC); + n += p.print(_address.bytes[i], DEC); n += p.print('.'); } - n += p.print(_address[3], DEC); + n += p.print(_address.bytes[3], DEC); return n; } diff --git a/cores/arduino/IPAddress.h b/cores/arduino/IPAddress.h index b6f454bba..94acdc456 100644 --- a/cores/arduino/IPAddress.h +++ b/cores/arduino/IPAddress.h @@ -1,5 +1,6 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + IPAddress.h - Base class that provides IPAddress + Copyright (c) 2011 Adrian McEwen. 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 @@ -8,8 +9,8 @@ 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. + 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 @@ -19,18 +20,23 @@ #ifndef IPAddress_h #define IPAddress_h +#include #include // A class to make it easier to handle and pass around IP addresses class IPAddress : public Printable { private: - uint8_t _address[4]; // IPv4 address + union { + uint8_t bytes[4]; // IPv4 address + uint32_t dword; + } _address; + // Access the raw byte array containing the address. Because this returns a pointer // to the internal structure rather than a copy of the address this function should only // be used when you know that the usage of the returned uint8_t* will be transient and not // stored. - uint8_t* raw_address() { return _address; }; + uint8_t* raw_address() { return _address.bytes; }; public: // Constructors @@ -41,13 +47,13 @@ class IPAddress : public Printable { // Overloaded cast operator to allow IPAddress objects to be used where a pointer // to a four-byte uint8_t array is expected - operator uint32_t() const { return *((uint32_t*)_address+0); }; - bool operator==(const IPAddress& addr) const { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); }; + operator uint32_t() const { return _address.dword; }; + bool operator==(const IPAddress& addr) const { return _address.dword == addr._address.dword; }; bool operator==(const uint8_t* addr) const; // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const { return _address[index]; }; - uint8_t& operator[](int index) { return _address[index]; }; + uint8_t operator[](int index) const { return _address.bytes[index]; }; + uint8_t& operator[](int index) { return _address.bytes[index]; }; // Overloaded copy operators to allow initialisation of IPAddress objects from other types IPAddress& operator=(const uint8_t *address); From 5b2615f14d82ae991ba0c89fcb59000444cac508 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Tue, 25 Aug 2015 10:48:54 -0400 Subject: [PATCH 025/124] implement Wire.end() for SAMD core --- libraries/Wire/Wire.cpp | 6 +++++- libraries/Wire/Wire.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 419d6e802..33266d9e0 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -48,7 +48,11 @@ void TwoWire::begin(uint8_t address) { sercom->initSlaveWIRE(address); sercom->enableWIRE(); } - + +void TwoWire::end() { + sercom->disableWIRE(); +} + void TwoWire::setClock(uint32_t frequency) { // dummy funtion } diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index ae7692c06..dfa1c1399 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -29,12 +29,16 @@ #define BUFFER_LENGTH 32 + // WIRE_HAS_END means Wire has end() +#define WIRE_HAS_END 1 + class TwoWire : public Stream { public: TwoWire(SERCOM *s, uint8_t pinSDA, uint8_t pinSCL); void begin(); void begin(uint8_t); + void end(); void setClock(uint32_t); // dummy function void beginTransmission(uint8_t); From 56b319cbe9fdd4b37585335aceb212ba912b808f Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 15:09:04 +0200 Subject: [PATCH 026/124] Fixed EXT_INT numbers in variant for pin 8 and 9 See #30 --- variants/arduino_zero/variant.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/variants/arduino_zero/variant.cpp b/variants/arduino_zero/variant.cpp index 4377a2fbb..b5f572de7 100644 --- a/variants/arduino_zero/variant.cpp +++ b/variants/arduino_zero/variant.cpp @@ -207,8 +207,8 @@ const PinDescription g_APinDescription[]= { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5 }, // Digital High - { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE }, // TCC1/WO[0] ADC/AIN[6] - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE }, // TCC1/WO[1] ADC/AIN[7] + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_6 }, // TCC1/WO[0] ADC/AIN[6] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_7 }, // TCC1/WO[1] ADC/AIN[7] { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2 }, // TC3/WO[0] SS: SERCOM1/PAD[2] { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // TCC2/WO[0] MOSI: SERCOM1/PAD[0] { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3 }, // TCC0/WO[3] MISO: SERCOM1/PAD[3] @@ -227,8 +227,8 @@ const PinDescription g_APinDescription[]= // 20..21 I2C pins (SDA/SCL and also EDBG:SDA/SCL) // ---------------------- - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA: SERCOM3/PAD[0] - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7 }, // SCL: SERCOM3/PAD[1] + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // SDA: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCL: SERCOM3/PAD[1] // 22..24 - SPI pins (ICSP:MISO,SCK,MOSI) // ---------------------- From 39cb1c16ac41ed0b5b45108a9e64f788825ad464 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 15:17:30 +0200 Subject: [PATCH 027/124] WInterrupts.c cosmetic fix --- cores/arduino/WInterrupts.c | 92 ++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 52 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 9294fc780..63e44ec97 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -68,99 +68,87 @@ static void __initialize() * \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. * Replaces any previous function that was attached to the interrupt. */ -//void attachInterrupt( uint32_t ulPin, void (*callback)(void), EExt_IntMode mode ) -//void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, EExt_IntMode mode ) -void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, uint32_t ulMode ) +void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) { - static int enabled = 0 ; - uint32_t ulConfig ; - uint32_t ulPos ; + static int enabled = 0; + uint32_t config; + uint32_t pos; // Assign pin to EIC - if ( pinPeripheral(ulPin, PIO_EXTINT) != RET_STATUS_OK ) - { - return ; - } + if ( pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK ) + return; - if ( !enabled ) - { - __initialize() ; - enabled = 1 ; + if (!enabled) { + __initialize(); + enabled = 1; } // Assign callback to interrupt - callbacksInt[digitalPinToInterrupt( ulPin )]._ulPin = ulPin ; - callbacksInt[digitalPinToInterrupt( ulPin )]._callback = callback ; + callbacksInt[digitalPinToInterrupt(pin)]._ulPin = pin; + callbacksInt[digitalPinToInterrupt(pin)]._callback = callback; // Check if normal interrupt or NMI - if ( digitalPinToInterrupt( ulPin ) != EXTERNAL_INT_NMI ) +if ( digitalPinToInterrupt( pin ) != EXTERNAL_INT_NMI ) { // Look for right CONFIG register to be addressed - if ( digitalPinToInterrupt( ulPin ) > EXTERNAL_INT_7 ) - { - ulConfig = 1 ; - } - else - { - ulConfig = 0 ; + if (digitalPinToInterrupt(pin) > EXTERNAL_INT_7) { + config = 1; + } else { + config = 0; } // Configure the interrupt mode - ulPos = ((digitalPinToInterrupt( ulPin ) - (8*ulConfig) ) << 2) ; - switch ( ulMode ) + pos = ((digitalPinToInterrupt(pin) - (8 * config)) << 2); + switch (mode) { case LOW: - EIC->CONFIG[ulConfig].reg |= EIC_CONFIG_SENSE0_LOW_Val << ulPos ; - break ; + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_LOW_Val << pos; + break; case HIGH: - // EIC->CONFIG[ulConfig].reg = EIC_CONFIG_SENSE0_HIGH_Val << ((digitalPinToInterrupt( ulPin ) >> ulConfig ) << ulPos) ; - EIC->CONFIG[ulConfig].reg |= EIC_CONFIG_SENSE0_HIGH_Val << ulPos ; - break ; + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_HIGH_Val << pos; + break; case CHANGE: - // EIC->CONFIG[ulConfig].reg = EIC_CONFIG_SENSE0_BOTH_Val << ((digitalPinToInterrupt( ulPin ) >> ulConfig ) << ulPos) ; - EIC->CONFIG[ulConfig].reg |= EIC_CONFIG_SENSE0_BOTH_Val << ulPos ; - break ; + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_BOTH_Val << pos; + break; case FALLING: - // EIC->CONFIG[ulConfig].reg = EIC_CONFIG_SENSE0_FALL_Val << ((digitalPinToInterrupt( ulPin ) >> ulConfig ) << ulPos) ; - EIC->CONFIG[ulConfig].reg |= EIC_CONFIG_SENSE0_FALL_Val << ulPos ; - break ; + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_FALL_Val << pos; + break; case RISING: - // EIC->CONFIG[ulConfig].reg = EIC_CONFIG_SENSE0_RISE_Val << ((digitalPinToInterrupt( ulPin ) >> ulConfig ) << ulPos) ; - EIC->CONFIG[ulConfig].reg |= EIC_CONFIG_SENSE0_RISE_Val << ulPos ; - break ; + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_RISE_Val << pos; + break; } // Enable the interrupt - EIC->INTENSET.reg = EIC_INTENSET_EXTINT( 1 << digitalPinToInterrupt( ulPin ) ) ; + EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << digitalPinToInterrupt(pin)); } else // Handles NMI { // Configure the interrupt mode - switch ( ulMode ) + switch (mode) { case LOW: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_LOW ; - break ; + EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_LOW; + break; case HIGH: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_HIGH ; - break ; + EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_HIGH; + break; case CHANGE: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_BOTH ; - break ; + EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_BOTH; + break; case FALLING: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_FALL ; - break ; + EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_FALL; + break; case RISING: - EIC->NMICTRL.reg= EIC_NMICTRL_NMISENSE_RISE ; - break ; + EIC->NMICTRL.reg= EIC_NMICTRL_NMISENSE_RISE; + break; } } } From efe46322d482d10f37e8dfe75f779dc5f9c608c4 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 15:20:26 +0200 Subject: [PATCH 028/124] NMI interrupts are now correctly ignored by attach/detachInterrupt Fixes #30 --- cores/arduino/WInterrupts.c | 123 +++++++++++------------------------- 1 file changed, 36 insertions(+), 87 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 63e44ec97..c427a0231 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -75,7 +75,9 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) uint32_t pos; // Assign pin to EIC - if ( pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK ) + if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) + return; + if (digitalPinToInterrupt(pin) == EXTERNAL_INT_NMI) return; if (!enabled) { @@ -87,91 +89,53 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) callbacksInt[digitalPinToInterrupt(pin)]._ulPin = pin; callbacksInt[digitalPinToInterrupt(pin)]._callback = callback; - // Check if normal interrupt or NMI -if ( digitalPinToInterrupt( pin ) != EXTERNAL_INT_NMI ) - { - // Look for right CONFIG register to be addressed - if (digitalPinToInterrupt(pin) > EXTERNAL_INT_7) { - config = 1; - } else { - config = 0; - } - - // Configure the interrupt mode - pos = ((digitalPinToInterrupt(pin) - (8 * config)) << 2); - switch (mode) - { - case LOW: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_LOW_Val << pos; - break; - - case HIGH: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_HIGH_Val << pos; - break; - - case CHANGE: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_BOTH_Val << pos; - break; - - case FALLING: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_FALL_Val << pos; - break; - - case RISING: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_RISE_Val << pos; - break; - } - - // Enable the interrupt - EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << digitalPinToInterrupt(pin)); + // Look for right CONFIG register to be addressed + if (digitalPinToInterrupt(pin) > EXTERNAL_INT_7) { + config = 1; + } else { + config = 0; } - else // Handles NMI + + // Configure the interrupt mode + pos = ((digitalPinToInterrupt(pin) - (8 * config)) << 2); + switch (mode) { - // Configure the interrupt mode - switch (mode) - { - case LOW: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_LOW; - break; + case LOW: + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_LOW_Val << pos; + break; - case HIGH: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_HIGH; - break; + case HIGH: + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_HIGH_Val << pos; + break; - case CHANGE: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_BOTH; - break; + case CHANGE: + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_BOTH_Val << pos; + break; - case FALLING: - EIC->NMICTRL.reg = EIC_NMICTRL_NMISENSE_FALL; - break; + case FALLING: + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_FALL_Val << pos; + break; - case RISING: - EIC->NMICTRL.reg= EIC_NMICTRL_NMISENSE_RISE; - break; - } + case RISING: + EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_RISE_Val << pos; + break; } + + // Enable the interrupt + EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << digitalPinToInterrupt(pin)); } /* * \brief Turns off the given interrupt. */ -void detachInterrupt( uint32_t ulPin ) +void detachInterrupt(uint32_t pin) { -/* - // Retrieve pin information - Pio *pio = g_APinDescription[pin].pPort; - uint32_t mask = g_APinDescription[pin].ulPin; - - // Disable interrupt - pio->PIO_IDR = mask; -*/ - if ( digitalPinToInterrupt( ulPin ) == NOT_AN_INTERRUPT ) - { - return ; - } + if (digitalPinToInterrupt(pin) == NOT_AN_INTERRUPT) + return; + if (digitalPinToInterrupt(pin) == EXTERNAL_INT_NMI) + return; - EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT( 1 << digitalPinToInterrupt( ulPin ) ) ; + EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << digitalPinToInterrupt(pin)); } /* @@ -198,21 +162,6 @@ void EIC_Handler( void ) } } -/* - * External Non-Maskable Interrupt Controller NVIC Interrupt Handler - */ -void NMI_Handler( void ) -{ - // Call the callback function if assigned - if ( callbacksInt[EXTERNAL_INT_NMI]._callback != NULL ) - { - callbacksInt[EXTERNAL_INT_NMI]._callback() ; - } - - // Clear the interrupt - EIC->NMIFLAG.reg = EIC_NMIFLAG_NMI ; -} - #ifdef __cplusplus } #endif From 54884205ad7846039362f9956e30ef00853018bb Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 15:35:38 +0200 Subject: [PATCH 029/124] Simplified "callbacksInt" structure in WInterrupts.c --- cores/arduino/WInterrupts.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index c427a0231..33ed009e9 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -25,16 +25,12 @@ extern "C" { #endif -static struct -{ - uint32_t _ulPin ; - voidFuncPtr _callback ; -} callbacksInt[EXTERNAL_NUM_INTERRUPTS] ; +static voidFuncPtr callbacksInt[EXTERNAL_NUM_INTERRUPTS]; /* Configure I/O interrupt sources */ static void __initialize() { - memset( callbacksInt, 0, sizeof( callbacksInt ) ) ; + memset(callbacksInt, 0, sizeof(callbacksInt)); NVIC_DisableIRQ( EIC_IRQn ) ; NVIC_ClearPendingIRQ( EIC_IRQn ) ; @@ -86,8 +82,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) } // Assign callback to interrupt - callbacksInt[digitalPinToInterrupt(pin)]._ulPin = pin; - callbacksInt[digitalPinToInterrupt(pin)]._callback = callback; + callbacksInt[digitalPinToInterrupt(pin)] = callback; // Look for right CONFIG register to be addressed if (digitalPinToInterrupt(pin) > EXTERNAL_INT_7) { @@ -151,9 +146,8 @@ void EIC_Handler( void ) if ( (EIC->INTFLAG.reg & ( 1 << ul ) ) != 0 ) { // Call the callback function if assigned - if ( callbacksInt[ul]._callback != NULL ) - { - callbacksInt[ul]._callback() ; + if (callbacksInt[ul]) { + callbacksInt[ul](); } // Clear the interrupt From ebad10abffa73b8ce874939e97429595a77640ab Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 17:16:21 +0200 Subject: [PATCH 030/124] Cosmetic changes in WInterrupt.* --- cores/arduino/WInterrupts.c | 39 +++++++++++++------------------------ cores/arduino/WInterrupts.h | 35 +++++---------------------------- cores/arduino/WVariant.h | 2 +- 3 files changed, 20 insertions(+), 56 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 33ed009e9..2bb9ef418 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -32,32 +32,23 @@ static void __initialize() { memset(callbacksInt, 0, sizeof(callbacksInt)); - NVIC_DisableIRQ( EIC_IRQn ) ; - NVIC_ClearPendingIRQ( EIC_IRQn ) ; - NVIC_SetPriority( EIC_IRQn, 0 ) ; - NVIC_EnableIRQ( EIC_IRQn ) ; + NVIC_DisableIRQ(EIC_IRQn); + NVIC_ClearPendingIRQ(EIC_IRQn); + NVIC_SetPriority(EIC_IRQn, 0); + NVIC_EnableIRQ(EIC_IRQn); // Enable GCLK for IEC (External Interrupt Controller) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_EIC )) ; + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_EIC)); /* Shall we do that? // Do a software reset on EIC EIC->CTRL.SWRST.bit = 1 ; - - while ( (EIC->CTRL.SWRST.bit == 1) && (EIC->STATUS.SYNCBUSY.bit == 1) ) - { - // Waiting for synchronisation - } + while ((EIC->CTRL.SWRST.bit == 1) && (EIC->STATUS.SYNCBUSY.bit == 1)) { } */ // Enable EIC - EIC->CTRL.bit.ENABLE = 1 ; - - while ( EIC->STATUS.bit.SYNCBUSY == 1 ) - { - // Waiting for synchronisation - } - + EIC->CTRL.bit.ENABLE = 1; + while (EIC->STATUS.bit.SYNCBUSY == 1) { } } /* @@ -136,22 +127,20 @@ void detachInterrupt(uint32_t pin) /* * External Interrupt Controller NVIC Interrupt Handler */ -void EIC_Handler( void ) +void EIC_Handler(void) { - uint32_t ul ; - // Test the normal interrupts - for ( ul = EXTERNAL_INT_0 ; ul < (EXTERNAL_NUM_INTERRUPTS - 1) ; ul++ ) + for (uint32_t i=EXTERNAL_INT_0; i<=EXTERNAL_NUM_INTERRUPTS; i++) { - if ( (EIC->INTFLAG.reg & ( 1 << ul ) ) != 0 ) + if ((EIC->INTFLAG.reg & (1 << i)) != 0) { // Call the callback function if assigned - if (callbacksInt[ul]) { - callbacksInt[ul](); + if (callbacksInt[i]) { + callbacksInt[i](); } // Clear the interrupt - EIC->INTFLAG.reg = 1 << ul ; + EIC->INTFLAG.reg = 1 << i; } } } diff --git a/cores/arduino/WInterrupts.h b/cores/arduino/WInterrupts.h index 8314dff24..5d2b24a0d 100644 --- a/cores/arduino/WInterrupts.h +++ b/cores/arduino/WInterrupts.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 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 @@ -31,49 +31,24 @@ extern "C" { #define FALLING 3 #define RISING 4 -///* - //* Interrupt modes - //* The two first values are conflicting with the ones used by Digital API, so we use another name for each. - //*/ -//typedef enum _EExt_IntMode -//{ - //IM_LOW = 0, - //IM_HIGH = 1, - //CHANGE = 2, - //FALLING = 3, - //RISING = 4, - //IM_CHANGE = 2, - //IM_FALLING = 3, - //IM_RISING = 4, -//} EExt_IntMode ; - #define DEFAULT 1 #define EXTERNAL 0 -typedef void (*voidFuncPtr)( void ) ; +typedef void (*voidFuncPtr)(void); /* * \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. * Replaces any previous function that was attached to the interrupt. */ -//void attachInterrupt( uint32_t ulPin, void (*callback)(void), EExt_IntMode mode ) ; -//void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, EExt_IntMode mode ) ; -void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, uint32_t mode ) ; +void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode); /* * \brief Turns off the given interrupt. */ -void detachInterrupt( uint32_t ulPin ) ; +void detachInterrupt(uint32_t pin); #ifdef __cplusplus } #endif -//#ifdef __cplusplus -//inline operator ::EExt_IntMode( uint32_t ul ) -//{ - //return (EExt_IntMode)ul ; -//} -//#endif - -#endif /* _WIRING_INTERRUPTS_ */ +#endif diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index 84ad85c7b..ddeec4e71 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -106,7 +106,7 @@ typedef enum _EPortType } EPortType ; /* The D11 has only INT 0 though 7 (the SAMD11C14A lacks INT 0 as well */ -typedef enum _EExt_Interrupts +typedef enum { EXTERNAL_INT_0 = 0, EXTERNAL_INT_1, From 03aa3ce15f0dbd96c3f32ee214a3b3fa5439e27a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 17:17:22 +0200 Subject: [PATCH 031/124] Removed redundant #ifdef __cplusplus in WInterrupts.c --- cores/arduino/WInterrupts.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 2bb9ef418..427cfc312 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -21,10 +21,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - static voidFuncPtr callbacksInt[EXTERNAL_NUM_INTERRUPTS]; /* Configure I/O interrupt sources */ @@ -144,7 +140,3 @@ void EIC_Handler(void) } } } - -#ifdef __cplusplus -} -#endif From 9405f1aff7ab9d5cd84ef1bbc9558f0d67a2304b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 4 Sep 2015 17:21:19 +0200 Subject: [PATCH 032/124] WInterrupts: optimized use of digitalPinToInterrupt() --- cores/arduino/WInterrupts.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 427cfc312..7fa70c61f 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -60,7 +60,9 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) // Assign pin to EIC if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) return; - if (digitalPinToInterrupt(pin) == EXTERNAL_INT_NMI) + + EExt_Interrupts in = digitalPinToInterrupt(pin); + if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; if (!enabled) { @@ -69,17 +71,17 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) } // Assign callback to interrupt - callbacksInt[digitalPinToInterrupt(pin)] = callback; + callbacksInt[in] = callback; // Look for right CONFIG register to be addressed - if (digitalPinToInterrupt(pin) > EXTERNAL_INT_7) { + if (in > EXTERNAL_INT_7) { config = 1; } else { config = 0; } // Configure the interrupt mode - pos = ((digitalPinToInterrupt(pin) - (8 * config)) << 2); + pos = (in - (8 * config)) << 2; switch (mode) { case LOW: @@ -104,7 +106,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) } // Enable the interrupt - EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << digitalPinToInterrupt(pin)); + EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << in); } /* @@ -112,12 +114,11 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) */ void detachInterrupt(uint32_t pin) { - if (digitalPinToInterrupt(pin) == NOT_AN_INTERRUPT) - return; - if (digitalPinToInterrupt(pin) == EXTERNAL_INT_NMI) + EExt_Interrupts in = digitalPinToInterrupt(pin); + if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; - EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << digitalPinToInterrupt(pin)); + EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << in); } /* From 8972f1e0476fe157ee86cc0af1016797df07177b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 25 Jun 2015 19:13:16 +0200 Subject: [PATCH 033/124] USB device refactoring (WIP) --- cores/arduino/USB/CDC.cpp | 141 ++-- cores/arduino/USB/HID.cpp | 31 +- cores/arduino/USB/SAMD21_USBDevice.h | 197 +++++ cores/arduino/USB/USBAPI.h | 134 +-- cores/arduino/USB/USBCore.cpp | 1125 ++++++++++++++------------ cores/arduino/USB/USBCore.h | 12 +- cores/arduino/USB/USBDesc.h | 2 +- cores/arduino/USB/USB_device.h | 63 -- cores/arduino/USB/USB_host.h | 2 +- cores/arduino/USB/USB_interrupt.c | 23 - cores/arduino/USB/samd21_device.h | 108 --- cores/arduino/USB/samd21_host.c | 7 +- cores/arduino/USB/samd21_host.h | 24 +- 13 files changed, 997 insertions(+), 872 deletions(-) create mode 100644 cores/arduino/USB/SAMD21_USBDevice.h delete mode 100644 cores/arduino/USB/USB_device.h delete mode 100644 cores/arduino/USB/USB_interrupt.c delete mode 100644 cores/arduino/USB/samd21_device.h diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 33c7b7e86..c0e61a893 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 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 @@ -16,22 +16,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include // Needed for auto-reset with 1200bps port touch + #include #include #include -// Include Atmel headers -#include "Arduino.h" -#include "sam.h" -#include "wiring_constants.h" -#include "USBCore.h" -#include "USB/USB_device.h" -#include "USBDesc.h" -#include "USBAPI.h" - -#include "Reset.h" - - #ifdef CDC_ENABLED #define CDC_SERIAL_BUFFER_SIZE 64 @@ -42,96 +33,93 @@ #define CDC_LINESTATE_READY (CDC_LINESTATE_RTS | CDC_LINESTATE_DTR) -struct ring_buffer -{ +struct ring_buffer { uint8_t buffer[CDC_SERIAL_BUFFER_SIZE]; volatile uint32_t head; volatile uint32_t tail; }; - ring_buffer cdc_rx_buffer = { { 0 }, 0, 0}; -typedef struct -{ - uint32_t dwDTERate; - uint8_t bCharFormat; - uint8_t bParityType; - uint8_t bDataBits; - uint8_t lineState; +typedef struct { + uint32_t dwDTERate; + uint8_t bCharFormat; + uint8_t bParityType; + uint8_t bDataBits; + uint8_t lineState; } LineInfo; _Pragma("pack(1)") static volatile LineInfo _usbLineInfo = { - 115200, // dWDTERate - 0x00, // bCharFormat - 0x00, // bParityType - 0x08, // bDataBits - 0x00 // lineState + 115200, // dWDTERate + 0x00, // bCharFormat + 0x00, // bParityType + 0x08, // bDataBits + 0x00 // lineState }; -static const CDCDescriptor _cdcInterface = -{ -#if (defined CDC_ENABLED) && defined(HID_ENABLED) +static const CDCDescriptor _cdcInterface = { + #if (defined CDC_ENABLED) && defined(HID_ENABLED) D_IAD(0, 2, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), -#endif - // CDC communication interface - D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0), - D_CDCCS( CDC_HEADER, CDC_V1_10 & 0xFF, (CDC_V1_10>>8) & 0x0FF ), // Header (1.10 bcd) - - D_CDCCS4(CDC_ABSTRACT_CONTROL_MANAGEMENT,6), // SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported - D_CDCCS(CDC_UNION,CDC_ACM_INTERFACE,CDC_DATA_INTERFACE), // Communication interface is master, data interface is slave 0 - D_CDCCS(CDC_CALL_MANAGEMENT,1,1), // Device handles call management (not) - D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_ACM),USB_ENDPOINT_TYPE_INTERRUPT,0x10, 0x10), - - // CDC data interface - D_INTERFACE(CDC_DATA_INTERFACE,2,CDC_DATA_INTERFACE_CLASS,0,0), - D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,EPX_SIZE,0), - D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,EPX_SIZE,0) + #endif + + // CDC communication interface + D_INTERFACE(CDC_ACM_INTERFACE, 1, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), + D_CDCCS(CDC_HEADER, CDC_V1_10 & 0xFF, (CDC_V1_10>>8) & 0x0FF), // Header (1.10 bcd) + + D_CDCCS4(CDC_ABSTRACT_CONTROL_MANAGEMENT, 6), // SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported + D_CDCCS(CDC_UNION, CDC_ACM_INTERFACE, CDC_DATA_INTERFACE), // Communication interface is master, data interface is slave 0 + D_CDCCS(CDC_CALL_MANAGEMENT, 1, 1), // Device handles call management (not) + D_ENDPOINT(USB_ENDPOINT_IN(CDC_ENDPOINT_ACM), USB_ENDPOINT_TYPE_INTERRUPT, 0x10, 0x10), + + // CDC data interface + D_INTERFACE(CDC_DATA_INTERFACE, 2, CDC_DATA_INTERFACE_CLASS, 0, 0), + D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT), USB_ENDPOINT_TYPE_BULK, EPX_SIZE, 0), + D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ), USB_ENDPOINT_TYPE_BULK, EPX_SIZE, 0) }; _Pragma("pack()") -const void* WEAK CDC_GetInterface(void) +const void* CDC_GetInterface(void) { - return &_cdcInterface; + return &_cdcInterface; } -uint32_t WEAK CDC_GetInterfaceLength(void) +uint32_t CDC_GetInterfaceLength(void) { - return sizeof( _cdcInterface ); + return sizeof(_cdcInterface); } -bool WEAK CDC_Setup(Setup& setup) +bool CDC_Setup(Setup& setup) { - uint8_t r = setup.bRequest; uint8_t requestType = setup.bmRequestType; + uint8_t r = setup.bRequest; - if (REQUEST_DEVICETOHOST_CLASS_INTERFACE == requestType) + if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { - if (CDC_GET_LINE_CODING == r) + if (r == CDC_GET_LINE_CODING) { - USBD_SendControl(0,(void*)&_usbLineInfo,7); + USBDevice.sendControl((void*)&_usbLineInfo, 7); return true; } } - if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType) + if (requestType == REQUEST_HOSTTODEVICE_CLASS_INTERFACE) { - if (CDC_SET_LINE_CODING == r) + if (r == CDC_SET_LINE_CODING) { - USBD_RecvControl((void*)&_usbLineInfo,7); + USBDevice.recvControl((void*)&_usbLineInfo, 7); } - if (CDC_SET_CONTROL_LINE_STATE == r) + if (r == CDC_SET_CONTROL_LINE_STATE) { _usbLineInfo.lineState = setup.wValueL; } - if (CDC_SET_LINE_CODING == r || CDC_SET_CONTROL_LINE_STATE == r) + if (r == CDC_SET_LINE_CODING || r == CDC_SET_CONTROL_LINE_STATE) { // auto-reset into the bootloader is triggered when the port, already // open at 1200 bps, is closed. We check DTR state to determine if host // port is open (bit 0 of lineState). - if (1200 == _usbLineInfo.dwDTERate && (_usbLineInfo.lineState & 0x01) == 0) + if (_usbLineInfo.dwDTERate == 1200 && (_usbLineInfo.lineState & 0x01) == 0) { initiateReset(250); } @@ -161,7 +149,7 @@ void Serial_::end(void) void Serial_::accept(void) { uint8_t buffer[CDC_SERIAL_BUFFER_SIZE]; - uint32_t len = USBD_Recv(CDC_ENDPOINT_OUT, (void*)&buffer, CDC_SERIAL_BUFFER_SIZE); + uint32_t len = usb.recv(CDC_ENDPOINT_OUT, &buffer, CDC_SERIAL_BUFFER_SIZE); noInterrupts(); ring_buffer *ringBuffer = &cdc_rx_buffer; @@ -173,7 +161,7 @@ void Serial_::accept(void) // and so we don't write the character or advance the head. uint32_t k = 0; i = (i + 1) % CDC_SERIAL_BUFFER_SIZE; - while (i != ringBuffer->tail && len>0) { + while ((i != ringBuffer->tail) && (len > 0)) { len--; ringBuffer->buffer[ringBuffer->head] = buffer[k++]; ringBuffer->head = i; @@ -185,6 +173,9 @@ void Serial_::accept(void) int Serial_::available(void) { ring_buffer *buffer = &cdc_rx_buffer; + if (buffer->head == buffer->tail) { + USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_TRCPT(1); + } return (uint32_t)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE; } @@ -202,12 +193,22 @@ int Serial_::peek(void) } } + +// if the ringBuffer is empty: try to fill it +// if it's still empty: return -1 +// else return the last char +// so the buffer is filled only when needed int Serial_::read(void) { ring_buffer *buffer = &cdc_rx_buffer; // if the head isn't ahead of the tail, we don't have any characters if (buffer->head == buffer->tail) + { + if (usb.available(CDC_ENDPOINT_OUT)) + accept(); + } + if (buffer->head == buffer->tail) { return -1; } @@ -215,15 +216,15 @@ int Serial_::read(void) { unsigned char c = buffer->buffer[buffer->tail]; buffer->tail = (uint32_t)(buffer->tail + 1) % CDC_SERIAL_BUFFER_SIZE; - if (USBD_Available(CDC_ENDPOINT_OUT)) - accept(); +// if (usb.available(CDC_ENDPOINT_OUT)) +// accept(); return c; } } void Serial_::flush(void) { - USBD_Flush(CDC_ENDPOINT_IN); + usb.flush(CDC_ENDPOINT_IN); } size_t Serial_::write(const uint8_t *buffer, size_t size) @@ -239,13 +240,11 @@ size_t Serial_::write(const uint8_t *buffer, size_t size) // or locks up, or host virtual serial port hangs) // if (_usbLineInfo.lineState > 0) // Problem with Windows(R) { - uint32_t r = USBD_Send(CDC_ENDPOINT_IN, buffer, size); + uint32_t r = usb.send(CDC_ENDPOINT_IN, buffer, size); - if (r > 0) - { + if (r > 0) { return r; - } else - { + } else { setWriteError(); return 0; } @@ -282,6 +281,6 @@ Serial_::operator bool() return result; } -Serial_ SerialUSB; +Serial_ SerialUSB(USBDevice); #endif diff --git a/cores/arduino/USB/HID.cpp b/cores/arduino/USB/HID.cpp index d8ce454b9..09b6402a7 100644 --- a/cores/arduino/USB/HID.cpp +++ b/cores/arduino/USB/HID.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 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 @@ -16,13 +16,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "USBAPI.h" -#include "Reset.h" -#include "USBCore.h" -#include "USBDesc.h" -#include "sam.h" -#include "USB/USB_device.h" - +#include #ifdef HID_ENABLED @@ -143,14 +137,12 @@ _Pragma("pack()") uint8_t _hid_protocol = 1; uint8_t _hid_idle = 1; -#define WEAK __attribute__ ((weak)) - -const void* WEAK HID_GetInterface(void) +const void* HID_GetInterface(void) { return &_hidInterface; } -uint32_t WEAK HID_GetInterfaceLength(void) +uint32_t HID_GetInterfaceLength(void) { return sizeof( _hidInterface ); } @@ -160,12 +152,12 @@ uint32_t HID_SizeReportDescriptor(void) return sizeof(_hidReportDescriptor); } -uint32_t WEAK HID_GetDescriptor(void) +uint32_t HID_GetDescriptor(void) { - return USBD_SendControl(0,_hidReportDescriptor,sizeof(_hidReportDescriptor)); + return USBDevice.sendControl(_hidReportDescriptor, sizeof(_hidReportDescriptor)); } -void WEAK HID_SendReport(uint8_t id, const void* data, uint32_t len) +void HID_SendReport(uint8_t id, const void* data, uint32_t len) { uint8_t p[8]; const uint8_t *d = reinterpret_cast(data); @@ -175,10 +167,10 @@ void WEAK HID_SendReport(uint8_t id, const void* data, uint32_t len) { p[i+1] = d[i]; } - USBD_Send(HID_ENDPOINT_INT, p, len+1); + USBDevice.send(HID_ENDPOINT_INT, p, len+1); } -bool WEAK HID_Setup(Setup& setup) +bool HID_Setup(Setup& setup) { uint8_t r = setup.bRequest; uint8_t requestType = setup.bmRequestType; @@ -197,8 +189,9 @@ bool WEAK HID_Setup(Setup& setup) } if (HID_GET_IDLE == r) { - UDD_Send(0, &_hid_idle, 1); - UDD_ClearIN(); + USBDevice.armSend(0, &_hid_idle, 1); + // RAM buffer is full, we can send data (IN) + USB->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.BK1RDY = 1; return true; } } diff --git a/cores/arduino/USB/SAMD21_USBDevice.h b/cores/arduino/USB/SAMD21_USBDevice.h new file mode 100644 index 000000000..203a1c787 --- /dev/null +++ b/cores/arduino/USB/SAMD21_USBDevice.h @@ -0,0 +1,197 @@ +/* + Copyright (c) 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 +*/ + +#pragma once + +#include + +#include +#include +#include + +typedef uint8_t ep_t; + +class USBDevice_SAMD21G18x { +public: + USBDevice_SAMD21G18x() : usb(USB->DEVICE) { + // Empty + } + + // USB Device function mapping + // --------------------------- + + // Reset USB Device + void reset(); + + // Enable + inline void enable() { usb.CTRLA.bit.ENABLE = 1; } + inline void disable() { usb.CTRLA.bit.ENABLE = 0; } + + // USB mode (device/host) + inline void setUSBDeviceMode() { usb.CTRLA.bit.MODE = USB_CTRLA_MODE_DEVICE_Val; } + inline void setUSBHostMode() { usb.CTRLA.bit.MODE = USB_CTRLA_MODE_HOST_Val; } + + inline void runInStandby() { usb.CTRLA.bit.RUNSTDBY = 1; } + inline void noRunInStandby() { usb.CTRLA.bit.RUNSTDBY = 0; } + + // USB speed + inline void setFullSpeed() { usb.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_FS_Val; } + inline void setLowSpeed() { usb.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_LS_Val; } + inline void setHiSpeed() { usb.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_HS_Val; } + inline void setHiSpeedTestMode() { usb.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_HSTM_Val; } + + // Authorize attach if Vbus is present + inline void attach() { usb.CTRLB.bit.DETACH = 0; } + inline void detach() { usb.CTRLB.bit.DETACH = 1; } + + // USB Interrupts + inline bool isEndOfResetInterrupt() { return usb.INTFLAG.bit.EORST; } + inline void ackEndOfResetInterrupt() { usb.INTFLAG.reg = USB_DEVICE_INTFLAG_EORST; } + inline void enableEndOfResetInterrupt() { usb.INTENSET.bit.EORST = 1; } + inline void disableEndOfResetInterrupt() { usb.INTENCLR.bit.EORST = 1; } + + inline bool isStartOfFrameInterrupt() { return usb.INTFLAG.bit.SOF; } + inline void ackStartOfFrameInterrupt() { usb.INTFLAG.reg = USB_DEVICE_INTFLAG_SOF; } + inline void enableStartOfFrameInterrupt() { usb.INTENSET.bit.SOF = 1; } + inline void disableStartOfFrameInterrupt() { usb.INTENCLR.bit.SOF = 1; } + + // USB Address + inline void setAddress(uint32_t addr) { usb.DADD.bit.DADD = addr; usb.DADD.bit.ADDEN = 1; } + inline void unsetAddress() { usb.DADD.bit.DADD = 0; usb.DADD.bit.ADDEN = 0; } + + // Frame number + inline uint16_t frameNumber() { return usb.FNUM.bit.FNUM; } + + // Load calibration values + void calibrate(); + + // USB Device Endpoints function mapping + // ------------------------------------- + + // Config + inline void epBank0SetType(ep_t ep, uint8_t type) { usb.DeviceEndpoint[ep].EPCFG.bit.EPTYPE0 = type; } + inline void epBank1SetType(ep_t ep, uint8_t type) { usb.DeviceEndpoint[ep].EPCFG.bit.EPTYPE1 = type; } + + // Interrupts + inline uint16_t epInterruptSummary() { return usb.EPINTSMRY.reg; } + + inline bool epBank0IsSetupReceived(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.RXSTP; } + inline bool epBank0IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL & 1; } + inline bool epBank1IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL & 2; } + inline bool epBank0IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT & 1; } + inline bool epBank1IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT & 2; } + + inline void epBank0AckSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP; } + inline void epBank0AckStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL(1); } + inline void epBank1AckStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL(2); } + inline void epBank0AckTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(1); } + inline void epBank1AckTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(2); } + + inline void epBank0EnableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.RXSTP = 1; } + inline void epBank0EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL = 1; } + inline void epBank1EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL = 2; } + inline void epBank0EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT = 1; } + inline void epBank1EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT = 2; } + + inline void epBank0DisableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.RXSTP = 1; } + inline void epBank0DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL = 1; } + inline void epBank1DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL = 2; } + inline void epBank0DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT = 1; } + inline void epBank1DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT = 2; } + + // Status + inline bool epBank0IsReady(ep_t ep) { return usb.DeviceEndpoint[ep].EPSTATUS.bit.BK0RDY; } + inline bool epBank1IsReady(ep_t ep) { return usb.DeviceEndpoint[ep].EPSTATUS.bit.BK1RDY; } + inline void epBank0SetReady(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.BK0RDY = 1; } + inline void epBank1SetReady(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.BK1RDY = 1; } + inline void epBank0ResetReady(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.BK0RDY = 1; } + inline void epBank1ResetReady(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.BK1RDY = 1; } + + inline void epBank0SetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.STALLRQ = 1; } + inline void epBank1SetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.STALLRQ = 2; } + inline void epBank0ResetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.STALLRQ = 1; } + inline void epBank1ResetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.STALLRQ = 2; } + + // Packet + inline uint16_t epBank0ByteCount(ep_t ep) { return EP[ep].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT; } + inline uint16_t epBank1ByteCount(ep_t ep) { return EP[ep].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT; } + inline void epBank0SetByteCount(ep_t ep, uint16_t bc) { EP[ep].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT = bc; } + inline void epBank1SetByteCount(ep_t ep, uint16_t bc) { EP[ep].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT = bc; } + inline void epBank0SetMultiPacketSize(ep_t ep, uint16_t s) { EP[ep].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = s; } + inline void epBank1SetMultiPacketSize(ep_t ep, uint16_t s) { EP[ep].DeviceDescBank[1].PCKSIZE.bit.MULTI_PACKET_SIZE = s; } + + inline void epBank0SetAddress(ep_t ep, void *addr) { EP[ep].DeviceDescBank[0].ADDR.reg = (uint32_t)addr; } + inline void epBank1SetAddress(ep_t ep, void *addr) { EP[ep].DeviceDescBank[1].ADDR.reg = (uint32_t)addr; } + inline void epBank0SetSize(ep_t ep, uint16_t size) { EP[ep].DeviceDescBank[0].PCKSIZE.bit.SIZE = EP_PCKSIZE_SIZE(size); } + inline void epBank1SetSize(ep_t ep, uint16_t size) { EP[ep].DeviceDescBank[1].PCKSIZE.bit.SIZE = EP_PCKSIZE_SIZE(size); } + inline uint8_t EP_PCKSIZE_SIZE(uint16_t size) { + switch (size) { + case 8: return 0; + case 16: return 1; + case 32: return 2; + case 64: return 3; + case 128: return 4; + case 256: return 5; + case 512: return 6; + case 1023: return 7; + default: return 0; + } + } + + inline void epBank0DisableAutoZLP(ep_t ep) { EP[ep].DeviceDescBank[0].PCKSIZE.bit.AUTO_ZLP = 0; } + inline void epBank1DisableAutoZLP(ep_t ep) { EP[ep].DeviceDescBank[1].PCKSIZE.bit.AUTO_ZLP = 0; } + inline void epBank0EnableAutoZLP(ep_t ep) { EP[ep].DeviceDescBank[0].PCKSIZE.bit.AUTO_ZLP = 1; } + inline void epBank1EnableAutoZLP(ep_t ep) { EP[ep].DeviceDescBank[1].PCKSIZE.bit.AUTO_ZLP = 1; } + +private: + // USB Device registers + UsbDevice &usb; + + // Endpoints descriptors table + __attribute__((__aligned__(4))) UsbDeviceDescriptor EP[USB_EPT_NUM]; +}; + +void USBDevice_SAMD21G18x::reset() { + usb.CTRLA.bit.SWRST = 1; + memset(EP, 0, sizeof(EP)); + while (usb.SYNCBUSY.bit.SWRST) {} + usb.DESCADD.reg = (uint32_t)(&EP); +} + +void USBDevice_SAMD21G18x::calibrate() { + // Load Pad Calibration data from non-volatile memory + uint32_t *pad_transn_p = (uint32_t *) USB_FUSES_TRANSN_ADDR; + uint32_t *pad_transp_p = (uint32_t *) USB_FUSES_TRANSP_ADDR; + uint32_t *pad_trim_p = (uint32_t *) USB_FUSES_TRIM_ADDR; + + uint32_t pad_transn = (*pad_transn_p & USB_FUSES_TRANSN_Msk) >> USB_FUSES_TRANSN_Pos; + uint32_t pad_transp = (*pad_transp_p & USB_FUSES_TRANSP_Msk) >> USB_FUSES_TRANSP_Pos; + uint32_t pad_trim = (*pad_trim_p & USB_FUSES_TRIM_Msk ) >> USB_FUSES_TRIM_Pos; + + if (pad_transn == 0x1F) // maximum value (31) + pad_transn = 5; + if (pad_transp == 0x1F) // maximum value (31) + pad_transp = 29; + if (pad_trim == 0x7) // maximum value (7) + pad_trim = 3; + + usb.PADCAL.bit.TRANSN = pad_transn; + usb.PADCAL.bit.TRANSP = pad_transp; + usb.PADCAL.bit.TRIM = pad_trim; +} + diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index 1229c3b71..b2d9d510b 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 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 @@ -16,8 +16,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __USBAPI__ -#define __USBAPI__ +#pragma once #define HSTPIPCFG_PTYPE_BLK 1 #define HSTPIPCFG_PTOKEN_IN 2 @@ -25,17 +24,8 @@ #define HSTPIPCFG_PBK_1_BANK 4 #define HSTPIPCFG_PTYPE_INTRPT 5 - - -/* Define attribute */ -#if defined ( __CC_ARM ) /* Keil uVision 4 */ - #define WEAK (__attribute__ ((weak))) -#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */ - #define WEAK __weak -#elif defined ( __GNUC__ ) /* GCC CS */ - #define WEAK __attribute__ ((weak)) -#endif - +#define EP0 0 +#define EPX_SIZE 64 // 64 for Full Speed, EPT size max is 1024 #if defined __cplusplus @@ -43,31 +33,81 @@ #include "RingBuffer.h" //================================================================================ -//================================================================================ -// USB +// USB -class USBDevice_ -{ +// Low level API +typedef struct { + union { + uint8_t bmRequestType; + struct { + uint8_t direction : 5; + uint8_t type : 2; + uint8_t transferDirection : 1; + }; + }; + uint8_t bRequest; + uint8_t wValueL; + uint8_t wValueH; + uint16_t wIndex; + uint16_t wLength; +} Setup; + +class USBDeviceClass { public: - USBDevice_(); - bool configured(); + USBDeviceClass() {}; - bool attach(); - bool detach(); // Serial port goes down too... - void poll(); + // USB Device API void init(); + bool attach(); + bool detach(); + void setAddress(uint32_t addr); + + bool configured(); + bool connected(); + + // Setup API + bool handleClassInterfaceSetup(Setup &setup); + bool handleStandardSetup(Setup &setup); + bool sendDescriptor(Setup &setup); + + // Control EndPoint API + uint32_t sendControl(const void *data, uint32_t len); + uint32_t recvControl(void *data, uint32_t len); + bool sendConfiguration(uint32_t maxlen); + bool sendStringDescriptor(const uint8_t *string, uint8_t maxlen); + + // Generic EndPoint API + void initEP(uint32_t ep, uint32_t type); + void handleEndpoint(uint8_t ep); + + uint32_t send(uint32_t ep, const void *data, uint32_t len); + void sendZlp(uint32_t ep); + uint32_t recv(uint32_t ep, void *data, uint32_t len); + uint32_t recv(uint32_t ep); + uint32_t available(uint32_t ep); + void flush(uint32_t ep); + void stall(uint32_t ep); + + // private? + uint32_t armSend(uint32_t ep, const void *data, uint32_t len); + uint8_t armRecv(uint32_t ep, uint32_t len); + uint8_t armRecvCtrlOUT(uint32_t ep, uint32_t len); + + void ISRHandler(); + +private: + bool initialized; }; -extern USBDevice_ USBDevice; -//================================================================================ +extern USBDeviceClass USBDevice; + //================================================================================ // Serial over CDC (Serial1 is the physical port) class Serial_ : public Stream { -private: - RingBuffer *_cdc_rx_buffer; public: + Serial_(USBDeviceClass &_usb) : usb(_usb) { } void begin(uint32_t baud_count); void begin(unsigned long, uint8_t); void end(void); @@ -81,6 +121,9 @@ class Serial_ : public Stream virtual size_t write(const uint8_t *buffer, size_t size); using Print::write; // pull in write(str) from Print operator bool(); +private: + USBDeviceClass &usb; + RingBuffer *_cdc_rx_buffer; }; extern Serial_ SerialUSB; @@ -175,26 +218,12 @@ class Keyboard_ : public Print }; extern Keyboard_ Keyboard; -//================================================================================ -//================================================================================ -// Low level API - -typedef struct -{ - uint8_t bmRequestType; - uint8_t bRequest; - uint8_t wValueL; - uint8_t wValueH; - uint16_t wIndex; - uint16_t wLength; -} Setup; - //================================================================================ //================================================================================ // HID 'Driver' -const void* WEAK HID_GetInterface(void); -uint32_t WEAK HID_GetInterfaceLength(void); +const void* HID_GetInterface(void); +uint32_t HID_GetInterfaceLength(void); uint32_t HID_SizeReportDescriptor(void); uint32_t HID_GetDescriptor(void); @@ -215,26 +244,9 @@ bool MSC_Data(uint8_t rx,uint8_t tx); // CDC 'Driver' const void* CDC_GetInterface(/*uint8_t* interfaceNum*/); -uint32_t WEAK CDC_GetInterfaceLength(void); +uint32_t CDC_GetInterfaceLength(void); uint32_t CDC_GetOtherInterface(uint8_t* interfaceNum); uint32_t CDC_GetDescriptor(uint32_t i); bool CDC_Setup(Setup& setup); -//================================================================================ -//================================================================================ - -uint32_t USBD_SendControl(uint8_t flags, const void* d, uint32_t len); -uint32_t USBD_RecvControl(void* d, uint32_t len); -uint32_t USBD_SendInterfaces(void); -bool USBD_ClassInterfaceRequest(Setup& setup); - -uint32_t USBD_Available(uint32_t ep); -uint32_t USBD_SendSpace(uint32_t ep); -uint32_t USBD_Send(uint32_t ep, const void* d, uint32_t len); -uint32_t USBD_Recv(uint32_t ep, void* data, uint32_t len); // non-blocking -uint32_t USBD_Recv(uint32_t ep); // non-blocking -void USBD_Flush(uint32_t ep); -uint32_t USBD_Connected(void); - #endif // __cplusplus -#endif // __USBAPI__ diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 31b8380af..cfcf101aa 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 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 @@ -16,14 +16,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "../Arduino.h" -#include "USBCore.h" -#include "USB/USB_device.h" // needed for USB PID define -#include "USBDesc.h" -#include "USBAPI.h" +#include -//#define TRACE_CORE(x) x -#define TRACE_CORE(x) +#include "SAMD21_USBDevice.h" + +#include +#include +#include + +USBDevice_SAMD21G18x usbd; static char isRemoteWakeUpEnabled = 0; static char isEndpointHalt = 0; @@ -50,184 +51,56 @@ const uint8_t STRING_PRODUCT[] = USB_PRODUCT; # define USB_MANUFACTURER "Unknown" #endif -const uint8_t STRING_MANUFACTURER[12] = USB_MANUFACTURER; +const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER; // DEVICE DESCRIPTOR #if (defined CDC_ENABLED) && defined(HID_ENABLED) -const DeviceDescriptor USB_DeviceDescriptor = - D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); +const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); #elif defined(CDC_ENABLED) // CDC only -const DeviceDescriptor USB_DeviceDescriptor = - D_DEVICE(0x02,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); +const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x02, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); #else // HID only -const DeviceDescriptor USB_DeviceDescriptor = - D_DEVICE(0,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); +const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); #endif //================================================================== volatile uint32_t _usbConfiguration = 0; -volatile uint32_t _usbInitialized = 0; volatile uint32_t _usbSetInterface = 0; -//================================================================== - - -// Number of bytes, assumes a rx endpoint -uint32_t USBD_Available(uint32_t ep) -{ - return UDD_FifoByteCount(ep); -} - -// Non Blocking receive -// Return number of bytes read -uint32_t USBD_Recv(uint32_t ep, void* d, uint32_t len) -{ - if (!_usbConfiguration) - return -1; - - uint8_t *buffer; - uint8_t *data = (uint8_t *)d; - - len = min(UDD_FifoByteCount(ep), len); - - UDD_Recv_data(ep, len); - UDD_Recv(ep, &buffer); - for (uint32_t i=0; i USBD_SendControl TOTAL len=%lu\r\n", len);) - - while (len > 0) - { - sent = UDD_Send(EP0, data + pos, len); - TRACE_CORE(printf("=> USBD_SendControl sent=%lu\r\n", sent);) - pos += sent; - len -= sent; - } - - return length; -} +//================================================================== // Send a USB descriptor string. The string is stored as a // plain ASCII string but is sent out as UTF-16 with the // correct 2-byte prefix -static bool USB_SendStringDescriptor(const uint8_t *string, int wLength) +bool USBDeviceClass::sendStringDescriptor(const uint8_t *string, uint8_t maxlen) { - uint16_t buff[64]; + if (maxlen < 2) + return false; + + uint16_t buff[maxlen/2]; int l = 1; - wLength -= 2; - while (*string && wLength>0) + maxlen -= 2; + while (*string && maxlen>0) { buff[l++] = (uint8_t)(*string++); - wLength -= 2; + maxlen -= 2; } buff[0] = (3<<8) | (l*2); - return USBD_SendControl(0, (uint8_t*)buff, l*2); + return USBDevice.sendControl((uint8_t*)buff, l*2); } -uint32_t USBD_RecvControl(void* d, uint32_t len) -{ - uint8_t *buffer; - uint8_t *data = (uint8_t *)d; - uint32_t read = UDD_Recv_data(EP0, len); - if (read > len) - read = len; - UDD_Recv(EP0, &buffer); - while (!udd_is_OUT_transf_cplt(EP0)); - for (uint32_t i=0; i USBD_ClassInterfaceRequest\r\n");) - -#ifdef CDC_ENABLED - if (CDC_ACM_INTERFACE == i) - { - if( CDC_Setup(setup) == false ) - { - send_zlp(); - } - return true; - } -#endif - -#ifdef HID_ENABLED - if (HID_INTERFACE == i) - { - if( HID_Setup(setup) == true ) - { - send_zlp(); - } - return true; - } -#endif - - return false; -} - -// Construct a dynamic configuration descriptor -// This really needs dynamic endpoint allocation etc -// TODO -static bool USBD_SendConfiguration(uint32_t maxlen) +// Construct a dynamic configuration descriptor +// This really needs dynamic endpoint allocation etc +bool USBDeviceClass::sendConfiguration(uint32_t maxlen) { uint8_t cache_buffer[128]; uint8_t i; @@ -238,494 +111,728 @@ static bool USBD_SendConfiguration(uint32_t maxlen) num_interfaces[0] = 0; -#if (defined CDC_ENABLED) && defined(HID_ENABLED) - num_interfaces[0] += 3; - interfaces = (const uint8_t*) CDC_GetInterface(); - interfaces_length = CDC_GetInterfaceLength() + HID_GetInterfaceLength(); - if( maxlen > CDC_GetInterfaceLength() + HID_GetInterfaceLength() + sizeof(ConfigDescriptor) ) - { - maxlen = CDC_GetInterfaceLength() + HID_GetInterfaceLength() + sizeof(ConfigDescriptor); - } - -#else -#ifdef CDC_ENABLED - num_interfaces[0] += 2; +#if defined(CDC_ENABLED) && defined(HID_ENABLED) + num_interfaces[0] += 3; + interfaces = (const uint8_t*) CDC_GetInterface(); + interfaces_length = CDC_GetInterfaceLength() + HID_GetInterfaceLength(); + if (maxlen > CDC_GetInterfaceLength() + HID_GetInterfaceLength() + sizeof(ConfigDescriptor)) + { + maxlen = CDC_GetInterfaceLength() + HID_GetInterfaceLength() + sizeof(ConfigDescriptor); + } +#elif defined(CDC_ENABLED) + num_interfaces[0] += 2; interfaces = (const uint8_t*) CDC_GetInterface(); interfaces_length += CDC_GetInterfaceLength(); - if( maxlen > CDC_GetInterfaceLength()+ sizeof(ConfigDescriptor) ) + if (maxlen > CDC_GetInterfaceLength() + sizeof(ConfigDescriptor)) { - maxlen = CDC_GetInterfaceLength()+ sizeof(ConfigDescriptor); + maxlen = CDC_GetInterfaceLength() + sizeof(ConfigDescriptor); } -#endif - -#ifdef HID_ENABLED - num_interfaces[0] += 1; +#elif defined(HID_ENABLED) + num_interfaces[0] += 1; interfaces = (const uint8_t*) HID_GetInterface(); interfaces_length += HID_GetInterfaceLength(); - if( maxlen > HID_GetInterfaceLength()+ sizeof(ConfigDescriptor) ) + if (maxlen > HID_GetInterfaceLength() + sizeof(ConfigDescriptor)) { - maxlen = HID_GetInterfaceLength()+ sizeof(ConfigDescriptor); + maxlen = HID_GetInterfaceLength() + sizeof(ConfigDescriptor); } #endif -#endif _Pragma("pack(1)") - ConfigDescriptor config = D_CONFIG((uint16_t)(interfaces_length + sizeof(ConfigDescriptor)),num_interfaces[0]); + ConfigDescriptor config = D_CONFIG((uint16_t)(interfaces_length + sizeof(ConfigDescriptor)), num_interfaces[0]); _Pragma("pack()") - memcpy( cache_buffer, &config, sizeof(ConfigDescriptor) ); + memcpy(cache_buffer, &config, sizeof(ConfigDescriptor)); -#if (defined CDC_ENABLED) && defined(HID_ENABLED) - for ( i=0; i sizeof(cache_buffer)) - { + if (maxlen > sizeof(cache_buffer)) { maxlen = sizeof(cache_buffer); } - USBD_SendControl(0,cache_buffer, maxlen ); - return true; + return sendControl(cache_buffer, maxlen); } -static bool USBD_SendDescriptor(Setup* pSetup) +bool USBDeviceClass::sendDescriptor(Setup &setup) { - uint8_t t = pSetup->wValueH; + uint8_t t = setup.wValueH; uint8_t desc_length = 0; - const uint8_t* desc_addr = 0; + const uint8_t *desc_addr = 0; - if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t) + if (t == USB_CONFIGURATION_DESCRIPTOR_TYPE) { - TRACE_CORE(printf("=> USBD_SendDescriptor : USB_CONFIGURATION_DESCRIPTOR_TYPE length=%d\r\n", setup.wLength);) - return USBD_SendConfiguration(pSetup->wLength); + return USBDevice.sendConfiguration(setup.wLength); } -#ifdef HID_ENABLED - if (HID_REPORT_DESCRIPTOR_TYPE == t) +#if defined(HID_ENABLED) + if (t == HID_REPORT_DESCRIPTOR_TYPE) { - TRACE_CORE(puts("=> USBD_SendDescriptor : HID_REPORT_DESCRIPTOR_TYPE\r\n");) return HID_GetDescriptor(); } - if (HID_HID_DESCRIPTOR_TYPE == t) + + if (t == HID_HID_DESCRIPTOR_TYPE) { uint8_t tab[9] = D_HIDREPORT((uint8_t)HID_SizeReportDescriptor()); - - TRACE_CORE(puts("=> USBD_SendDescriptor : HID_HID_DESCRIPTOR_TYPE\r\n");) - - return USBD_SendControl(0, tab, sizeof(tab)); + return USBDevice.sendControl(tab, sizeof(tab)); } #endif - if (USB_DEVICE_DESCRIPTOR_TYPE == t) + if (t == USB_DEVICE_DESCRIPTOR_TYPE) { - TRACE_CORE(puts("=> USBD_SendDescriptor : USB_DEVICE_DESCRIPTOR_TYPE\r\n");) desc_addr = (const uint8_t*)&USB_DeviceDescriptor; - if( *desc_addr > pSetup->wLength ) { - desc_length = pSetup->wLength; - } + if (*desc_addr > setup.wLength) { + desc_length = setup.wLength; + } } else if (USB_STRING_DESCRIPTOR_TYPE == t) { - TRACE_CORE(puts("=> USBD_SendDescriptor : USB_STRING_DESCRIPTOR_TYPE\r\n");) - if (pSetup->wValueL == 0) { + if (setup.wValueL == 0) { desc_addr = (const uint8_t*)&STRING_LANGUAGE; } - else if (pSetup->wValueL == IPRODUCT) { - return USB_SendStringDescriptor(STRING_PRODUCT, pSetup->wLength); + else if (setup.wValueL == IPRODUCT) { + return sendStringDescriptor(STRING_PRODUCT, setup.wLength); } - else if (pSetup->wValueL == IMANUFACTURER) { - return USB_SendStringDescriptor(STRING_MANUFACTURER, pSetup->wLength); + else if (setup.wValueL == IMANUFACTURER) { + return sendStringDescriptor(STRING_MANUFACTURER, setup.wLength); } else { return false; } - if( *desc_addr > pSetup->wLength ) { - desc_length = pSetup->wLength; + if (*desc_addr > setup.wLength) { + desc_length = setup.wLength; } } - else - { - TRACE_CORE(printf("Device ERROR");) - } - - if (desc_addr == 0) + else { + } + + if (desc_addr == 0) { return false; } - if (desc_length == 0) - { + if (desc_length == 0) { desc_length = *desc_addr; } - TRACE_CORE(printf("=> USBD_SendDescriptor : desc_addr=%p desc_length=%d\r\n", desc_addr, desc_length);) - USBD_SendControl(0, desc_addr, desc_length); + sendControl(desc_addr, desc_length); return true; } -void EndpointHandler(uint8_t bEndpoint) +void USBDeviceClass::handleEndpoint(uint8_t ep) { -#ifdef CDC_ENABLED - if( bEndpoint == CDC_ENDPOINT_OUT ) +#if defined(CDC_ENABLED) + if (ep == CDC_ENDPOINT_OUT) { - udd_OUT_transfer_allowed(CDC_ENDPOINT_OUT); + // The RAM Buffer is empty: we can receive data + //usbd.epBank0ResetReady(CDC_ENDPOINT_OUT); // Handle received bytes - if (USBD_Available(CDC_ENDPOINT_OUT)) - { + if (available(CDC_ENDPOINT_OUT)) SerialUSB.accept(); - } } - if( bEndpoint == CDC_ENDPOINT_IN ) + if (ep == CDC_ENDPOINT_IN) { - udd_IN_stop_transfer(CDC_ENDPOINT_IN); - /* Clear the transfer complete flag */ - udd_clear_IN_transf_cplt(CDC_ENDPOINT_IN); - + // NAK on endpoint IN, the bank is not yet filled in. + usbd.epBank1ResetReady(CDC_ENDPOINT_IN); + usbd.epBank1AckTransferComplete(CDC_ENDPOINT_IN); } - if( bEndpoint == CDC_ENDPOINT_ACM ) + if (ep == CDC_ENDPOINT_ACM) { - udd_IN_stop_transfer(CDC_ENDPOINT_ACM); - /* Clear the transfer complete flag */ - udd_clear_IN_transf_cplt(CDC_ENDPOINT_ACM); + // NAK on endpoint IN, the bank is not yet filled in. + usbd.epBank1ResetReady(CDC_ENDPOINT_ACM); + usbd.epBank1AckTransferComplete(CDC_ENDPOINT_ACM); } #endif -#ifdef HID_ENABLED - /* Nothing to do in our example */ +#if defined(HID_ENABLED) + // Empty #endif } +void USBDeviceClass::init() +{ + // Enable USB clock + PM->APBBMASK.reg |= PM_APBBMASK_USB; + + // Set up the USB DP/DN pins + PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; + PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg &= ~(0xF << (4 * (PIN_PA24G_USB_DM & 0x01u))); + PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg |= MUX_PA24G_USB_DM << (4 * (PIN_PA24G_USB_DM & 0x01u)); + PORT->Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PMUXEN = 1; + PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg &= ~(0xF << (4 * (PIN_PA25G_USB_DP & 0x01u))); + PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); + + // Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) + GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(6) | // Generic Clock Multiplexer 6 + GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source + GCLK_CLKCTRL_CLKEN; + while (GCLK->STATUS.bit.SYNCBUSY) + ; + + // Reset USB Device + usbd.reset(); + + usbd.calibrate(); + usbd.setUSBDeviceMode(); + usbd.runInStandby(); + usbd.setFullSpeed(); + + // Configure interrupts + NVIC_SetPriority((IRQn_Type) USB_IRQn, 0UL); + NVIC_EnableIRQ((IRQn_Type) USB_IRQn); + + usbd.enable(); + + initialized = true; +} -void USB_ISR(void) +bool USBDeviceClass::attach() { - uint16_t flags; - uint8_t i; - uint8_t ept_int; + if (!initialized) + return false; - ept_int = udd_endpoint_interrupt(); + usbd.attach(); + usbd.enableEndOfResetInterrupt(); + usbd.enableStartOfFrameInterrupt(); - /* Not endpoint interrupt */ - if (0 == ept_int) - { - udd_clear_wakeup_interrupt(); - udd_clear_eorsm_interrupt(); - udd_clear_suspend_interrupt(); + _usbConfiguration = 0; + return true; +} - // End of bus reset - if (Is_udd_reset()) - { - TRACE_CORE(printf(">>> End of Reset\r\n");) - // Reset USB address to 0 - udd_configure_address(0); - - // Configure EP 0 - UDD_InitEP(0, USB_ENDPOINT_TYPE_CONTROL); - udd_enable_setup_received_interrupt(0); - _usbConfiguration = 0; - udd_ack_reset(); +void USBDeviceClass::setAddress(uint32_t addr) +{ + usbd.epBank1SetByteCount(0, 0); + usbd.epBank1AckTransferComplete(0); + + // RAM buffer is full, we can send data (IN) + usbd.epBank1SetReady(0); + + // Wait for transfer to complete + while (!usbd.epBank1IsTransferComplete(0)) {} + + // Set USB address to addr + USB->DEVICE.DADD.bit.DADD = addr; // Address + USB->DEVICE.DADD.bit.ADDEN = 1; // Enable +} + +bool USBDeviceClass::detach() +{ + if (!initialized) + return false; + usbd.detach(); + return true; +} + +bool USBDeviceClass::configured() +{ + return _usbConfiguration != 0; +} + +bool USBDeviceClass::handleClassInterfaceSetup(Setup& setup) +{ + uint8_t i = setup.wIndex; + + #if defined(CDC_ENABLED) + if (CDC_ACM_INTERFACE == i) + { + if (CDC_Setup(setup) == false) { + sendZlp(0); } + return true; + } + #endif - if (Is_udd_sof()) - { - udd_ack_sof(); + #if defined(HID_ENABLED) + if (HID_INTERFACE == i) + { + if (HID_Setup(setup) == true) { + sendZlp(0); } + return true; + } + #endif + return false; +} + +void USBDeviceClass::initEP(uint32_t ep, uint32_t config) +{ + if (config == (USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0))) + { + usbd.epBank1SetSize(ep, 8); + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); + usbd.epBank1SetType(ep, 4); // INTERRUPT IN } - else + else if (config == (USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0))) { - // Endpoint interrupt - flags = udd_read_endpoint_flag(0); + usbd.epBank0SetSize(ep, 64); + usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[ep]); + usbd.epBank0SetType(ep, 3); // BULK OUT + + // Release OUT EP + usbd.epBank0SetMultiPacketSize(ep, 64); + usbd.epBank0SetByteCount(ep, 0); + + // The RAM Buffer is empty: we can receive data + //usbd.epBank0ResetReady(ep); + } + else if (config == (USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0))) + { + usbd.epBank1SetSize(ep, 64); + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); - // endpoint received setup interrupt - if (flags & USB_DEVICE_EPINTFLAG_RXSTP) - { - Setup *pSetupData; + // NAK on endpoint IN, the bank is not yet filled in. + usbd.epBank1ResetReady(ep); - /* Clear the Received Setup flag */ - udd_read_endpoint_flag(0) = USB_DEVICE_EPINTFLAG_RXSTP; + usbd.epBank1SetType(ep, 3); // BULK IN + } + else if (config == USB_ENDPOINT_TYPE_CONTROL) + { + // XXX: Needed? + usbd.epBank0DisableAutoZLP(ep); + usbd.epBank1DisableAutoZLP(ep); + + // Setup Control OUT + usbd.epBank0SetSize(ep, 64); + usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[0]); + usbd.epBank0SetType(ep, 1); // CONTROL OUT / SETUP + + // Setup Control IN + usbd.epBank1SetSize(ep, 64); + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[0]); + usbd.epBank1SetType(ep, 1); // CONTROL IN + + // Release OUT EP + usbd.epBank0SetMultiPacketSize(ep, 64); + usbd.epBank0SetByteCount(ep, 0); + + // NAK on endpoint OUT, the bank is full. + usbd.epBank0SetReady(ep); + // NAK on endpoint IN, the bank is not yet filled in. + //usbd.epBank1ResetReady(ep); + } +} - UDD_Recv(EP0, (uint8_t**)&pSetupData); +void USBDeviceClass::flush(uint32_t ep) +{ + if (available(ep)) { + // RAM buffer is full, we can send data (IN) + usbd.epBank1SetReady(ep); - /* Clear the Bank 0 ready flag on Control OUT */ - udd_OUT_transfer_allowed(0); + // Clear the transfer complete flag + usbd.epBank1AckTransferComplete(ep); + } +} - bool ok = true; - if (REQUEST_STANDARD == (pSetupData->bmRequestType & REQUEST_TYPE)) - { - unsigned char data_to_be_send[2]; - - // Standard Requests - uint8_t r = pSetupData->bRequest; - if (GET_STATUS == r) - { - if( pSetupData->bmRequestType == 0 ) // device - { - // Send the device status - TRACE_CORE(puts(">>> EP0 Int: GET_STATUS\r\n");) - // Check current configuration for power mode (if device is configured) - // TODO - // Check if remote wake-up is enabled - // TODO - data_to_be_send[0]=0; - data_to_be_send[1]=0; - UDD_Send(0, data_to_be_send, 2); - } - // if( pSetupData->bmRequestType == 2 ) // Endpoint: - else - { - // Send the endpoint status - // Check if the endpoint if currently halted - if( isEndpointHalt == 1 ) - data_to_be_send[0]=1; - else - data_to_be_send[0]=0; - data_to_be_send[1]=0; - UDD_Send(0, data_to_be_send, 2); - } - } - else if (CLEAR_FEATURE == r) - { - // Check which is the selected feature - if( pSetupData->wValueL == 1) // DEVICEREMOTEWAKEUP - { - // Enable remote wake-up and send a ZLP - if( isRemoteWakeUpEnabled == 1 ) - data_to_be_send[0]=1; - else - data_to_be_send[0]=0; - data_to_be_send[1]=0; - UDD_Send(0, data_to_be_send, 2); - } - else // if( pSetupData->wValueL == 0) // ENDPOINTHALT - { - isEndpointHalt = 0; - send_zlp(); - } - } - else if (SET_FEATURE == r) - { - // Check which is the selected feature - if( pSetupData->wValueL == 1) // DEVICEREMOTEWAKEUP - { - // Enable remote wake-up and send a ZLP - isRemoteWakeUpEnabled = 1; - data_to_be_send[0] = 0; - UDD_Send(0, data_to_be_send, 1); - } - if( pSetupData->wValueL == 0) // ENDPOINTHALT - { - // Halt endpoint - isEndpointHalt = 1; - send_zlp(); - } - } - else if (SET_ADDRESS == r) - { - TRACE_CORE(puts(">>> EP0 Int: SET_ADDRESS\r\n");) - UDD_SetAddress(pSetupData->wValueL); - } - else if (GET_DESCRIPTOR == r) - { - TRACE_CORE(puts(">>> EP0 Int: GET_DESCRIPTOR\r\n");) - ok = USBD_SendDescriptor(pSetupData); - } - else if (SET_DESCRIPTOR == r) - { - TRACE_CORE(puts(">>> EP0 Int: SET_DESCRIPTOR\r\n");) - ok = false; - } - else if (GET_CONFIGURATION == r) - { - TRACE_CORE(puts(">>> EP0 Int: GET_CONFIGURATION\r\n");) - UDD_Send(0, (void*)&_usbConfiguration, 1); - } - else if (SET_CONFIGURATION == r) - { - if (REQUEST_DEVICE == (pSetupData->bmRequestType & REQUEST_RECIPIENT)) - { - TRACE_CORE(printf(">>> EP0 Int: SET_CONFIGURATION REQUEST_DEVICE %d\r\n", pSetupData->wValueL);) -#ifdef HID_ENABLED - UDD_InitEP( HID_ENDPOINT_INT, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); -#endif +void USBDeviceClass::stall(uint32_t ep) +{ + // TODO: test + // TODO: use .bit. notation -#ifdef CDC_ENABLED - UDD_InitEP( CDC_ENDPOINT_ACM, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0)); - UDD_InitEP( CDC_ENDPOINT_OUT, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0)); - UDD_InitEP( CDC_ENDPOINT_IN, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); -#endif - _usbConfiguration = pSetupData->wValueL; + // Stall endpoint + USB->DEVICE.DeviceEndpoint[ep].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ(2); +} -#ifdef CDC_ENABLED - // Enable interrupt for CDC reception from host (OUT packet) - udd_ept_enable_it_IN_transf_cplt(CDC_ENDPOINT_ACM); - udd_ept_enable_it_OUT_transf_cplt(CDC_ENDPOINT_OUT); -#endif - send_zlp(); - } - else - { - TRACE_CORE(puts(">>> EP0 Int: SET_CONFIGURATION failed!\r\n");) - ok = false; - } - } - else if (GET_INTERFACE == r) - { - TRACE_CORE(puts(">>> EP0 Int: GET_INTERFACE\r\n");) - UDD_Send(0, (void*)&_usbSetInterface, 1); - } - else if (SET_INTERFACE == r) - { - _usbSetInterface = pSetupData->wValueL; - TRACE_CORE(puts(">>> EP0 Int: SET_INTERFACE\r\n");) - send_zlp(); - } - } - else - { - TRACE_CORE(puts(">>> EP0 Int: ClassInterfaceRequest\r\n");) - ok = USBD_ClassInterfaceRequest(*pSetupData); - } +bool USBDeviceClass::connected() +{ + // Count frame numbers + uint8_t f = USB->DEVICE.FNUM.bit.FNUM; + //delay(3); + return f != USB->DEVICE.FNUM.bit.FNUM; +} - if (ok) - { - TRACE_CORE(puts(">>> EP0 Int: Send packet\r\n");) - UDD_ClearIN(); - } - else - { - TRACE_CORE(puts(">>> EP0 Int: Stall\r\n");) - UDD_Stall(0); - } - if( flags & USB_DEVICE_EPINTFLAG_STALL(2) ) - { - /* Clear the stall flag */ - udd_clear_stall_request(0); +uint32_t USBDeviceClass::recvControl(void *_data, uint32_t len) +{ + uint8_t *data = reinterpret_cast(_data); +// NO RXOUT ??????? - // Remove stall request - udd_remove_stall_request(0); - } - } // end if USB_DEVICE_EPINTFLAG_RXSTP + // The RAM Buffer is empty: we can receive data + usbd.epBank0ResetReady(0); - i=0; - ept_int &= 0xFE; // Remove endpoint number 0 (setup) - while (ept_int != 0) - { - // Check if endpoint has a pending interrupt - if ((ept_int & (1 << i)) != 0) - { - if( (udd_read_endpoint_flag(i) & USB_DEVICE_EPINTFLAG_TRCPT_Msk ) != 0 ) + //usbd.epBank0AckSetupReceived(0); + uint32_t read = armRecvCtrlOUT(0, len); + if (read > len) + read = len; + //while (!usbd.epBank0AckTransferComplete(0)) {} + uint8_t *buffer = udd_ep_out_cache_buffer[0]; + for (uint32_t i=0; i USB_EPT_NUM) break; // fire exit - } + uint8_t *buffer = udd_ep_out_cache_buffer[ep]; + uint8_t *data = reinterpret_cast(_data); + for (uint32_t i=0; iDEVICE.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT == 0); + return usbd.epBank0ByteCount(ep); +} -void USBD_Flush(uint32_t ep) +uint8_t USBDeviceClass::armRecv(uint32_t ep, uint32_t len) { - if (UDD_FifoByteCount(ep)) - { - UDD_ReleaseTX(ep); + usbd.epBank0SetSize(ep, 64); + usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[ep]); + usbd.epBank0SetMultiPacketSize(ep, 64); // XXX: Should be "len"? + uint16_t count = usbd.epBank0ByteCount(ep); + if (count >= 64) { + usbd.epBank0SetByteCount(ep, count - 64); + } else { + usbd.epBank0SetByteCount(ep, 0); } + // The RAM Buffer is empty: we can receive data + //usbd.epBank0ResetReady(ep); + + // Wait for transfer to complete + //while (!usbd.epBank0IsTransferComplete(ep)) {} + //while (usbd.epBank0IsReady(ep)) {} + // NAK on endpoint OUT, the bank is full. + //usbd.epBank0ResetReady(ep); + + return usbd.epBank0ByteCount(ep); } -// Counting frames -uint32_t USBD_Connected(void) +// Blocking Send of data to an endpoint +uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) { - uint8_t f = UDD_GetFrameNumber(); + if (!_usbConfiguration) + return -1; + + armSend(ep, data, len); + + // Clear the transfer complete flag + usbd.epBank1AckTransferComplete(ep); - //delay(3); + // RAM buffer is full, we can send data (IN) + usbd.epBank1SetReady(ep); - return f != UDD_GetFrameNumber(); + // Wait for transfer to complete + while (!usbd.epBank1IsTransferComplete(ep)) { + ; // need fire exit. + } + return len; } +uint32_t USBDeviceClass::armSend(uint32_t ep, const void* data, uint32_t len) +{ + memcpy(&udd_ep_in_cache_buffer[ep], data, len); -//======================================================================= -//======================================================================= + // Get endpoint configuration from setting register + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); + usbd.epBank1SetMultiPacketSize(ep, 0); + usbd.epBank1SetByteCount(ep, len); -USBDevice_ USBDevice; + return len; +} -USBDevice_::USBDevice_() +uint32_t USBDeviceClass::sendControl(const void* _data, uint32_t len) { - UDD_SetStack(&USB_ISR); + const uint8_t *data = reinterpret_cast(_data); + uint32_t length = len; + uint32_t sent = 0; + uint32_t pos = 0; + + while (len > 0) + { + sent = armSend(EP0, data + pos, len); + pos += sent; + len -= sent; + } + + return length; } -bool USBDevice_::attach() +void USBDeviceClass::sendZlp(uint32_t ep) { - if (_usbInitialized != 0UL) - { - UDD_Attach(); - _usbConfiguration = 0; - return true; - } - else - { - return false; - } + // Set the byte count as zero + usbd.epBank1SetByteCount(ep, 0); } -bool USBDevice_::detach() +bool USBDeviceClass::handleStandardSetup(Setup &setup) { - if (_usbInitialized != 0UL) - { - UDD_Detach(); + switch (setup.bRequest) { + case GET_STATUS: + if (setup.bmRequestType == 0) // device + { + // Send the device status + // TODO: Check current configuration for power mode (if device is configured) + // TODO: Check if remote wake-up is enabled + uint8_t buff[] = { 0, 0 }; + armSend(0, buff, 2); + return true; + } + // if( setup.bmRequestType == 2 ) // Endpoint: + else + { + // Send the endpoint status + // Check if the endpoint if currently halted + uint8_t buff[] = { 0, 0 }; + if (isEndpointHalt == 1) + buff[0] = 1; + armSend(0, buff, 2); + return true; + } + + case CLEAR_FEATURE: + // Check which is the selected feature + if (setup.wValueL == 1) // DEVICEREMOTEWAKEUP + { + // Enable remote wake-up and send a ZLP + uint8_t buff[] = { 0, 0 }; + if (isRemoteWakeUpEnabled == 1) + buff[0] = 1; + armSend(0, buff, 2); + return true; + } + else // if( setup.wValueL == 0) // ENDPOINTHALT + { + isEndpointHalt = 0; + sendZlp(0); + return true; + } + + case SET_FEATURE: + // Check which is the selected feature + if (setup.wValueL == 1) // DEVICEREMOTEWAKEUP + { + // Enable remote wake-up and send a ZLP + isRemoteWakeUpEnabled = 1; + uint8_t buff[] = { 0 }; + armSend(0, buff, 1); + return true; + } + if (setup.wValueL == 0) // ENDPOINTHALT + { + // Halt endpoint + isEndpointHalt = 1; + sendZlp(0); + return true; + } + + case SET_ADDRESS: + setAddress(setup.wValueL); return true; - } - else - { + + case GET_DESCRIPTOR: + return sendDescriptor(setup); + + case SET_DESCRIPTOR: return false; + + case GET_CONFIGURATION: + armSend(0, (void*)&_usbConfiguration, 1); + return true; + + case SET_CONFIGURATION: + if (REQUEST_DEVICE == (setup.bmRequestType & REQUEST_RECIPIENT)) { + #if defined(HID_ENABLED) + initEP(HID_ENDPOINT_INT, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); + #endif + + #if defined(CDC_ENABLED) + initEP(CDC_ENDPOINT_ACM, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0)); + initEP(CDC_ENDPOINT_OUT, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0)); + initEP(CDC_ENDPOINT_IN, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); + #endif + _usbConfiguration = setup.wValueL; + + #if defined(CDC_ENABLED) + // Enable interrupt for CDC reception from host (OUT packet) + usbd.epBank1EnableTransferComplete(CDC_ENDPOINT_ACM); + usbd.epBank0EnableTransferComplete(CDC_ENDPOINT_OUT); + #endif + + sendZlp(0); + return true; + } else { + return false; + } + + case GET_INTERFACE: + armSend(0, (void*)&_usbSetInterface, 1); + return true; + + case SET_INTERFACE: + _usbSetInterface = setup.wValueL; + sendZlp(0); + return true; + + default: + return true; } } -bool USBDevice_::configured() +void USBDeviceClass::ISRHandler() { - return _usbConfiguration; -} + // End-Of-Reset + if (usbd.isEndOfResetInterrupt()) + { + // Configure EP 0 + initEP(0, USB_ENDPOINT_TYPE_CONTROL); -void USBDevice_::poll() -{ + // Enable Setup-Received interrupt + usbd.epBank0EnableSetupReceived(0); + + _usbConfiguration = 0; + + usbd.ackEndOfResetInterrupt(); + } + + // Start-Of-Frame + if (usbd.isStartOfFrameInterrupt()) + { + usbd.ackStartOfFrameInterrupt(); + } + + // Endpoint 0 Received Setup interrupt + if (usbd.epBank0IsSetupReceived(0)) + { + usbd.epBank0AckSetupReceived(0); + + Setup *setup = reinterpret_cast(udd_ep_out_cache_buffer[0]); + + /* Clear the Bank 0 ready flag on Control OUT */ + // The RAM Buffer is empty: we can receive data + usbd.epBank0ResetReady(0); + + bool ok; + if (REQUEST_STANDARD == (setup->bmRequestType & REQUEST_TYPE)) { + // Standard Requests + ok = handleStandardSetup(*setup); + } else { + // Class Interface Requests + ok = handleClassInterfaceSetup(*setup); + } + + if (ok) { + usbd.epBank1SetReady(0); + } else { + stall(0); + } + + // XXX: Should be really cleared? + if (usbd.epBank1IsStalled(0)) // XXX:(USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.STALL) + { + usbd.epBank1AckStalled(0); + + // Remove stall request + usbd.epBank1DisableStalled(0); + } + + } // end Received Setup handler + + uint8_t i=0; + uint8_t ept_int = usbd.epInterruptSummary() & 0xFE; // Remove endpoint number 0 (setup) + while (ept_int != 0) + { + // Check if endpoint has a pending interrupt + if ((ept_int & (1 << i)) != 0) + { + // Endpoint Transfer Complete (0/1) Interrupt + if (usbd.epBank0IsTransferComplete(i) || + usbd.epBank1IsTransferComplete(i)) + { + handleEndpoint(i); + } + ept_int &= ~(1 << i); + } + i++; + if (i > USB_EPT_NUM) + break; // fire exit + } } -void USBDevice_::init() -{ - UDD_Init(); - _usbInitialized=1UL; +/* + * USB Device instance + * ------------------- + */ + +// USBDevice class instance +USBDeviceClass USBDevice; + +// USB_Handler ISR +extern "C" void USB_Handler(void) { + USBDevice.ISRHandler(); } diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 1441a6492..d584fdfc9 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 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 @@ -31,6 +31,16 @@ #define GET_INTERFACE 10 #define SET_INTERFACE 11 +// bEndpointAddress in Endpoint Descriptor +#define USB_ENDPOINT_DIRECTION_MASK 0x80 +#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) +#define USB_ENDPOINT_IN(addr) ((addr) | 0x80) + +#define USB_ENDPOINT_TYPE_MASK 0x03 +#define USB_ENDPOINT_TYPE_CONTROL 0x00 +#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 +#define USB_ENDPOINT_TYPE_BULK 0x02 +#define USB_ENDPOINT_TYPE_INTERRUPT 0x03 // bmRequestType #define REQUEST_HOSTTODEVICE 0x00 diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index 2f34bbc2e..b12d707b1 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 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 diff --git a/cores/arduino/USB/USB_device.h b/cores/arduino/USB/USB_device.h deleted file mode 100644 index 6353f9770..000000000 --- a/cores/arduino/USB/USB_device.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2014 Arduino. 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 USB_DEVICE_H_INCLUDED -#define USB_DEVICE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "USB/samd21_device.h" - - -// bEndpointAddress in Endpoint Descriptor -#define USB_ENDPOINT_DIRECTION_MASK 0x80 -#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) -#define USB_ENDPOINT_IN(addr) ((addr) | 0x80) - -#define USB_ENDPOINT_TYPE_MASK 0x03 -#define USB_ENDPOINT_TYPE_CONTROL 0x00 -#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 -#define USB_ENDPOINT_TYPE_BULK 0x02 -#define USB_ENDPOINT_TYPE_INTERRUPT 0x03 - - -extern void UDD_ClearIN(void); -extern uint32_t UDD_FifoByteCount(uint32_t ep); -extern void UDD_ReleaseRX(uint32_t ep); -extern void UDD_ReleaseTX(uint32_t ep); -extern uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len); -extern uint8_t UDD_Recv_data(uint32_t ep, uint32_t len); -extern void UDD_Recv(uint32_t ep, uint8_t** data); -extern void UDD_Init(void); -extern void UDD_InitEP( uint32_t ul_ep, uint32_t ul_ep_cfg ); -extern void send_zlp (void); -extern void UDD_Attach(void); -extern void UDD_Detach(void); -extern void UDD_SetAddress(uint32_t addr); -extern void UDD_Stall(uint32_t ep); -extern uint32_t UDD_GetFrameNumber(void); -extern void UDD_SetStack(void (*pf_isr)(void)); - -#ifdef __cplusplus -} -#endif - -#endif /* USB_DEVICE_H_INCLUDED */ diff --git a/cores/arduino/USB/USB_host.h b/cores/arduino/USB/USB_host.h index e20738e85..390e3dd1e 100644 --- a/cores/arduino/USB/USB_host.h +++ b/cores/arduino/USB/USB_host.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 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 diff --git a/cores/arduino/USB/USB_interrupt.c b/cores/arduino/USB/USB_interrupt.c deleted file mode 100644 index 3f1f05f6c..000000000 --- a/cores/arduino/USB/USB_interrupt.c +++ /dev/null @@ -1,23 +0,0 @@ -/* -** Permission to use, copy, modify, and/or distribute this software for -** any purpose with or without fee is hereby granted, provided that the -** above copyright notice and this permission notice appear in all copies. -** -** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR -** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -** SOFTWARE. -*/ - -void (*gpf_isr)(void) = (0UL); - -void USB_Handler( void ) -{ - if (gpf_isr) - gpf_isr(); -} - diff --git a/cores/arduino/USB/samd21_device.h b/cores/arduino/USB/samd21_device.h deleted file mode 100644 index deded25b4..000000000 --- a/cores/arduino/USB/samd21_device.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (c) 2014 Arduino. 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 SAMD21_DEVICE_H_INCLUDED -#define SAMD21_DEVICE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#define EP0 0 -#define EPX_SIZE 64// 64 for Full Speed, EPT size max is 1024 - -// Force device low speed mode -#define udd_force_low_speed() USB->DEVICE.CTRLB.reg &= ~USB_DEVICE_CTRLB_SPDCONF_Msk; USB->DEVICE.CTRLB.reg |= USB_DEVICE_CTRLB_SPDCONF_1_Val -// Force full speed mode -#define udd_force_full_speed() USB->DEVICE.CTRLB.reg &= ~USB_DEVICE_CTRLB_SPDCONF_Msk - -// Attaches to USB bus -#define udd_attach_device() USB->DEVICE.CTRLB.reg &= ~USB_DEVICE_CTRLB_DETACH -#define udd_detach_device() USB->DEVICE.CTRLB.reg |= USB_DEVICE_CTRLB_DETACH - -// Manage reset event -// Set when a USB "End of Reset" has been detected -#define udd_enable_reset_interrupt() USB->DEVICE.INTENSET.reg = USB_DEVICE_INTENSET_EORST -#define udd_ack_reset() USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTFLAG_EORST -#define Is_udd_reset() (USB->DEVICE.INTFLAG.reg & USB_DEVICE_INTFLAG_EORST) - -// Manage start of frame (SOF) event -#define udd_enable_sof_interrupt() USB->DEVICE.INTENSET.reg = USB_DEVICE_INTENSET_SOF -#define udd_ack_sof() USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTFLAG_SOF -#define Is_udd_sof() (USB->DEVICE.INTENSET.reg & USB_DEVICE_INTENSET_SOF) -#define udd_frame_number() ((USB->DEVICE.FNUM.reg & USB_DEVICE_FNUM_FNUM_Msk) >> USB_DEVICE_FNUM_FNUM_Pos) - -// configures the USB device address and enable it. -#define udd_configure_address(address) USB->DEVICE.DADD.reg = USB_DEVICE_DADD_ADDEN | address - -// Clear BK0RDY for know that the BANK0 ram buffer (udd_g_ep_table[ep].DeviceDescBank[0]) is empty and can receive data -#define udd_OUT_transfer_allowed(ep) USB->DEVICE.DeviceEndpoint[ep].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK0RDY -// Set BK1RDY for know that the BANK1 ram buffer (udd_g_ep_table[ep].DeviceDescBank[1]) is full and can send data -#define udd_IN_transfer_allowed(ep) USB->DEVICE.DeviceEndpoint[ep].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK1RDY - -// Stop OUT transfer -#define udd_OUT_stop_transfer(ep) USB->DEVICE.DeviceEndpoint[ep].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK0RDY -// Stop IN transfer -#define udd_IN_stop_transfer(ep) USB->DEVICE.DeviceEndpoint[ep].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY - -#define udd_read_endpoint_flag(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTFLAG.reg -// Is transfer completed ? -#define udd_is_IN_transf_cplt(ep) (USB->DEVICE.DeviceEndpoint[ep].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRCPT(2)) -#define udd_is_OUT_transf_cplt(ep) (USB->DEVICE.DeviceEndpoint[ep].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRCPT(1)) -// Clear the transfer complete flag -#define udd_clear_IN_transf_cplt(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(2) -#define udd_clear_OUT_transf_cplt(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(1) -// Enable interrupt transfer complete -#define udd_ept_enable_it_IN_transf_cplt(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRCPT(2) -#define udd_ept_enable_it_OUT_transf_cplt(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRCPT(1) - -// Enables SETUP received interrupt -#define udd_enable_setup_received_interrupt(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTENSET.reg = USB_DEVICE_EPINTFLAG_RXSTP -// Clear the stall flag -#define udd_clear_stall_request(ep) USB->DEVICE.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL(2) -// Remove stall -#define udd_remove_stall_request(ep) USB->DEVICE.DeviceEndpoint[ep].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_STALLRQ(2) - -// Endpoint Interrupt Summary -#define udd_endpoint_interrupt() USB->DEVICE.EPINTSMRY.reg - -#define udd_clear_wakeup_interrupt() USB->DEVICE.INTENCLR.reg = USB_DEVICE_INTENCLR_WAKEUP -#define udd_clear_eorsm_interrupt() USB->DEVICE.INTENCLR.reg = USB_DEVICE_INTENCLR_EORSM -#define udd_clear_suspend_interrupt() USB->DEVICE.INTENCLR.reg = USB_DEVICE_INTENCLR_SUSPEND - - - -// Force device mode -#define udd_force_device_mode() USB->DEVICE.CTRLA.reg &= ~USB_CTRLA_MODE -// Run in Standby -#define udd_device_run_in_standby() USB->DEVICE.CTRLA.reg |= USB_CTRLA_RUNSTDBY -// Force host mode -#define udd_force_host_mode() USB->DEVICE.CTRLA.reg |= USB_CTRLA_MODE - - -// Enable USB macro -#define udd_enable() USB->DEVICE.CTRLA.reg |= USB_CTRLA_ENABLE -// Disable USB macro -#define udd_disable() USB->DEVICE.CTRLA.reg &= ~USB_CTRLA_ENABLE - -#ifdef __cplusplus -} -#endif - -#endif /* SAMD21_DEVICE_H_INCLUDED */ - diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index b1aeccf82..d1bf3558a 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 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 @@ -22,9 +22,11 @@ #include #include "../Arduino.h" -#include "../wiring_private.h" +#include "variant.h" #include "USB_host.h" #include "samd21_host.h" +#include "sam.h" +#include "wiring_digital.h" #define HOST_DEFINED #ifdef HOST_DEFINED @@ -150,7 +152,6 @@ void UHD_Init(void) USB->HOST.DESCADD.reg = (uint32_t)(&usb_pipe_table[0]); // For USB_SPEED_FULL uhd_force_full_speed(); - memset(&usb_pipe_table[0], 0, sizeof(usb_pipe_table)); uhd_state = UHD_STATE_NO_VBUS; diff --git a/cores/arduino/USB/samd21_host.h b/cores/arduino/USB/samd21_host.h index 5e2e2c897..d2d9c9e09 100644 --- a/cores/arduino/USB/samd21_host.h +++ b/cores/arduino/USB/samd21_host.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Arduino. All right reserved. + Copyright (c) 2014 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 @@ -28,18 +28,18 @@ extern __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table #define USB_EP_DIR_IN 0x80 // USB_SETUP_DEVICE_TO_HOST #define USB_EP_DIR_OUT 0x00 // USB_SETUP_HOST_TO_DEVICE -#define USB_HOST_PTYPE_DIS USB_HOST_PCFG_PTYPE(0x0) // Pipe is disabled -#define USB_HOST_PTYPE_CTRL USB_HOST_PCFG_PTYPE(0x1) // Pipe is enabled and configured as CONTROL -#define USB_HOST_PTYPE_ISO USB_HOST_PCFG_PTYPE(0x2) // Pipe is enabled and configured as ISO -#define USB_HOST_PTYPE_BULK USB_HOST_PCFG_PTYPE(0x3) // Pipe is enabled and configured as BULK -#define USB_HOST_PTYPE_INT USB_HOST_PCFG_PTYPE(0x4) // Pipe is enabled and configured as INTERRUPT -#define USB_HOST_PTYPE_EXT USB_HOST_PCFG_PTYPE(0x5) // Pipe is enabled and configured as EXTENDED +#define USB_HOST_PTYPE_DIS USB_HOST_PCFG_PTYPE(0x0) // Pipe is disabled +#define USB_HOST_PTYPE_CTRL USB_HOST_PCFG_PTYPE(0x1) // Pipe is enabled and configured as CONTROL +#define USB_HOST_PTYPE_ISO USB_HOST_PCFG_PTYPE(0x2) // Pipe is enabled and configured as ISO +#define USB_HOST_PTYPE_BULK USB_HOST_PCFG_PTYPE(0x3) // Pipe is enabled and configured as BULK +#define USB_HOST_PTYPE_INT USB_HOST_PCFG_PTYPE(0x4) // Pipe is enabled and configured as INTERRUPT +#define USB_HOST_PTYPE_EXT USB_HOST_PCFG_PTYPE(0x5) // Pipe is enabled and configured as EXTENDED #define USB_HOST_NB_BK_1 1 -#define USB_HOST_PCFG_PTOKEN_SETUP USB_HOST_PCFG_PTOKEN(0x0) -#define USB_HOST_PCFG_PTOKEN_IN USB_HOST_PCFG_PTOKEN(0x1) -#define USB_HOST_PCFG_PTOKEN_OUT USB_HOST_PCFG_PTOKEN(0x2) +#define USB_HOST_PCFG_PTOKEN_SETUP USB_HOST_PCFG_PTOKEN(0x0) +#define USB_HOST_PCFG_PTOKEN_IN USB_HOST_PCFG_PTOKEN(0x1) +#define USB_HOST_PCFG_PTOKEN_OUT USB_HOST_PCFG_PTOKEN(0x2) #define USB_ERRORFLOW USB_HOST_STATUS_BK_ERRORFLOW #define USB_ERRORTIMEOUT USB_HOST_STATUS_PIPE_TOUTER @@ -84,7 +84,7 @@ extern __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table #define Is_uhd_sof() (USB->HOST.INTFLAG.reg & USB_HOST_INTFLAG_HSOF) // USB address of pipes -#define uhd_configure_address(pipe_num, addr) usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR = addr +#define uhd_configure_address(pipe_num, addr) usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR = addr #define uhd_get_configured_address(pipe_num) usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR // Pipes @@ -104,7 +104,7 @@ extern __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table #define uhd_ack_out_ready(p) USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1) #define Is_uhd_out_ready(p) ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TRCPT(1)) == USB_HOST_PINTFLAG_TRCPT(1)) #define uhd_ack_nak_received(p) usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg &= ~USB_HOST_STATUS_BK_ERRORFLOW -#define Is_uhd_nak_received(p) (usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg & USB_HOST_STATUS_BK_ERRORFLOW) +#define Is_uhd_nak_received(p) (usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg & USB_HOST_STATUS_BK_ERRORFLOW) // Endpoint Interrupt Summary #define uhd_endpoint_interrupt() USB->HOST.PINTSMRY.reg From 383d87c99c4981b49834dd1c135b117a64594f7c Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 29 Jun 2015 16:52:49 +0200 Subject: [PATCH 034/124] USBDevice: added 'full' flag to USB buffer This way all the 64 bytes available can be filled up --- cores/arduino/USB/CDC.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index c0e61a893..d68bd8c49 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -37,8 +37,9 @@ struct ring_buffer { uint8_t buffer[CDC_SERIAL_BUFFER_SIZE]; volatile uint32_t head; volatile uint32_t tail; + volatile bool full; }; -ring_buffer cdc_rx_buffer = { { 0 }, 0, 0}; +ring_buffer cdc_rx_buffer = {{0}, 0, 0, false}; typedef struct { uint32_t dwDTERate; @@ -160,19 +161,22 @@ void Serial_::accept(void) // current location of the tail), we're about to overflow the buffer // and so we don't write the character or advance the head. uint32_t k = 0; - i = (i + 1) % CDC_SERIAL_BUFFER_SIZE; - while ((i != ringBuffer->tail) && (len > 0)) { + while (len > 0 && !ringBuffer->full) { len--; - ringBuffer->buffer[ringBuffer->head] = buffer[k++]; - ringBuffer->head = i; - i = (i + 1) % CDC_SERIAL_BUFFER_SIZE; + ringBuffer->buffer[i++] = buffer[k++]; + i %= CDC_SERIAL_BUFFER_SIZE; + if (i == ringBuffer->tail) + ringBuffer->full = true; } + ringBuffer->head = i; interrupts(); } int Serial_::available(void) { ring_buffer *buffer = &cdc_rx_buffer; + if (buffer->full) + return CDC_SERIAL_BUFFER_SIZE; if (buffer->head == buffer->tail) { USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_TRCPT(1); } @@ -182,13 +186,9 @@ int Serial_::available(void) int Serial_::peek(void) { ring_buffer *buffer = &cdc_rx_buffer; - - if (buffer->head == buffer->tail) - { + if (buffer->head == buffer->tail && !buffer->full) { return -1; - } - else - { + } else { return buffer->buffer[buffer->tail]; } } @@ -203,12 +203,12 @@ int Serial_::read(void) ring_buffer *buffer = &cdc_rx_buffer; // if the head isn't ahead of the tail, we don't have any characters - if (buffer->head == buffer->tail) + if (buffer->head == buffer->tail && !buffer->full) { if (usb.available(CDC_ENDPOINT_OUT)) accept(); } - if (buffer->head == buffer->tail) + if (buffer->head == buffer->tail && !buffer->full) { return -1; } @@ -216,6 +216,7 @@ int Serial_::read(void) { unsigned char c = buffer->buffer[buffer->tail]; buffer->tail = (uint32_t)(buffer->tail + 1) % CDC_SERIAL_BUFFER_SIZE; + buffer->full = false; // if (usb.available(CDC_ENDPOINT_OUT)) // accept(); return c; From 4fb7c1572b8f119b6eaf305ad69220b59281ab05 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Tue, 30 Jun 2015 18:08:49 +0200 Subject: [PATCH 035/124] USB: fix CDC endpoints * fix in_endpoint buffer size (was too big) * use the same EP for CDC_ENDPOINT_OUT and CDC_ENDPOINT_IN (different buffers) * fix CDC_ENDPOINT_IN ep type --- cores/arduino/USB/USBCore.cpp | 20 +++++++++++++------- cores/arduino/USB/USBDesc.h | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index cfcf101aa..472efc421 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -68,11 +68,11 @@ const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB volatile uint32_t _usbConfiguration = 0; volatile uint32_t _usbSetInterface = 0; -static __attribute__((__aligned__(4))) /*__attribute__((__section__(".bss_hram0")))*/ +static __attribute__((__aligned__(8))) //__attribute__((__section__(".bss_hram0"))) uint8_t udd_ep_out_cache_buffer[4][64]; -static __attribute__((__aligned__(4))) /*__attribute__((__section__(".bss_hram0")))*/ -uint8_t udd_ep_in_cache_buffer[4][128]; +static __attribute__((__aligned__(8))) //__attribute__((__section__(".bss_hram0"))) +uint8_t udd_ep_in_cache_buffer[4][64]; //================================================================== @@ -375,7 +375,7 @@ void USBDeviceClass::initEP(uint32_t ep, uint32_t config) { if (config == (USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0))) { - usbd.epBank1SetSize(ep, 8); + usbd.epBank1SetSize(ep, 64); usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); usbd.epBank1SetType(ep, 4); // INTERRUPT IN } @@ -580,7 +580,13 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) if (!_usbConfiguration) return -1; - armSend(ep, data, len); + //armSend(ep, data, len); + + /* memcopy could be safer in multithreaded environment */ + memcpy(&udd_ep_in_cache_buffer[ep], data, len); + + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); + usbd.epBank1SetByteCount(ep, len); // Clear the transfer complete flag usbd.epBank1AckTransferComplete(ep); @@ -712,9 +718,9 @@ bool USBDeviceClass::handleStandardSetup(Setup &setup) #endif #if defined(CDC_ENABLED) - initEP(CDC_ENDPOINT_ACM, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0)); + initEP(CDC_ENDPOINT_ACM, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); initEP(CDC_ENDPOINT_OUT, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0)); - initEP(CDC_ENDPOINT_IN, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); + initEP(CDC_ENDPOINT_IN, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0)); #endif _usbConfiguration = setup.wValueL; diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index b12d707b1..ae7f57423 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -39,11 +39,11 @@ #define CDC_DATA_INTERFACE 1 // CDC Data #define CDC_ENDPOINT_ACM 1 #define CDC_ENDPOINT_OUT 2 -#define CDC_ENDPOINT_IN 3 +#define CDC_ENDPOINT_IN 2 // HID #define HID_INTERFACE 2 // HID -#define HID_ENDPOINT_INT 4 +#define HID_ENDPOINT_INT 3 // Defined string description #define IMANUFACTURER 1 From e2a8367e79d0ef84e4ba4656f7809d073ba16134 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Thu, 2 Jul 2015 15:43:40 +0200 Subject: [PATCH 036/124] fix back-to-back SerialUSB test --- cores/arduino/USB/CDC.cpp | 7 +++++-- cores/arduino/USB/USBCore.cpp | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index d68bd8c49..0ecee14a0 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -25,7 +25,7 @@ #ifdef CDC_ENABLED -#define CDC_SERIAL_BUFFER_SIZE 64 +#define CDC_SERIAL_BUFFER_SIZE 256 /* For information purpose only since RTS is not always handled by the terminal application */ #define CDC_LINESTATE_DTR 0x01 // Data Terminal Ready @@ -175,9 +175,12 @@ void Serial_::accept(void) int Serial_::available(void) { ring_buffer *buffer = &cdc_rx_buffer; - if (buffer->full) + if (buffer->full) { + USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = ~USB_DEVICE_EPINTENCLR_RXSTP; return CDC_SERIAL_BUFFER_SIZE; + } if (buffer->head == buffer->tail) { + USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_RXSTP; USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_TRCPT(1); } return (uint32_t)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE; diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 472efc421..3852e30fb 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -68,10 +68,10 @@ const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB volatile uint32_t _usbConfiguration = 0; volatile uint32_t _usbSetInterface = 0; -static __attribute__((__aligned__(8))) //__attribute__((__section__(".bss_hram0"))) +static __attribute__((__aligned__(4))) //__attribute__((__section__(".bss_hram0"))) uint8_t udd_ep_out_cache_buffer[4][64]; -static __attribute__((__aligned__(8))) //__attribute__((__section__(".bss_hram0"))) +static __attribute__((__aligned__(4))) //__attribute__((__section__(".bss_hram0"))) uint8_t udd_ep_in_cache_buffer[4][64]; //================================================================== @@ -502,17 +502,19 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len) // NAK on endpoint OUT, the bank is full. //usbd.epBank0SetReady(CDC_ENDPOINT_OUT); - uint8_t *buffer = udd_ep_out_cache_buffer[ep]; - uint8_t *data = reinterpret_cast(_data); - for (uint32_t i=0; i(_data); + // for (uint32_t i=0; i= 64) { usbd.epBank0SetByteCount(ep, count - 64); From 85825a3d35db9a38e052748638a5200a89eb7880 Mon Sep 17 00:00:00 2001 From: Jean-Christophe BUDA Date: Fri, 3 Jul 2015 12:12:46 +0200 Subject: [PATCH 037/124] Fix to USBDevice blocking-send --- cores/arduino/USB/CDC.cpp | 4 +-- cores/arduino/USB/USBCore.cpp | 61 ++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 0ecee14a0..f3e4cd70b 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -242,11 +242,11 @@ size_t Serial_::write(const uint8_t *buffer, size_t size) // TODO - ZE - check behavior on different OSes and test what happens if an // open connection isn't broken cleanly (cable is yanked out, host dies // or locks up, or host virtual serial port hangs) -// if (_usbLineInfo.lineState > 0) // Problem with Windows(R) + if (_usbLineInfo.lineState > 0) // Problem with Windows(R) { uint32_t r = usb.send(CDC_ENDPOINT_IN, buffer, size); - if (r > 0) { + if (r == 0) { return r; } else { setWriteError(); diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 3852e30fb..3792c85cd 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -579,27 +579,64 @@ uint8_t USBDeviceClass::armRecv(uint32_t ep, uint32_t len) // Blocking Send of data to an endpoint uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) { + uint32_t length = 0; + if (!_usbConfiguration) return -1; + if (len > 16384) + return -1; - //armSend(ep, data, len); + if ((unsigned int)data > 0x20000000) + { + // Buffer in RAM + usbd.epBank1SetAddress(ep, (void *)data); + usbd.epBank1SetMultiPacketSize(ep, 0); - /* memcopy could be safer in multithreaded environment */ - memcpy(&udd_ep_in_cache_buffer[ep], data, len); + usbd.epBank1SetByteCount(ep, len); - usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); - usbd.epBank1SetByteCount(ep, len); + // Clear the transfer complete flag + usbd.epBank1AckTransferComplete(ep); - // Clear the transfer complete flag - usbd.epBank1AckTransferComplete(ep); + // RAM buffer is full, we can send data (IN) + usbd.epBank1SetReady(ep); - // RAM buffer is full, we can send data (IN) - usbd.epBank1SetReady(ep); + // Wait for transfer to complete + while (!usbd.epBank1IsTransferComplete(ep)) { + ; // need fire exit. + } + len = 0; + } + else + { + // Flash area + while (len != 0) + { + if (len >= 64) { + length = 64; + } else { + length = len; + } - // Wait for transfer to complete - while (!usbd.epBank1IsTransferComplete(ep)) { - ; // need fire exit. + /* memcopy could be safer in multi threaded environment */ + memcpy(&udd_ep_in_cache_buffer[ep], data, length); + + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); + usbd.epBank1SetByteCount(ep, length); + + // Clear the transfer complete flag + usbd.epBank1AckTransferComplete(ep); + + // RAM buffer is full, we can send data (IN) + usbd.epBank1SetReady(ep); + + // Wait for transfer to complete + while (!usbd.epBank1IsTransferComplete(ep)) { + ; // need fire exit. + } + len -= length; + } } + return len; } From 9487fbeb43ad4bfd79ba79cdb385f42e5cf9b353 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 3 Jul 2015 15:54:26 +0200 Subject: [PATCH 038/124] use different EP for CDC IN and OUT --- cores/arduino/USB/CDC.cpp | 2 -- cores/arduino/USB/USBDesc.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index f3e4cd70b..944073336 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -176,11 +176,9 @@ int Serial_::available(void) { ring_buffer *buffer = &cdc_rx_buffer; if (buffer->full) { - USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = ~USB_DEVICE_EPINTENCLR_RXSTP; return CDC_SERIAL_BUFFER_SIZE; } if (buffer->head == buffer->tail) { - USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_RXSTP; USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_TRCPT(1); } return (uint32_t)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE; diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index ae7f57423..b12d707b1 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -39,11 +39,11 @@ #define CDC_DATA_INTERFACE 1 // CDC Data #define CDC_ENDPOINT_ACM 1 #define CDC_ENDPOINT_OUT 2 -#define CDC_ENDPOINT_IN 2 +#define CDC_ENDPOINT_IN 3 // HID #define HID_INTERFACE 2 // HID -#define HID_ENDPOINT_INT 3 +#define HID_ENDPOINT_INT 4 // Defined string description #define IMANUFACTURER 1 From 84a761e2468b46534a643c4be965bbfdba3b70bd Mon Sep 17 00:00:00 2001 From: Jean-Christophe BUDA Date: Fri, 3 Jul 2015 16:29:56 +0200 Subject: [PATCH 039/124] HID class fixes --- cores/arduino/USB/HID.cpp | 4 +--- cores/arduino/USB/USBCore.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cores/arduino/USB/HID.cpp b/cores/arduino/USB/HID.cpp index 09b6402a7..1d214e1a1 100644 --- a/cores/arduino/USB/HID.cpp +++ b/cores/arduino/USB/HID.cpp @@ -190,8 +190,6 @@ bool HID_Setup(Setup& setup) if (HID_GET_IDLE == r) { USBDevice.armSend(0, &_hid_idle, 1); - // RAM buffer is full, we can send data (IN) - USB->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.BK1RDY = 1; return true; } } @@ -207,7 +205,7 @@ bool HID_Setup(Setup& setup) if (HID_SET_IDLE == r) { _hid_idle = setup.wValueH; - return true; + return false; } } return false; diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 3792c85cd..3baf7cc50 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -361,7 +361,7 @@ bool USBDeviceClass::handleClassInterfaceSetup(Setup& setup) #if defined(HID_ENABLED) if (HID_INTERFACE == i) { - if (HID_Setup(setup) == true) { + if (HID_Setup(setup) == false) { sendZlp(0); } return true; From c719f6e62a2f83b5a76858088c8b81780362b4cb Mon Sep 17 00:00:00 2001 From: Jean-Christophe BUDA Date: Wed, 8 Jul 2015 16:41:58 +0200 Subject: [PATCH 040/124] Update for host and Device USB --- cores/arduino/USB/USBCore.cpp | 60 ++--- cores/arduino/USB/USB_interrupt.c | 30 +++ cores/arduino/USB/samd21_device.c | 352 ------------------------------ cores/arduino/USB/samd21_host.c | 16 +- libraries/USBHost/src/Usb.cpp | 6 +- 5 files changed, 60 insertions(+), 404 deletions(-) create mode 100644 cores/arduino/USB/USB_interrupt.c delete mode 100644 cores/arduino/USB/samd21_device.c diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 3baf7cc50..b9ba77e4e 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -29,6 +29,15 @@ USBDevice_SAMD21G18x usbd; static char isRemoteWakeUpEnabled = 0; static char isEndpointHalt = 0; +extern void (*gpf_isr)(void); + +// USB_Handler ISR +extern "C" void UDD_Handler(void) { + USBDevice.ISRHandler(); +} + + + const uint16_t STRING_LANGUAGE[2] = { (3<<8) | (2+2), 0x0409 // English @@ -285,6 +294,8 @@ void USBDeviceClass::init() while (GCLK->STATUS.bit.SYNCBUSY) ; + UHD_SetStack(&UDD_Handler); + // Reset USB Device usbd.reset(); @@ -388,9 +399,6 @@ void USBDeviceClass::initEP(uint32_t ep, uint32_t config) // Release OUT EP usbd.epBank0SetMultiPacketSize(ep, 64); usbd.epBank0SetByteCount(ep, 0); - - // The RAM Buffer is empty: we can receive data - //usbd.epBank0ResetReady(ep); } else if (config == (USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0))) { @@ -405,12 +413,12 @@ void USBDeviceClass::initEP(uint32_t ep, uint32_t config) else if (config == USB_ENDPOINT_TYPE_CONTROL) { // XXX: Needed? - usbd.epBank0DisableAutoZLP(ep); - usbd.epBank1DisableAutoZLP(ep); +// usbd.epBank0DisableAutoZLP(ep); +// usbd.epBank1DisableAutoZLP(ep); // Setup Control OUT usbd.epBank0SetSize(ep, 64); - usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[0]); + usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[ep]); usbd.epBank0SetType(ep, 1); // CONTROL OUT / SETUP // Setup Control IN @@ -424,8 +432,6 @@ void USBDeviceClass::initEP(uint32_t ep, uint32_t config) // NAK on endpoint OUT, the bank is full. usbd.epBank0SetReady(ep); - // NAK on endpoint IN, the bank is not yet filled in. - //usbd.epBank1ResetReady(ep); } } @@ -461,7 +467,6 @@ bool USBDeviceClass::connected() uint32_t USBDeviceClass::recvControl(void *_data, uint32_t len) { uint8_t *data = reinterpret_cast(_data); -// NO RXOUT ??????? // The RAM Buffer is empty: we can receive data usbd.epBank0ResetReady(0); @@ -499,17 +504,8 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len) usbd.epBank0DisableTransferComplete(ep); - // NAK on endpoint OUT, the bank is full. - //usbd.epBank0SetReady(CDC_ENDPOINT_OUT); - memcpy(_data, udd_ep_out_cache_buffer[ep], len); - // uint8_t *buffer = udd_ep_out_cache_buffer[ep]; - // uint8_t *data = reinterpret_cast(_data); - // for (uint32_t i=0; iDEVICE.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT == 0); + while (!usbd.epBank0IsTransferComplete(ep)) {} return usbd.epBank0ByteCount(ep); } uint8_t USBDeviceClass::armRecv(uint32_t ep, uint32_t len) { - //usbd.epBank0SetSize(ep, 64); - //usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[ep]); - //usbd.epBank0SetMultiPacketSize(ep, 64); // XXX: Should be "len"? uint16_t count = usbd.epBank0ByteCount(ep); if (count >= 64) { usbd.epBank0SetByteCount(ep, count - 64); } else { usbd.epBank0SetByteCount(ep, 0); } - // The RAM Buffer is empty: we can receive data - //usbd.epBank0ResetReady(ep); - - // Wait for transfer to complete - //while (!usbd.epBank0IsTransferComplete(ep)) {} - //while (usbd.epBank0IsReady(ep)) {} - // NAK on endpoint OUT, the bank is full. - //usbd.epBank0ResetReady(ep); - return usbd.epBank0ByteCount(ep); } @@ -837,8 +816,7 @@ void USBDeviceClass::ISRHandler() stall(0); } - // XXX: Should be really cleared? - if (usbd.epBank1IsStalled(0)) // XXX:(USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.STALL) + if (usbd.epBank1IsStalled(0)) { usbd.epBank1AckStalled(0); @@ -878,6 +856,6 @@ void USBDeviceClass::ISRHandler() USBDeviceClass USBDevice; // USB_Handler ISR -extern "C" void USB_Handler(void) { - USBDevice.ISRHandler(); -} +// extern "C" void USB_Handler(void) { +// USBDevice.ISRHandler(); +// } diff --git a/cores/arduino/USB/USB_interrupt.c b/cores/arduino/USB/USB_interrupt.c new file mode 100644 index 000000000..09f7a81a8 --- /dev/null +++ b/cores/arduino/USB/USB_interrupt.c @@ -0,0 +1,30 @@ +/* + Copyright (c) 2014 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 +*/ + +void (*gpf_isr)(void) = (0UL); + +void USB_Handler( void ) +{ + if (gpf_isr) + gpf_isr(); +} + +void UHD_SetStack(void (*pf_isr)(void)) +{ + gpf_isr = pf_isr; +} diff --git a/cores/arduino/USB/samd21_device.c b/cores/arduino/USB/samd21_device.c deleted file mode 100644 index 24f90d710..000000000 --- a/cores/arduino/USB/samd21_device.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - Copyright (c) 2014 Arduino. 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 -*/ - -#include -#include -#include - -#include "variant.h" -#include "USB/USB_device.h" -#include "USB/samd21_device.h" -#include "sam.h" - -#ifdef __cplusplus -extern "C"{ -#endif // __cplusplus - -#ifdef SAMD_SERIES - -//#define TRACE_DEVICE(x) x -#define TRACE_DEVICE(x) - -__attribute__((__aligned__(4))) /*__attribute__((__section__(".bss_hram0")))*/ uint8_t udd_ep_out_cache_buffer[4][64]; -__attribute__((__aligned__(4))) /*__attribute__((__section__(".bss_hram0")))*/ uint8_t udd_ep_in_cache_buffer[4][128]; - -/** - * USB SRAM data containing pipe descriptor table - * The content of the USB SRAM can be : - * - modified by USB hardware interface to update pipe status. - * Thereby, it is read by software. - * - modified by USB software to control pipe. - * Thereby, it is read by hardware. - * This data section is volatile. - */ - __attribute__((__aligned__(4))) UsbDeviceDescriptor usb_endpoint_table[USB_EPT_NUM]; - - -extern void (*gpf_isr)(void); - - -void UDD_SetStack(void (*pf_isr)(void)) -{ - gpf_isr = pf_isr; -} - -// NVM Software Calibration Area Mapping -// USB TRANSN calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRANSN_POS 45 -#define NVM_USB_PAD_TRANSN_SIZE 5 -// USB TRANSP calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRANSP_POS 50 -#define NVM_USB_PAD_TRANSP_SIZE 5 -// USB TRIM calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRIM_POS 55 -#define NVM_USB_PAD_TRIM_SIZE 3 - -void UDD_Init(void) -{ - uint32_t pad_transn; - uint32_t pad_transp; - uint32_t pad_trim; - uint32_t i; - - /* Enable USB clock */ - PM->APBBMASK.reg |= PM_APBBMASK_USB; - - /* Set up the USB DP/DN pins */ - pinPeripheral( PIN_USB_DM, PIO_COM ); - pinPeripheral( PIN_USB_DP, PIO_COM ); -// PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; -// PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg &= ~(0xF << (4 * (PIN_PA24G_USB_DM & 0x01u))); -// PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg |= MUX_PA24G_USB_DM << (4 * (PIN_PA24G_USB_DM & 0x01u)); -// PORT->Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PMUXEN = 1; -// PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg &= ~(0xF << (4 * (PIN_PA25G_USB_DP & 0x01u))); -// PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); - - /* ---------------------------------------------------------------------------------------------- - * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) - */ - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( 6 ) | // Generic Clock Multiplexer 6 - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN ; - - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } - - /* Reset */ - USB->DEVICE.CTRLA.bit.SWRST = 1; - while (USB->DEVICE.SYNCBUSY.bit.SWRST) { - /* Sync wait */ - } - - udd_enable(); - - /* Load Pad Calibration */ - pad_transn =( *((uint32_t *)(NVMCTRL_OTP4) // Non-Volatile Memory Controller - + (NVM_USB_PAD_TRANSN_POS / 32)) - >> (NVM_USB_PAD_TRANSN_POS % 32)) - & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); - - if (pad_transn == 0x1F) { // maximum value (31) - pad_transn = 5; - } - - USB->DEVICE.PADCAL.bit.TRANSN = pad_transn; - - pad_transp =( *((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRANSP_POS / 32)) - >> (NVM_USB_PAD_TRANSP_POS % 32)) - & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); - - if (pad_transp == 0x1F) { // maximum value (31) - pad_transp = 29; - } - - USB->DEVICE.PADCAL.bit.TRANSP = pad_transp; - - pad_trim =( *((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRIM_POS / 32)) - >> (NVM_USB_PAD_TRIM_POS % 32)) - & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); - - if (pad_trim == 0x7) { // maximum value (7) - pad_trim = 3; - } - - USB->DEVICE.PADCAL.bit.TRIM = pad_trim; - - /* Set the configuration */ - udd_force_device_mode(); - udd_device_run_in_standby(); - // Set address of USB SRAM - USB->DEVICE.DESCADD.reg = (uint32_t)(&usb_endpoint_table[0]); - // For USB_SPEED_FULL - udd_force_full_speed(); - - memset(&usb_endpoint_table[0], 0, sizeof(usb_endpoint_table)); - - // Configure interrupts - NVIC_SetPriority((IRQn_Type) USB_IRQn, 0UL); - NVIC_EnableIRQ((IRQn_Type) USB_IRQn); -} - -void UDD_Attach(void) -{ - TRACE_DEVICE(printf("=> UDD_Attach\r\n");) - - // Authorize attach if Vbus is present - udd_attach_device(); - - // Enable USB line events - udd_enable_reset_interrupt(); - - // usefull for debug - udd_enable_sof_interrupt(); -} - -void UDD_Detach(void) -{ - TRACE_DEVICE(printf("=> UDD_Detach\r\n");) - udd_detach_device(); -} - -void send_zlp(void) -{ - /* Set the byte count as zero */ - usb_endpoint_table[0].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT = 0; -} - - -void UDD_InitEP( uint32_t ul_ep_nb, uint32_t ul_ep_cfg ) -{ - TRACE_DEVICE(printf("=> UDD_InitEP : init EP %lu\r\n", (unsigned long)ul_ep_nb);) - - if( ul_ep_cfg == (USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)) ) - { - USB->DEVICE.DeviceEndpoint[ul_ep_nb].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE1(4); - /* Set maximum packet size as 8 bytes */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[1].PCKSIZE.bit.SIZE = 0; // 8 bytes - /* Configure the data buffer */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[1].ADDR.reg = (uint32_t)&udd_ep_in_cache_buffer[ul_ep_nb]; - } - else if( ul_ep_cfg == (USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0)) ) - { - /* Configure BULK OUT endpoint for CDC Data interface*/ - USB->DEVICE.DeviceEndpoint[ul_ep_nb].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE0(3); - /* Set maximum packet size as 64 bytes */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.bit.SIZE = 0x3; // for 64 bytes - /* Configure the data buffer */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].ADDR.reg = (uint32_t)&udd_ep_out_cache_buffer[ul_ep_nb]; - - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = 64; - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - // NACK if not ready - udd_OUT_transfer_allowed(ul_ep_nb); - } - else if( ul_ep_cfg == (USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0)) ) - { - /* Configure BULK IN endpoint for CDC Data interface */ - USB->DEVICE.DeviceEndpoint[ul_ep_nb].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE1(3); - /* Set maximum packet size as 64 bytes */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[1].PCKSIZE.bit.SIZE = 0x3; // for 64 bytes - /* Configure the data buffer */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[1].ADDR.reg = (uint32_t)&udd_ep_in_cache_buffer[ul_ep_nb]; - // NACK if not ready - udd_IN_stop_transfer(ul_ep_nb); - } - else if( ul_ep_cfg == USB_ENDPOINT_TYPE_CONTROL ) - { - /* Configure CONTROL endpoint */ - USB->DEVICE.DeviceEndpoint[ul_ep_nb].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE0(1) | USB_DEVICE_EPCFG_EPTYPE1(1); - udd_OUT_stop_transfer(ul_ep_nb); - udd_IN_stop_transfer(ul_ep_nb); - - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.reg &= ~USB_DEVICE_PCKSIZE_AUTO_ZLP; - usb_endpoint_table[ul_ep_nb].DeviceDescBank[1].PCKSIZE.reg &= ~USB_DEVICE_PCKSIZE_AUTO_ZLP; - - /* Set maximum packet size as 64 bytes */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.bit.SIZE = 0x3; // for 64 bytes - usb_endpoint_table[ul_ep_nb].DeviceDescBank[1].PCKSIZE.bit.SIZE = 0x3; // for 64 bytes - - /* get endpoint configuration from setting register */ - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].ADDR.reg = (uint32_t)&udd_ep_out_cache_buffer[0]; - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = 8; - usb_endpoint_table[ul_ep_nb].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - - // NACK if not ready - udd_OUT_stop_transfer(ul_ep_nb); - udd_IN_stop_transfer(ul_ep_nb); - } -} - - -// Send packet. -void UDD_ClearIN(void) -{ - udd_IN_transfer_allowed(EP0); -} - - - -uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len) -{ - memcpy(&udd_ep_in_cache_buffer[ep], data, len); - - /* Get endpoint configuration from setting register */ - usb_endpoint_table[ep].DeviceDescBank[1].ADDR.reg = (uint32_t)&udd_ep_in_cache_buffer[ep]; - usb_endpoint_table[ep].DeviceDescBank[1].PCKSIZE.bit.MULTI_PACKET_SIZE = 0; - usb_endpoint_table[ep].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT = len; - - return len; -} - -uint8_t UDD_Recv_data(uint32_t ep, uint32_t len) -{ - TRACE_DEVICE(printf("=> UDD_Recvdata : ep=%d\r\n", (char)ep);) - - if (len>64) len=64; - usb_endpoint_table[ep].DeviceDescBank[0].ADDR.reg = (uint32_t)&udd_ep_out_cache_buffer[ep]; - usb_endpoint_table[ep].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = len; - usb_endpoint_table[ep].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - udd_OUT_transfer_allowed(ep); - TRACE_DEVICE(printf("=> UDD_Recv_data : data=%lu\r\n", (unsigned long)data);) - - /* Wait for transfer to complete */ - while (!udd_is_OUT_transf_cplt(ep)); - /* Clear Transfer complete 0 flag */ - udd_clear_OUT_transf_cplt(ep); - - return udd_ep_out_cache_buffer[ep][0]; -} - -void UDD_Recv(uint32_t ep, uint8_t** ppData) -{ - *ppData = udd_ep_out_cache_buffer[ep]; -} - -void UDD_Stall(uint32_t ep) -{ - uint8_t ep_num = ep; - - // Stall endpoint - USB->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ(2); -} - -uint32_t UDD_FifoByteCount(uint32_t ep) -{ - return ((uint16_t)(usb_endpoint_table[ep].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT)); -} - -void UDD_ReleaseRX(uint32_t ep) -{ - TRACE_DEVICE(puts("=> UDD_ReleaseRX\r\n");) - // The RAM Buffer is empty: we can receive data - udd_OUT_transfer_allowed(ep); - /* Clear Transfer complete 0 flag */ - udd_clear_OUT_transf_cplt(ep); -} - -void UDD_ReleaseTX(uint32_t ep) -{ - TRACE_DEVICE(printf("=> UDD_ReleaseTX ep=%lu\r\n", (unsigned long)ep);) - // The RAM Buffer is full: we can send data - udd_IN_transfer_allowed(ep); - /* Clear the transfer complete flag */ - udd_clear_IN_transf_cplt(ep); -} - -void UDD_SetAddress(uint32_t addr) -{ - TRACE_DEVICE(printf("=> UDD_SetAddress : setting address to %lu\r\n", (unsigned long)addr);) - - /* Set the byte count as zero */ - usb_endpoint_table[0].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT = 0; - /* Clear the transfer complete flag */ - udd_clear_IN_transf_cplt(0); - /* Set the bank as ready */ - udd_IN_transfer_allowed(0); - - /* Wait for transfer to complete */ - while (!udd_is_IN_transf_cplt(EP0)) {} - - udd_configure_address(addr); -} - -uint32_t UDD_GetFrameNumber(void) -{ - return udd_frame_number(); -} - -#ifdef __cplusplus -} -#endif - -#endif /* SAMD_SERIES */ - diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index d1bf3558a..09cbe478a 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -34,8 +34,6 @@ //#define TRACE_UOTGHS_HOST(x) x #define TRACE_UOTGHS_HOST(x) -//extern void (*gpf_isr)(void); - // Handle UOTGHS Host driver state static uhd_vbus_state_t uhd_state = UHD_STATE_NO_VBUS; @@ -43,10 +41,6 @@ __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EP extern void (*gpf_isr)(void); -void UHD_SetStack(void (*pf_isr)(void)) -{ - gpf_isr = pf_isr; -} // NVM Software Calibration Area Mapping // USB TRANSN calibration value. Should be written to the USB PADCAL register. @@ -177,7 +171,6 @@ void UHD_Init(void) /** * \brief Interrupt sub routine for USB Host state machine management. */ -//static void UHD_ISR(void) void UHD_Handler(void) { uint16_t flags; @@ -515,4 +508,13 @@ uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type) return 0; } + + + + +// USB_Handler ISR +// void USB_Handler(void) { +// UHD_Handler(); +// } + #endif // HOST_DEFINED diff --git a/libraries/USBHost/src/Usb.cpp b/libraries/USBHost/src/Usb.cpp index 70d1b754b..167365d7d 100644 --- a/libraries/USBHost/src/Usb.cpp +++ b/libraries/USBHost/src/Usb.cpp @@ -21,7 +21,7 @@ e-mail : support@circuitsathome.com #include "Usb.h" -#ifdef ARDUINO_ARCH_SAMD +//#ifdef ARDUINO_SAMD_ZERO static uint32_t usb_error = 0; static uint32_t usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; @@ -854,6 +854,4 @@ uint32_t USBHost::setConf(uint32_t addr, uint32_t ep, uint32_t conf_value) { return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL)); } -#else -#error This library is only compatible with ARDUINO_ARCH_SAMD -#endif //ARDUINO_ARCH_SAMD +//#endif //ARDUINO_SAMD_ZERO From 65b67a961453a070aca307f13fff71c9f0a30d65 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 8 Jul 2015 17:31:43 +0200 Subject: [PATCH 041/124] Moved USB ISR handler in startup.c --- cores/arduino/USB/USBCore.cpp | 2 +- cores/arduino/USB/USB_host.h | 2 +- cores/arduino/USB/USB_interrupt.c | 30 ------------------------------ cores/arduino/USB/samd21_host.c | 2 +- cores/arduino/cortex_handlers.c | 21 +++++++++++++++++---- cores/arduino/startup.c | 3 ++- 6 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 cores/arduino/USB/USB_interrupt.c diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index b9ba77e4e..557210c3e 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -294,7 +294,7 @@ void USBDeviceClass::init() while (GCLK->STATUS.bit.SYNCBUSY) ; - UHD_SetStack(&UDD_Handler); + USB_SetHandler(&UDD_Handler); // Reset USB Device usbd.reset(); diff --git a/cores/arduino/USB/USB_host.h b/cores/arduino/USB/USB_host.h index 390e3dd1e..319dffea5 100644 --- a/cores/arduino/USB/USB_host.h +++ b/cores/arduino/USB/USB_host.h @@ -48,7 +48,7 @@ typedef enum { extern void UHD_Init(void); extern void UHD_Handler(void); -extern void UHD_SetStack(void (*pf_isr)(void)); +extern void USB_SetHandler(void (*pf_isr)(void)); extern uhd_vbus_state_t UHD_GetVBUSState(void); extern uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size); extern uint32_t UHD_Pipe_Alloc(uint32_t ul_dev_addr, uint32_t ul_dev_ep, uint32_t ul_type, uint32_t ul_dir, uint32_t ul_maxsize, uint32_t ul_interval, uint32_t ul_nb_bank); diff --git a/cores/arduino/USB/USB_interrupt.c b/cores/arduino/USB/USB_interrupt.c deleted file mode 100644 index 09f7a81a8..000000000 --- a/cores/arduino/USB/USB_interrupt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (c) 2014 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 -*/ - -void (*gpf_isr)(void) = (0UL); - -void USB_Handler( void ) -{ - if (gpf_isr) - gpf_isr(); -} - -void UHD_SetStack(void (*pf_isr)(void)) -{ - gpf_isr = pf_isr; -} diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index 09cbe478a..e08400314 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -63,7 +63,7 @@ void UHD_Init(void) uint32_t pad_trim; uint32_t i; - UHD_SetStack(&UHD_Handler); + USB_SetHandler(&UHD_Handler); /* Enable USB clock */ PM->APBBMASK.reg |= PM_APBBMASK_USB; diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c index f602a2041..5a848d148 100644 --- a/cores/arduino/cortex_handlers.c +++ b/cores/arduino/cortex_handlers.c @@ -16,8 +16,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sam.h" -#include "variant.h" +#include +#include +#include /* RTOS Hooks */ extern void svcHook(void); @@ -25,7 +26,6 @@ extern void pendSVHook(void); extern int sysTickHook(void); /* Default empty handler */ - void Dummy_Handler(void) { #if defined DEBUG @@ -50,7 +50,7 @@ void RTC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void EIC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void NVMCTRL_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void DMAC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); -void USB_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void USB_Handler (void) __attribute__ ((weak)); void EVSYS_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); @@ -193,3 +193,16 @@ void SysTick_Handler(void) return; SysTick_DefaultHandler(); } + +static void (*usb_isr)(void) = NULL; + +void USB_Handler(void) +{ + if (usb_isr) + usb_isr(); +} + +void USB_SetHandler(void (*new_usb_isr)(void)) +{ + usb_isr = new_usb_isr; +} diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index 243aa9626..c1ac65f36 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -19,6 +19,8 @@ #include "sam.h" #include "variant.h" +#include + /** * \brief SystemInit() configures the needed clocks and according Flash Read Wait States. * At reset: @@ -208,4 +210,3 @@ void SystemInit( void ) ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); } - From 4dffbb5029a17a56bec3fc25deb56691d5396e2e Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 17 Jul 2015 11:01:26 +0200 Subject: [PATCH 042/124] Fixed a lot of warnings in USBHost --- cores/arduino/USB/CDC.cpp | 6 ++- cores/arduino/USB/samd21_host.c | 5 ++- libraries/USBHost/src/MouseController.cpp | 42 ++++++++++---------- libraries/USBHost/src/Usb.cpp | 2 +- libraries/USBHost/src/Usb.h | 2 - libraries/USBHost/src/UsbCore.h | 10 ++--- libraries/USBHost/src/adk.cpp | 2 +- libraries/USBHost/src/confdescparser.h | 2 +- libraries/USBHost/src/hidboot.cpp | 4 +- libraries/USBHost/src/hidboot.h | 22 +++++----- libraries/USBHost/src/hidescriptorparser.cpp | 4 +- libraries/USBHost/src/hiduniversal.h | 2 +- libraries/USBHost/src/message.h | 14 +++++-- libraries/USBHost/src/printhex.h | 13 ++++-- libraries/USBHost/src/sink_parser.h | 2 +- libraries/USBHost/src/usbhub.cpp | 2 +- 16 files changed, 74 insertions(+), 60 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 944073336..daca74cc6 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -135,12 +135,14 @@ bool CDC_Setup(Setup& setup) } uint32_t _serialPeek = -1; -void Serial_::begin(uint32_t baud_count) +void Serial_::begin(uint32_t /* baud_count */) { + // uart config is ignored in USB-CDC } -void Serial_::begin(uint32_t baud_count, uint8_t config) +void Serial_::begin(uint32_t /* baud_count */, uint8_t /* config */) { + // uart config is ignored in USB-CDC } void Serial_::end(void) diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index e08400314..c798a4d6d 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -27,6 +27,7 @@ #include "samd21_host.h" #include "sam.h" #include "wiring_digital.h" +#include "wiring_private.h" #define HOST_DEFINED #ifdef HOST_DEFINED @@ -295,8 +296,10 @@ uhd_vbus_state_t UHD_GetVBUSState(void) * \retval 0 success. * \retval 1 error. */ -uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size) +uint32_t UHD_Pipe0_Alloc(uint32_t ul_add , uint32_t ul_ep_size) { + (void)(ul_add); // Unused argument + if( USB->HOST.STATUS.reg & USB_HOST_STATUS_SPEED(1) ) ul_ep_size = USB_PCKSIZE_SIZE_8_BYTES; // Low Speed else diff --git a/libraries/USBHost/src/MouseController.cpp b/libraries/USBHost/src/MouseController.cpp index 3d528bc37..0912a0374 100644 --- a/libraries/USBHost/src/MouseController.cpp +++ b/libraries/USBHost/src/MouseController.cpp @@ -1,19 +1,19 @@ /* - Copyright (c) 2012 Arduino. 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 + * Copyright (c) 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 */ #include @@ -49,35 +49,35 @@ void MouseController::OnMouseMove(MOUSEINFO *mi) { mouseMoved(); } -void MouseController::OnLeftButtonUp(MOUSEINFO *mi) { +void MouseController::OnLeftButtonUp(MOUSEINFO * /* mi */) { buttons &= ~LEFT_BUTTON; mouseReleased(); mouseClicked(); } -void MouseController::OnLeftButtonDown(MOUSEINFO *mi) { +void MouseController::OnLeftButtonDown(MOUSEINFO * /* mi */) { buttons |= LEFT_BUTTON; mousePressed(); } -void MouseController::OnMiddleButtonUp(MOUSEINFO *mi) { +void MouseController::OnMiddleButtonUp(MOUSEINFO * /* mi */) { buttons &= ~MIDDLE_BUTTON; mouseReleased(); mouseClicked(); } -void MouseController::OnMiddleButtonDown(MOUSEINFO *mi) { +void MouseController::OnMiddleButtonDown(MOUSEINFO * /* mi */) { buttons |= MIDDLE_BUTTON; mousePressed(); } -void MouseController::OnRightButtonUp(MOUSEINFO *mi) { +void MouseController::OnRightButtonUp(MOUSEINFO * /* mi */) { buttons &= ~RIGHT_BUTTON; mouseReleased(); mouseClicked(); } -void MouseController::OnRightButtonDown(MOUSEINFO *mi) { +void MouseController::OnRightButtonDown(MOUSEINFO * /* mi */) { buttons |= RIGHT_BUTTON; mousePressed(); } diff --git a/libraries/USBHost/src/Usb.cpp b/libraries/USBHost/src/Usb.cpp index 167365d7d..30b0816f9 100644 --- a/libraries/USBHost/src/Usb.cpp +++ b/libraries/USBHost/src/Usb.cpp @@ -340,7 +340,7 @@ uint32_t USBHost::OutTransfer(EpInfo *pep, uint32_t nak_limit, uint32_t nbytes, for( i=0; ibmSndToggle) diff --git a/libraries/USBHost/src/Usb.h b/libraries/USBHost/src/Usb.h index 40bed77ed..919b83523 100644 --- a/libraries/USBHost/src/Usb.h +++ b/libraries/USBHost/src/Usb.h @@ -22,8 +22,6 @@ e-mail : support@circuitsathome.com #include -#define ARDUINO 101 - //#include "Arduino.h" #include "macros.h" // None of these should ever be included by a driver, or a user's sketch. diff --git a/libraries/USBHost/src/UsbCore.h b/libraries/USBHost/src/UsbCore.h index fdb14c1c1..6382e8dc9 100644 --- a/libraries/USBHost/src/UsbCore.h +++ b/libraries/USBHost/src/UsbCore.h @@ -119,11 +119,11 @@ typedef MAX3421e MAX3421E; // Balanduino class USBDeviceConfig { public: - virtual uint32_t Init(uint32_t parent, uint32_t port, uint32_t lowspeed) { + virtual uint32_t Init(uint32_t /* parent */, uint32_t /* port */, uint32_t /* lowspeed */) { return 0; } - virtual uint32_t ConfigureDevice(uint32_t parent, uint32_t port, uint32_t lowspeed) { + virtual uint32_t ConfigureDevice(uint32_t /* parent */, uint32_t /* port */, uint32_t /* lowspeed */) { return 0; } @@ -139,15 +139,15 @@ class USBDeviceConfig { return 0; } - virtual void ResetHubPort(uint32_t port) { + virtual void ResetHubPort(uint32_t /* port */) { return; } // Note used for hubs only! - virtual uint32_t VIDPIDOK(uint32_t vid, uint32_t pid) { + virtual uint32_t VIDPIDOK(uint32_t /* vid */, uint32_t /* pid */) { return false; } - virtual uint32_t DEVCLASSOK(uint32_t klass) { + virtual uint32_t DEVCLASSOK(uint32_t /* klass */) { return false; } }; diff --git a/libraries/USBHost/src/adk.cpp b/libraries/USBHost/src/adk.cpp index e271cb4a4..165f50c3d 100644 --- a/libraries/USBHost/src/adk.cpp +++ b/libraries/USBHost/src/adk.cpp @@ -347,7 +347,7 @@ uint32_t ADK::Init(uint32_t parent, uint32_t port, uint32_t lowspeed) { } /* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */ -void ADK::EndpointXtract(uint32_t conf, uint32_t iface, uint32_t alt, uint32_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) { +void ADK::EndpointXtract(uint32_t conf, uint32_t /* iface */, uint32_t /* alt */, uint32_t /* proto */, const USB_ENDPOINT_DESCRIPTOR *pep) { //ErrorMessage(PSTR("Conf.Val"), conf); //ErrorMessage(PSTR("Iface Num"), iface); //ErrorMessage(PSTR("Alt.Set"), alt); diff --git a/libraries/USBHost/src/confdescparser.h b/libraries/USBHost/src/confdescparser.h index 6ee6a1eef..4b2b41b4f 100644 --- a/libraries/USBHost/src/confdescparser.h +++ b/libraries/USBHost/src/confdescparser.h @@ -85,7 +85,7 @@ UseOr(false) { }; template -void ConfigDescParser::Parse(const uint32_t len, const uint8_t *pbuf, const uint32_t &offset) { +void ConfigDescParser::Parse(const uint32_t len, const uint8_t *pbuf, const uint32_t & /* offset */) { uint32_t cntdn = len; uint8_t *p = (uint8_t*)pbuf; diff --git a/libraries/USBHost/src/hidboot.cpp b/libraries/USBHost/src/hidboot.cpp index 9f6b8743a..ea59f39fb 100644 --- a/libraries/USBHost/src/hidboot.cpp +++ b/libraries/USBHost/src/hidboot.cpp @@ -16,7 +16,7 @@ e-mail : support@circuitsathome.com */ #include "hidboot.h" -void MouseReportParser::Parse(HID *hid, uint32_t is_rpt_id, uint32_t len, uint8_t *buf) { +void MouseReportParser::Parse(HID * /* hid */, uint32_t /* is_rpt_id */, uint32_t /* len */, uint8_t *buf) { MOUSEINFO *pmi = (MOUSEINFO*)buf; // Future: // bool event; @@ -124,7 +124,7 @@ void MouseReportParser::Parse(HID *hid, uint32_t is_rpt_id, uint32_t len, uint8_ }; -void KeyboardReportParser::Parse(HID *hid, uint32_t is_rpt_id, uint32_t len, uint8_t *buf) { +void KeyboardReportParser::Parse(HID *hid, uint32_t /* is_rpt_id */, uint32_t /* len */, uint8_t *buf) { // On error - return if (buf[2] == 1) return; diff --git a/libraries/USBHost/src/hidboot.h b/libraries/USBHost/src/hidboot.h index 621ce57ac..1aa98e1af 100644 --- a/libraries/USBHost/src/hidboot.h +++ b/libraries/USBHost/src/hidboot.h @@ -64,25 +64,25 @@ class MouseReportParser : public HIDReportParser { protected: - virtual void OnMouseMove(MOUSEINFO *mi) { + virtual void OnMouseMove(MOUSEINFO *) { }; - virtual void OnLeftButtonUp(MOUSEINFO *mi) { + virtual void OnLeftButtonUp(MOUSEINFO *) { }; - virtual void OnLeftButtonDown(MOUSEINFO *mi) { + virtual void OnLeftButtonDown(MOUSEINFO *) { }; - virtual void OnRightButtonUp(MOUSEINFO *mi) { + virtual void OnRightButtonUp(MOUSEINFO *) { }; - virtual void OnRightButtonDown(MOUSEINFO *mi) { + virtual void OnRightButtonDown(MOUSEINFO *) { }; - virtual void OnMiddleButtonUp(MOUSEINFO *mi) { + virtual void OnMiddleButtonUp(MOUSEINFO *) { }; - virtual void OnMiddleButtonDown(MOUSEINFO *mi) { + virtual void OnMiddleButtonDown(MOUSEINFO *) { }; }; @@ -153,13 +153,13 @@ class KeyboardReportParser : public HIDReportParser { protected: virtual uint8_t HandleLockingKeys(HID* hid, uint8_t key); - virtual void OnControlKeysChanged(uint8_t before, uint8_t after) { + virtual void OnControlKeysChanged(uint8_t /* before */, uint8_t /* after */) { }; - virtual void OnKeyDown(uint8_t mod, uint8_t key) { + virtual void OnKeyDown(uint8_t /* mod */, uint8_t /* key */) { }; - virtual void OnKeyUp(uint8_t mod, uint8_t key) { + virtual void OnKeyUp(uint8_t /* mod */, uint8_t /* key */) { }; virtual const uint8_t *getNumKeys() { @@ -520,7 +520,7 @@ uint32_t HIDBoot::Init(uint32_t parent, uint32_t port, uint32_t l } template -void HIDBoot::EndpointXtract(uint32_t conf, uint32_t iface, uint32_t alt, uint32_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) { +void HIDBoot::EndpointXtract(uint32_t conf, uint32_t iface, uint32_t /* alt */, uint32_t /* proto */, const USB_ENDPOINT_DESCRIPTOR *pep) { // If the first configuration satisfies, the others are not considered. //if(bNumEP > 1 && conf != bConfNum) if(bNumEP == totalEndpoints(BOOT_PROTOCOL)) diff --git a/libraries/USBHost/src/hidescriptorparser.cpp b/libraries/USBHost/src/hidescriptorparser.cpp index 1e30d08eb..353874300 100644 --- a/libraries/USBHost/src/hidescriptorparser.cpp +++ b/libraries/USBHost/src/hidescriptorparser.cpp @@ -990,7 +990,7 @@ const char * const ReportDescParserBase::medInstrTitles4[] PROGMEM = { pstrUsageSoftControlAdjust }; -void ReportDescParserBase::Parse(const uint32_t len, const uint8_t *pbuf, const uint32_t &offset) { +void ReportDescParserBase::Parse(const uint32_t len, const uint8_t *pbuf, const uint32_t & /* offset */) { uint32_t cntdn = (uint32_t)len; uint8_t *p = (uint8_t*)pbuf; @@ -1589,7 +1589,7 @@ void ReportDescParser2::OnInputItem(uint8_t itm) { E_Notify(PSTR("\r\n"), 0x80); } -void UniversalReportParser::Parse(HID *hid, uint32_t is_rpt_id, uint32_t len, uint8_t *buf) { +void UniversalReportParser::Parse(HID *hid, uint32_t /* is_rpt_id */, uint32_t len, uint8_t *buf) { ReportDescParser2 prs(len, buf); uint8_t ret = hid->GetReportDescr(0, &prs); diff --git a/libraries/USBHost/src/hiduniversal.h b/libraries/USBHost/src/hiduniversal.h index b0e7958a6..3387619e9 100644 --- a/libraries/USBHost/src/hiduniversal.h +++ b/libraries/USBHost/src/hiduniversal.h @@ -75,7 +75,7 @@ class HIDUniversal : public HID { return 0; }; - virtual void ParseHIDData(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) { + virtual void ParseHIDData(HID * /* hid */, bool /* is_rpt_id */, uint8_t /* len */, uint8_t * /* buf */) { return; }; diff --git a/libraries/USBHost/src/message.h b/libraries/USBHost/src/message.h index 41f526de2..6144b56de 100644 --- a/libraries/USBHost/src/message.h +++ b/libraries/USBHost/src/message.h @@ -55,24 +55,30 @@ void NotifyFail(uint8_t rcode); #define NotifyFail(...) ((void)0) #endif +#ifdef DEBUG_USB_HOST template void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) { -#ifdef DEBUG_USB_HOST Notify(msg, level); Notify(PSTR(": "), level); D_PrintHex (rcode, level); Notify(PSTR("\r\n"), level); -#endif } template void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) { -#ifdef DEBUG_USB_HOST Notify(msg, 0x80); Notify(PSTR(": "), 0x80); D_PrintHex (rcode, 0x80); Notify(PSTR("\r\n"), 0x80); -#endif } +#else +template +void ErrorMessage(uint8_t, char const *, ERROR_TYPE = 0) { +} + +template +void ErrorMessage(char const *, ERROR_TYPE = 0) { +} +#endif #endif // __MESSAGE_H__ diff --git a/libraries/USBHost/src/printhex.h b/libraries/USBHost/src/printhex.h index 369d7e1f7..98c1ae602 100644 --- a/libraries/USBHost/src/printhex.h +++ b/libraries/USBHost/src/printhex.h @@ -66,18 +66,23 @@ void PrintHex2(Print *prn, T val) { prn->print((T)val, HEX); } -template void D_PrintHex(T val, int lvl) { #ifdef DEBUG_USB_HOST +template void D_PrintHex(T val, int lvl) { PrintHex (val, lvl); -#endif } template void D_PrintBin(T val, int lvl) { -#ifdef DEBUG_USB_HOST PrintBin (val, lvl); -#endif } +#else +template void D_PrintHex(T, int) { +} + +template +void D_PrintBin(T, int) { +} +#endif diff --git a/libraries/USBHost/src/sink_parser.h b/libraries/USBHost/src/sink_parser.h index a23637d2b..f1c7386a3 100644 --- a/libraries/USBHost/src/sink_parser.h +++ b/libraries/USBHost/src/sink_parser.h @@ -33,7 +33,7 @@ class SinkParser : public BASE_CLASS { void Initialize() { }; - void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) { + void Parse(const LEN_TYPE /* len */, const uint8_t * /* pbuf */, const OFFSET_TYPE & /* offset */) { }; }; diff --git a/libraries/USBHost/src/usbhub.cpp b/libraries/USBHost/src/usbhub.cpp index a6aebd973..1f6aa712b 100644 --- a/libraries/USBHost/src/usbhub.cpp +++ b/libraries/USBHost/src/usbhub.cpp @@ -374,7 +374,7 @@ uint32_t USBHub::PortStatusChange(uint32_t port, HubEvent &evt) { return 0; } -void PrintHubPortStatus(USBHub *hubptr, uint32_t addr, uint32_t port, uint32_t print_changes) { +void PrintHubPortStatus(USBHub *hubptr, uint32_t /* addr */, uint32_t port, uint32_t print_changes) { uint8_t rcode = 0; HubEvent evt; From e7c311699df791790cd0268f5dd9e771a22389ef Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 17 Jul 2015 11:26:46 +0200 Subject: [PATCH 043/124] Removed some unused warning in USB-Core --- cores/arduino/USB/USBAPI.h | 4 ++-- cores/arduino/USB/USBCore.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index b2d9d510b..bbb0a3e03 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -90,8 +90,8 @@ class USBDeviceClass { // private? uint32_t armSend(uint32_t ep, const void *data, uint32_t len); - uint8_t armRecv(uint32_t ep, uint32_t len); - uint8_t armRecvCtrlOUT(uint32_t ep, uint32_t len); + uint8_t armRecv(uint32_t ep); + uint8_t armRecvCtrlOUT(uint32_t ep); void ISRHandler(); diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 557210c3e..99009e835 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -472,7 +472,7 @@ uint32_t USBDeviceClass::recvControl(void *_data, uint32_t len) usbd.epBank0ResetReady(0); //usbd.epBank0AckSetupReceived(0); - uint32_t read = armRecvCtrlOUT(0, len); + uint32_t read = armRecvCtrlOUT(0); if (read > len) read = len; //while (!usbd.epBank0AckTransferComplete(0)) {} @@ -500,7 +500,7 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len) if (available(ep) < len) len = available(ep); - armRecv(ep, len); + armRecv(ep); usbd.epBank0DisableTransferComplete(ep); @@ -518,7 +518,7 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len) return len; } -// Recv 1 byte if ready +// Recv 1 byte if ready uint32_t USBDeviceClass::recv(uint32_t ep) { uint8_t c; @@ -529,9 +529,9 @@ uint32_t USBDeviceClass::recv(uint32_t ep) } } -uint8_t USBDeviceClass::armRecvCtrlOUT(uint32_t ep, uint32_t len) +uint8_t USBDeviceClass::armRecvCtrlOUT(uint32_t ep) { - /* get endpoint configuration from setting register */ + // Get endpoint configuration from setting register usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[ep]); usbd.epBank0SetMultiPacketSize(ep, 8); usbd.epBank0SetByteCount(ep, 0); @@ -544,7 +544,7 @@ uint8_t USBDeviceClass::armRecvCtrlOUT(uint32_t ep, uint32_t len) return usbd.epBank0ByteCount(ep); } -uint8_t USBDeviceClass::armRecv(uint32_t ep, uint32_t len) +uint8_t USBDeviceClass::armRecv(uint32_t ep) { uint16_t count = usbd.epBank0ByteCount(ep); if (count >= 64) { @@ -555,7 +555,7 @@ uint8_t USBDeviceClass::armRecv(uint32_t ep, uint32_t len) return usbd.epBank0ByteCount(ep); } -// Blocking Send of data to an endpoint +// Blocking Send of data to an endpoint uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) { uint32_t length = 0; From c9207f950bf7d491db5faccfd29bef489e1a2fa8 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 10 Sep 2015 16:08:32 +0200 Subject: [PATCH 044/124] Disabled SRAM shortcut when in USBCore::send The shortcut has some issues: - sometimes it fails when sending an odd number of bytes (may be due to memory alignment?) - the data pointer should point to "stable" data (and this is not guaranteed by caller, it may be some sort of temporary buffer) - the SRAM is not guaranteed to start at 0x20000000 All the above problems must be properly fixed before reenabling this part --- cores/arduino/USB/USBCore.cpp | 57 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 99009e835..d40662f08 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -565,6 +565,17 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) if (len > 16384) return -1; +#if 0 +// This shortcut has some issues: +// - sometimes it fails when sending an odd number of bytes (may be +// due to memory alignment?) +// - the data pointer should point to "stable" data (and this is not +// guaranteed by caller, it may be some sort of temporary buffer) +// - the SRAM is not guaranteed to start at 0x20000000 + +// All the above problems must be properly fixed before reenabling +// this part + if ((unsigned int)data > 0x20000000) { // Buffer in RAM @@ -583,39 +594,37 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) while (!usbd.epBank1IsTransferComplete(ep)) { ; // need fire exit. } - len = 0; + return 0; } - else +#endif + + // Flash area + while (len != 0) { - // Flash area - while (len != 0) - { - if (len >= 64) { - length = 64; - } else { - length = len; - } + if (len >= 64) { + length = 64; + } else { + length = len; + } - /* memcopy could be safer in multi threaded environment */ - memcpy(&udd_ep_in_cache_buffer[ep], data, length); + /* memcopy could be safer in multi threaded environment */ + memcpy(&udd_ep_in_cache_buffer[ep], data, length); - usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); - usbd.epBank1SetByteCount(ep, length); + usbd.epBank1SetAddress(ep, &udd_ep_in_cache_buffer[ep]); + usbd.epBank1SetByteCount(ep, length); - // Clear the transfer complete flag - usbd.epBank1AckTransferComplete(ep); + // Clear the transfer complete flag + usbd.epBank1AckTransferComplete(ep); - // RAM buffer is full, we can send data (IN) - usbd.epBank1SetReady(ep); + // RAM buffer is full, we can send data (IN) + usbd.epBank1SetReady(ep); - // Wait for transfer to complete - while (!usbd.epBank1IsTransferComplete(ep)) { - ; // need fire exit. - } - len -= length; + // Wait for transfer to complete + while (!usbd.epBank1IsTransferComplete(ep)) { + ; // need fire exit. } + len -= length; } - return len; } From 223968776eefbe2c31893a2b6ed77cf0c18e3c2a Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Thu, 10 Sep 2015 16:40:33 +0200 Subject: [PATCH 045/124] Wire: allow scanning bus via beginTransmission-endTransmission --- libraries/Wire/Wire.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 33266d9e0..b38abfe68 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -109,12 +109,6 @@ uint8_t TwoWire::endTransmission(bool stopBit) { transmissionBegun = false ; - // Check if there are data to send - if ( txBuffer.available() == 0) - { - return 4 ; - } - // Start I2C transmission if ( !sercom->startTransmissionWIRE( txAddress, WIRE_WRITE_FLAG ) ) { From a4afec787b041ab856161c08611e7325f60b9bd3 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 10 Sep 2015 18:46:28 +0200 Subject: [PATCH 046/124] Fixed bug in USBCore::send... (yikes!) --- cores/arduino/USB/USBCore.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index d40662f08..d32dd4cb2 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -624,6 +624,7 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) ; // need fire exit. } len -= length; + data += length; } return len; } From a615df318d52cc62b23fe7d26f3f949f35450697 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 17 Jul 2015 17:43:25 +0200 Subject: [PATCH 047/124] adapt USB core to PluggableUSB --- cores/arduino/USB/CDC.cpp | 18 +- cores/arduino/USB/HID.cpp | 534 ----------------------------- cores/arduino/USB/PluggableUSB.cpp | 98 ++++++ cores/arduino/USB/PluggableUSB.h | 63 ++++ cores/arduino/USB/USBAPI.h | 128 +------ cores/arduino/USB/USBCore.cpp | 207 ++++++----- cores/arduino/USB/USBCore.h | 37 -- cores/arduino/USB/USBDesc.h | 15 +- libraries/HID/HID.cpp | 176 ++++++++++ libraries/HID/HID.h | 93 +++++ libraries/HID/keywords.txt | 21 ++ libraries/HID/library.properties | 8 + 12 files changed, 611 insertions(+), 787 deletions(-) delete mode 100644 cores/arduino/USB/HID.cpp create mode 100644 cores/arduino/USB/PluggableUSB.cpp create mode 100644 cores/arduino/USB/PluggableUSB.h create mode 100644 libraries/HID/HID.cpp create mode 100644 libraries/HID/HID.h create mode 100644 libraries/HID/keywords.txt create mode 100644 libraries/HID/library.properties diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index daca74cc6..0f1016848 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -58,10 +58,8 @@ static volatile LineInfo _usbLineInfo = { 0x00 // lineState }; -static const CDCDescriptor _cdcInterface = { - #if (defined CDC_ENABLED) && defined(HID_ENABLED) +static CDCDescriptor _cdcInterface = { D_IAD(0, 2, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), - #endif // CDC communication interface D_INTERFACE(CDC_ACM_INTERFACE, 1, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), @@ -79,17 +77,23 @@ static const CDCDescriptor _cdcInterface = { }; _Pragma("pack()") -const void* CDC_GetInterface(void) +const void* _CDC_GetInterface(void) { return &_cdcInterface; } -uint32_t CDC_GetInterfaceLength(void) +uint32_t _CDC_GetInterfaceLength(void) { return sizeof(_cdcInterface); } -bool CDC_Setup(Setup& setup) +int CDC_GetInterface(uint8_t* interfaceNum) +{ + interfaceNum[0] += 2; // uses 2 + return USBDevice.sendControl(&_cdcInterface,sizeof(_cdcInterface)); +} + +bool CDC_Setup(USBSetup& setup) { uint8_t requestType = setup.bmRequestType; uint8_t r = setup.bRequest; @@ -181,7 +185,7 @@ int Serial_::available(void) return CDC_SERIAL_BUFFER_SIZE; } if (buffer->head == buffer->tail) { - USB->DEVICE.DeviceEndpoint[2].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_TRCPT(1); + USB->DEVICE.DeviceEndpoint[CDC_ENDPOINT_OUT].EPINTENSET.reg = USB_DEVICE_EPINTENCLR_TRCPT(1); } return (uint32_t)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE; } diff --git a/cores/arduino/USB/HID.cpp b/cores/arduino/USB/HID.cpp deleted file mode 100644 index 1d214e1a1..000000000 --- a/cores/arduino/USB/HID.cpp +++ /dev/null @@ -1,534 +0,0 @@ -/* - Copyright (c) 2014 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 -*/ - -#include - -#ifdef HID_ENABLED - -//#define RAWHID_ENABLED - -// Singletons for mouse and keyboard -Mouse_ Mouse; -Keyboard_ Keyboard; - -//================================================================================ -//================================================================================ - -#define LSB(_x) ((_x) & 0xFF) -#define MSB(_x) ((_x) >> 8) - -#define RAWHID_USAGE_PAGE 0xFFC0 -#define RAWHID_USAGE 0x0C00 -#define RAWHID_TX_SIZE 64 -#define RAWHID_RX_SIZE 64 - -// HID report descriptor -_Pragma("pack(1)") -extern const uint8_t _hidReportDescriptor[] = { - // Mouse - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 54 - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - 0x09, 0x01, // USAGE (Pointer) - 0xa1, 0x00, // COLLECTION (Physical) - 0x85, 0x01, // REPORT_ID (1) - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x03, // USAGE_MAXIMUM (Button 3) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x95, 0x03, // REPORT_COUNT (3) - 0x75, 0x01, // REPORT_SIZE (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x01, // REPORT_COUNT (1) - 0x75, 0x05, // REPORT_SIZE (5) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x09, 0x38, // USAGE (Wheel) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x03, // REPORT_COUNT (3) - 0x81, 0x06, // INPUT (Data,Var,Rel) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION - - // Keyboard - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 47 - 0x09, 0x06, // USAGE (Keyboard) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, 0x02, // REPORT_ID (2) - 0x05, 0x07, // USAGE_PAGE (Keyboard) - - 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) - 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - - 0x95, 0x08, // REPORT_COUNT (8) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x01, // REPORT_COUNT (1) - 0x75, 0x08, // REPORT_SIZE (8) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - - 0x95, 0x06, // REPORT_COUNT (6) - 0x75, 0x08, // REPORT_SIZE (8) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x65, // LOGICAL_MAXIMUM (101) - 0x05, 0x07, // USAGE_PAGE (Keyboard) - - 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) - 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) - 0x81, 0x00, // INPUT (Data,Ary,Abs) - 0xc0, // END_COLLECTION - -#ifdef RAWHID_ENABLED - // RAW HID - 0x06, LSB(RAWHID_USAGE_PAGE), MSB(RAWHID_USAGE_PAGE), // 30 - 0x0A, LSB(RAWHID_USAGE), MSB(RAWHID_USAGE), - - 0xA1, 0x01, // Collection 0x01 - 0x85, 0x03, // REPORT_ID (3) - 0x75, 0x08, // report size = 8 bits - 0x15, 0x00, // logical minimum = 0 - 0x26, 0xFF, 0x00, // logical maximum = 255 - - 0x95, 64, // report count TX - 0x09, 0x01, // usage - 0x81, 0x02, // Input (array) - - 0x95, 64, // report count RX - 0x09, 0x02, // usage - 0x91, 0x02, // Output (array) - 0xC0 // end collection -#endif -}; - -extern const HIDDescriptor _hidInterface = -{ - D_INTERFACE(HID_INTERFACE,1,3,0,0), - D_HIDREPORT(sizeof(_hidReportDescriptor)), - D_ENDPOINT(USB_ENDPOINT_IN(HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x01) -}; -_Pragma("pack()") - -//================================================================================ -//================================================================================ -// Driver - -uint8_t _hid_protocol = 1; -uint8_t _hid_idle = 1; - -const void* HID_GetInterface(void) -{ - return &_hidInterface; -} - -uint32_t HID_GetInterfaceLength(void) -{ - return sizeof( _hidInterface ); -} - -uint32_t HID_SizeReportDescriptor(void) -{ - return sizeof(_hidReportDescriptor); -} - -uint32_t HID_GetDescriptor(void) -{ - return USBDevice.sendControl(_hidReportDescriptor, sizeof(_hidReportDescriptor)); -} - -void HID_SendReport(uint8_t id, const void* data, uint32_t len) -{ - uint8_t p[8]; - const uint8_t *d = reinterpret_cast(data); - - p[0] = id; - for (uint32_t i=0; i 0) - return true; - return false; -} - -//================================================================================ -//================================================================================ -// Keyboard - -Keyboard_::Keyboard_(void) -{ -} - -void Keyboard_::begin(void) -{ -} - -void Keyboard_::end(void) -{ -} - -void Keyboard_::sendReport(KeyReport* keys) -{ - HID_SendReport(2,keys,sizeof(KeyReport)); -} - -#define SHIFT 0x80 -extern const uint8_t _asciimap[128] = -{ - 0x00, // NUL - 0x00, // SOH - 0x00, // STX - 0x00, // ETX - 0x00, // EOT - 0x00, // ENQ - 0x00, // ACK - 0x00, // BEL - 0x2a, // BS Backspace - 0x2b, // TAB Tab - 0x28, // LF Enter - 0x00, // VT - 0x00, // FF - 0x00, // CR - 0x00, // SO - 0x00, // SI - 0x00, // DEL - 0x00, // DC1 - 0x00, // DC2 - 0x00, // DC3 - 0x00, // DC4 - 0x00, // NAK - 0x00, // SYN - 0x00, // ETB - 0x00, // CAN - 0x00, // EM - 0x00, // SUB - 0x00, // ESC - 0x00, // FS - 0x00, // GS - 0x00, // RS - 0x00, // US - - 0x2c, // ' ' - 0x1e|SHIFT, // ! - 0x34|SHIFT, // " - 0x20|SHIFT, // # - 0x21|SHIFT, // $ - 0x22|SHIFT, // % - 0x24|SHIFT, // & - 0x34, // ' - 0x26|SHIFT, // ( - 0x27|SHIFT, // ) - 0x25|SHIFT, // * - 0x2e|SHIFT, // + - 0x36, // , - 0x2d, // - - 0x37, // . - 0x38, // / - 0x27, // 0 - 0x1e, // 1 - 0x1f, // 2 - 0x20, // 3 - 0x21, // 4 - 0x22, // 5 - 0x23, // 6 - 0x24, // 7 - 0x25, // 8 - 0x26, // 9 - 0x33|SHIFT, // : - 0x33, // ; - 0x36|SHIFT, // < - 0x2e, // = - 0x37|SHIFT, // > - 0x38|SHIFT, // ? - 0x1f|SHIFT, // @ - 0x04|SHIFT, // A - 0x05|SHIFT, // B - 0x06|SHIFT, // C - 0x07|SHIFT, // D - 0x08|SHIFT, // E - 0x09|SHIFT, // F - 0x0a|SHIFT, // G - 0x0b|SHIFT, // H - 0x0c|SHIFT, // I - 0x0d|SHIFT, // J - 0x0e|SHIFT, // K - 0x0f|SHIFT, // L - 0x10|SHIFT, // M - 0x11|SHIFT, // N - 0x12|SHIFT, // O - 0x13|SHIFT, // P - 0x14|SHIFT, // Q - 0x15|SHIFT, // R - 0x16|SHIFT, // S - 0x17|SHIFT, // T - 0x18|SHIFT, // U - 0x19|SHIFT, // V - 0x1a|SHIFT, // W - 0x1b|SHIFT, // X - 0x1c|SHIFT, // Y - 0x1d|SHIFT, // Z - 0x2f, // [ - 0x31, // bslash - 0x30, // ] - 0x23|SHIFT, // ^ - 0x2d|SHIFT, // _ - 0x35, // ` - 0x04, // a - 0x05, // b - 0x06, // c - 0x07, // d - 0x08, // e - 0x09, // f - 0x0a, // g - 0x0b, // h - 0x0c, // i - 0x0d, // j - 0x0e, // k - 0x0f, // l - 0x10, // m - 0x11, // n - 0x12, // o - 0x13, // p - 0x14, // q - 0x15, // r - 0x16, // s - 0x17, // t - 0x18, // u - 0x19, // v - 0x1a, // w - 0x1b, // x - 0x1c, // y - 0x1d, // z - 0x2f|SHIFT, // - 0x31|SHIFT, // | - 0x30|SHIFT, // } - 0x35|SHIFT, // ~ - 0 // DEL -}; - -// press() adds the specified key (printing, non-printing, or modifier) -// to the persistent key report and sends the report. Because of the way -// USB HID works, the host acts like the key remains pressed until we -// call release(), releaseAll(), or otherwise clear the report and resend. -size_t Keyboard_::press(uint8_t k) -{ - uint8_t i; - if (k >= 136) { // it's a non-printing key (not a modifier) - k = k - 136; - } else if (k >= 128) { // it's a modifier key - _keyReport.modifiers |= (1<<(k-128)); - k = 0; - } else { // it's a printing key - k = _asciimap[k]; - if (!k) { - setWriteError(); - return 0; - } - if (k & 0x80) { // it's a capital letter or other character reached with shift - _keyReport.modifiers |= 0x02; // the left shift modifier - k &= 0x7F; - } - } - - // Add k to the key report only if it's not already present - // and if there is an empty slot. - uint8_t keyAlreadyPresent = 0; - for (i=0; i<6; i++) { - if (_keyReport.keys[i] == k) { - keyAlreadyPresent = 1; - } - } - - if (keyAlreadyPresent) { - for (i=0; i<6; i++) { - if (_keyReport.keys[i] == 0x00) { - _keyReport.keys[i] = k; - break; - } - } - if (i == 6) { - setWriteError(); - return 0; - } - } - sendReport(&_keyReport); - return 1; -} - -// release() takes the specified key out of the persistent key report and -// sends the report. This tells the OS the key is no longer pressed and that -// it shouldn't be repeated any more. -size_t Keyboard_::release(uint8_t k) -{ - uint8_t i; - if (k >= 136) { // it's a non-printing key (not a modifier) - k = k - 136; - } else if (k >= 128) { // it's a modifier key - _keyReport.modifiers &= ~(1<<(k-128)); - k = 0; - } else { // it's a printing key - k = _asciimap[k]; - if (!k) { - return 0; - } - if (k & 0x80) { // it's a capital letter or other character reached with shift - _keyReport.modifiers &= ~(0x02); // the left shift modifier - k &= 0x7F; - } - } - - // Test the key report to see if k is present. Clear it if it exists. - // Check all positions in case the key is present more than once (which it shouldn't be) - for (i=0; i<6; i++) { - if (0 != k && _keyReport.keys[i] == k) { - _keyReport.keys[i] = 0x00; - } - } - - sendReport(&_keyReport); - return 1; -} - -void Keyboard_::releaseAll(void) -{ - _keyReport.keys[0] = 0; - _keyReport.keys[1] = 0; - _keyReport.keys[2] = 0; - _keyReport.keys[3] = 0; - _keyReport.keys[4] = 0; - _keyReport.keys[5] = 0; - _keyReport.modifiers = 0; - sendReport(&_keyReport); -} - -size_t Keyboard_::write(uint8_t c) -{ - uint8_t p = 0; - - p = press(c); // Keydown - release(c); // Keyup - - return (p); // Just return the result of press() since release() almost always returns 1 -} - -#endif diff --git a/cores/arduino/USB/PluggableUSB.cpp b/cores/arduino/USB/PluggableUSB.cpp new file mode 100644 index 000000000..84d781d81 --- /dev/null +++ b/cores/arduino/USB/PluggableUSB.cpp @@ -0,0 +1,98 @@ +/* + PluggableUSB.cpp + Copyright (c) 2015 Arduino LLC + + 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 +*/ + +#include "USBAPI.h" +#include "USBDesc.h" +#include "PluggableUSB.h" + +#ifdef PLUGGABLE_USB_ENABLED + +#define MAX_MODULES 6 + +static uint8_t lastIf = CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT; +static uint8_t lastEp = CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT; + +extern uint32_t EndPoints[]; + +//PUSBCallbacks cbs[MAX_MODULES]; +static uint8_t modules_count = 0; + +static PUSBListNode* rootNode = NULL; + +int PUSB_GetInterface(uint8_t* interfaceNum) +{ + int ret = 0; + PUSBListNode* node = rootNode; + for (uint8_t i=0; icb->getInterface(interfaceNum); + node = node->next; + } + return ret; +} + +int PUSB_GetDescriptor(int8_t t) +{ + int ret = 0; + PUSBListNode* node = rootNode; + for (uint8_t i=0; icb->getDescriptor(t); + node = node->next; + } + return ret; +} + +bool PUSB_Setup(USBSetup& setup, uint8_t j) +{ + bool ret = false; + PUSBListNode* node = rootNode; + for (uint8_t i=0; icb->setup(setup, j); + node = node->next; + } + return ret; +} + +int8_t PUSB_AddFunction(PUSBListNode *node, uint8_t* interface) +{ + if (modules_count >= MAX_MODULES) { + return 0; + } + + if (modules_count == 0) { + rootNode = node; + } else { + PUSBListNode *current = rootNode; + while(current->next != NULL) { + current = current->next; + } + current->next = node; + } + + *interface = lastIf; + lastIf += node->cb->numInterfaces; + for ( uint8_t i = 0; i< node->cb->numEndpoints; i++) { + EndPoints[lastEp] = node->cb->endpointType[i]; + lastEp++; + } + modules_count++; + return lastEp - node->cb->numEndpoints; + // restart USB layer??? +} + +#endif \ No newline at end of file diff --git a/cores/arduino/USB/PluggableUSB.h b/cores/arduino/USB/PluggableUSB.h new file mode 100644 index 000000000..205900550 --- /dev/null +++ b/cores/arduino/USB/PluggableUSB.h @@ -0,0 +1,63 @@ +/* + PluggableUSB.h + Copyright (c) 2015 Arduino LLC + + 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 PUSB_h +#define PUSB_h + +#include "USBAPI.h" +#include + +#if defined(USBCON) + +typedef struct __attribute__((packed)) +{ + bool (*setup)(USBSetup& setup, uint8_t i); + int (*getInterface)(uint8_t* interfaceNum); + int (*getDescriptor)(int8_t t); + int8_t numEndpoints; + int8_t numInterfaces; + uint8_t *endpointType; +} PUSBCallbacks; + +typedef struct +{ + uint8_t interface; + uint8_t firstEndpoint; +} PUSBReturn; + +class PUSBListNode { +public: + PUSBListNode *next = NULL; + PUSBCallbacks *cb; + PUSBListNode(PUSBCallbacks *ncb) {cb = ncb;} +}; + +int8_t PUSB_AddFunction(PUSBListNode *node, uint8_t *interface); + +int PUSB_GetInterface(uint8_t* interfaceNum); + +int PUSB_GetDescriptor(int8_t t); + +bool PUSB_Setup(USBSetup& setup, uint8_t i); + +void PUSB_Begin(); + +#endif + +#endif diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index bbb0a3e03..23d0ae242 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -50,7 +50,7 @@ typedef struct { uint8_t wValueH; uint16_t wIndex; uint16_t wLength; -} Setup; +} USBSetup; class USBDeviceClass { public: @@ -66,17 +66,21 @@ class USBDeviceClass { bool connected(); // Setup API - bool handleClassInterfaceSetup(Setup &setup); - bool handleStandardSetup(Setup &setup); - bool sendDescriptor(Setup &setup); + bool handleClassInterfaceSetup(USBSetup &setup); + bool handleStandardSetup(USBSetup &setup); + bool sendDescriptor(USBSetup &setup); // Control EndPoint API uint32_t sendControl(const void *data, uint32_t len); + uint32_t sendControl(int /* ep */, const void *data, uint32_t len) { return sendControl(data, len); } uint32_t recvControl(void *data, uint32_t len); - bool sendConfiguration(uint32_t maxlen); + uint32_t sendConfiguration(uint32_t maxlen); bool sendStringDescriptor(const uint8_t *string, uint8_t maxlen); + void initControl(int end); + uint8_t SendInterfaces(uint32_t* total); // Generic EndPoint API + void initEndpoints(void); void initEP(uint32_t ep, uint32_t type); void handleEndpoint(uint8_t ep); @@ -96,6 +100,8 @@ class USBDeviceClass { void ISRHandler(); private: + void packMessages(bool val); + bool initialized; }; @@ -127,126 +133,24 @@ class Serial_ : public Stream }; extern Serial_ SerialUSB; -//================================================================================ -//================================================================================ -// Mouse - -#define MOUSE_LEFT 1 -#define MOUSE_RIGHT 2 -#define MOUSE_MIDDLE 4 -#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE) - -class Mouse_ -{ -private: - uint8_t _buttons; - void buttons(uint8_t b); -public: - Mouse_(void); - void begin(void); - void end(void); - void click(uint8_t b = MOUSE_LEFT); - void move(signed char x, signed char y, signed char wheel = 0); - void press(uint8_t b = MOUSE_LEFT); // press LEFT by default - void release(uint8_t b = MOUSE_LEFT); // release LEFT by default - bool isPressed(uint8_t b = MOUSE_ALL); // check all buttons by default -}; -extern Mouse_ Mouse; - -//================================================================================ -//================================================================================ -// Keyboard - -#define KEY_LEFT_CTRL 0x80 -#define KEY_LEFT_SHIFT 0x81 -#define KEY_LEFT_ALT 0x82 -#define KEY_LEFT_GUI 0x83 -#define KEY_RIGHT_CTRL 0x84 -#define KEY_RIGHT_SHIFT 0x85 -#define KEY_RIGHT_ALT 0x86 -#define KEY_RIGHT_GUI 0x87 - -#define KEY_UP_ARROW 0xDA -#define KEY_DOWN_ARROW 0xD9 -#define KEY_LEFT_ARROW 0xD8 -#define KEY_RIGHT_ARROW 0xD7 -#define KEY_BACKSPACE 0xB2 -#define KEY_TAB 0xB3 -#define KEY_RETURN 0xB0 -#define KEY_ESC 0xB1 -#define KEY_INSERT 0xD1 -#define KEY_DELETE 0xD4 -#define KEY_PAGE_UP 0xD3 -#define KEY_PAGE_DOWN 0xD6 -#define KEY_HOME 0xD2 -#define KEY_END 0xD5 -#define KEY_CAPS_LOCK 0xC1 -#define KEY_F1 0xC2 -#define KEY_F2 0xC3 -#define KEY_F3 0xC4 -#define KEY_F4 0xC5 -#define KEY_F5 0xC6 -#define KEY_F6 0xC7 -#define KEY_F7 0xC8 -#define KEY_F8 0xC9 -#define KEY_F9 0xCA -#define KEY_F10 0xCB -#define KEY_F11 0xCC -#define KEY_F12 0xCD - -// Low level key report: up to 6 keys and shift, ctrl etc at once -typedef struct -{ - uint8_t modifiers; - uint8_t reserved; - uint8_t keys[6]; -} KeyReport; - -class Keyboard_ : public Print -{ -private: - KeyReport _keyReport; - void sendReport(KeyReport* keys); -public: - Keyboard_(void); - void begin(void); - void end(void); - virtual size_t write(uint8_t k); - virtual size_t press(uint8_t k); - virtual size_t release(uint8_t k); - virtual void releaseAll(void); -}; -extern Keyboard_ Keyboard; - -//================================================================================ -//================================================================================ -// HID 'Driver' - -const void* HID_GetInterface(void); -uint32_t HID_GetInterfaceLength(void); -uint32_t HID_SizeReportDescriptor(void); - -uint32_t HID_GetDescriptor(void); -bool HID_Setup(Setup& setup); -void HID_SendReport(uint8_t id, const void* data, uint32_t len); - //================================================================================ //================================================================================ // MSC 'Driver' uint32_t MSC_GetInterface(uint8_t* interfaceNum); uint32_t MSC_GetDescriptor(uint32_t i); -bool MSC_Setup(Setup& setup); +bool MSC_Setup(USBSetup& setup); bool MSC_Data(uint8_t rx,uint8_t tx); //================================================================================ //================================================================================ // CDC 'Driver' -const void* CDC_GetInterface(/*uint8_t* interfaceNum*/); -uint32_t CDC_GetInterfaceLength(void); +int CDC_GetInterface(uint8_t* interfaceNum); +const void* _CDC_GetInterface(void); +uint32_t _CDC_GetInterfaceLength(void); uint32_t CDC_GetOtherInterface(uint8_t* interfaceNum); uint32_t CDC_GetDescriptor(uint32_t i); -bool CDC_Setup(Setup& setup); +bool CDC_Setup(USBSetup& setup); #endif // __cplusplus diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index d32dd4cb2..26f3ced61 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -19,10 +19,12 @@ #include #include "SAMD21_USBDevice.h" +#include "PluggableUSB.h" #include #include #include +#include USBDevice_SAMD21G18x usbd; @@ -64,13 +66,8 @@ const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER; // DEVICE DESCRIPTOR -#if (defined CDC_ENABLED) && defined(HID_ENABLED) -const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); -#elif defined(CDC_ENABLED) // CDC only -const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x02, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); -#else // HID only +const DeviceDescriptor USB_DeviceDescriptorB = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); -#endif //================================================================== @@ -107,79 +104,72 @@ bool USBDeviceClass::sendStringDescriptor(const uint8_t *string, uint8_t maxlen) return USBDevice.sendControl((uint8_t*)buff, l*2); } -// Construct a dynamic configuration descriptor -// This really needs dynamic endpoint allocation etc -bool USBDeviceClass::sendConfiguration(uint32_t maxlen) +bool _dry_run = false; +bool _pack_message = false; +uint16_t _pack_size = 0; +uint8_t _pack_buffer[256]; + +void USBDeviceClass::packMessages(bool val) { - uint8_t cache_buffer[128]; - uint8_t i; + if (val) { + _pack_message = true; + _pack_size = 0; + } else { + _pack_message = false; + sendControl(_pack_buffer, _pack_size); + } +} - const uint8_t* interfaces; - uint32_t interfaces_length = 0; - uint8_t num_interfaces[1]; +uint8_t USBDeviceClass::SendInterfaces(uint32_t* total) +{ + uint8_t interfaces = 0; - num_interfaces[0] = 0; +#if defined(CDC_ENABLED) + total[0] += CDC_GetInterface(&interfaces); +#endif -#if defined(CDC_ENABLED) && defined(HID_ENABLED) - num_interfaces[0] += 3; - interfaces = (const uint8_t*) CDC_GetInterface(); - interfaces_length = CDC_GetInterfaceLength() + HID_GetInterfaceLength(); - if (maxlen > CDC_GetInterfaceLength() + HID_GetInterfaceLength() + sizeof(ConfigDescriptor)) - { - maxlen = CDC_GetInterfaceLength() + HID_GetInterfaceLength() + sizeof(ConfigDescriptor); - } -#elif defined(CDC_ENABLED) - num_interfaces[0] += 2; - interfaces = (const uint8_t*) CDC_GetInterface(); - interfaces_length += CDC_GetInterfaceLength(); - if (maxlen > CDC_GetInterfaceLength() + sizeof(ConfigDescriptor)) - { - maxlen = CDC_GetInterfaceLength() + sizeof(ConfigDescriptor); - } -#elif defined(HID_ENABLED) - num_interfaces[0] += 1; - interfaces = (const uint8_t*) HID_GetInterface(); - interfaces_length += HID_GetInterfaceLength(); - if (maxlen > HID_GetInterfaceLength() + sizeof(ConfigDescriptor)) - { - maxlen = HID_GetInterfaceLength() + sizeof(ConfigDescriptor); - } +#ifdef PLUGGABLE_USB_ENABLED + total[0] += PUSB_GetInterface(&interfaces); #endif -_Pragma("pack(1)") - ConfigDescriptor config = D_CONFIG((uint16_t)(interfaces_length + sizeof(ConfigDescriptor)), num_interfaces[0]); -_Pragma("pack()") + return interfaces; +} - memcpy(cache_buffer, &config, sizeof(ConfigDescriptor)); +// Construct a dynamic configuration descriptor +// This really needs dynamic endpoint allocation etc +uint32_t USBDeviceClass::sendConfiguration(uint32_t maxlen) +{ + uint32_t total = 0; + // Count and measure interfaces + _dry_run = true; + uint8_t interfaces = SendInterfaces(&total); -#if defined(CDC_ENABLED) && defined(HID_ENABLED) - for (i=0; i sizeof(cache_buffer)) { - maxlen = sizeof(cache_buffer); + // Now send them + _dry_run = false; + + if (maxlen == sizeof(ConfigDescriptor)) { + sendControl(&config, sizeof(ConfigDescriptor)); + return true; } - return sendControl(cache_buffer, maxlen); + + packMessages(true); + sendControl(&config, sizeof(ConfigDescriptor)); + SendInterfaces(&total); + packMessages(false); + + return true; } -bool USBDeviceClass::sendDescriptor(Setup &setup) +bool USBDeviceClass::sendDescriptor(USBSetup &setup) { uint8_t t = setup.wValueH; uint8_t desc_length = 0; + bool _cdcComposite; + int ret; const uint8_t *desc_addr = 0; if (t == USB_CONFIGURATION_DESCRIPTOR_TYPE) @@ -187,22 +177,20 @@ bool USBDeviceClass::sendDescriptor(Setup &setup) return USBDevice.sendConfiguration(setup.wLength); } -#if defined(HID_ENABLED) - if (t == HID_REPORT_DESCRIPTOR_TYPE) - { - return HID_GetDescriptor(); - } - - if (t == HID_HID_DESCRIPTOR_TYPE) - { - uint8_t tab[9] = D_HIDREPORT((uint8_t)HID_SizeReportDescriptor()); - return USBDevice.sendControl(tab, sizeof(tab)); +#ifdef PLUGGABLE_USB_ENABLED + ret = PUSB_GetDescriptor(t); + if (ret != 0) { + return (ret > 0 ? true : false); } #endif if (t == USB_DEVICE_DESCRIPTOR_TYPE) { - desc_addr = (const uint8_t*)&USB_DeviceDescriptor; + if (setup.wLength == 8) + _cdcComposite = 1; + + desc_addr = _cdcComposite ? (const uint8_t*)&USB_DeviceDescriptorB : (const uint8_t*)&USB_DeviceDescriptor; + if (*desc_addr > setup.wLength) { desc_length = setup.wLength; } @@ -269,7 +257,7 @@ void USBDeviceClass::handleEndpoint(uint8_t ep) } #endif -#if defined(HID_ENABLED) +#if defined(PLUGGABLE_USB_ENABLED) // Empty #endif } @@ -355,7 +343,7 @@ bool USBDeviceClass::configured() return _usbConfiguration != 0; } -bool USBDeviceClass::handleClassInterfaceSetup(Setup& setup) +bool USBDeviceClass::handleClassInterfaceSetup(USBSetup& setup) { uint8_t i = setup.wIndex; @@ -369,19 +357,44 @@ bool USBDeviceClass::handleClassInterfaceSetup(Setup& setup) } #endif - #if defined(HID_ENABLED) - if (HID_INTERFACE == i) - { - if (HID_Setup(setup) == false) { - sendZlp(0); - } - return true; + #if defined(PLUGGABLE_USB_ENABLED) + bool ret = PUSB_Setup(setup, i); + if ( ret == false) { + sendZlp(0); } + return ret; #endif return false; } +uint32_t EndPoints[] = +{ + USB_ENDPOINT_TYPE_CONTROL, + +#ifdef CDC_ENABLED + USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0), // CDC_ENDPOINT_ACM + USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0), // CDC_ENDPOINT_OUT + USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0), // CDC_ENDPOINT_IN +#endif + +#ifdef PLUGGABLE_USB_ENABLED + //allocate 6 endpoints and remove const so they can be changed by the user + 0, + 0, + 0, + 0, + 0, + 0, +#endif +}; + +void USBDeviceClass::initEndpoints() { + for (uint8_t i = 1; i < sizeof(EndPoints) && EndPoints[i] != 0; i++) { + initEP(i, EndPoints[i]); + } +} + void USBDeviceClass::initEP(uint32_t ep, uint32_t config) { if (config == (USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0))) @@ -648,6 +661,15 @@ uint32_t USBDeviceClass::sendControl(const void* _data, uint32_t len) uint32_t sent = 0; uint32_t pos = 0; + if (_dry_run == true) + return length; + + if (_pack_message == true) { + memcpy(&_pack_buffer[_pack_size], data, len); + _pack_size += len; + return length; + } + while (len > 0) { sent = armSend(EP0, data + pos, len); @@ -664,7 +686,7 @@ void USBDeviceClass::sendZlp(uint32_t ep) usbd.epBank1SetByteCount(ep, 0); } -bool USBDeviceClass::handleStandardSetup(Setup &setup) +bool USBDeviceClass::handleStandardSetup(USBSetup &setup) { switch (setup.bRequest) { case GET_STATUS: @@ -741,15 +763,8 @@ bool USBDeviceClass::handleStandardSetup(Setup &setup) case SET_CONFIGURATION: if (REQUEST_DEVICE == (setup.bmRequestType & REQUEST_RECIPIENT)) { - #if defined(HID_ENABLED) - initEP(HID_ENDPOINT_INT, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); - #endif - #if defined(CDC_ENABLED) - initEP(CDC_ENDPOINT_ACM, USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0)); - initEP(CDC_ENDPOINT_OUT, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0)); - initEP(CDC_ENDPOINT_IN, USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0)); - #endif + initEndpoints(); _usbConfiguration = setup.wValueL; #if defined(CDC_ENABLED) @@ -780,6 +795,10 @@ bool USBDeviceClass::handleStandardSetup(Setup &setup) void USBDeviceClass::ISRHandler() { + + if (_pack_message == true) { + return; + } // End-Of-Reset if (usbd.isEndOfResetInterrupt()) { @@ -805,7 +824,7 @@ void USBDeviceClass::ISRHandler() { usbd.epBank0AckSetupReceived(0); - Setup *setup = reinterpret_cast(udd_ep_out_cache_buffer[0]); + USBSetup *setup = reinterpret_cast(udd_ep_out_cache_buffer[0]); /* Clear the Bank 0 ready flag on Control OUT */ // The RAM Buffer is empty: we can receive data diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index d584fdfc9..0d2dc7854 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -70,13 +70,6 @@ #define MSC_RESET 0xFF #define MSC_GET_MAX_LUN 0xFE -#define HID_GET_REPORT 0x01 -#define HID_GET_IDLE 0x02 -#define HID_GET_PROTOCOL 0x03 -#define HID_SET_REPORT 0x09 -#define HID_SET_IDLE 0x0A -#define HID_SET_PROTOCOL 0x0B - // Descriptors // #define USB_DEVICE_DESC_SIZE 18 @@ -120,10 +113,6 @@ #define MSC_SUBCLASS_SCSI 0x06 #define MSC_PROTOCOL_BULK_ONLY 0x50 -#define HID_HID_DESCRIPTOR_TYPE 0x21 -#define HID_REPORT_DESCRIPTOR_TYPE 0x22 -#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 - _Pragma("pack(1)") // Device @@ -234,10 +223,8 @@ typedef struct typedef struct { -#if (defined CDC_ENABLED) && defined(HID_ENABLED) // IAD IADDescriptor iad; // Only needed on compound device -#endif // Control InterfaceDescriptor cif; CDCCSInterfaceDescriptor header; @@ -259,26 +246,6 @@ typedef struct EndpointDescriptor out; } MSCDescriptor; -typedef struct -{ - uint8_t len; // 9 - uint8_t dtype; // 0x21 - uint8_t addr; - uint8_t versionL; // 0x101 - uint8_t versionH; // 0x101 - uint8_t country; - uint8_t desctype; // 0x22 report - uint8_t descLenL; - uint8_t descLenH; -} HIDDescDescriptor; - -typedef struct -{ - InterfaceDescriptor hid; - HIDDescDescriptor desc; - EndpointDescriptor in; -} HIDDescriptor; - _Pragma("pack()") #define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \ @@ -308,10 +275,6 @@ _Pragma("pack()") { 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 } /* iadclasscode_r10.pdf, Table 9–Z. Standard Interface Association Descriptor * bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass, bFunctionProtocol, iFunction */ -#define D_HIDREPORT(_descriptorLength) \ - { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 } -/* HID1_11.pdf E.8 HID Descriptor (Mouse) - * bLength, bDescriptorType, bcdHID, bCountryCode, bNumDescriptors, bDescriptorType, wItemLength */ // Functional Descriptor General Format #define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 } diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index b12d707b1..033011ffb 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -20,6 +20,8 @@ #define __USBDESC_H__ // CDC or HID can be enabled together. +#define PLUGGABLE_USB_ENABLED + // These are now controlled by the boards.txt menu system #if defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) #define CDC_ENABLED @@ -34,16 +36,23 @@ #error "USBDesc.h: CDC_ENABLED and HID_ENABLED are now controlled by the boards.txt menu system" #endif +#ifdef CDC_ENABLED +#define CDC_INTERFACE_COUNT 2 +#define CDC_ENPOINT_COUNT 3 +#endif + // CDC #define CDC_ACM_INTERFACE 0 // CDC ACM #define CDC_DATA_INTERFACE 1 // CDC Data +#define CDC_FIRST_ENDPOINT 1 #define CDC_ENDPOINT_ACM 1 #define CDC_ENDPOINT_OUT 2 #define CDC_ENDPOINT_IN 3 -// HID -#define HID_INTERFACE 2 // HID -#define HID_ENDPOINT_INT 4 +#ifdef CDC_ENABLED +#define CDC_RX CDC_ENDPOINT_OUT +#define CDC_TX CDC_ENDPOINT_IN +#endif // Defined string description #define IMANUFACTURER 1 diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp new file mode 100644 index 000000000..2679faa54 --- /dev/null +++ b/libraries/HID/HID.cpp @@ -0,0 +1,176 @@ +/* Copyright (c) 2015, Arduino LLC +** +** Original code (pre-library): Copyright (c) 2011, Peter Barrett +** +** Permission to use, copy, modify, and/or distribute this software for +** any purpose with or without fee is hereby granted, provided that the +** above copyright notice and this permission notice appear in all copies. +** +** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR +** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +** SOFTWARE. +*/ + +#include "USB/PluggableUSB.h" +#include "HID.h" + +HID_ HID; + +static uint8_t HID_ENDPOINT_INT; + +//================================================================================ +//================================================================================ + +// HID report descriptor + +#define LSB(_x) ((_x) & 0xFF) +#define MSB(_x) ((_x) >> 8) + +#define RAWHID_USAGE_PAGE 0xFFC0 +#define RAWHID_USAGE 0x0C00 +#define RAWHID_TX_SIZE 64 +#define RAWHID_RX_SIZE 64 + +static uint8_t HID_INTERFACE; + +HIDDescriptor _hidInterface; + +static HIDDescriptorListNode* rootNode = NULL; +static uint8_t sizeof_hidReportDescriptor = 0; +static uint8_t modules_count = 0; +//================================================================================ +//================================================================================ +// Driver + +uint8_t _hid_protocol = 1; +uint8_t _hid_idle = 1; + +int HID_GetInterface(uint8_t* interfaceNum) +{ + interfaceNum[0] += 1; // uses 1 + _hidInterface = + { + D_INTERFACE(HID_INTERFACE,1,3,0,0), + D_HIDREPORT(sizeof_hidReportDescriptor), + D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x01) + }; + return USBDevice.sendControl(&_hidInterface,sizeof(_hidInterface)); +} + +int HID_GetDescriptor(int8_t t) +{ + if (HID_REPORT_DESCRIPTOR_TYPE == t) { + HIDDescriptorListNode* current = rootNode; + int total = 0; + while(current != NULL) { + total += USBDevice.sendControl(current->cb->descriptor,current->cb->length); + current = current->next; + } + return total; + } else { + return 0; + } +} + +void HID_::AppendDescriptor(HIDDescriptorListNode *node) +{ + if (modules_count == 0) { + rootNode = node; + } else { + HIDDescriptorListNode *current = rootNode; + while(current->next != NULL) { + current = current->next; + } + current->next = node; + } + modules_count++; + sizeof_hidReportDescriptor += node->cb->length; +} + +void HID_::SendReport(uint8_t id, const void* data, int len) +{ + uint8_t p[8]; + const uint8_t *d = reinterpret_cast(data); + + p[0] = id; + for (uint32_t i=0; i +#include + +#define _USING_HID + +//================================================================================ +//================================================================================ +// HID 'Driver' + +#define HID_GET_REPORT 0x01 +#define HID_GET_IDLE 0x02 +#define HID_GET_PROTOCOL 0x03 +#define HID_SET_REPORT 0x09 +#define HID_SET_IDLE 0x0A +#define HID_SET_PROTOCOL 0x0B + +#define HID_HID_DESCRIPTOR_TYPE 0x21 +#define HID_REPORT_DESCRIPTOR_TYPE 0x22 +#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 + +typedef struct __attribute__((packed)) { + uint8_t length; + const void* descriptor; +} HID_Descriptor; + +class HIDDescriptorListNode { +public: + HIDDescriptorListNode *next = NULL; + const HID_Descriptor * cb; + HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;} +}; + +class HID_ +{ +public: + HID_(void); + int begin(void); + void SendReport(uint8_t id, const void* data, int len); + void AppendDescriptor(HIDDescriptorListNode* node); +}; + +typedef struct +{ + uint8_t len; // 9 + uint8_t dtype; // 0x21 + uint8_t addr; + uint8_t versionL; // 0x101 + uint8_t versionH; // 0x101 + uint8_t country; + uint8_t desctype; // 0x22 report + uint8_t descLenL; + uint8_t descLenH; +} HIDDescDescriptor; + +typedef struct +{ + InterfaceDescriptor hid; + HIDDescDescriptor desc; + EndpointDescriptor in; +} HIDDescriptor; + +#define HID_TX HID_ENDPOINT_INT + +#define D_HIDREPORT(_descriptorLength) \ + { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 } + +#define WEAK __attribute__ ((weak)) + +#endif \ No newline at end of file diff --git a/libraries/HID/keywords.txt b/libraries/HID/keywords.txt new file mode 100644 index 000000000..32a9ba5f2 --- /dev/null +++ b/libraries/HID/keywords.txt @@ -0,0 +1,21 @@ +####################################### +# Syntax Coloring Map HID +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +HID KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### +begin KEYWORD2 +SendReport KEYWORD2 +AppendDescriptor KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### +HID_TX LITERAL1 \ No newline at end of file diff --git a/libraries/HID/library.properties b/libraries/HID/library.properties new file mode 100644 index 000000000..b175b1ede --- /dev/null +++ b/libraries/HID/library.properties @@ -0,0 +1,8 @@ +name=HID +version=1.0 +author=Arduino +maintainer=Arduino +sentence=Module for PluggableUSB infrastructure. Exposes an API for devices like Keyboards, Mice and Gamepads +paragraph= +url=http://www.arduino.cc/en/Reference/HID +architectures=samd \ No newline at end of file From aea34792db7cf3a9c45d22d83739979350ce563f Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 7 Sep 2015 15:29:11 +0200 Subject: [PATCH 048/124] fix pluggableUSB OUT packets --- cores/arduino/USB/PluggableUSB.h | 2 +- cores/arduino/USB/USBCore.cpp | 4 ++-- libraries/HID/HID.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cores/arduino/USB/PluggableUSB.h b/cores/arduino/USB/PluggableUSB.h index 205900550..502da9ebc 100644 --- a/cores/arduino/USB/PluggableUSB.h +++ b/cores/arduino/USB/PluggableUSB.h @@ -32,7 +32,7 @@ typedef struct __attribute__((packed)) int (*getDescriptor)(int8_t t); int8_t numEndpoints; int8_t numInterfaces; - uint8_t *endpointType; + uint32_t *endpointType; } PUSBCallbacks; typedef struct diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 26f3ced61..171fe389f 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -75,10 +75,10 @@ volatile uint32_t _usbConfiguration = 0; volatile uint32_t _usbSetInterface = 0; static __attribute__((__aligned__(4))) //__attribute__((__section__(".bss_hram0"))) -uint8_t udd_ep_out_cache_buffer[4][64]; +uint8_t udd_ep_out_cache_buffer[6][64]; static __attribute__((__aligned__(4))) //__attribute__((__section__(".bss_hram0"))) -uint8_t udd_ep_in_cache_buffer[4][64]; +uint8_t udd_ep_in_cache_buffer[6][64]; //================================================================== diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index 2679faa54..c4bbd5cd8 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -152,7 +152,7 @@ bool HID_Setup(USBSetup& setup, uint8_t i) HID_::HID_(void) { - static uint8_t endpointType[1]; + static uint32_t endpointType[1]; endpointType[0] = USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0); From a22b3122bda5c199e23a06aacf1582dcbe07ad26 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Wed, 16 Sep 2015 14:56:21 +0200 Subject: [PATCH 049/124] fix PUSB_getInterface return value --- cores/arduino/USB/PluggableUSB.cpp | 2 +- cores/arduino/USB/USBCore.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cores/arduino/USB/PluggableUSB.cpp b/cores/arduino/USB/PluggableUSB.cpp index 84d781d81..1a15dfa46 100644 --- a/cores/arduino/USB/PluggableUSB.cpp +++ b/cores/arduino/USB/PluggableUSB.cpp @@ -40,7 +40,7 @@ int PUSB_GetInterface(uint8_t* interfaceNum) int ret = 0; PUSBListNode* node = rootNode; for (uint8_t i=0; icb->getInterface(interfaceNum); + ret += node->cb->getInterface(interfaceNum); node = node->next; } return ret; diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 171fe389f..ddc20146b 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -156,6 +156,8 @@ uint32_t USBDeviceClass::sendConfiguration(uint32_t maxlen) return true; } + total = 0; + packMessages(true); sendControl(&config, sizeof(ConfigDescriptor)); SendInterfaces(&total); From 30ada3e56eaf963bc74042b13ee0f79072c55632 Mon Sep 17 00:00:00 2001 From: Paolo Paolucci Date: Wed, 23 Sep 2015 10:24:39 +0200 Subject: [PATCH 050/124] Add function setClock on Wire library --- libraries/Wire/Wire.cpp | 8 +++++--- libraries/Wire/Wire.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index b38abfe68..76e0a1313 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -49,12 +49,14 @@ void TwoWire::begin(uint8_t address) { sercom->enableWIRE(); } -void TwoWire::end() { +void TwoWire::setClock(uint32_t baudrate) { sercom->disableWIRE(); + sercom->initMasterWIRE(baudrate); + sercom->enableWIRE(); } -void TwoWire::setClock(uint32_t frequency) { - // dummy funtion +void TwoWire::end() { + sercom->disableWIRE(); } uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index dfa1c1399..1dd6ec0be 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -39,7 +39,7 @@ class TwoWire : public Stream void begin(); void begin(uint8_t); void end(); - void setClock(uint32_t); // dummy function + void setClock(uint32_t); void beginTransmission(uint8_t); uint8_t endTransmission(bool stopBit); From 126a8c725310fe19e823e48d1fb604573ead3e5d Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 24 Sep 2015 16:06:15 +0200 Subject: [PATCH 051/124] Updated IPAddress to the latest version --- cores/arduino/IPAddress.cpp | 42 +++++++++++++++++++++++++++++++++++++ cores/arduino/IPAddress.h | 7 +++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/cores/arduino/IPAddress.cpp b/cores/arduino/IPAddress.cpp index 899cbd4ed..76aefa8b2 100644 --- a/cores/arduino/IPAddress.cpp +++ b/cores/arduino/IPAddress.cpp @@ -43,6 +43,48 @@ IPAddress::IPAddress(const uint8_t *address) memcpy(_address.bytes, address, sizeof(_address.bytes)); } +bool IPAddress::fromString(const char *address) +{ + // TODO: add support for "a", "a.b", "a.b.c" formats + + uint16_t acc = 0; // Accumulator + uint8_t dots = 0; + + while (*address) + { + char c = *address++; + if (c >= '0' && c <= '9') + { + acc = acc * 10 + (c - '0'); + if (acc > 255) { + // Value out of [0..255] range + return false; + } + } + else if (c == '.') + { + if (dots == 3) { + // Too much dots (there must be 3 dots) + return false; + } + _address.bytes[dots++] = acc; + acc = 0; + } + else + { + // Invalid char + return false; + } + } + + if (dots != 3) { + // Too few dots (there must be 3 dots) + return false; + } + _address.bytes[3] = acc; + return true; +} + IPAddress& IPAddress::operator=(const uint8_t *address) { memcpy(_address.bytes, address, sizeof(_address.bytes)); diff --git a/cores/arduino/IPAddress.h b/cores/arduino/IPAddress.h index 94acdc456..d762f2c02 100644 --- a/cores/arduino/IPAddress.h +++ b/cores/arduino/IPAddress.h @@ -21,7 +21,8 @@ #define IPAddress_h #include -#include +#include "Printable.h" +#include "WString.h" // A class to make it easier to handle and pass around IP addresses @@ -45,6 +46,9 @@ class IPAddress : public Printable { IPAddress(uint32_t address); IPAddress(const uint8_t *address); + bool fromString(const char *address); + bool fromString(const String &address) { return fromString(address.c_str()); } + // Overloaded cast operator to allow IPAddress objects to be used where a pointer // to a four-byte uint8_t array is expected operator uint32_t() const { return _address.dword; }; @@ -71,5 +75,4 @@ class IPAddress : public Printable { const IPAddress INADDR_NONE(0,0,0,0); - #endif From 623091314a78a5ce023617ea130f5bf44baa6718 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 5 Oct 2015 18:27:43 +0200 Subject: [PATCH 052/124] [PluggableUSB] port to stable API --- cores/arduino/USB/PluggableUSB.cpp | 95 ++++++++------ cores/arduino/USB/PluggableUSB.h | 61 +++++---- cores/arduino/USB/USBAPI.h | 3 +- cores/arduino/USB/USBCore.cpp | 10 +- cores/arduino/USB/USBCore.h | 8 +- libraries/HID/HID.cpp | 204 +++++++++++++---------------- libraries/HID/HID.h | 132 +++++++++++-------- 7 files changed, 266 insertions(+), 247 deletions(-) diff --git a/cores/arduino/USB/PluggableUSB.cpp b/cores/arduino/USB/PluggableUSB.cpp index 1a15dfa46..0f2d08c0d 100644 --- a/cores/arduino/USB/PluggableUSB.cpp +++ b/cores/arduino/USB/PluggableUSB.cpp @@ -19,80 +19,89 @@ #include "USBAPI.h" #include "USBDesc.h" +#include "USBCore.h" #include "PluggableUSB.h" +#if defined(USBCON) #ifdef PLUGGABLE_USB_ENABLED -#define MAX_MODULES 6 - -static uint8_t lastIf = CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT; -static uint8_t lastEp = CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT; - extern uint32_t EndPoints[]; -//PUSBCallbacks cbs[MAX_MODULES]; -static uint8_t modules_count = 0; - -static PUSBListNode* rootNode = NULL; - -int PUSB_GetInterface(uint8_t* interfaceNum) +int PluggableUSB_::getInterface(uint8_t* interfaceCount) { - int ret = 0; - PUSBListNode* node = rootNode; - for (uint8_t i=0; icb->getInterface(interfaceNum); - node = node->next; + int sent = 0; + PluggableUSBModule* node; + for (node = rootNode; node; node = node->next) { + int res = node->getInterface(interfaceCount); + if (res < 0) + return -1; + sent += res; } - return ret; + return sent; } -int PUSB_GetDescriptor(int8_t t) +int PluggableUSB_::getDescriptor(USBSetup& setup) { - int ret = 0; - PUSBListNode* node = rootNode; - for (uint8_t i=0; icb->getDescriptor(t); - node = node->next; + PluggableUSBModule* node; + for (node = rootNode; node; node = node->next) { + int ret = node->getDescriptor(setup); + // ret!=0 -> request has been processed + if (ret) + return ret; } - return ret; + return 0; } -bool PUSB_Setup(USBSetup& setup, uint8_t j) +bool PluggableUSB_::setup(USBSetup& setup) { - bool ret = false; - PUSBListNode* node = rootNode; - for (uint8_t i=0; icb->setup(setup, j); - node = node->next; + PluggableUSBModule* node; + for (node = rootNode; node; node = node->next) { + if (node->setup(setup)) { + return true; + } } - return ret; + return false; } -int8_t PUSB_AddFunction(PUSBListNode *node, uint8_t* interface) +bool PluggableUSB_::plug(PluggableUSBModule *node) { - if (modules_count >= MAX_MODULES) { - return 0; + if ((lastEp + node->numEndpoints) > USB_ENDPOINTS) { + return false; } - if (modules_count == 0) { + if (!rootNode) { rootNode = node; } else { - PUSBListNode *current = rootNode; - while(current->next != NULL) { + PluggableUSBModule *current = rootNode; + while (current->next) { current = current->next; } current->next = node; } - *interface = lastIf; - lastIf += node->cb->numInterfaces; - for ( uint8_t i = 0; i< node->cb->numEndpoints; i++) { - EndPoints[lastEp] = node->cb->endpointType[i]; + node->pluggedInterface = lastIf; + node->pluggedEndpoint = lastEp; + lastIf += node->numInterfaces; + for (uint8_t i = 0; i < node->numEndpoints; i++) { + EndPoints[lastEp] = node->endpointType[i]; lastEp++; } - modules_count++; - return lastEp - node->cb->numEndpoints; + return true; // restart USB layer??? } +PluggableUSB_& PluggableUSB() +{ + static PluggableUSB_ obj; + return obj; +} + +PluggableUSB_::PluggableUSB_() : lastIf(CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT), + lastEp(CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT), + rootNode(NULL) +{ + // Empty +} + +#endif #endif \ No newline at end of file diff --git a/cores/arduino/USB/PluggableUSB.h b/cores/arduino/USB/PluggableUSB.h index 502da9ebc..eb18ca253 100644 --- a/cores/arduino/USB/PluggableUSB.h +++ b/cores/arduino/USB/PluggableUSB.h @@ -25,38 +25,47 @@ #if defined(USBCON) -typedef struct __attribute__((packed)) -{ - bool (*setup)(USBSetup& setup, uint8_t i); - int (*getInterface)(uint8_t* interfaceNum); - int (*getDescriptor)(int8_t t); - int8_t numEndpoints; - int8_t numInterfaces; - uint32_t *endpointType; -} PUSBCallbacks; - -typedef struct -{ - uint8_t interface; - uint8_t firstEndpoint; -} PUSBReturn; - -class PUSBListNode { +class PluggableUSBModule { public: - PUSBListNode *next = NULL; - PUSBCallbacks *cb; - PUSBListNode(PUSBCallbacks *ncb) {cb = ncb;} -}; + PluggableUSBModule(uint8_t numEps, uint8_t numIfs, uint32_t *epType) : + numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType) + { } + +protected: + virtual bool setup(USBSetup& setup) = 0; + virtual int getInterface(uint8_t* interfaceCount) = 0; + virtual int getDescriptor(USBSetup& setup) = 0; + + uint8_t pluggedInterface; + uint8_t pluggedEndpoint; -int8_t PUSB_AddFunction(PUSBListNode *node, uint8_t *interface); + const uint8_t numEndpoints; + const uint8_t numInterfaces; + const uint32_t *endpointType; -int PUSB_GetInterface(uint8_t* interfaceNum); + PluggableUSBModule *next = NULL; -int PUSB_GetDescriptor(int8_t t); + friend class PluggableUSB_; +}; -bool PUSB_Setup(USBSetup& setup, uint8_t i); +class PluggableUSB_ { +public: + PluggableUSB_(); + bool plug(PluggableUSBModule *node); + int getInterface(uint8_t* interfaceCount); + int getDescriptor(USBSetup& setup); + bool setup(USBSetup& setup); + +private: + uint8_t lastIf; + uint8_t lastEp; + PluggableUSBModule* rootNode; +}; -void PUSB_Begin(); +// Replacement for global singleton. +// This function prevents static-initialization-order-fiasco +// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use +PluggableUSB_& PluggableUSB(); #endif diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index 23d0ae242..f4a0babf8 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -78,6 +78,7 @@ class USBDeviceClass { bool sendStringDescriptor(const uint8_t *string, uint8_t maxlen); void initControl(int end); uint8_t SendInterfaces(uint32_t* total); + void packMessages(bool val); // Generic EndPoint API void initEndpoints(void); @@ -100,8 +101,6 @@ class USBDeviceClass { void ISRHandler(); private: - void packMessages(bool val); - bool initialized; }; diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index ddc20146b..a584a638e 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -75,10 +75,10 @@ volatile uint32_t _usbConfiguration = 0; volatile uint32_t _usbSetInterface = 0; static __attribute__((__aligned__(4))) //__attribute__((__section__(".bss_hram0"))) -uint8_t udd_ep_out_cache_buffer[6][64]; +uint8_t udd_ep_out_cache_buffer[7][64]; static __attribute__((__aligned__(4))) //__attribute__((__section__(".bss_hram0"))) -uint8_t udd_ep_in_cache_buffer[6][64]; +uint8_t udd_ep_in_cache_buffer[7][64]; //================================================================== @@ -129,7 +129,7 @@ uint8_t USBDeviceClass::SendInterfaces(uint32_t* total) #endif #ifdef PLUGGABLE_USB_ENABLED - total[0] += PUSB_GetInterface(&interfaces); + total[0] += PluggableUSB().getInterface(&interfaces); #endif return interfaces; @@ -180,7 +180,7 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup) } #ifdef PLUGGABLE_USB_ENABLED - ret = PUSB_GetDescriptor(t); + ret = PluggableUSB().getDescriptor(setup); if (ret != 0) { return (ret > 0 ? true : false); } @@ -360,7 +360,7 @@ bool USBDeviceClass::handleClassInterfaceSetup(USBSetup& setup) #endif #if defined(PLUGGABLE_USB_ENABLED) - bool ret = PUSB_Setup(setup, i); + bool ret = PluggableUSB().setup(setup); if ( ret == false) { sendZlp(0); } diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 0d2dc7854..853f305ae 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -36,6 +36,8 @@ #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) #define USB_ENDPOINT_IN(addr) ((addr) | 0x80) +#define USB_ENDPOINTS 7 + #define USB_ENDPOINT_TYPE_MASK 0x03 #define USB_ENDPOINT_TYPE_CONTROL 0x00 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 @@ -58,9 +60,9 @@ #define REQUEST_OTHER 0x03 #define REQUEST_RECIPIENT 0x1F -#define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE) -#define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE) - +#define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST | REQUEST_CLASS | REQUEST_INTERFACE) +#define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE | REQUEST_CLASS | REQUEST_INTERFACE) +#define REQUEST_DEVICETOHOST_STANDARD_INTERFACE (REQUEST_DEVICETOHOST | REQUEST_STANDARD | REQUEST_INTERFACE) // Class requests #define CDC_SET_LINE_CODING 0x20 diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index c4bbd5cd8..94bf9f598 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -19,158 +19,132 @@ #include "USB/PluggableUSB.h" #include "HID.h" -HID_ HID; +#if defined(USBCON) -static uint8_t HID_ENDPOINT_INT; - -//================================================================================ -//================================================================================ - -// HID report descriptor - -#define LSB(_x) ((_x) & 0xFF) -#define MSB(_x) ((_x) >> 8) - -#define RAWHID_USAGE_PAGE 0xFFC0 -#define RAWHID_USAGE 0x0C00 -#define RAWHID_TX_SIZE 64 -#define RAWHID_RX_SIZE 64 - -static uint8_t HID_INTERFACE; - -HIDDescriptor _hidInterface; - -static HIDDescriptorListNode* rootNode = NULL; -static uint8_t sizeof_hidReportDescriptor = 0; -static uint8_t modules_count = 0; -//================================================================================ -//================================================================================ -// Driver - -uint8_t _hid_protocol = 1; -uint8_t _hid_idle = 1; +HID_& HID() +{ + static HID_ obj; + return obj; +} -int HID_GetInterface(uint8_t* interfaceNum) +int HID_::getInterface(uint8_t* interfaceCount) { - interfaceNum[0] += 1; // uses 1 - _hidInterface = - { - D_INTERFACE(HID_INTERFACE,1,3,0,0), - D_HIDREPORT(sizeof_hidReportDescriptor), - D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x01) + *interfaceCount += 1; // uses 1 + HIDDescriptor hidInterface = { + D_INTERFACE(pluggedInterface, 1, USB_DEVICE_CLASS_HUMAN_INTERFACE, HID_SUBCLASS_NONE, HID_PROTOCOL_NONE), + D_HIDREPORT(descriptorSize), + D_ENDPOINT(USB_ENDPOINT_IN(pluggedEndpoint), USB_ENDPOINT_TYPE_INTERRUPT, 0x40, 0x01) }; - return USBDevice.sendControl(&_hidInterface,sizeof(_hidInterface)); + return USBDevice.sendControl(&hidInterface, sizeof(hidInterface)); } -int HID_GetDescriptor(int8_t t) +int HID_::getDescriptor(USBSetup& setup) { - if (HID_REPORT_DESCRIPTOR_TYPE == t) { - HIDDescriptorListNode* current = rootNode; - int total = 0; - while(current != NULL) { - total += USBDevice.sendControl(current->cb->descriptor,current->cb->length); - current = current->next; - } - return total; - } else { - return 0; + // Check if this is a HID Class Descriptor request + if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; } + if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0; } + + // In a HID Class Descriptor wIndex cointains the interface number + if (setup.wIndex != pluggedInterface) { return 0; } + + int total = 0; + HIDSubDescriptor* node; + USBDevice.packMessages(true); + for (node = rootNode; node; node = node->next) { + int res = USBDevice.sendControl(node->data, node->length); + if (res == -1) + return -1; + total += res; } + USBDevice.packMessages(false); + return total; } -void HID_::AppendDescriptor(HIDDescriptorListNode *node) +void HID_::AppendDescriptor(HIDSubDescriptor *node) { - if (modules_count == 0) { + if (!rootNode) { rootNode = node; } else { - HIDDescriptorListNode *current = rootNode; - while(current->next != NULL) { + HIDSubDescriptor *current = rootNode; + while (current->next) { current = current->next; } current->next = node; } - modules_count++; - sizeof_hidReportDescriptor += node->cb->length; + descriptorSize += node->length; } void HID_::SendReport(uint8_t id, const void* data, int len) { - uint8_t p[8]; - const uint8_t *d = reinterpret_cast(data); - + uint8_t p[64]; p[0] = id; - for (uint32_t i=0; i #include +#include "USB/PluggableUSB.h" -#define _USING_HID +#if defined(USBCON) -//================================================================================ -//================================================================================ -// HID 'Driver' +#define _USING_HID +// HID 'Driver' +// ------------ #define HID_GET_REPORT 0x01 #define HID_GET_IDLE 0x02 #define HID_GET_PROTOCOL 0x03 @@ -42,52 +40,80 @@ #define HID_REPORT_DESCRIPTOR_TYPE 0x22 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 -typedef struct __attribute__((packed)) { - uint8_t length; - const void* descriptor; -} HID_Descriptor; +// HID subclass HID1.11 Page 8 4.2 Subclass +#define HID_SUBCLASS_NONE 0 +#define HID_SUBCLASS_BOOT_INTERFACE 1 + +// HID Keyboard/Mouse bios compatible protocols HID1.11 Page 9 4.3 Protocols +#define HID_PROTOCOL_NONE 0 +#define HID_PROTOCOL_KEYBOARD 1 +#define HID_PROTOCOL_MOUSE 2 + +// Normal or bios protocol (Keyboard/Mouse) HID1.11 Page 54 7.2.5 Get_Protocol Request +// "protocol" variable is used for this purpose. +#define HID_BOOT_PROTOCOL 0 +#define HID_REPORT_PROTOCOL 1 + +typedef struct +{ + uint8_t len; // 9 + uint8_t dtype; // 0x21 + uint8_t addr; + uint8_t versionL; // 0x101 + uint8_t versionH; // 0x101 + uint8_t country; + uint8_t desctype; // 0x22 report + uint8_t descLenL; + uint8_t descLenH; +} HIDDescDescriptor; + +typedef struct +{ + InterfaceDescriptor hid; + HIDDescDescriptor desc; + EndpointDescriptor in; +} HIDDescriptor; -class HIDDescriptorListNode { +class HIDSubDescriptor { public: - HIDDescriptorListNode *next = NULL; - const HID_Descriptor * cb; - HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;} + HIDSubDescriptor *next = NULL; + HIDSubDescriptor(const void *d, const uint16_t l) : data(d), length(l) { } + + const void* data; + const uint16_t length; }; -class HID_ +class HID_ : public PluggableUSBModule { public: HID_(void); int begin(void); void SendReport(uint8_t id, const void* data, int len); - void AppendDescriptor(HIDDescriptorListNode* node); -}; + void AppendDescriptor(HIDSubDescriptor* node); -typedef struct -{ - uint8_t len; // 9 - uint8_t dtype; // 0x21 - uint8_t addr; - uint8_t versionL; // 0x101 - uint8_t versionH; // 0x101 - uint8_t country; - uint8_t desctype; // 0x22 report - uint8_t descLenL; - uint8_t descLenH; -} HIDDescDescriptor; +protected: + // Implementation of the PluggableUSBModule + int getInterface(uint8_t* interfaceCount); + int getDescriptor(USBSetup& setup); + bool setup(USBSetup& setup); -typedef struct -{ - InterfaceDescriptor hid; - HIDDescDescriptor desc; - EndpointDescriptor in; -} HIDDescriptor; +private: + uint32_t epType[1]; + + HIDSubDescriptor* rootNode; + uint16_t descriptorSize; + + uint8_t protocol; + uint8_t idle; +}; -#define HID_TX HID_ENDPOINT_INT +// Replacement for global singleton. +// This function prevents static-initialization-order-fiasco +// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use +HID_& HID(); -#define D_HIDREPORT(_descriptorLength) \ - { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 } +#define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) } -#define WEAK __attribute__ ((weak)) +#endif -#endif \ No newline at end of file +#endif From 304b76e844d1e78f3f69bb6ed184adb784dcfe0e Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Wed, 21 Oct 2015 16:45:55 +0200 Subject: [PATCH 053/124] PUSB: add iSerial USB field --- cores/arduino/USB/PluggableUSB.cpp | 9 +++++++++ cores/arduino/USB/PluggableUSB.h | 2 ++ cores/arduino/USB/USBCore.cpp | 11 +++++++++-- cores/arduino/USB/USBDesc.h | 5 ++++- libraries/HID/HID.cpp | 10 ++++++++++ libraries/HID/HID.h | 1 + 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/cores/arduino/USB/PluggableUSB.cpp b/cores/arduino/USB/PluggableUSB.cpp index 0f2d08c0d..4c52c1fad 100644 --- a/cores/arduino/USB/PluggableUSB.cpp +++ b/cores/arduino/USB/PluggableUSB.cpp @@ -52,6 +52,15 @@ int PluggableUSB_::getDescriptor(USBSetup& setup) return 0; } +void PluggableUSB_::getShortName(char *iSerialNum) +{ + PluggableUSBModule* node; + for (node = rootNode; node; node = node->next) { + iSerialNum += node->getShortName(iSerialNum); + } + *iSerialNum = 0; +} + bool PluggableUSB_::setup(USBSetup& setup) { PluggableUSBModule* node; diff --git a/cores/arduino/USB/PluggableUSB.h b/cores/arduino/USB/PluggableUSB.h index eb18ca253..4e08e5dfc 100644 --- a/cores/arduino/USB/PluggableUSB.h +++ b/cores/arduino/USB/PluggableUSB.h @@ -35,6 +35,7 @@ class PluggableUSBModule { virtual bool setup(USBSetup& setup) = 0; virtual int getInterface(uint8_t* interfaceCount) = 0; virtual int getDescriptor(USBSetup& setup) = 0; + virtual uint8_t getShortName(char *name) { name[0] = 'A'+pluggedInterface; return 1; } uint8_t pluggedInterface; uint8_t pluggedEndpoint; @@ -55,6 +56,7 @@ class PluggableUSB_ { int getInterface(uint8_t* interfaceCount); int getDescriptor(USBSetup& setup); bool setup(USBSetup& setup); + void getShortName(char *iSerialNum); private: uint8_t lastIf; diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index a584a638e..9642c2aad 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -66,8 +66,8 @@ const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER; // DEVICE DESCRIPTOR -const DeviceDescriptor USB_DeviceDescriptorB = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); -const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, 0, 1); +const DeviceDescriptor USB_DeviceDescriptorB = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, ISERIAL, 1); +const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, ISERIAL, 1); //================================================================== @@ -208,6 +208,13 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup) else if (setup.wValueL == IMANUFACTURER) { return sendStringDescriptor(STRING_MANUFACTURER, setup.wLength); } + else if (setup.wValueL == ISERIAL) { +#ifdef PLUGGABLE_USB_ENABLED + char name[ISERIAL_MAX_LEN]; + PluggableUSB().getShortName(name); + return sendStringDescriptor((uint8_t*)name, setup.wLength); +#endif + } else { return false; } diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index 033011ffb..645704941 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -54,8 +54,11 @@ #define CDC_TX CDC_ENDPOINT_IN #endif +#define ISERIAL_MAX_LEN 20 + // Defined string description #define IMANUFACTURER 1 -#define IPRODUCT 2 +#define IPRODUCT 2 +#define ISERIAL 3 #endif /* __USBDESC_H__ */ diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index 94bf9f598..34995fe67 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -60,6 +60,16 @@ int HID_::getDescriptor(USBSetup& setup) return total; } +uint8_t HID_::getShortName(char *name) +{ + name[0] = 'H'; + name[1] = 'I'; + name[2] = 'D'; + name[3] = 'A' + (descriptorSize & 0x0F); + name[4] = 'A' + ((descriptorSize >> 4) & 0x0F); + return 5; +} + void HID_::AppendDescriptor(HIDSubDescriptor *node) { if (!rootNode) { diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index e5dfa3395..9499b726c 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -96,6 +96,7 @@ class HID_ : public PluggableUSBModule int getInterface(uint8_t* interfaceCount); int getDescriptor(USBSetup& setup); bool setup(USBSetup& setup); + uint8_t getShortName(char* name); private: uint32_t epType[1]; From 23dbf1190276871fe1382159584d30c0c4c9be53 Mon Sep 17 00:00:00 2001 From: agdl Date: Thu, 22 Oct 2015 14:20:49 +0200 Subject: [PATCH 054/124] Tone fix for #59 and optimizations This fixes issue #59 and optimize the way the prescaler is found. Furthermore non needed instructions are not repeated. --- cores/arduino/Tone.cpp | 131 ++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 67 deletions(-) diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 5d135e70b..99e7fa173 100644 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -29,6 +29,7 @@ volatile uint32_t *portClearRegister; volatile uint32_t portBitMask; volatile int64_t toggleCount; volatile bool toneIsActive = false; +volatile bool firstTimeRunning = false; /* TC5 does not exist on the D11. Using TC2 instead. It will conflict with the 2 TC2 PWM pins */ #if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) @@ -41,6 +42,7 @@ volatile bool toneIsActive = false; #define TONE_TC_TOP 0xFFFF #define TONE_TC_CHANNEL 0 + void TC5_Handler (void) __attribute__ ((weak, alias("Tone_Handler"))); static inline void resetTC (Tc* TCx) @@ -62,6 +64,25 @@ void toneAccurateClock (uint32_t accurateSystemCoreClockFrequency) void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration) { + // Configure interrupt request + NVIC_DisableIRQ(TONE_TC_IRQn); + NVIC_ClearPendingIRQ(TONE_TC_IRQn); + + if(!firstTimeRunning) + { + firstTimeRunning = true; + + NVIC_SetPriority(TONE_TC_IRQn, 0); + + // Enable GCLK for timer used +#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC1_TC2)); +#else + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC4_TC5)); +#endif + while (GCLK->STATUS.bit.SYNCBUSY); + } + if (toneIsActive && (outputPin != lastOutputPin)) noTone(lastOutputPin); @@ -74,94 +95,70 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration) ccValue = toneMaxFrequency / frequency - 1; prescalerConfigBits = TC_CTRLA_PRESCALER_DIV1; - - if (ccValue > TONE_TC_TOP) + + uint8_t i = 0; + + while(ccValue > TONE_TC_TOP) + { + ccValue = toneMaxFrequency / frequency / (2< TONE_TC_TOP) - { - ccValue = toneMaxFrequency / frequency / 4 - 1; - prescalerConfigBits = TC_CTRLA_PRESCALER_DIV4; - - if (ccValue > TONE_TC_TOP) - { - ccValue = toneMaxFrequency / frequency / 8 - 1; - prescalerConfigBits = TC_CTRLA_PRESCALER_DIV8; - - if (ccValue > TONE_TC_TOP) - { - ccValue = toneMaxFrequency / frequency / 16 - 1; - prescalerConfigBits = TC_CTRLA_PRESCALER_DIV16; - - if (ccValue > TONE_TC_TOP) - { - ccValue = toneMaxFrequency / frequency / 64 - 1; - prescalerConfigBits = TC_CTRLA_PRESCALER_DIV64; - - if (ccValue > TONE_TC_TOP) - { - ccValue = toneMaxFrequency / frequency / 256 - 1; - prescalerConfigBits = TC_CTRLA_PRESCALER_DIV256; - - if (ccValue > TONE_TC_TOP) - { - ccValue = toneMaxFrequency / frequency / 1024 - 1; - prescalerConfigBits = TC_CTRLA_PRESCALER_DIV1024; - } - } - } - } - } - } + case 0: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV2; break; + + case 1: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV4; break; + + case 2: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV8; break; + + case 3: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV16; break; + + case 5: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV64; break; + + case 7: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV256; break; + + case 9: prescalerConfigBits = TC_CTRLA_PRESCALER_DIV1024; break; + + default: break; } toggleCount = (duration > 0 ? frequency * duration * 2 / 1000UL : -1); - // Enable GCLK for timer used -#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC1_TC2)); -#else - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC4_TC5)); -#endif - - while (GCLK->STATUS.bit.SYNCBUSY); - resetTC(TONE_TC); - // Set Timer counter Mode to 16 bits - TONE_TC->COUNT16.CTRLA.reg |= TC_CTRLA_MODE_COUNT16; - - // Set TONE_TC mode as match frequency - TONE_TC->COUNT16.CTRLA.reg |= TC_CTRLA_WAVEGEN_MFRQ; - - TONE_TC->COUNT16.CTRLA.reg |= prescalerConfigBits; + uint16_t tmpReg = 0; + tmpReg |= TC_CTRLA_MODE_COUNT16; // Set Timer counter Mode to 16 bits + tmpReg |= TC_CTRLA_WAVEGEN_MFRQ; // Set TONE_TC mode as match frequency + tmpReg |= prescalerConfigBits; + TONE_TC->COUNT16.CTRLA.reg |= tmpReg; + WAIT_TC16_REGS_SYNC(TONE_TC) TONE_TC->COUNT16.CC[TONE_TC_CHANNEL].reg = (uint16_t) ccValue; WAIT_TC16_REGS_SYNC(TONE_TC) - // Configure interrupt request - NVIC_DisableIRQ(TONE_TC_IRQn); - NVIC_ClearPendingIRQ(TONE_TC_IRQn); - NVIC_SetPriority(TONE_TC_IRQn, 0); - NVIC_EnableIRQ(TONE_TC_IRQn); - portToggleRegister = &(PORT->Group[g_APinDescription[outputPin].ulPort].OUTTGL.reg); portClearRegister = &(PORT->Group[g_APinDescription[outputPin].ulPort].OUTCLR.reg); portBitMask = (1ul << g_APinDescription[outputPin].ulPin); // Enable the TONE_TC interrupt request TONE_TC->COUNT16.INTENSET.bit.MC0 = 1; - - lastOutputPin = outputPin; - digitalWrite(outputPin, LOW); - pinMode(outputPin, OUTPUT); - toneIsActive = true; + + if (outputPin != lastOutputPin) + { + lastOutputPin = outputPin; + digitalWrite(outputPin, LOW); + pinMode(outputPin, OUTPUT); + toneIsActive = true; + } // Enable TONE_TC TONE_TC->COUNT16.CTRLA.reg |= TC_CTRLA_ENABLE; WAIT_TC16_REGS_SYNC(TONE_TC) + + NVIC_EnableIRQ(TONE_TC_IRQn); } void noTone (uint32_t outputPin) From 0c7945b8c3469fa067c154d5ea133ecfa8240564 Mon Sep 17 00:00:00 2001 From: Paolo Paolucci Date: Sat, 31 Oct 2015 17:20:08 +0100 Subject: [PATCH 055/124] Add category on library.properties files --- libraries/HID/library.properties | 3 ++- libraries/SAMD_AnalogCorrection/library.properties | 1 + libraries/SPI/library.properties | 1 + libraries/USBHost/library.properties | 1 + libraries/Wire/library.properties | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/HID/library.properties b/libraries/HID/library.properties index b175b1ede..ff9377bc4 100644 --- a/libraries/HID/library.properties +++ b/libraries/HID/library.properties @@ -4,5 +4,6 @@ author=Arduino maintainer=Arduino sentence=Module for PluggableUSB infrastructure. Exposes an API for devices like Keyboards, Mice and Gamepads paragraph= +category=Other url=http://www.arduino.cc/en/Reference/HID -architectures=samd \ No newline at end of file +architectures=samd diff --git a/libraries/SAMD_AnalogCorrection/library.properties b/libraries/SAMD_AnalogCorrection/library.properties index e12ada2d1..b8ba59a45 100644 --- a/libraries/SAMD_AnalogCorrection/library.properties +++ b/libraries/SAMD_AnalogCorrection/library.properties @@ -4,5 +4,6 @@ author=Arduino maintainer=Arduino sentence=Sets and enables the digital correction logic of the SAMD ADC. paragraph=Useful to correct the values returned by the ADC. +category=Other url= architectures=samd diff --git a/libraries/SPI/library.properties b/libraries/SPI/library.properties index 3aaa770b8..6940f1458 100644 --- a/libraries/SPI/library.properties +++ b/libraries/SPI/library.properties @@ -4,5 +4,6 @@ author=Jonathan BAUDIN, Thibaut VIARD, Arduino maintainer=Arduino sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. Specific implementation for Arduino Zero. paragraph= +category=Communication url=http://www.arduino.cc/en/Reference/SPI architectures=samd diff --git a/libraries/USBHost/library.properties b/libraries/USBHost/library.properties index 240f951e4..48f542e2c 100644 --- a/libraries/USBHost/library.properties +++ b/libraries/USBHost/library.properties @@ -4,5 +4,6 @@ author=Arduino maintainer=Arduino sentence=Allows the communication with USB peripherals like mice, keyboards, and thumbdrives. For Arduino Due and Zero. paragraph=The USBHost library allows the board to appear as a USB host, enabling it to communicate with peripherals like USB mice and keyboards. USBHost does not support devices that are connected through USB hubs. This includes some keyboards that have an internal hub. +category=Other url=http://arduino.cc/en/Reference/USBHost architectures=samd diff --git a/libraries/Wire/library.properties b/libraries/Wire/library.properties index eff193aa2..d5b44eaf1 100644 --- a/libraries/Wire/library.properties +++ b/libraries/Wire/library.properties @@ -4,6 +4,6 @@ author=Jonathan BAUDIN, Thibaut VIARD, Arduino maintainer=Arduino sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. Specific implementation for Arduino Zero. paragraph= +category=Communication url=http://www.arduino.cc/en/Reference/Wire architectures=samd - From 2e951a5e2f83beecba55270226d038dd96ceeabf Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 3 Nov 2015 15:21:58 +0100 Subject: [PATCH 056/124] Update HID API --- libraries/HID/HID.cpp | 4 ++-- libraries/HID/HID.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index 34995fe67..a2f1382b2 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -84,12 +84,12 @@ void HID_::AppendDescriptor(HIDSubDescriptor *node) descriptorSize += node->length; } -void HID_::SendReport(uint8_t id, const void* data, int len) +int HID_::SendReport(uint8_t id, const void* data, int len) { uint8_t p[64]; p[0] = id; memcpy(&p[1], data, len); - USBDevice.send(pluggedEndpoint, p, len+1); + return USBDevice.send(pluggedEndpoint, p, len+1); } bool HID_::setup(USBSetup& setup) diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index 9499b726c..d086593b6 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -88,7 +88,7 @@ class HID_ : public PluggableUSBModule public: HID_(void); int begin(void); - void SendReport(uint8_t id, const void* data, int len); + int SendReport(uint8_t id, const void* data, int len); void AppendDescriptor(HIDSubDescriptor* node); protected: From f1f0297ca90ccc8e815222c5879c61a503d12a77 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Wed, 4 Nov 2015 15:05:18 -0500 Subject: [PATCH 057/124] Add getDataOrderSPI API to Sercom --- cores/arduino/SERCOM.cpp | 5 +++++ cores/arduino/SERCOM.h | 1 + 2 files changed, 6 insertions(+) diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index c7a829284..ffbf37de2 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -291,6 +291,11 @@ void SERCOM::setDataOrderSPI(SercomDataOrder dataOrder) enableSPI(); } +SercomDataOrder SERCOM::getDataOrderSPI() +{ + return (sercom->SPI.CTRLA.bit.DORD ? LSB_FIRST : MSB_FIRST); +} + void SERCOM::setBaudrateSPI(uint8_t divider) { //Can't divide by 0 diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index 772715d09..661d12006 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -173,6 +173,7 @@ class SERCOM void enableSPI( void ) ; void disableSPI( void ) ; void setDataOrderSPI(SercomDataOrder dataOrder) ; + SercomDataOrder getDataOrderSPI( void ) ; void setBaudrateSPI(uint8_t divider) ; void setClockModeSPI(SercomSpiClockMode clockMode) ; void writeDataSPI(uint8_t data) ; From b7e750e10469f77455e3ce08fddf51a69e4dba01 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Wed, 4 Nov 2015 15:06:02 -0500 Subject: [PATCH 058/124] Add SPI. transfer16(...) API --- libraries/SPI/SPI.cpp | 16 ++++++++++++++++ libraries/SPI/SPI.h | 1 + 2 files changed, 17 insertions(+) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 7e2735c8c..b004a9acd 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -194,6 +194,22 @@ byte SPIClass::transfer(uint8_t data) return _p_sercom->readDataSPI() & 0xFF; } +uint16_t SPIClass::transfer16(uint16_t data) { + union { uint16_t val; struct { uint8_t lsb; uint8_t msb; }; } t; + + t.val = data; + + if (_p_sercom->getDataOrderSPI() == LSB_FIRST) { + t.lsb = transfer(t.lsb); + t.msb = transfer(t.msb); + } else { + t.msb = transfer(t.msb); + t.lsb = transfer(t.lsb); + } + + return t.val; +} + void SPIClass::attachInterrupt() { // Should be enableInterrupt() } diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index cca53db01..e4fc948c9 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -96,6 +96,7 @@ class SPIClass { byte transfer(uint8_t data); + uint16_t transfer16(uint16_t data); inline void transfer(void *buf, size_t count); // Transaction Functions From 0405f03dba437196b32ac833b1f32e1a847706d9 Mon Sep 17 00:00:00 2001 From: tuxedo0801 Date: Fri, 6 Nov 2015 14:51:58 +0100 Subject: [PATCH 059/124] Added missing begin() variant with 2nd argument for configuring serial port (parity etc..) --- cores/arduino/HardwareSerial.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index 62cd90078..7c3a76ad2 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -68,6 +68,7 @@ class HardwareSerial : public Stream { public: virtual void begin(unsigned long); + virtual void begin(unsigned long baudrate, uint8_t config); virtual void end(); virtual int available(void) = 0; virtual int peek(void) = 0; From be488e54a2a19fb7e4b249f961df4f7e3d6122e4 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 13 Nov 2015 18:27:44 +0000 Subject: [PATCH 060/124] Print not aborting on write failure, changelog update --- README.md | 17 +++++++++++++++++ cores/arduino/Print.cpp | 7 +++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 37ea5401d..6c1707d8c 100644 --- a/README.md +++ b/README.md @@ -468,6 +468,23 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## ChangeLog +* 1.6.6-mt1: + + * Merged in changes from upstream SAMD CORE 1.6.3 + * Added SPI.transfer16(..) method + * Bugfix: added missing Serial.begin(baud, config) method. Thanks @tuxedo0801 + + * Merged in changes from upstream SAMD CORE 1.6.2 2015.11.03 + * Fixed bug in delay calculations + * Fixed deadlock conditions in Wire. Thanks Erin Tomson + * Print not aborting on write() failure. Thanks @stickbreaker + * SPI can now be configured in variants. Thanks @aethaniel + * Implemented Wire.end + * Implemented Wire.setClock. Thanks @PaoloP74 + * Wire: allow scanning bus via beginTransmission-endTransmission + * USB Device: big refactoring and bug fix + * USB Device: added PluggableUSB interface + * 1.6.5-mt2: * See 'What's New' above. diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index b40e91947..98eb4fd6e 100644 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -31,7 +31,8 @@ size_t Print::write(const uint8_t *buffer, size_t size) { size_t n = 0; while (size--) { - n += write(*buffer++); + if (write(*buffer++)) n++; + else break; } return n; } @@ -112,9 +113,7 @@ size_t Print::print(const Printable& x) size_t Print::println(void) { - size_t n = print('\r'); - n += print('\n'); - return n; + return write("\r\n"); } size_t Print::println(const String &s) From 3f1a0ff3be04aee8cee8205ee0550894769a1413 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 16 Nov 2015 04:36:27 +0000 Subject: [PATCH 061/124] Send a ZLP if data size is multiple of EPX_SIZE for USB sends, arduino/ArduinoCore-samd#63 --- cores/arduino/USB/USBCore.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 9642c2aad..aad0fd38e 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -581,7 +581,10 @@ uint8_t USBDeviceClass::armRecv(uint32_t ep) uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) { uint32_t length = 0; - + // if len is a multiple of EPX_SIZE an ZLP needs to be sent + // to indicate end of transfer + bool sendZlp = (len % EPX_SIZE) == 0; + if (!_usbConfiguration) return -1; if (len > 16384) @@ -621,10 +624,10 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) #endif // Flash area - while (len != 0) + while (len != 0 || sendZlp) { - if (len >= 64) { - length = 64; + if (len >= EPX_SIZE) { + length = EPX_SIZE; } else { length = len; } @@ -646,6 +649,12 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) ; // need fire exit. } len -= length; + + if (len == 0 && sendZlp) { + // empty transfer sent + sendZlp = false; + } + data += length; } return len; @@ -679,12 +688,12 @@ uint32_t USBDeviceClass::sendControl(const void* _data, uint32_t len) return length; } - while (len > 0) - { + while (len > 0) + { sent = armSend(EP0, data + pos, len); pos += sent; len -= sent; - } + } return length; } From 7b881bbd5a1780eb821a07086a8790cf054d41c6 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 16 Nov 2015 04:38:28 +0000 Subject: [PATCH 062/124] HardwareSerial BUG Rx pin floating input, arduino/ArduinoCore-samd#48 --- cores/arduino/Uart.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 3bf278228..914338b67 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -36,6 +36,7 @@ void Uart::begin(unsigned long baudrate) void Uart::begin(unsigned long baudrate, uint8_t config) { + pinMode(uc_pinRX,INPUT_PULLUP);//Rx pin set INPUT_PULLUP mode pinPeripheral(uc_pinRX, PIO_SERCOM); pinPeripheral(uc_pinTX, PIO_SERCOM); From 4ad6141a4ebb8525cd85e09f909c0918096dbaed Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 16 Nov 2015 04:40:46 +0000 Subject: [PATCH 063/124] the pin mode is changed to INPUT mode, arduino/ArduinoCore-samd#28 --- cores/arduino/wiring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index e8361f7fb..adf8a6408 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -97,10 +97,10 @@ void init( void ) PM->APBCMASK.reg |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ; // Setup all pins (digital and analog) in INPUT mode (default is nothing) - for ( ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ ) - { - pinMode( ul, INPUT ) ; - } + // for ( ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ ) + // { + // pinMode( ul, INPUT ) ; + // } // Initialize Analog Controller // Setting clock From 911852046d07ec565ab0bcdb26dc6955eebd0fb9 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 24 Nov 2015 08:29:00 +0000 Subject: [PATCH 064/124] Fix warnings about deprecated recipe.ar.pattern and std=gnu11 --- platform.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.txt b/platform.txt index 6ab1cdde2..581dcf4d6 100644 --- a/platform.txt +++ b/platform.txt @@ -40,7 +40,7 @@ compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps compiler.S.cmd=arm-none-eabi-gcc compiler.S.flags=-c -g -x assembler-with-cpp compiler.cpp.cmd=arm-none-eabi-g++ -compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD compiler.ar.cmd=arm-none-eabi-ar compiler.ar.flags=rcs compiler.objcopy.cmd=arm-none-eabi-objcopy From 8c273eaab823a1e78cc74beafc730793a2d1e895 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 24 Nov 2015 08:34:45 +0000 Subject: [PATCH 065/124] Update Tools->Communications menu to work with PluggabeUSB --- boards.txt | 104 ++++++++++++++++++++++------------ cores/arduino/USB/CDC.cpp | 3 + cores/arduino/USB/USBCore.cpp | 25 +++++--- cores/arduino/USB/USBDesc.h | 42 +++++++++----- libraries/HID/HID.h | 3 + 5 files changed, 120 insertions(+), 57 deletions(-) diff --git a/boards.txt b/boards.txt index 1362c6f08..ce64f4437 100644 --- a/boards.txt +++ b/boards.txt @@ -53,25 +53,31 @@ mattairtech_mt_d21e_bl8k.build.mcu=cortex-m0plus mattairtech_mt_d21e_bl8k.build.f_cpu=48000000L mattairtech_mt_d21e_bl8k.build.usb_product="MT-D21E" mattairtech_mt_d21e_bl8k.build.usb_manufacturer="MattairTech" -mattairtech_mt_d21e_bl8k.build.board=CDC_HID_UART +mattairtech_mt_d21e_bl8k.build.board=CDC_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart=CDC_HID_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.pid=0x0856 mattairtech_mt_d21e_bl8k.menu.com.cdc_uart=CDC_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.board=CDC_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.pid=0x0557 -mattairtech_mt_d21e_bl8k.menu.com.hid_uart=HID_UART -mattairtech_mt_d21e_bl8k.menu.com.hid_uart.build.board=HID_UART -mattairtech_mt_d21e_bl8k.menu.com.hid_uart.build.pid=0x0856 mattairtech_mt_d21e_bl8k.menu.com.cdc_hid=CDC_HID mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.board=CDC_HID mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.pid=0x0856 mattairtech_mt_d21e_bl8k.menu.com.cdc=CDC_ONLY mattairtech_mt_d21e_bl8k.menu.com.cdc.build.board=CDC_ONLY mattairtech_mt_d21e_bl8k.menu.com.cdc.build.pid=0x0557 -mattairtech_mt_d21e_bl8k.menu.com.hid=HID_ONLY -mattairtech_mt_d21e_bl8k.menu.com.hid.build.board=HID_ONLY -mattairtech_mt_d21e_bl8k.menu.com.hid.build.pid=0x0856 +mattairtech_mt_d21e_bl8k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 +# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 +# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 +# mattairtech_mt_d21e_bl8k.menu.com.msd_uart=MSD_UART +# mattairtech_mt_d21e_bl8k.menu.com.msd_uart.build.board=MSD_UART +# mattairtech_mt_d21e_bl8k.menu.com.msd_uart.build.pid=0x0A0C mattairtech_mt_d21e_bl8k.menu.com.uart=UART_ONLY mattairtech_mt_d21e_bl8k.menu.com.uart.build.board=UART_ONLY mattairtech_mt_d21e_bl8k.menu.com.uart.build.pid=0x0856 @@ -115,25 +121,31 @@ mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam #mattairtech_mt_d21e_bl16k.build.f_cpu=48000000L #mattairtech_mt_d21e_bl16k.build.usb_product="MT-D21E" #mattairtech_mt_d21e_bl16k.build.usb_manufacturer="MattairTech" -#mattairtech_mt_d21e_bl16k.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl16k.build.board=CDC_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart=CDC_HID_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl16k.menu.com.cdc_uart=CDC_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.board=CDC_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.pid=0x0557 -#mattairtech_mt_d21e_bl16k.menu.com.hid_uart=HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.hid_uart.build.board=HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid=CDC_HID #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.board=CDC_HID #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.pid=0x0856 #mattairtech_mt_d21e_bl16k.menu.com.cdc=CDC_ONLY #mattairtech_mt_d21e_bl16k.menu.com.cdc.build.board=CDC_ONLY #mattairtech_mt_d21e_bl16k.menu.com.cdc.build.pid=0x0557 -#mattairtech_mt_d21e_bl16k.menu.com.hid=HID_ONLY -#mattairtech_mt_d21e_bl16k.menu.com.hid.build.board=HID_ONLY -#mattairtech_mt_d21e_bl16k.menu.com.hid.build.pid=0x0856 +#mattairtech_mt_d21e_bl16k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 +# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 +# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 +# mattairtech_mt_d21e_bl16k.menu.com.msd_uart=MSD_UART +# mattairtech_mt_d21e_bl16k.menu.com.msd_uart.build.board=MSD_UART +# mattairtech_mt_d21e_bl16k.menu.com.msd_uart.build.pid=0x0A0C #mattairtech_mt_d21e_bl16k.menu.com.uart=UART_ONLY #mattairtech_mt_d21e_bl16k.menu.com.uart.build.board=UART_ONLY #mattairtech_mt_d21e_bl16k.menu.com.uart.build.pid=0x0856 @@ -178,25 +190,31 @@ mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam #mattairtech_mt_d21e_bl0k.build.f_cpu=48000000L #mattairtech_mt_d21e_bl0k.build.usb_product="MT-D21E" #mattairtech_mt_d21e_bl0k.build.usb_manufacturer="MattairTech" -#mattairtech_mt_d21e_bl0k.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl0k.build.board=CDC_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl0k.menu.com.cdc_uart=CDC_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.board=CDC_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.pid=0x0557 -#mattairtech_mt_d21e_bl0k.menu.com.hid_uart=HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.hid_uart.build.board=HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid=CDC_HID #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.board=CDC_HID #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.pid=0x0856 #mattairtech_mt_d21e_bl0k.menu.com.cdc=CDC_ONLY #mattairtech_mt_d21e_bl0k.menu.com.cdc.build.board=CDC_ONLY #mattairtech_mt_d21e_bl0k.menu.com.cdc.build.pid=0x0557 -#mattairtech_mt_d21e_bl0k.menu.com.hid=HID_ONLY -#mattairtech_mt_d21e_bl0k.menu.com.hid.build.board=HID_ONLY -#mattairtech_mt_d21e_bl0k.menu.com.hid.build.pid=0x0856 +#mattairtech_mt_d21e_bl0k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 +# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 +# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 +# mattairtech_mt_d21e_bl0k.menu.com.msd_uart=MSD_UART +# mattairtech_mt_d21e_bl0k.menu.com.msd_uart.build.board=MSD_UART +# mattairtech_mt_d21e_bl0k.menu.com.msd_uart.build.pid=0x0A0C #mattairtech_mt_d21e_bl0k.menu.com.uart=UART_ONLY #mattairtech_mt_d21e_bl0k.menu.com.uart.build.board=UART_ONLY #mattairtech_mt_d21e_bl0k.menu.com.uart.build.pid=0x0856 @@ -230,25 +248,31 @@ mattairtech_mt_d11.build.mcu=cortex-m0plus mattairtech_mt_d11.build.f_cpu=48000000L mattairtech_mt_d11.build.usb_product="MT-D11" mattairtech_mt_d11.build.usb_manufacturer="MattairTech" -mattairtech_mt_d11.build.board=CDC_HID_UART +mattairtech_mt_d11.build.board=CDC_UART mattairtech_mt_d11.menu.com.cdc_hid_uart=CDC_HID_UART mattairtech_mt_d11.menu.com.cdc_hid_uart.build.board=CDC_HID_UART mattairtech_mt_d11.menu.com.cdc_hid_uart.build.pid=0x0856 mattairtech_mt_d11.menu.com.cdc_uart=CDC_UART mattairtech_mt_d11.menu.com.cdc_uart.build.board=CDC_UART mattairtech_mt_d11.menu.com.cdc_uart.build.pid=0x0557 -mattairtech_mt_d11.menu.com.hid_uart=HID_UART -mattairtech_mt_d11.menu.com.hid_uart.build.board=HID_UART -mattairtech_mt_d11.menu.com.hid_uart.build.pid=0x0856 mattairtech_mt_d11.menu.com.cdc_hid=CDC_HID mattairtech_mt_d11.menu.com.cdc_hid.build.board=CDC_HID mattairtech_mt_d11.menu.com.cdc_hid.build.pid=0x0856 mattairtech_mt_d11.menu.com.cdc=CDC_ONLY mattairtech_mt_d11.menu.com.cdc.build.board=CDC_ONLY mattairtech_mt_d11.menu.com.cdc.build.pid=0x0557 -mattairtech_mt_d11.menu.com.hid=HID_ONLY -mattairtech_mt_d11.menu.com.hid.build.board=HID_ONLY -mattairtech_mt_d11.menu.com.hid.build.pid=0x0856 +mattairtech_mt_d11.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +mattairtech_mt_d11.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +mattairtech_mt_d11.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 +# mattairtech_mt_d11.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# mattairtech_mt_d11.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# mattairtech_mt_d11.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 +# mattairtech_mt_d11.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d11.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d11.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 +# mattairtech_mt_d11.menu.com.msd_uart=MSD_UART +# mattairtech_mt_d11.menu.com.msd_uart.build.board=MSD_UART +# mattairtech_mt_d11.menu.com.msd_uart.build.pid=0x0A0C mattairtech_mt_d11.menu.com.uart=UART_ONLY mattairtech_mt_d11.menu.com.uart.build.board=UART_ONLY mattairtech_mt_d11.menu.com.uart.build.pid=0x0856 @@ -286,14 +310,18 @@ arduino_zero_native.menu.com.cdc_hid_uart=CDC_HID_UART arduino_zero_native.menu.com.cdc_hid_uart.build.board=CDC_HID_UART arduino_zero_native.menu.com.cdc_uart=CDC_UART arduino_zero_native.menu.com.cdc_uart.build.board=CDC_UART -arduino_zero_native.menu.com.hid_uart=HID_UART -arduino_zero_native.menu.com.hid_uart.build.board=HID_UART arduino_zero_native.menu.com.cdc_hid=CDC_HID arduino_zero_native.menu.com.cdc_hid.build.board=CDC_HID arduino_zero_native.menu.com.cdc=CDC_ONLY arduino_zero_native.menu.com.cdc.build.board=CDC_ONLY -arduino_zero_native.menu.com.hid=HID_ONLY -arduino_zero_native.menu.com.hid.build.board=HID_ONLY +arduino_zero_native.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +arduino_zero_native.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +# arduino_zero_native.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# arduino_zero_native.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# arduino_zero_native.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# arduino_zero_native.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# arduino_zero_native.menu.com.msd_uart=MSD_UART +# arduino_zero_native.menu.com.msd_uart.build.board=MSD_UART arduino_zero_native.menu.com.uart=UART_ONLY arduino_zero_native.menu.com.uart.build.board=UART_ONLY arduino_zero_native.menu.com.none=USB_UART_DISABLED @@ -326,14 +354,18 @@ arduino_zero_native.build.pid=0x804d #arduino_zero_edbg.menu.com.cdc_hid_uart.build.board=CDC_HID_UART #arduino_zero_edbg.menu.com.cdc_uart=CDC_UART #arduino_zero_edbg.menu.com.cdc_uart.build.board=CDC_UART -#arduino_zero_edbg.menu.com.hid_uart=HID_UART -#arduino_zero_edbg.menu.com.hid_uart.build.board=HID_UART #arduino_zero_edbg.menu.com.cdc_hid=CDC_HID #arduino_zero_edbg.menu.com.cdc_hid.build.board=CDC_HID #arduino_zero_edbg.menu.com.cdc=CDC_ONLY #arduino_zero_edbg.menu.com.cdc.build.board=CDC_ONLY -#arduino_zero_edbg.menu.com.hid=HID_ONLY -#arduino_zero_edbg.menu.com.hid.build.board=HID_ONLY +#arduino_zero_edbg.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +#arduino_zero_edbg.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +# arduino_zero_edbg.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# arduino_zero_edbg.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# arduino_zero_edbg.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# arduino_zero_edbg.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# arduino_zero_edbg.menu.com.msd_uart=MSD_UART +# arduino_zero_edbg.menu.com.msd_uart.build.board=MSD_UART #arduino_zero_edbg.menu.com.uart=UART_ONLY #arduino_zero_edbg.menu.com.uart.build.board=UART_ONLY #arduino_zero_edbg.menu.com.none=USB_UART_DISABLED diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 0f1016848..14dd2e31b 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -18,6 +18,7 @@ #include #include // Needed for auto-reset with 1200bps port touch +#include "USBDesc.h" #include #include @@ -59,7 +60,9 @@ static volatile LineInfo _usbLineInfo = { }; static CDCDescriptor _cdcInterface = { +#if !defined(CDC_ONLY) D_IAD(0, 2, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), +#endif // CDC communication interface D_INTERFACE(CDC_ACM_INTERFACE, 1, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index aad0fd38e..cbecacd1f 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -20,6 +20,7 @@ #include "SAMD21_USBDevice.h" #include "PluggableUSB.h" +#include "USBDesc.h" #include #include @@ -66,8 +67,9 @@ const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER; // DEVICE DESCRIPTOR -const DeviceDescriptor USB_DeviceDescriptorB = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, ISERIAL, 1); const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, ISERIAL, 1); +const DeviceDescriptor USB_DeviceDescriptorB = D_DEVICE(0xEF, 0x02, 0x01, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, ISERIAL, 1); +const DeviceDescriptor USB_DeviceDescriptorC = D_DEVICE(0x02, 0x00, 0x00, 64, USB_VID, USB_PID, 0x100, IMANUFACTURER, IPRODUCT, ISERIAL, 1); //================================================================== @@ -170,7 +172,7 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup) { uint8_t t = setup.wValueH; uint8_t desc_length = 0; - bool _cdcComposite; + //bool _cdcComposite; int ret; const uint8_t *desc_addr = 0; @@ -188,10 +190,17 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup) if (t == USB_DEVICE_DESCRIPTOR_TYPE) { - if (setup.wLength == 8) - _cdcComposite = 1; - - desc_addr = _cdcComposite ? (const uint8_t*)&USB_DeviceDescriptorB : (const uint8_t*)&USB_DeviceDescriptor; + //if (setup.wLength == 8) + // _cdcComposite = 1; + + //desc_addr = _cdcComposite ? (const uint8_t*)&USB_DeviceDescriptorB : (const uint8_t*)&USB_DeviceDescriptor; +#if defined(IAD_PRESENT) + desc_addr = (const uint8_t*)&USB_DeviceDescriptorB; +#elif defined(CDC_ONLY) + desc_addr = (const uint8_t*)&USB_DeviceDescriptorC; +#else + desc_addr = (const uint8_t*)&USB_DeviceDescriptor; +#endif if (*desc_addr > setup.wLength) { desc_length = setup.wLength; @@ -785,11 +794,11 @@ bool USBDeviceClass::handleStandardSetup(USBSetup &setup) initEndpoints(); _usbConfiguration = setup.wValueL; - #if defined(CDC_ENABLED) +#if defined(CDC_ENABLED) // Enable interrupt for CDC reception from host (OUT packet) usbd.epBank1EnableTransferComplete(CDC_ENDPOINT_ACM); usbd.epBank0EnableTransferComplete(CDC_ENDPOINT_OUT); - #endif +#endif sendZlp(0); return true; diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index 645704941..2dd9bc6bd 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -19,32 +19,48 @@ #ifndef __USBDESC_H__ #define __USBDESC_H__ -// CDC or HID can be enabled together. +#if !defined(ARDUINO_USB_UART_DISABLED) && !defined(ARDUINO_UART_ONLY) #define PLUGGABLE_USB_ENABLED +#endif -// These are now controlled by the boards.txt menu system -#if defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) - #define CDC_ENABLED - #define HID_ENABLED -#elif defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) - #define CDC_ENABLED -#elif defined(ARDUINO_HID_ONLY) || defined(ARDUINO_HID_UART) - #define HID_ENABLED -#elif defined(ARDUINO_USB_UART_DISABLED) || defined(ARDUINO_UART_ONLY) - // do nothing +// These are controlled by the boards.txt menu system. +// Now that there is Pluggable USB, these will be eliminated +// once an alternate method for USB PID allocation is found. +#if defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) +#define CDC_ENABLED +#if defined(ARDUINO_CDC_ONLY) +#define CDC_ONLY #else - #error "USBDesc.h: CDC_ENABLED and HID_ENABLED are now controlled by the boards.txt menu system" +#define IAD_PRESENT +#endif +#endif + +#if defined(ARDUINO_HID_ONLY) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) +#define HID_ENABLED +#endif + +#if defined(ARDUINO_MIDI_ONLY) || defined(ARDUINO_MIDI_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) +#define MIDI_ENABLED +#define IAD_PRESENT +#endif + +#if defined(ARDUINO_MSD_ONLY) || defined(ARDUINO_MSD_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) +#define MSD_ENABLED #endif + #ifdef CDC_ENABLED #define CDC_INTERFACE_COUNT 2 #define CDC_ENPOINT_COUNT 3 +#else +#define CDC_INTERFACE_COUNT 0 +#define CDC_ENPOINT_COUNT 0 #endif // CDC #define CDC_ACM_INTERFACE 0 // CDC ACM #define CDC_DATA_INTERFACE 1 // CDC Data -#define CDC_FIRST_ENDPOINT 1 +#define CDC_FIRST_ENDPOINT 1 #define CDC_ENDPOINT_ACM 1 #define CDC_ENDPOINT_OUT 2 #define CDC_ENDPOINT_IN 3 diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index d086593b6..f0c6ad9ae 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -22,6 +22,9 @@ #include #include #include "USB/PluggableUSB.h" +#if !defined(HID_ENABLED) +#error Please select an appropriate option that includes HID in the Tools->Communications menu. +#endif #if defined(USBCON) From 778e0ef84b581974b0fa012bac4812ef1ea44150 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 24 Nov 2015 08:36:10 +0000 Subject: [PATCH 066/124] Update documentation for release 1.6.6-mt1 --- README.md | 209 +++++++++++++++++++----------- variants/MT_D11/variant.cpp | 30 ++--- variants/MT_D21E/variant.cpp | 48 +++---- variants/arduino_zero/variant.cpp | 2 +- 4 files changed, 170 insertions(+), 119 deletions(-) diff --git a/README.md b/README.md index 6c1707d8c..e94ca21e6 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,32 @@ This core is intended to be installed using Boards Manager (see below). To updat previous version, click on MattairTech SAMD Boards in Boards Manager, then click Update. -## What's New - -* Added support for the MT-D11 (ATSAMD11D14AM). -* Reduced code size (see 'Code Size and RAM Usage' below). -* Any combination of CDC, HID, or UART can be used (or no combination), by using the Tools->Communication menu. -* Note that switching between CDC and CDC+HID will require re-selecting the COM port. -* More detailed memory usage at end of compilation (see below). -* Merged in upstream updates. Fixed Wire interrupt. -* Tested all ADC, DAC, external interrupts, PWM outputs, serial, SPI, and Wire instances/pins. +## What's New (1.6.6-mt1, November 24, 2015) + +* New documentation section 'Special Notes'. Please read! +* Updated ASCII pinouts to be more readable and less ambiguous. +* Updated the Signed driver for Windows (extras directory). + * adds CDC/MIDI/HID, CDC/MSD/HID, and CDC/MSD/MIDI/HID composite USB devices. + * Of the above, currently only CDC/MIDI/HID is usable (see MIDIUSB library). +* Merged in changes from upstream past SAMD CORE 1.6.2 release + * Added SPI.transfer16(..) method + * Bugfix: added missing Serial.begin(baud, config) method. Thanks @tuxedo0801 + * the pin mode is changed to INPUT mode, arduino/ArduinoCore-samd#28 + * HardwareSerial BUG Rx pin floating input, arduino/ArduinoCore-samd#48 + * Send a ZLP if data size is multiple of EPX_SIZE for USB sends, arduino/ArduinoCore-samd#63 + * Print not aborting on write failure, changelog update + * Tone fix for arduino/ArduinoCore-samd#59 and optimizations + * Fix warnings about deprecated recipe.ar.pattern +* Merged in changes from upstream SAMD CORE 1.6.2 2015.11.03 + * Fixed bug in delay calculations + * Fixed deadlock conditions in Wire. Thanks Erin Tomson + * Print not aborting on write() failure. Thanks @stickbreaker + * SPI can now be configured in variants. Thanks @aethaniel + * Implemented Wire.end + * Implemented Wire.setClock. Thanks @PaoloP74 + * Wire: allow scanning bus via beginTransmission-endTransmission + * USB Device: big refactoring and bug fix + * USB Device: added PluggableUSB interface ## Summary @@ -44,6 +61,33 @@ Operating Voltage | 3.3V (Do not connect voltages higher than 3.3V!) | 3.3V ( DC Current per I/O Pin | 7 mA | 7 mA +## Special Notes + +* Boards Manager may require opening twice (with possibly a delay in between) to see some updates. + +* Errors when compiling, uploading, or burning the bootloader + Be sure to install the Arduino samd core before installing the MattairTech samd core. If you have problems upgrading + the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. + Use Arduino core 1.6.2 or above. + +* Tools->Communications menu + Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration + must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an + option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the + USB device configuration (needed for Windows). This may become automatic in a future release. + + * Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. + * Different combinations of USB devices will result in different COM port assingments in Windows. + +* Incude platform specific libraries + You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. + +* Differences from Arduino in versioning + The MattairTech ArduinoCore-samd version currently tracks the IDE version. In some cases, it may indicate the + minimum IDE version. This is the case for both 1.6.5-mtX and 1.6.6-mtX (which corresponds to SAMD CORE 1.6.2). + 1.6.6-mt1 corresponds to Arduino SAMD CORE 1.6.2 plus some pull requests. + + ## Pin Configurations Most pins have multiple configurations available (even analog pins). For example, pin A10 on the MT-D21E can be an analog @@ -54,50 +98,50 @@ but without the 'A' (with the usable pins starting at 2). DO NOT connect voltage ``` ============================= MattairTech MT-D21E (ATsamd21eXXa) ======================== -Other INT PWM Digital Analog Digital PWM INT Other +Other INT PWM Digital Analog Digital PWM INT Other ========================================================================================= - ------------------- -Xin32 | A0 RST | Reset -Xout32 | A1 NC | -DAC 2 2 (ADC0) | A2 NC | -REF 3 3 (ADC1) | A3 A31 | 31 TCC1[1] INT11 SWD IO * - INT4 4 4 (ADC4) | A4 A30 | 30 TCC1[0] INT10 SWD CLK - INT5 5 5 (ADC5) | A5 NC | - 6 6 (ADC6) | A6 A28 | 28 INT8 LED -VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A - INTNMI TCC0[0] 8 8 (ADC16) | A8 A23 | 23 TC4[1] INT7 SPI SS - INT9 TCC0[1] 9 9 (ADC17) | A9 A22 | 22 TC4[0] INT6 SPI MISO -TX (1) TCC0[2] 10 10 (ADC18)| A10 A19 | 19 INT3 SPI SCK -RX (1) TCC0[3] 11 11 (ADC19)| A11 A18 | 18 INT2 SPI MOSI -TX (2) INT14 TC3[0] 14 | A14 A17 | 17 TCC2[1] INT1 I2C/SCL -RX (2) TC3[1] 15 | A15 A16 | 16 TCC2[0] INT0 I2C/SDA - | NC NC | - | NC NC | - | Vbus 3.3V| * Button B available on 31 -USB D- | A24- _____ Vcc | -USB D+ | A25+ | | Vin | - | Gnd | USB | Gnd | - ------------------- + ------------------- +Xin32 | A0 RST | Reset +Xout32 | A1 NC | +DAC 2 2(ADC0) | A2 NC | +REF 3 3(ADC1) | A3 A31 | 31 31(TCC11) 31(INT11) SWDIO* + 4(INT4) 4 4(ADC4) | A4 A30 | 30 30(TCC10) 30(INT10) SWDCLK + 5(INT5) 5 5(ADC5) | A5 NC | + 6 6(ADC6) | A6 A28 | 28 28(INT8) LED +VDIV 7 7(ADC7) | A7 A27 | 27 27(INT15) BTNA + 8(INTNMI) 8(TCC00) 8 8(ADC16) | A8 A23 | 23 23(TC41) 23(INT7) SS + 9(INT9) 9(TCC01) 9 9(ADC17) | A9 A22 | 22 22(TC40) 22(INT6) MISO +TX1 10(TCC02) 10 10(ADC18)| A10 A19 | 19 19(INT3) SCK +RX1 11(TCC03) 11 11(ADC19)| A11 A18 | 18 18(INT2) MOSI +TX2 14(INT14) 14(TC30) 14 | A14 A17 | 17 17(TCC21) 17(INT1) SCL +RX2 15(TC31) 15 | A15 A16 | 16 16(TCC20) 16(INT0) SDA + | NC NC | + | NC NC | + | Vbus 3.3V| * Button B available on 31 +USB D- | A24- _____ Vcc | +USB D+ | A25+ | | Vin | + | Gnd | USB | Gnd | + ------------------- ``` ### SAMD11 (MT-D11) ``` -============================= MattairTech MT-D11 (ATsamd11D14AM) ======================== -Other INT PWM Digital Analog Digital PWM INT Other +=========================== MattairTech MT-D11 (ATsamd11D14AM) ========================== +Other INT PWM Digital Analog Digital PWM INT Other ========================================================================================= - ------------------- -DAC 2 2 (ADC0) | A2 | USB | Gnd | -REF 3 3 (ADC1) | A3 | | Vcc | -VDIV INT4 TCC0[0] 4 4 (ADC2) | A4 ----- A31 | 31 TC2[1] INT3 RX / SWDIO - INT5 TCC0[1] 5 5 (ADC3) | A5 A30 | 30 TC2[0] TX / SWDCLK - TCC0[2] 6 6 (ADC4) | A6 A27 | 27 INT7 - TCC0[3] 7 7 (ADC5) | A7 A23 | 23 I2C/SCL -SPI MOSI INT2 10 10 (ADC8) | A10 A22 | 22 INT6 I2C/SDA -SPI SCK 11 11 (ADC9) | A11 A17 | 17 TC1[1] -SPI MISO INTNMI 14 14 (ADC6) | A14 A16 | 16 TC1[0] INT0 LED -Button INT1 15 15 (ADC7) | A15 RST | Reset - ------------------- + ------------------- +DAC 2 2(ADC0) | A2 | USB | Gnd | +REF 3 3(ADC1) | A3 | | Vcc | + 4(INT4) 4(TCC00) 4 4(ADC2) | A4 ----- A31 | 31 31(TC21) 31(INT3) RX/SWDIO + 5(INT5) 5(TCC01) 5 5(ADC3) | A5 A30 | 30 30(TC20) TX/SWDCLK + 6(TCC02) 6 6(ADC4) | A6 A27 | 27 27(INT7) + 7(TCC03) 7 7(ADC5) | A7 A23 | 23 SCL +MOSI 10(INT2) 10 10(ADC8) | A10 A22 | 22 22(INT6) SDA +SCK 11 11(ADC9) | A11 A17 | 17 17(TC11) +MISO 14(INTNMI) 14 14(ADC6) | A14 A16 | 16 16(TC10) 16(INT0) LED +BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | Reset + ------------------- ``` #### All pins operate at 3.3 volts. DO NOT connect voltages higher than 3.3V! @@ -131,6 +175,8 @@ Button INT1 15 15 (ADC7) | A15 RST | * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). * SPI communication using the SPI library. +* Note that the SPI library will set SS as an output. +* On the MT-D11, the button must be configured as reset (default) when using SPI. * **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). * MT-D11: Pin 22 (SDA) and pin 23 (SCL). @@ -144,7 +190,7 @@ Button INT1 15 15 (ADC7) | A15 RST | * The upper end of the analog measurement range can be changed using the analogReference() function. * **Reset: Bring this line LOW to reset the microcontroller.** -### MT-D21E and MT-D11 Board Configuration +### MT-D21E and MT-D11 Board Configuration Notes * The 32.768KHz crystal is used by the Arduino core, so it MUST be connected via the solder jumpers. * Note that the sketch may still run without the crystal attached, but the clock speed will be very inaccurate. @@ -154,6 +200,7 @@ Button INT1 15 15 (ADC7) | A15 RST | * Button A should be connected via the solder jumper. The debouncing capacitor should also be connected. * Button B (MT-D21E only) is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. * A reference voltage can be connected to AREF. In this case, the capacitors should be enabled via the solder jumper. +* On the MT-D11, BTN is shared with SPI SS, so the button must be configured as reset (default) when using SPI. ## Serial Monitor @@ -173,7 +220,7 @@ the Reset button will reset the SAMD chip, which in turn will reset USB communic that if the serial monitor is open, it will be necessary to close and re-open it to restart communication. -## Code Size and RAM Usage +## Code Size and RAM Usage (1.6.5-mt2) Sketch and Configuration | MT-D21E (Flash + RAM) | MT-D11 (Flash + RAM) ----------------------------|-----------------------|----------------------- @@ -217,15 +264,16 @@ everything else (ie: W) resides in flash (in most cases). #### Windows -There are two "drivers", a CDC only driver for the bootloader, and a CDC-HID driver for Arduino sketches (optional). -The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP3), Vista, 7, and 8. +There are currently four USB composite device combinations that include CDC as well as a CDC only device. +Drivers are required for each of these five devices. The CDC only driver is required by the bootloader. +The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP3), Vista, 7, 8, and 10. 1. If you do not already have the SAM-BA bootloader installed, see below. 2. Download https://www.mattairtech.com/software/MattairTech_CDC_Driver_Signed.zip and unzip into any folder. 3. Plug in the board while holding down button A to enter the bootloader. The LED should light. 4. Windows will detect the board. Point the installer to the folder from above to install the bootloader driver. 5. If you don't intend on using Arduino, you can skip the rest of this list. See Using Bossac Standalone below. -6. If you do not already have the test firmware installed, see Using Bossac Standalone below. +6. If you do not already have the test firmware installed (comes preinstalled), see Using Bossac Standalone below. 7. Press the reset button to run the test firmware (blink sketch with CDC-HID). 8. Windows will detect the board. Point the installer to the folder from above to install the sketch driver. 9. Continue with SAMD Core Installation below. @@ -243,7 +291,7 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 1. As of this writing, only the 256 KB chip variants work with the OS X version of the upload tool, bossac. 2. First, you will need to open boards.txt and change mattairtech_mt_d21e_bl8k.upload.tool to equal arduino:bossac. -3. Open platform.txt and change tools.bossac.path to equal{runtime.tools.bossac-1.5-arduino.path}. +3. Open platform.txt and change tools.bossac.path to equal{runtime.tools.bossac-1.6.1-arduino.path}. 4. No driver installation is needed. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: * Click the "Network Preferences..." button, then click "Apply". * The board will show up as “Not Configuredâ€, but it will work fine. @@ -252,14 +300,15 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP ### SAMD Core Installation * To update from a previous version, click on MattairTech SAMD Boards in Boards Manager, then click Update. +* Boards Manager may require opening twice (with possibly a delay in between) to see some updates. -1. The MattairTech SAMD Core requires Arduino 1.6.5+. -2. In the Arduino IDE 1.6.5+, click File->Preferences. +1. The MattairTech SAMD Core requires Arduino 1.6.6+ (1.6.5-mtX required IDE 1.6.5). +2. In the Arduino IDE, click File->Preferences. 3. Click the button next to Additional Boards Manager URLs. 4. Add https://www.mattairtech.com/software/arduino/package_MattairTech_index.json. 5. Save preferences, then open the Boards Manager. -6. Install the Arduino SAMD Boards package. -7. Install the MattairTech SAMD Boards package. +6. Install the Arduino SAMD Boards package. Use version 1.6.2 or higher with 1.6.6-mtX. +7. Install the MattairTech SAMD Boards package (1.6.6-mtX). 8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E (or MT-D11). 9. Select the processor with the now visible Tools->Processor menu. 10. If you do not already have the bootloader or blink sketch installed, see SAM-BA USB CDC Bootloader below. @@ -453,40 +502,42 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## Possible Future Additions -* Port Servo library -* Features for lower power consumption +* USB Host mode CDC ACM +* Features for lower power consumption (library?) +* Enhanced SD card library +* Optional use of single on-board LED as USB activity LED * Replace pulse with timer capture -* MIDI USB Device Class * MSC (Mass Storage) USB Device Class -* More detailed memory usage statistics -* Some kind of stack overflow detection. Estimation on stack usage. -* Analog calibration * Polyphonic tone * Better OS X support -* Drivers for some hardware I plan on using (TFT LCD, motor controller, IR decoder, several I2C (Wire) sensor devices, I2S device, etc.) +* Libraries for some hardware I plan on using: + TFT LCD + Motor controller + IR decoder + I2S DAC/AMP and I2S MEMS microphone + Battery management IC + XBee/Xbee Pro devices + RS485 + Several I2C (Wire) sensor devices: + Accelerometer/gyro/magnetometer + Barometer/altimeter + Humidity/temperature + Light/color sensor ## ChangeLog * 1.6.6-mt1: - - * Merged in changes from upstream SAMD CORE 1.6.3 - * Added SPI.transfer16(..) method - * Bugfix: added missing Serial.begin(baud, config) method. Thanks @tuxedo0801 - - * Merged in changes from upstream SAMD CORE 1.6.2 2015.11.03 - * Fixed bug in delay calculations - * Fixed deadlock conditions in Wire. Thanks Erin Tomson - * Print not aborting on write() failure. Thanks @stickbreaker - * SPI can now be configured in variants. Thanks @aethaniel - * Implemented Wire.end - * Implemented Wire.setClock. Thanks @PaoloP74 - * Wire: allow scanning bus via beginTransmission-endTransmission - * USB Device: big refactoring and bug fix - * USB Device: added PluggableUSB interface + * See 'What's New' above. * 1.6.5-mt2: - * See 'What's New' above. + * Added support for the MT-D11 (ATSAMD11D14AM). + * Reduced code size (see 'Code Size and RAM Usage' below). + * Any combination of CDC, HID, or UART can be used (or no combination), by using the Tools->Communication menu. + * Note that switching between CDC and CDC+HID will require re-selecting the COM port. + * More detailed memory usage at end of compilation (see below). + * Merged in upstream updates. Fixed Wire interrupt. + * Tested all ADC, DAC, external interrupts, PWM outputs, serial, SPI, and Wire instances/pins. * 1.6.5-mt1: * Initial release diff --git a/variants/MT_D11/variant.cpp b/variants/MT_D11/variant.cpp index f69bc5810..d0cd1a7d5 100644 --- a/variants/MT_D11/variant.cpp +++ b/variants/MT_D11/variant.cpp @@ -22,21 +22,21 @@ */ /* -============================= MattairTech MT-D11 (ATsamd11D14AM) ======================== -Other INT PWM Digital Analog Digital PWM INT Other +=========================== MattairTech MT-D11 (ATsamd11D14AM) ========================== +Other INT PWM Digital Analog Digital PWM INT Other ========================================================================================= - ------------------- -DAC 2 2 (ADC0) | A2 | USB | Gnd | -REF 3 3 (ADC1) | A3 | | Vcc | -VDIV INT4 TCC0[0] 4 4 (ADC2) | A4 ----- A31 | 31 TC2[1] INT3 RX / SWDIO - INT5 TCC0[1] 5 5 (ADC3) | A5 A30 | 30 TC2[0] TX / SWDCLK - TCC0[2] 6 6 (ADC4) | A6 A27 | 27 INT7 - TCC0[3] 7 7 (ADC5) | A7 A23 | 23 I2C/SCL -SPI MOSI INT2 10 10 (ADC8) | A10 A22 | 22 INT6 I2C/SDA -SPI SCK 11 11 (ADC9) | A11 A17 | 17 TC1[1] -SPI MISO INTNMI 14 14 (ADC6) | A14 A16 | 16 TC1[0] INT0 LED -Button INT1 15 15 (ADC7) | A15 RST | Reset - ------------------- + ------------------- +DAC 2 2(ADC0) | A2 | USB | Gnd | +REF 3 3(ADC1) | A3 | | Vcc | + 4(INT4) 4(TCC00) 4 4(ADC2) | A4 ----- A31 | 31 31(TC21) 31(INT3) RX/SWDIO + 5(INT5) 5(TCC01) 5 5(ADC3) | A5 A30 | 30 30(TC20) TX/SWDCLK + 6(TCC02) 6 6(ADC4) | A6 A27 | 27 27(INT7) + 7(TCC03) 7 7(ADC5) | A7 A23 | 23 SCL +MOSI 10(INT2) 10 10(ADC8) | A10 A22 | 22 22(INT6) SDA +SCK 11 11(ADC9) | A11 A17 | 17 17(TC11) +MISO 14(INTNMI) 14 14(ADC6) | A14 A16 | 16 16(TC10) 16(INT0) LED +BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | Reset + ------------------- Most pins have multiple configurations available (even analog pins). For example, pin 4 can be an analog input, a PWM output, Digital I/O, or interrupt input. These always reference the pin number printed on the board but without the 'A' (with the @@ -269,7 +269,7 @@ SERCOM sercom0( SERCOM0 ) ; SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; -#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) +#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; void SERCOM1_Handler() diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index fa835c7c5..841733b84 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -23,30 +23,30 @@ /* ============================= MattairTech MT-D21E (ATsamd21eXXa) ======================== -Other INT PWM Digital Analog Digital PWM INT Other +Other INT PWM Digital Analog Digital PWM INT Other ========================================================================================= - ------------------- -Xin32 | A0 RST | Reset -Xout32 | A1 NC | -DAC 2 2 (ADC0) | A2 NC | -REF 3 3 (ADC1) | A3 A31 | 31 TCC1[1] INT11 SWD IO * - INT4 4 4 (ADC4) | A4 A30 | 30 TCC1[0] INT10 SWD CLK - INT5 5 5 (ADC5) | A5 NC | - 6 6 (ADC6) | A6 A28 | 28 INT8 LED -VDIV 7 7 (ADC7) | A7 A27 | 27 INT15 Button A - INTNMI TCC0[0] 8 8 (ADC16) | A8 A23 | 23 TC4[1] INT7 SPI SS - INT9 TCC0[1] 9 9 (ADC17) | A9 A22 | 22 TC4[0] INT6 SPI MISO -TX (1) TCC0[2] 10 10 (ADC18)| A10 A19 | 19 INT3 SPI SCK -RX (1) TCC0[3] 11 11 (ADC19)| A11 A18 | 18 INT2 SPI MOSI -TX (2) INT14 TC3[0] 14 | A14 A17 | 17 TCC2[1] INT1 I2C/SCL -RX (2) TC3[1] 15 | A15 A16 | 16 TCC2[0] INT0 I2C/SDA - | NC NC | - | NC NC | - | Vbus 3.3V| * Button B available on 31 -USB D- | A24- _____ Vcc | -USB D+ | A25+ | | Vin | - | Gnd | USB | Gnd | - ------------------- + ------------------- +Xin32 | A0 RST | Reset +Xout32 | A1 NC | +DAC 2 2(ADC0) | A2 NC | +REF 3 3(ADC1) | A3 A31 | 31 31(TCC11) 31(INT11) SWDIO* + 4(INT4) 4 4(ADC4) | A4 A30 | 30 30(TCC10) 30(INT10) SWDCLK + 5(INT5) 5 5(ADC5) | A5 NC | + 6 6(ADC6) | A6 A28 | 28 28(INT8) LED +VDIV 7 7(ADC7) | A7 A27 | 27 27(INT15) BTNA + 8(INTNMI) 8(TCC00) 8 8(ADC16) | A8 A23 | 23 23(TC41) 23(INT7) SS + 9(INT9) 9(TCC01) 9 9(ADC17) | A9 A22 | 22 22(TC40) 22(INT6) MISO +TX1 10(TCC02) 10 10(ADC18)| A10 A19 | 19 19(INT3) SCK +RX1 11(TCC03) 11 11(ADC19)| A11 A18 | 18 18(INT2) MOSI +TX2 14(INT14) 14(TC30) 14 | A14 A17 | 17 17(TCC21) 17(INT1) SCL +RX2 15(TC31) 15 | A15 A16 | 16 16(TCC20) 16(INT0) SDA + | NC NC | + | NC NC | + | Vbus 3.3V| * Button B available on 31 +USB D- | A24- _____ Vcc | +USB D+ | A25+ | | Vin | + | Gnd | USB | Gnd | + ------------------- Most pins have multiple configurations available (even analog pins). For example, pin 10 can be an analog input, a PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board but without the 'A' (with the @@ -257,7 +257,7 @@ SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; SERCOM sercom3( SERCOM3 ) ; -#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) +#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; diff --git a/variants/arduino_zero/variant.cpp b/variants/arduino_zero/variant.cpp index b5f572de7..88e7a42d1 100644 --- a/variants/arduino_zero/variant.cpp +++ b/variants/arduino_zero/variant.cpp @@ -288,7 +288,7 @@ SERCOM sercom3( SERCOM3 ) ; SERCOM sercom4( SERCOM4 ) ; SERCOM sercom5( SERCOM5 ) ; -#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) +#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; Uart Serial( SERCOM_INSTANCE_SERIAL, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ; void SERCOM0_Handler() From 6e2034c5dcc34d5130a9f24dfa016e173b8391e3 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 24 Nov 2015 08:37:46 +0000 Subject: [PATCH 067/124] Added signed drivers to extras directory --- extras/MattairTech_CDC.inf | 103 ++++++++++++++++++++++++++ extras/mattairtech_cdc.cat | Bin 0 -> 8252 bytes extras/pack.pullrequest.bash | 33 --------- extras/pack.release.bash | 16 ---- extras/package_index.json.PR.template | 54 -------------- 5 files changed, 103 insertions(+), 103 deletions(-) create mode 100644 extras/MattairTech_CDC.inf create mode 100644 extras/mattairtech_cdc.cat delete mode 100755 extras/pack.pullrequest.bash delete mode 100755 extras/pack.release.bash delete mode 100644 extras/package_index.json.PR.template diff --git a/extras/MattairTech_CDC.inf b/extras/MattairTech_CDC.inf new file mode 100644 index 000000000..7c595b055 --- /dev/null +++ b/extras/MattairTech_CDC.inf @@ -0,0 +1,103 @@ +;************************************************************ +; Windows USB CDC ACM Setup File +; Copyright (c) 2000 Microsoft Corporation +; Updated November 23, 2015 +;************************************************************ + +[DefaultInstall] +CopyINF=MattairTech_CDC.inf + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%MFGNAME% +DriverPackageDisplayName=%DriverPackageDisplayName% +CatalogFile=MattairTech_CDC.cat +DriverVer=11/23/2015,1.1.2.0 + +[Manufacturer] +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 + +[SourceDisksNames] + +[SourceDisksFiles] + +[DestinationDirs] +FakeModemCopyFileSection=12 +DefaultDestDir=12 + +[DriverInstall] +Include=mdmcpq.inf,usb.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverAddReg + +[DriverAddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, DriverService + +[DriverService] +DisplayName=%ServiceName% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\usbser.sys +LoadOrderGroup=Base + + +;------------------------------------------------------------------------------ +; Vendor and Product ID Definitions +;------------------------------------------------------------------------------ +; When developing your USB device, the VID and PID used in the PC side +; application program and the firmware on the microcontroller must match. +; Modify the below line to use your VID and PID. Use the format as shown below. +; Note: One INF file can be used for multiple devices with different VID and PIDs. +; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. +;------------------------------------------------------------------------------ +[DeviceList] +%DESCRIPTION.CDC%=DriverInstall, USB\VID_16D0&PID_0557 +%DESCRIPTION.CDC.HID%=DriverInstall, USB\VID_16D0&PID_0856&MI_00 +%DESCRIPTION.CDC.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B34&MI_00 +%DESCRIPTION.CDC.MSD.HID%=DriverInstall, USB\VID_16D0&PID_0B40&MI_00 +%DESCRIPTION.CDC.MSD.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B41&MI_00 + +[DeviceList.NTx86] +%DESCRIPTION.CDC%=DriverInstall, USB\VID_16D0&PID_0557 +%DESCRIPTION.CDC.HID%=DriverInstall, USB\VID_16D0&PID_0856&MI_00 +%DESCRIPTION.CDC.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B34&MI_00 +%DESCRIPTION.CDC.MSD.HID%=DriverInstall, USB\VID_16D0&PID_0B40&MI_00 +%DESCRIPTION.CDC.MSD.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B41&MI_00 + +[DeviceList.NTamd64] +%DESCRIPTION.CDC%=DriverInstall, USB\VID_16D0&PID_0557 +%DESCRIPTION.CDC.HID%=DriverInstall, USB\VID_16D0&PID_0856&MI_00 +%DESCRIPTION.CDC.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B34&MI_00 +%DESCRIPTION.CDC.MSD.HID%=DriverInstall, USB\VID_16D0&PID_0B40&MI_00 +%DESCRIPTION.CDC.MSD.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B41&MI_00 + +[DeviceList.NTia64] +%DESCRIPTION.CDC%=DriverInstall, USB\VID_16D0&PID_0557 +%DESCRIPTION.CDC.HID%=DriverInstall, USB\VID_16D0&PID_0856&MI_00 +%DESCRIPTION.CDC.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B34&MI_00 +%DESCRIPTION.CDC.MSD.HID%=DriverInstall, USB\VID_16D0&PID_0B40&MI_00 +%DESCRIPTION.CDC.MSD.MIDI.HID%=DriverInstall, USB\VID_16D0&PID_0B41&MI_00 + +;------------------------------------------------------------------------------ +; String Definitions +;------------------------------------------------------------------------------ +;Modify these strings to customize your device +;------------------------------------------------------------------------------ +[Strings] +DriverPackageDisplayName="MattairTech CDC Drivers" +ServiceName="USB RS-232 Emulation Driver" +MFGNAME="MattairTech LLC" +DESCRIPTION.CDC="MattairTech CDC Serial" +DESCRIPTION.CDC.HID="MattairTech CDC Serial & HID Keyboard/Mouse" +DESCRIPTION.CDC.MIDI.HID="MattairTech CDC Serial & MIDI & HID Keyboard/Mouse" +DESCRIPTION.CDC.MSD.HID="MattairTech CDC Serial & Mass Storage & HID Keyboard/Mouse" +DESCRIPTION.CDC.MSD.MIDI.HID="MattairTech CDC Serial & Mass Storage & MIDI & HID Keyboard/Mouse" diff --git a/extras/mattairtech_cdc.cat b/extras/mattairtech_cdc.cat new file mode 100644 index 0000000000000000000000000000000000000000..525de42fca463cd56843cc5d79be3fc98c2e45ab GIT binary patch literal 8252 zcmd5>2{@Ep`+sIJwy{M*j6tFW&)C;2W8asNcBU~1*+vve(nj%`D6*7N%4>OB zv=LHTlu99OB&CIt|CzBg-u=CL?NZPAeg~5f#F?+L7))~9X)ki2y;1Kv36!bzy>rwl^%uQ5?y#if94%d9*75(u33? zGsqI$8juCJbs-%fQ3rB8NE`f{1BoU3hJi*8q&3)O&49)fV#zciEw-NZ4g?Vxh(Oq4 zzCI)ZP0)e0U||l4WC=0_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QVpbC_-&xx)}Zm;e_5)i-e#pGn?e{%!^mZb3lcxSTcQ}Dyja4PW{E_ z)%S>%5oM;>z+R-N=}-Gb`3DU66Jo-T465XAipYAqn^KVyH92N;wLv;s8`&SB& zZ+a4pg+@{ucAjXQ4oq*}n*O5R%dh z6C)Yqc~yH`>XXer*SBxiG||>&JZx|M)cfvrVD&Py=l=9ctFXwErNva#)__}NLZ24t z*F1mZr{YkTt8F3f{9&R8JzIALX|6q~cchiJUH1yE|HFgFZ7ON}50~FYlC~drO_a=N zI{wwZ&E~| package_samd-b${BUILD_NUMBER}_index.json - diff --git a/extras/pack.release.bash b/extras/pack.release.bash deleted file mode 100755 index 6ccb13108..000000000 --- a/extras/pack.release.bash +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -ex - -VERSION=`grep version= platform.txt | sed 's/version=//g'` - -PWD=`pwd` -FOLDERNAME=`basename $PWD` -THIS_SCRIPT_NAME=`basename $0` - -rm -f samd-$VERSION.tar.bz2 - -cd .. -tar --transform "s|$FOLDERNAME|$FOLDERNAME-$VERSION|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf samd-$VERSION.tar.bz2 $FOLDERNAME -cd - - -mv ../samd-$VERSION.tar.bz2 . - diff --git a/extras/package_index.json.PR.template b/extras/package_index.json.PR.template deleted file mode 100644 index 2832b54cc..000000000 --- a/extras/package_index.json.PR.template +++ /dev/null @@ -1,54 +0,0 @@ -{ - "packages": [ - { - "name": "arduino-beta", - "maintainer": "Arduino Betatesting", - "websiteURL": "http://www.arduino.cc/", - "email": "packages@arduino.cc", - "help": { - "online": "http://www.arduino.cc/en/Reference/HomePage" - }, - "platforms": [ - { - "name": "Arduino SAMD core - Pull request #%%PR_NUMBER%% (build %%BUILD_NUMBER%%)", - "architecture": "samd", - "version": "%%VERSION%%", - "category": "Arduino", - "url": "http://downloads.arduino.cc/PR/samd/%%FILENAME%%", - "archiveFileName": "%%FILENAME%%", - "checksum": "SHA-256:%%CHECKSUM%%", - "size": "%%SIZE%%", - "boards": [ - { - "name": "Arduino Zero" - } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "arm-none-eabi-gcc", - "version": "4.8.3-2014q1" - }, - { - "packager": "arduino", - "name": "bossac", - "version": "1.5-arduino" - }, - { - "packager": "arduino", - "name": "openocd", - "version": "0.9.0-arduino" - }, - { - "packager": "arduino", - "name": "CMSIS", - "version": "4.0.0-atmel" - } - ] - } - ], - "tools": [ - ] - } - ] -} From a2f09304311e0d6f1be6a95549389cfa24939ecb Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 26 Nov 2015 04:27:49 +0000 Subject: [PATCH 068/124] Minor documentation update --- README.md | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index e94ca21e6..964ef2a8d 100644 --- a/README.md +++ b/README.md @@ -63,27 +63,27 @@ DC Current per I/O Pin | 7 mA | 7 mA ## Special Notes -* Boards Manager may require opening twice (with possibly a delay in between) to see some updates. +* ** Boards Manager must be opened twice to see some updates ** -* Errors when compiling, uploading, or burning the bootloader - Be sure to install the Arduino samd core before installing the MattairTech samd core. If you have problems upgrading +* ** Errors when compiling, uploading, or burning the bootloader ** + * Be sure to install the Arduino samd core before installing the MattairTech samd core. If you have problems upgrading the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. Use Arduino core 1.6.2 or above. -* Tools->Communications menu - Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration +* ** Tools->Communications menu ** + * Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the USB device configuration (needed for Windows). This may become automatic in a future release. - * Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. - * Different combinations of USB devices will result in different COM port assingments in Windows. + * Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. + * Different combinations of USB devices will result in different COM port assingments in Windows. -* Incude platform specific libraries - You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. +* ** Incude platform specific libraries ** + * You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. -* Differences from Arduino in versioning - The MattairTech ArduinoCore-samd version currently tracks the IDE version. In some cases, it may indicate the +* ** Differences from Arduino in versioning ** + * The MattairTech ArduinoCore-samd version currently tracks the IDE version. In some cases, it may indicate the minimum IDE version. This is the case for both 1.6.5-mtX and 1.6.6-mtX (which corresponds to SAMD CORE 1.6.2). 1.6.6-mt1 corresponds to Arduino SAMD CORE 1.6.2 plus some pull requests. @@ -149,57 +149,57 @@ BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | ### Pin Capabilities * **Digital: All pins can be used for general purpose I/O** -* Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. -* Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). -* Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). -* Use the pinMode(), digitalWrite(), and digitalRead() functions. -* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** -* These are available using the analogRead() function. -* All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). -* Each pin provides 10 bits of resolution (1024 values) by default. -* 12-bit resolution supported by using the analogReadResolution() function. -* Each pin measures from ground to 3.3 volts. -* The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. + * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + * Use the pinMode(), digitalWrite(), and digitalRead() functions. + * **Analog Inputs: 10 pins can be configured as ADC analog inputs.** + * These are available using the analogRead() function. + * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * Each pin measures from ground to 3.3 volts. + * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. * **DAC: One analog output is available on pin 2.** -* Provides a 10-bit voltage output with the analogWrite() function. + * Provides a 10-bit voltage output with the analogWrite() function. * **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** -* Available using the analogWrite() function. -* Each pin provides 8 bits of resolution (256 values) by default. -* 12-bit resolution supported by using the analogWriteResolution() function. + * Available using the analogWrite() function. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. * **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** -* Available using the attachInterrupt() function. + * Available using the attachInterrupt() function. * **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** -* MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). -* MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). + * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). + * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). * **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** -* MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). -* MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). -* SPI communication using the SPI library. -* Note that the SPI library will set SS as an output. -* On the MT-D11, the button must be configured as reset (default) when using SPI. + * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). + * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). + * SPI communication using the SPI library. + * Note that the SPI library will set SS as an output. + * On the MT-D11, the button must be configured as reset (default) when using SPI. * **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** -* MT-D21E: Pin 16 (SDA) and pin 17 (SCL). -* MT-D11: Pin 22 (SDA) and pin 23 (SCL). -* TWI communication using the Wire library. + * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). + * MT-D11: Pin 22 (SDA) and pin 23 (SCL). + * TWI communication using the Wire library. * **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** -* Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. + * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. * **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** -* Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. -* If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. + * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. * **AREF: One pin can be configured as an AREF analog input.** -* The upper end of the analog measurement range can be changed using the analogReference() function. + * The upper end of the analog measurement range can be changed using the analogReference() function. * **Reset: Bring this line LOW to reset the microcontroller.** ### MT-D21E and MT-D11 Board Configuration Notes * The 32.768KHz crystal is used by the Arduino core, so it MUST be connected via the solder jumpers. -* Note that the sketch may still run without the crystal attached, but the clock speed will be very inaccurate. +* The sketch in some cases can run without the crystal attached, but the clock will be very inaccurate. * The 16MHz crystal is not used. It should be disconnected via the solder jumpers. * The I2C (TWI) pullup resistors should be enabled via the solder jumpers. * The LED should be enabled via the solder jumper. -* Button A should be connected via the solder jumper. The debouncing capacitor should also be connected. +* Button A and the debouncing capacitor should be connected via the solder jumpers. * Button B (MT-D21E only) is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. -* A reference voltage can be connected to AREF. In this case, the capacitors should be enabled via the solder jumper. +* A reference voltage can be connected to AREF. In this case, the capacitors should be enabled via the solder jumpers. * On the MT-D11, BTN is shared with SPI SS, so the button must be configured as reset (default) when using SPI. From 93449e405969e22299ec25b5c1d7738cb1131ee2 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 26 Nov 2015 04:30:48 +0000 Subject: [PATCH 069/124] Minor documentation update, try #2 --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 964ef2a8d..a84b5d976 100644 --- a/README.md +++ b/README.md @@ -63,14 +63,14 @@ DC Current per I/O Pin | 7 mA | 7 mA ## Special Notes -* ** Boards Manager must be opened twice to see some updates ** +* **Boards Manager must be opened twice to see some updates** -* ** Errors when compiling, uploading, or burning the bootloader ** +* **Errors when compiling, uploading, or burning the bootloader** * Be sure to install the Arduino samd core before installing the MattairTech samd core. If you have problems upgrading the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. Use Arduino core 1.6.2 or above. -* ** Tools->Communications menu ** +* **Tools->Communications menu** * Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the @@ -79,10 +79,10 @@ DC Current per I/O Pin | 7 mA | 7 mA * Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. * Different combinations of USB devices will result in different COM port assingments in Windows. -* ** Incude platform specific libraries ** +* **Incude platform specific libraries** * You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. -* ** Differences from Arduino in versioning ** +* **Differences from Arduino in versioning** * The MattairTech ArduinoCore-samd version currently tracks the IDE version. In some cases, it may indicate the minimum IDE version. This is the case for both 1.6.5-mtX and 1.6.6-mtX (which corresponds to SAMD CORE 1.6.2). 1.6.6-mt1 corresponds to Arduino SAMD CORE 1.6.2 plus some pull requests. @@ -153,7 +153,7 @@ BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). * Use the pinMode(), digitalWrite(), and digitalRead() functions. - * **Analog Inputs: 10 pins can be configured as ADC analog inputs.** +* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** * These are available using the analogRead() function. * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). * Each pin provides 10 bits of resolution (1024 values) by default. From 7d11a2be188f3c1e92df0c23559fdc3223ae4c3e Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 1 Dec 2015 16:35:21 +0000 Subject: [PATCH 070/124] Changed default communications configuration to CDC_UART --- boards.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/boards.txt b/boards.txt index ce64f4437..d8c1ab7b9 100644 --- a/boards.txt +++ b/boards.txt @@ -54,12 +54,12 @@ mattairtech_mt_d21e_bl8k.build.f_cpu=48000000L mattairtech_mt_d21e_bl8k.build.usb_product="MT-D21E" mattairtech_mt_d21e_bl8k.build.usb_manufacturer="MattairTech" mattairtech_mt_d21e_bl8k.build.board=CDC_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart=CDC_HID_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.pid=0x0856 mattairtech_mt_d21e_bl8k.menu.com.cdc_uart=CDC_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.board=CDC_UART mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.pid=0x0557 +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart=CDC_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.pid=0x0856 mattairtech_mt_d21e_bl8k.menu.com.cdc_hid=CDC_HID mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.board=CDC_HID mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.pid=0x0856 @@ -122,12 +122,12 @@ mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam #mattairtech_mt_d21e_bl16k.build.usb_product="MT-D21E" #mattairtech_mt_d21e_bl16k.build.usb_manufacturer="MattairTech" #mattairtech_mt_d21e_bl16k.build.board=CDC_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart=CDC_HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl16k.menu.com.cdc_uart=CDC_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.board=CDC_UART #mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.pid=0x0557 +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart=CDC_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid=CDC_HID #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.board=CDC_HID #mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.pid=0x0856 @@ -191,12 +191,12 @@ mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/samd21e15a_sam #mattairtech_mt_d21e_bl0k.build.usb_product="MT-D21E" #mattairtech_mt_d21e_bl0k.build.usb_manufacturer="MattairTech" #mattairtech_mt_d21e_bl0k.build.board=CDC_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl0k.menu.com.cdc_uart=CDC_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.board=CDC_UART #mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.pid=0x0557 +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid=CDC_HID #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.board=CDC_HID #mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.pid=0x0856 @@ -249,12 +249,12 @@ mattairtech_mt_d11.build.f_cpu=48000000L mattairtech_mt_d11.build.usb_product="MT-D11" mattairtech_mt_d11.build.usb_manufacturer="MattairTech" mattairtech_mt_d11.build.board=CDC_UART -mattairtech_mt_d11.menu.com.cdc_hid_uart=CDC_HID_UART -mattairtech_mt_d11.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -mattairtech_mt_d11.menu.com.cdc_hid_uart.build.pid=0x0856 mattairtech_mt_d11.menu.com.cdc_uart=CDC_UART mattairtech_mt_d11.menu.com.cdc_uart.build.board=CDC_UART mattairtech_mt_d11.menu.com.cdc_uart.build.pid=0x0557 +mattairtech_mt_d11.menu.com.cdc_hid_uart=CDC_HID_UART +mattairtech_mt_d11.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +mattairtech_mt_d11.menu.com.cdc_hid_uart.build.pid=0x0856 mattairtech_mt_d11.menu.com.cdc_hid=CDC_HID mattairtech_mt_d11.menu.com.cdc_hid.build.board=CDC_HID mattairtech_mt_d11.menu.com.cdc_hid.build.pid=0x0856 @@ -306,10 +306,10 @@ arduino_zero_native.build.f_cpu=48000000L arduino_zero_native.build.usb_product="Arduino Zero" arduino_zero_native.build.usb_manufacturer="Arduino LLC" arduino_zero_native.build.board=SAMD_ZERO -arduino_zero_native.menu.com.cdc_hid_uart=CDC_HID_UART -arduino_zero_native.menu.com.cdc_hid_uart.build.board=CDC_HID_UART arduino_zero_native.menu.com.cdc_uart=CDC_UART arduino_zero_native.menu.com.cdc_uart.build.board=CDC_UART +arduino_zero_native.menu.com.cdc_hid_uart=CDC_HID_UART +arduino_zero_native.menu.com.cdc_hid_uart.build.board=CDC_HID_UART arduino_zero_native.menu.com.cdc_hid=CDC_HID arduino_zero_native.menu.com.cdc_hid.build.board=CDC_HID arduino_zero_native.menu.com.cdc=CDC_ONLY @@ -350,10 +350,10 @@ arduino_zero_native.build.pid=0x804d #arduino_zero_edbg.build.usb_product="Arduino Zero" #arduino_zero_edbg.build.usb_manufacturer="Arduino LLC" #arduino_zero_edbg.build.board=SAMD_ZERO -#arduino_zero_edbg.menu.com.cdc_hid_uart=CDC_HID_UART -#arduino_zero_edbg.menu.com.cdc_hid_uart.build.board=CDC_HID_UART #arduino_zero_edbg.menu.com.cdc_uart=CDC_UART #arduino_zero_edbg.menu.com.cdc_uart.build.board=CDC_UART +#arduino_zero_edbg.menu.com.cdc_hid_uart=CDC_HID_UART +#arduino_zero_edbg.menu.com.cdc_hid_uart.build.board=CDC_HID_UART #arduino_zero_edbg.menu.com.cdc_hid=CDC_HID #arduino_zero_edbg.menu.com.cdc_hid.build.board=CDC_HID #arduino_zero_edbg.menu.com.cdc=CDC_ONLY From a7aa530cb780180238a082a0fe32295f82ccc874 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 25 Dec 2015 15:19:24 +0000 Subject: [PATCH 071/124] Fixed compilation when CDC_ONLY defined --- cores/arduino/USB/USBCore.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 853f305ae..ca0d30d54 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -19,6 +19,8 @@ #ifndef __USBCORE_H__ #define __USBCORE_H__ +#include "USBDesc.h" + // Standard requests #define GET_STATUS 0 #define CLEAR_FEATURE 1 @@ -226,7 +228,9 @@ typedef struct typedef struct { // IAD +#if !defined(CDC_ONLY) IADDescriptor iad; // Only needed on compound device +#endif // Control InterfaceDescriptor cif; CDCCSInterfaceDescriptor header; From 7959ee9301a01c47c36a83e78c84c99a39d308c5 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 25 Dec 2015 16:59:15 +0000 Subject: [PATCH 072/124] Fixed compilation when CDC_ONLY defined #2 --- cores/arduino/USB/USBDesc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index 2dd9bc6bd..b7c9067e3 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -28,7 +28,7 @@ // once an alternate method for USB PID allocation is found. #if defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) #define CDC_ENABLED -#if defined(ARDUINO_CDC_ONLY) +#if defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) #define CDC_ONLY #else #define IAD_PRESENT From b984e0ed36afd8a1fdfbbf3b79b9af3d32f5d7df Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 28 Dec 2015 11:17:14 +0000 Subject: [PATCH 073/124] Doc update for 1.6.6-mt3 --- README.md | 2 ++ platform.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a84b5d976..547c74c45 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ previous version, click on MattairTech SAMD Boards in Boards Manager, then click * Wire: allow scanning bus via beginTransmission-endTransmission * USB Device: big refactoring and bug fix * USB Device: added PluggableUSB interface +* 1.6.6-mt2 changes the default Communication setting to CDC_UART (from CDC_HID_UART) +* 1.6.6-mt3 fixes compilation with CDC_UART and CDC_ONLY settings ## Summary diff --git a/platform.txt b/platform.txt index 581dcf4d6..48e653e99 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=MattairTech SAMD Boards -version=1.6.6-mt1 +version=1.6.6-mt3 # Compile variables From 54909e384527cde9d11c88041621142cebc2860c Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Wed, 30 Mar 2016 06:24:27 +0000 Subject: [PATCH 074/124] Enable digitalRead on output pins, only enable pullup or pulldown in digitalWrite if pin is not output. arduino/ArduinoCore-samd#56 arduino/ArduinoCore-samd#79 arduino/ArduinoCore-samd#94 arduino/ArduinoCore-samd#101 --- README.md | 52 +++++++++++++++++++++++++--------- cores/arduino/Uart.cpp | 1 - cores/arduino/WVariant.h | 6 ++++ cores/arduino/wiring.c | 10 +++---- cores/arduino/wiring_digital.c | 47 +++++++++++++++++------------- cores/arduino/wiring_private.c | 17 +++++++---- 6 files changed, 89 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 547c74c45..9d727c663 100644 --- a/README.md +++ b/README.md @@ -266,9 +266,16 @@ everything else (ie: W) resides in flash (in most cases). #### Windows -There are currently four USB composite device combinations that include CDC as well as a CDC only device. -Drivers are required for each of these five devices. The CDC only driver is required by the bootloader. -The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP3), Vista, 7, 8, and 10. +Prior to core version 1.6.6-mt1, sketches compiled with both CDC and HID USB code by default, thus requiring a CDC +driver for the bootloader and a CDC-HID driver for sketches. Now that PluggableUSB is supported, sketches compile +with only CDC code by default. Thus, only one driver is needed. Since HID and MIDI are currently supported (and +MSD potentially in the future), driver installation will be required for each different combination of USB devices. +There are currently four USB composite device combinations that include CDC as well as a CDC only device. Each +supported combination has a unique USB VID:PID pair, and these are listed in the .inf file. Once the first device +is installed (the CDC only device), future installations *might* be automatic, otherwise, you may direct the +installer to the same .inf file. The drivers are signed and support both 32 and 64 bit versions of Windows XP(SP3), +Vista, 7, 8, and 10. + 1. If you do not already have the SAM-BA bootloader installed, see below. 2. Download https://www.mattairtech.com/software/MattairTech_CDC_Driver_Signed.zip and unzip into any folder. @@ -276,8 +283,8 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 4. Windows will detect the board. Point the installer to the folder from above to install the bootloader driver. 5. If you don't intend on using Arduino, you can skip the rest of this list. See Using Bossac Standalone below. 6. If you do not already have the test firmware installed (comes preinstalled), see Using Bossac Standalone below. -7. Press the reset button to run the test firmware (blink sketch with CDC-HID). -8. Windows will detect the board. Point the installer to the folder from above to install the sketch driver. +7. Press the reset button to run the test firmware (blink sketch). +8. Windows will detect the board. Point the installer to the above folder to install the sketch driver (if needed). 9. Continue with SAMD Core Installation below. #### Linux @@ -291,14 +298,17 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP #### OS X +UNTESTED 1. As of this writing, only the 256 KB chip variants work with the OS X version of the upload tool, bossac. 2. First, you will need to open boards.txt and change mattairtech_mt_d21e_bl8k.upload.tool to equal arduino:bossac. 3. Open platform.txt and change tools.bossac.path to equal{runtime.tools.bossac-1.6.1-arduino.path}. -4. No driver installation is needed. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: +4. No driver installation is needed. +5. Plug in the board. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: * Click the "Network Preferences..." button, then click "Apply". * The board will show up as “Not Configuredâ€, but it will work fine. 5. Continue with SAMD Core Installation below. + ### SAMD Core Installation * To update from a previous version, click on MattairTech SAMD Boards in Boards Manager, then click Update. @@ -319,6 +329,16 @@ The drivers are signed and support both 32 and 64 bit versions of Windows XP (SP 13. You can now upload your own sketch. +### Uploading the First Sketch + +1. In the Arduino IDE 1.6.7 (or above), open File->Examples->01.Basics->Blink. +2. Change the three instances of '13' to 'LED_BUILTIN'. +3. Be sure the correct options are selected in the Tools menu (see AVR Core Installation above). +4. With the board plugged in, select the correct port from Tools->Port. +5. Click the Upload button. After compiling, the sketch should be transferred to the board. +6. Once the bootloader exits, the blink sketch should be running. + + ## SAM-BA USB CDC Bootloader (Arduino compatible) The SAM-BA bootloader has both a CDC USB interface, and a UART interface (MT-D21E: TX: pin 10, RX: pin 11). It is @@ -361,6 +381,7 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: 3. The board is reset. The bootloader (which always runs first) detects the blank flah row, so bootloader operation resumes. 4. Opening and closing the port at a baud rate other than 1200bps will not erase or reset the SAMD. + ### Bootloader Firmware Installation #### Bootloader Installation Using the Arduino IDE @@ -383,6 +404,7 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: * You can optionally set the EEPROM bits or anything else. The Arduino installation method uses factory defaults. 4. Continue with driver installation above. + ### Using Bossac Standalone When using Bossac standalone, you will need to ensure that your application starts at 0x00002000 for 8 KB bootloaders, @@ -408,13 +430,13 @@ As an example, bossac will be used to upload the test firmware (blink sketch): 1. Download firmware from https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip and unzip. 2. If you have not already installed the bootloader driver, see Driver Installation above. 3. Be sure there is a binary that matches your chip. On the command line (change the binary to match yours): -4. On Linux --port might be /dev/ttyACM0. If the device is not found, remove the --port argument for auto-detection. ``` bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ``` +4. On Linux --port might be /dev/ttyACM0. If the device is not found, remove the --port argument for auto-detection. 5. See http://manpages.ubuntu.com/manpages/vivid/man1/bossac.1.html for details. -6. Continue with the CDC-HID driver installation above (optional). +6. The board should reset automatically and the sketch should be running. @@ -504,7 +526,9 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## Possible Future Additions -* USB Host mode CDC ACM +* SAML21 support in the works +* Timer library in the works (like TimerOne, plus input capture and possibly waveform extensions) +* USB Host mode CDC ACM (partially complete; BSD-like license?) * Features for lower power consumption (library?) * Enhanced SD card library * Optional use of single on-board LED as USB activity LED @@ -512,17 +536,19 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R * MSC (Mass Storage) USB Device Class * Polyphonic tone * Better OS X support +* Wired-AND, Wired-OR for port pins +* High-speed port pin access (IOBUS) * Libraries for some hardware I plan on using: - TFT LCD - Motor controller + TFT LCD (CFAF128128B-0145T) + Motor controller (LV8711T) IR decoder I2S DAC/AMP and I2S MEMS microphone Battery management IC XBee/Xbee Pro devices RS485 Several I2C (Wire) sensor devices: - Accelerometer/gyro/magnetometer - Barometer/altimeter + Accelerometer/magnetometer (LSM303CTR) + Barometer/altimeter (LPS22HBTR) Humidity/temperature Light/color sensor diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 914338b67..3bf278228 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -36,7 +36,6 @@ void Uart::begin(unsigned long baudrate) void Uart::begin(unsigned long baudrate, uint8_t config) { - pinMode(uc_pinRX,INPUT_PULLUP);//Rx pin set INPUT_PULLUP mode pinPeripheral(uc_pinRX, PIO_SERCOM); pinPeripheral(uc_pinTX, PIO_SERCOM); diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index ddeec4e71..256f9f003 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -161,6 +161,8 @@ typedef enum _EPioType PIO_AC_GCLK=12, /* The pin is controlled by the AC_GCLK peripheral (output). */ PIO_MULTI, /* The pin can be configured to any type based on the attributes. */ + + PIO_STARTUP, /* Used as parameter to pinPeripheral() only to set startup state (enable INEN only) */ } EPioType ; /** @@ -228,6 +230,10 @@ typedef enum _EPioPeripheral #define PER_ATTR_OUTPUT_TYPE_BUSKEEPER (3UL<<3) #define PER_ATTR_OUTPUT_TYPE_MASK (3UL<<3) +#define PER_ATTR_INPUT_SYNCHRONIZER_ON_DEMAND (0UL<<5) +#define PER_ATTR_INPUT_SYNCHRONIZER_ALWAYS_ON (1UL<<5) +#define PER_ATTR_INPUT_SYNCHRONIZER_MASK (1UL<<5) + /* Types used for the table below * This struct MUST be 12 bytes long (elements are ordered to prevent unaligned access). diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index adf8a6408..67ef41751 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -96,11 +96,11 @@ void init( void ) // Clock ADC/DAC for Analog PM->APBCMASK.reg |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ; - // Setup all pins (digital and analog) in INPUT mode (default is nothing) - // for ( ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ ) - // { - // pinMode( ul, INPUT ) ; - // } + //Setup all pins (digital and analog) in STARTUP mode (enable INEN only) + for ( ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ ) + { + pinMode( ul, PIO_STARTUP ) ; + } // Initialize Analog Controller // Setting clock diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index d31c83592..8273679cb 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -39,29 +39,38 @@ void digitalWrite( uint32_t ulPin, uint32_t ulVal ) uint32_t pinAttribute = g_APinDescription[ulPin].ulPinAttribute; uint8_t pinPort = g_APinDescription[ulPin].ulPort; uint8_t pinNum = g_APinDescription[ulPin].ulPin; - uint8_t pullConfig = PORT->Group[pinPort].PINCFG[pinNum].reg; - - // Enable pull resistor if pin attributes allow - if ( (ulVal == HIGH && (pinAttribute & PIN_ATTR_INPUT_PULLUP)) || (ulVal == LOW && (pinAttribute & PIN_ATTR_INPUT_PULLDOWN)) ) - { - pullConfig |= (uint8_t)(PORT_PINCFG_PULLEN) ; + uint8_t pinConfig = PORT->Group[pinPort].PINCFG[pinNum].reg; + uint8_t pinDir = PORT->Group[pinPort].DIR[pinNum].reg; + uint8_t pinOut = PORT->Group[pinPort].OUT[pinNum].reg; + + // Enable pull resistor if pin attributes allow and only if pin is not configured as output + // Note that most pins should use PIN_ATTR_DIGITAL, which includes both PIN_ATTR_INPUT_PULLUP and PIN_ATTR_INPUT_PULLDOWN. + if ( pinDir == 0 ) { // pin DIR is input + if ( ulVal == HIGH ) + { + if ( (pinOut == 1 && (pinAttribute & PIN_ATTR_INPUT_PULLUP)) || (pinOut == 0 && (pinAttribute & PIN_ATTR_INPUT_PULLDOWN)) ) + { + pinConfig |= (uint8_t)(PORT_PINCFG_PULLEN) ; + } + } + else + { + pinConfig &= ~(uint8_t)(PORT_PINCFG_PULLEN) ; + } + + PORT->Group[pinPort].PINCFG[pinNum].reg = pinConfig ; } + // Set or clear OUT register only when pin DIR is set to output. + // Pull direction (pullup or pulldown) is now set with pinMode only. else { - pullConfig &= ~(uint8_t)(PORT_PINCFG_PULLEN) ; - } - - PORT->Group[pinPort].PINCFG[pinNum].reg = pullConfig ; - - switch ( ulVal ) - { - case LOW: - PORT->Group[pinPort].OUTCLR.reg = (1ul << pinNum) ; - break ; - - default: + if ( ulVal == HIGH ) { PORT->Group[pinPort].OUTSET.reg = (1ul << pinNum) ; - break ; + } + else + { + PORT->Group[pinPort].OUTCLR.reg = (1ul << pinNum) ; + } } return ; diff --git a/cores/arduino/wiring_private.c b/cores/arduino/wiring_private.c index 9cae69ce8..9746ac117 100644 --- a/cores/arduino/wiring_private.c +++ b/cores/arduino/wiring_private.c @@ -37,14 +37,14 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) return -1 ; } - // If pinType is not PIO_MULTI in the pinDescription table, then it must match ulPeripheral - if ( pinType != PIO_MULTI && pinType != ulPeripheral ) + // If pinType is not PIO_MULTI or PIO_STARTUP in the pinDescription table, then it must match ulPeripheral + if ( pinType != PIO_MULTI && pinType != PIO_STARTUP && pinType != ulPeripheral ) { return -1 ; } // Make sure ulPeripheral is listed in the attributes - if ( !(pinAttribute & (1UL << ulPeripheral)) ) + if ( !(pinAttribute & (1UL << ulPeripheral)) && pinType != PIO_STARTUP ) { return -1 ; } @@ -123,10 +123,14 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) uint8_t pinPort = g_APinDescription[ulPin].ulPort; uint8_t pinNum = g_APinDescription[ulPin].ulPin; - uint8_t pinCfg = PORT_PINCFG_INEN; + uint8_t pinCfg = PORT_PINCFG_INEN; // INEN should be enabled for both input and output (but not analog) switch ( ulPeripheral ) { + case PIO_STARTUP: + PORT->Group[pinPort].PINCFG[pinNum].reg=(uint8_t)pinCfg ; // Just enable INEN + break; + // Set pin mode according to chapter '22.6.3 I/O Pin Configuration' case PIO_INPUT: case PIO_INPUT_PULLUP: @@ -151,7 +155,6 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) break ; case PIO_OUTPUT: - pinCfg = 0; if ( (peripheralAttribute & PER_ATTR_DRIVE_MASK) == PER_ATTR_DRIVE_STRONG ) { pinCfg |= PORT_PINCFG_DRVSTR; @@ -162,10 +165,12 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) break ; - case PIO_EXTINT: case PIO_ANALOG_ADC: case PIO_ANALOG_DAC: case PIO_ANALOG_REF: + pinCfg = 0; // Disable INEN with analog + + case PIO_EXTINT: case PIO_TIMER_PWM: case PIO_TIMER_CAPTURE: case PIO_SERCOM: From bebef1d2ebd1e8aa27e8da80f8a61759cb6ca962 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Wed, 30 Mar 2016 20:55:19 +0000 Subject: [PATCH 075/124] Write protect bootloader after "Burn bootloader" command. See arduino/ArduinoCore-samd#124 --- README.md | 24 ++++++++++++------------ platform.txt | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9d727c663..365d337b6 100644 --- a/README.md +++ b/README.md @@ -539,18 +539,18 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R * Wired-AND, Wired-OR for port pins * High-speed port pin access (IOBUS) * Libraries for some hardware I plan on using: - TFT LCD (CFAF128128B-0145T) - Motor controller (LV8711T) - IR decoder - I2S DAC/AMP and I2S MEMS microphone - Battery management IC - XBee/Xbee Pro devices - RS485 - Several I2C (Wire) sensor devices: - Accelerometer/magnetometer (LSM303CTR) - Barometer/altimeter (LPS22HBTR) - Humidity/temperature - Light/color sensor + * TFT LCD (CFAF128128B-0145T) + * Motor controller (LV8711T) + * IR decoder + * I2S DAC/AMP and I2S MEMS microphone + * Battery management IC + * XBee/Xbee Pro devices + * RS485 + * Several I2C (Wire) sensor devices: + * Accelerometer/magnetometer (LSM303CTR) + * Barometer/altimeter (LPS22HBTR) + * Humidity/temperature + * Light/color sensor ## ChangeLog diff --git a/platform.txt b/platform.txt index 48e653e99..844c010af 100644 --- a/platform.txt +++ b/platform.txt @@ -149,5 +149,5 @@ tools.openocd.erase.pattern= tools.openocd.bootloader.params.verbose=-d3 tools.openocd.bootloader.params.quiet=-d0 -tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown" +tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify; at91samd bootloader 8192; reset; shutdown" From 3acaaef8ec839d5ca4223505533c47f1edc2f33d Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 20 May 2016 05:41:33 +0000 Subject: [PATCH 076/124] Make digitalPinToInterrupt(pin) return the same pin so that it works as described in the attachInterrupt() documentation. --- cores/arduino/Arduino.h | 5 +++++ cores/arduino/WInterrupts.c | 4 ++-- variants/MT_D11/variant.h | 3 --- variants/MT_D21E/variant.h | 3 --- variants/arduino_zero/variant.h | 2 -- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 1be6d7171..66b10614b 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -20,6 +20,8 @@ #ifndef Arduino_h #define Arduino_h +#define MATTAIRTECH_CORE + #include #include #include @@ -114,6 +116,9 @@ void loop( void ) ; #define bit(b) (1UL << (b)) +// Interrupts +#define digitalPinToInterrupt(P) ( P ) + // USB Device #include "USB/USBDesc.h" #include "USB/USBCore.h" diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 7fa70c61f..42830ed4b 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -61,7 +61,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) return; - EExt_Interrupts in = digitalPinToInterrupt(pin); + EExt_Interrupts in = g_APinDescription[pin].ulExtInt; if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; @@ -114,7 +114,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) */ void detachInterrupt(uint32_t pin) { - EExt_Interrupts in = digitalPinToInterrupt(pin); + EExt_Interrupts in = g_APinDescription[pin].ulExtInt; if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index 44b9e33fc..51c2147d2 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -88,9 +88,6 @@ extern "C" */ // #define digitalPinToTimer(P) -// Interrupts -#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) - /* LEDs * None of these defines are currently used by the core. diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index 6e6bd5fc1..632f7828a 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -79,9 +79,6 @@ extern "C" */ // #define digitalPinToTimer(P) -// Interrupts -#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) - /* LEDs * None of these defines are currently used by the core. diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 67f11eacb..a13873b58 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -74,8 +74,6 @@ extern "C" */ // #define digitalPinToTimer(P) -// Interrupts -#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) // LEDs #define PIN_LED_13 (13u) From a9b095a7d18bda4b0dafc44ea9e2d3bbce2d2cb3 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 20 May 2016 05:45:49 +0000 Subject: [PATCH 077/124] Add support for compiling sketches for SAMD11 without a bootloader --- boards.txt | 58 +++++ bootloaders/zero/readme.txt | 2 + .../gcc/SAMD11C14A_without_bootloader.ld | 212 ++++++++++++++++++ .../gcc/SAMD11D14AM_without_bootloader.ld | 212 ++++++++++++++++++ .../gcc/SAMD11D14AS_without_bootloader.ld | 212 ++++++++++++++++++ 5 files changed, 696 insertions(+) create mode 100644 variants/MT_D11/linker_scripts/gcc/SAMD11C14A_without_bootloader.ld create mode 100644 variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld create mode 100644 variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld diff --git a/boards.txt b/boards.txt index d8c1ab7b9..1ce9535e0 100644 --- a/boards.txt +++ b/boards.txt @@ -288,6 +288,64 @@ mattairtech_mt_d11.bootloader.tool=arduino:openocd mattairtech_mt_d11.bootloader.file=zero/samd11d14am_sam_ba.bin +# MattairTech MT-D11 (no bootloader) +mattairtech_mt_d11_bl0k.name=MattairTech MT-D11 (no bootloader) +mattairtech_mt_d11_bl0k.vid.0=0x16D0 +mattairtech_mt_d11_bl0k.pid.0=0x0557 +mattairtech_mt_d11_bl0k.vid.1=0x16D0 +mattairtech_mt_d11_bl0k.pid.1=0x0856 +mattairtech_mt_d11_bl0k.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d11_bl0k.upload.protocol=sam-ba +mattairtech_mt_d11_bl0k.upload.use_1200bps_touch=true +mattairtech_mt_d11_bl0k.upload.wait_for_upload_port=true +mattairtech_mt_d11_bl0k.upload.native_usb=true +mattairtech_mt_d11_bl0k.upload.maximum_size=16384 +mattairtech_mt_d11_bl0k.build.extra_flags=-D__SAMD11D14AM__ -D__NO_BOOTLOADER__ {build.usb_flags} +mattairtech_mt_d11_bl0k.build.ldscript=linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld +mattairtech_mt_d11_bl0k.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg +mattairtech_mt_d11_bl0k.build.mcu=cortex-m0plus +mattairtech_mt_d11_bl0k.build.f_cpu=48000000L +mattairtech_mt_d11_bl0k.build.usb_product="MT-D11" +mattairtech_mt_d11_bl0k.build.usb_manufacturer="MattairTech" +mattairtech_mt_d11_bl0k.build.board=CDC_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_uart=CDC_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_uart.build.board=CDC_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_uart.build.pid=0x0557 +mattairtech_mt_d11_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 +mattairtech_mt_d11_bl0k.menu.com.cdc_hid=CDC_HID +mattairtech_mt_d11_bl0k.menu.com.cdc_hid.build.board=CDC_HID +mattairtech_mt_d11_bl0k.menu.com.cdc_hid.build.pid=0x0856 +mattairtech_mt_d11_bl0k.menu.com.cdc=CDC_ONLY +mattairtech_mt_d11_bl0k.menu.com.cdc.build.board=CDC_ONLY +mattairtech_mt_d11_bl0k.menu.com.cdc.build.pid=0x0557 +mattairtech_mt_d11_bl0k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART +mattairtech_mt_d11_bl0k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 +# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART +# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART +# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 +# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART +# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 +# mattairtech_mt_d11_bl0k.menu.com.msd_uart=MSD_UART +# mattairtech_mt_d11_bl0k.menu.com.msd_uart.build.board=MSD_UART +# mattairtech_mt_d11_bl0k.menu.com.msd_uart.build.pid=0x0A0C +mattairtech_mt_d11_bl0k.menu.com.uart=UART_ONLY +mattairtech_mt_d11_bl0k.menu.com.uart.build.board=UART_ONLY +mattairtech_mt_d11_bl0k.menu.com.uart.build.pid=0x0856 +mattairtech_mt_d11_bl0k.menu.com.none=USB_UART_DISABLED +mattairtech_mt_d11_bl0k.menu.com.none.build.board=USB_UART_DISABLED +mattairtech_mt_d11_bl0k.menu.com.none.build.pid=0x0856 +mattairtech_mt_d11_bl0k.build.core=arduino +mattairtech_mt_d11_bl0k.build.variant=MT_D11 +mattairtech_mt_d11_bl0k.build.variant_system_lib= +mattairtech_mt_d11_bl0k.build.vid=0x16D0 +mattairtech_mt_d11_bl0k.build.pid=0x0856 +mattairtech_mt_d11_bl0k.bootloader.tool=arduino:openocd +mattairtech_mt_d11_bl0k.bootloader.file=zero/samd11d14am_sam_ba.bin + # MattairTech Core for Arduino Zero (8KB bootloader, Native USB Port) arduino_zero_native.name=Arduino Zero (Native USB Port) diff --git a/bootloaders/zero/readme.txt b/bootloaders/zero/readme.txt index 4f9f94912..1ff629b92 100644 --- a/bootloaders/zero/readme.txt +++ b/bootloaders/zero/readme.txt @@ -35,6 +35,8 @@ twice in quick succession. If so, bootloader execution is resumed Second, the bo checks the state of BOOT_LOAD_PIN (configurable by the user from main.h). If BOOT_LOAD_PIN is pulled low, bootloader execution is resumed. Finally, the first location of application is fetched and checked. If it is empty (0xFFFFFFFF), then bootloader execution is resumed. +Note that when Arduino auto-reset (into bootloader) is initiated, the first flash row is +erased, so the bootloader will always run after reset until a new sketch is transferred. Otherwise, it jumps to application and starts execution from there. The LED will light during bootloader execution. diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_without_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_without_bootloader.ld new file mode 100644 index 000000000..f85765ef4 --- /dev/null +++ b/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld new file mode 100644 index 000000000..f85765ef4 --- /dev/null +++ b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld new file mode 100644 index 000000000..f85765ef4 --- /dev/null +++ b/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} From 441ffca2c7e576f205573a82fde46fe788ad0199 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 20 May 2016 05:49:17 +0000 Subject: [PATCH 078/124] Undo write protection of bootloader from bebef1d2ebd1e8aa27e8da80f8a61759cb6ca962 --- platform.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.txt b/platform.txt index 844c010af..ba33b1a38 100644 --- a/platform.txt +++ b/platform.txt @@ -149,5 +149,5 @@ tools.openocd.erase.pattern= tools.openocd.bootloader.params.verbose=-d3 tools.openocd.bootloader.params.quiet=-d0 -tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify; at91samd bootloader 8192; reset; shutdown" +tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify; reset; shutdown" From 11c601bcceea46db39702e743a75cd312c8bdc3c Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 20 May 2016 05:53:34 +0000 Subject: [PATCH 079/124] Update ETCChannel to support SAML and SAMC, minor doc update --- README.md | 4 ++++ cores/arduino/WVariant.h | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 365d337b6..e631fdc31 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,10 @@ DC Current per I/O Pin | 7 mA | 7 mA 1.6.6-mt1 corresponds to Arduino SAMD CORE 1.6.2 plus some pull requests. +## Differences Between MattairTech and Arduino Cores +* TODO + + ## Pin Configurations Most pins have multiple configurations available (even analog pins). For example, pin A10 on the MT-D21E can be an analog diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index 256f9f003..0f8e685c0 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -70,24 +70,22 @@ typedef enum _ETCChannel 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(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) + TC0_CH0 = (0<<8)|(0), + TC0_CH1 = (0<<8)|(1), TC1_CH0 = (1<<8)|(0), TC1_CH1 = (1<<8)|(1), TC2_CH0 = (2<<8)|(0), TC2_CH1 = (2<<8)|(1), -#endif 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(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) TC6_CH0 = (6<<8)|(0), TC6_CH1 = (6<<8)|(1), TC7_CH0 = (7<<8)|(0), TC7_CH1 = (7<<8)|(1) -#endif } ETCChannel ; extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; From a133b582adcdaed90fca0313d4ea307061de814e Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 6 Mar 2017 02:10:40 +0000 Subject: [PATCH 080/124] Add L21 and C21 support (mostly complete) --- VARIANT_COMPLIANCE_CHANGELOG | 12 ++ cores/arduino/Arduino.h | 2 + cores/arduino/Reset.cpp | 2 + cores/arduino/SERCOM.cpp | 32 ++-- cores/arduino/SERCOM.h | 2 +- cores/arduino/Tone.cpp | 42 ++++- cores/arduino/USB/CDC.cpp | 3 +- cores/arduino/USB/USBCore.cpp | 42 +++-- cores/arduino/USB/USBCore.h | 2 - cores/arduino/USB/USBDesc.h | 32 +--- cores/arduino/USB/samd21_host.c | 23 ++- cores/arduino/WInterrupts.c | 62 ++++--- cores/arduino/WVariant.h | 224 +++++++++++++++++------- cores/arduino/cortex_handlers.c | 96 +++++++++-- cores/arduino/main.cpp | 5 +- cores/arduino/startup.c | 118 ++++++++----- cores/arduino/wiring.c | 168 ++++++++++++++---- cores/arduino/wiring_analog.c | 258 +++++++++++++++++++--------- cores/arduino/wiring_analog.h | 56 +++++- cores/arduino/wiring_private.c | 21 +-- platform.txt | 24 ++- variants/MT_D11/README.md | 198 +++++++++++++++++++++ variants/MT_D11/variant.cpp | 259 +++++++--------------------- variants/MT_D11/variant.h | 97 ++++++++++- variants/MT_D21E/README.md | 187 ++++++++++++++++++++ variants/MT_D21E/variant.cpp | 251 +++++---------------------- variants/MT_D21E/variant.h | 25 ++- variants/arduino_zero/README.md | 195 +++++++++++++++++++++ variants/arduino_zero/variant.cpp | 274 +++++++----------------------- variants/arduino_zero/variant.h | 23 ++- 30 files changed, 1734 insertions(+), 1001 deletions(-) create mode 100644 VARIANT_COMPLIANCE_CHANGELOG create mode 100644 variants/MT_D11/README.md create mode 100644 variants/MT_D21E/README.md create mode 100644 variants/arduino_zero/README.md diff --git a/VARIANT_COMPLIANCE_CHANGELOG b/VARIANT_COMPLIANCE_CHANGELOG new file mode 100644 index 000000000..281c7010d --- /dev/null +++ b/VARIANT_COMPLIANCE_CHANGELOG @@ -0,0 +1,12 @@ +* 1.6.8-beta-b0: +* Introduced MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE define and VARIANT_COMPLIANCE_CHANGELOG file. + The definitions in the variants files need the MattairTech SAMD core >= the listed version. + The format is different than the stock Arduino SAMD core, which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + If using board variant files with the old format, the new core will still read the table the old way, losing + any new features introduced by the new column. +* The GCLKCCL column was added. It is not yet used. It will eventually support the Analog Comparators (AC), + the Configurable Custom Logic (CCL) units of the L21 and C21, and the GCLK outputs (inputs). +* New definitions have been added for L21 and C21 support. +* The C21 has two ADC instances, which is selected in the PeripheralAttribute column. +* the timer type is now encoded in this column to support the L21 and C21, which use TC numbers starting at 0 + (rather than 3 as on the D21). diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 66b10614b..4e6936ac3 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -120,9 +120,11 @@ void loop( void ) ; #define digitalPinToInterrupt(P) ( P ) // USB Device +#if defined(USBCON) #include "USB/USBDesc.h" #include "USB/USBCore.h" #include "USB/USBAPI.h" #include "USB/USB_host.h" +#endif #endif // Arduino_h diff --git a/cores/arduino/Reset.cpp b/cores/arduino/Reset.cpp index 42ebb1d1e..25444218b 100644 --- a/cores/arduino/Reset.cpp +++ b/cores/arduino/Reset.cpp @@ -46,6 +46,7 @@ void banzai() { // Disable all interrupts __disable_irq(); +#if !defined(__NO_BOOTLOADER__) // Erase application while (!nvmReady()) ; @@ -54,6 +55,7 @@ void banzai() { NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMD_ER | NVMCTRL_CTRLA_CMDEX_KEY; while (!nvmReady()) ; +#endif // Reset the device NVIC_SystemReset() ; diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index 6f6e6028a..b61b9bdb0 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -55,6 +55,14 @@ static uint64_t divide64(uint64_t n, uint64_t d) */ void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint32_t baudrate) { +#if (SAML21) + // On the SAML21, SERCOM5 is on PD0, which is a low power domain on a different bridge than the other SERCOMs. + // SERCOM5 does not support SAMPLE_RATE_x8 or SAMPLE_RATE_x3. + if (sercom == SERCOM5) { + sampleRate = SAMPLE_RATE_x16; + } +#endif + initClockNVIC(); resetUART(); @@ -691,22 +699,21 @@ void SERCOM::initClockNVIC( void ) clockId = GCM_SERCOM1_CORE; IdNvic = SERCOM1_IRQn; } -#if !defined(__SAMD11C14A__) +#if !(SAMD11C14) else if(sercom == SERCOM2) { clockId = GCM_SERCOM2_CORE; IdNvic = SERCOM2_IRQn; } #endif -#if !defined(__SAMD11D14AM__) && !defined(__SAMD11C14A__) && !defined(__SAMD11D14AS__) +#if !(SAMD11_SERIES) else if(sercom == SERCOM3) { clockId = GCM_SERCOM3_CORE; IdNvic = SERCOM3_IRQn; } #endif -#if defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ - defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) +#if !(SAMD11_SERIES) && !(SAMD21E) && !(SAMC21E) else if(sercom == SERCOM4) { clockId = GCM_SERCOM4_CORE; @@ -730,12 +737,13 @@ void SERCOM::initClockNVIC( void ) NVIC_SetPriority (IdNvic, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */ //Setting clock - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( clockId ) | // Generic Clock 0 (SERCOMx) - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN ; - - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } +#if (SAMD21 || SAMD11) + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( clockId ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); +#elif (SAML21 || SAMC21) + GCLK->PCHCTRL[clockId].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); +#else + #error "SERCOM.cpp: Unsupported chip" +#endif } diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index 4b9d0e634..676947ecf 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -21,7 +21,7 @@ #include "sam.h" -#define SERCOM_FREQ_REF 48000000 +#define SERCOM_FREQ_REF F_CPU typedef enum { diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 4453c3b4d..18276a658 100644 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -18,8 +18,15 @@ #include "Tone.h" #include "variant.h" +#include "sam.h" +#if (SAMD21 || SAMD11) #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY); +#elif (SAML21 || SAMC21) +#define WAIT_TC16_REGS_SYNC(x) while(x->SYNCBUSY.reg); +#else +#error "Tone.cpp: Unsupported chip" +#endif uint32_t toneMaxFrequency = F_CPU / 2; uint32_t lastOutputPin = 0xFFFFFFFF; @@ -31,19 +38,29 @@ volatile int64_t toggleCount; volatile bool toneIsActive = false; volatile bool firstTimeRunning = false; -/* TC5 does not exist on the D11. Using TC2 instead. It will conflict with the 2 TC2 PWM pins */ -#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) +/* TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14A as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. */ +#if (SAMD11D14A) #define TONE_TC TC2 #define TONE_TC_IRQn TC2_IRQn +void TC2_Handler (void) __attribute__ ((alias("Tone_Handler"))); +#elif (SAMD11C14) +#define TONE_TC TC1 +#define TONE_TC_IRQn TC1_IRQn +void TC1_Handler (void) __attribute__ ((alias("Tone_Handler"))); +/* TC5 does not exist on the SAML or SAMC. Using TC3 instead. It will conflict with the 2 associated TC analogWrite() pins. */ +#elif (SAML_SERIES || SAMC_SERIES) +#define TONE_TC TC3 +#define TONE_TC_IRQn TC3_IRQn +void TC3_Handler (void) __attribute__ ((alias("Tone_Handler"))); #else #define TONE_TC TC5 #define TONE_TC_IRQn TC5_IRQn +void TC5_Handler (void) __attribute__ ((alias("Tone_Handler"))); #endif #define TONE_TC_TOP 0xFFFF #define TONE_TC_CHANNEL 0 -void TC5_Handler (void) __attribute__ ((weak, alias("Tone_Handler"))); static inline void resetTC (Tc* TCx) { @@ -75,12 +92,16 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration) NVIC_SetPriority(TONE_TC_IRQn, 0); // Enable GCLK for timer used -#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC1_TC2)); +#if (SAMD11_SERIES) + GCLK->CLKCTRL.reg = (uint16_t) ( GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC1_TC2 )); + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); +#elif (SAML_SERIES || SAMC_SERIES) + GCLK->PCHCTRL[GCM_TC2_TC3].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); #else - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC4_TC5)); + GCLK->CLKCTRL.reg = (uint16_t) ( GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC4_TC5 )); + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); #endif - while (GCLK->STATUS.bit.SYNCBUSY); } if (toneIsActive && (outputPin != lastOutputPin)) @@ -131,11 +152,18 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration) uint16_t tmpReg = 0; tmpReg |= TC_CTRLA_MODE_COUNT16; // Set Timer counter Mode to 16 bits +#if (SAMD21 || SAMD11) tmpReg |= TC_CTRLA_WAVEGEN_MFRQ; // Set TONE_TC mode as match frequency +#endif tmpReg |= prescalerConfigBits; TONE_TC->COUNT16.CTRLA.reg |= tmpReg; WAIT_TC16_REGS_SYNC(TONE_TC) +#if (SAML21 || SAMC21) + TONE_TC->WAVE.reg = TC_WAVE_WAVEGEN_MFRQ; + WAIT_TC16_REGS_SYNC(TONE_TC) +#endif + TONE_TC->COUNT16.CC[TONE_TC_CHANNEL].reg = (uint16_t) ccValue; WAIT_TC16_REGS_SYNC(TONE_TC) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 3f1b6f081..52812e35a 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -18,13 +18,12 @@ #include #include // Needed for auto-reset with 1200bps port touch -#include "USBDesc.h" #include #include #include -#ifdef CDC_ENABLED +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define CDC_SERIAL_BUFFER_SIZE 256 diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index 68e37ec33..0c51eaf9d 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -21,6 +21,8 @@ #include "SAMD21_USBDevice.h" #include "PluggableUSB.h" #include "USBDesc.h" +#include "WVariant.h" +#include "sam.h" #include #include @@ -134,7 +136,7 @@ uint8_t USBDeviceClass::SendInterfaces(uint32_t* total) { uint8_t interfaces = 0; -#if defined(CDC_ENABLED) +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) total[0] += CDC_GetInterface(&interfaces); #endif @@ -198,16 +200,12 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup) if (t == USB_DEVICE_DESCRIPTOR_TYPE) { - //if (setup.wLength == 8) - // _cdcComposite = 1; - - //desc_addr = _cdcComposite ? (const uint8_t*)&USB_DeviceDescriptorB : (const uint8_t*)&USB_DeviceDescriptor; -#if defined(IAD_PRESENT) - desc_addr = (const uint8_t*)&USB_DeviceDescriptorB; -#elif defined(CDC_ONLY) +#if defined(CDC_ONLY) desc_addr = (const uint8_t*)&USB_DeviceDescriptorC; -#else +#elif defined(HID_ONLY) desc_addr = (const uint8_t*)&USB_DeviceDescriptor; +#else + desc_addr = (const uint8_t*)&USB_DeviceDescriptorB; #endif if (*desc_addr > setup.wLength) { @@ -259,7 +257,7 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup) void USBDeviceClass::handleEndpoint(uint8_t ep) { -#if defined(CDC_ENABLED) +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) if (ep == CDC_ENDPOINT_OUT) { // The RAM Buffer is empty: we can receive data @@ -303,7 +301,13 @@ void USBDeviceClass::init() #endif // Enable USB clock +#if (SAMD21 || SAMD11) PM->APBBMASK.reg |= PM_APBBMASK_USB; +#elif (SAML21) + MCLK->APBBMASK.reg |= MCLK_APBBMASK_USB; +#else + #error "USBCore.cpp: Unsupported chip" +#endif // Set up the USB DP/DN pins PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; @@ -314,11 +318,13 @@ void USBDeviceClass::init() PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); // Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(6) | // Generic Clock Multiplexer 6 - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN; - while (GCLK->STATUS.bit.SYNCBUSY) - ; +#if (SAMD21 || SAMD11) + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GCM_USB ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); +#else + GCLK->PCHCTRL[GCM_USB].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); +#endif USB_SetHandler(&UDD_Handler); @@ -385,7 +391,7 @@ bool USBDeviceClass::handleClassInterfaceSetup(USBSetup& setup) { uint8_t i = setup.wIndex; - #if defined(CDC_ENABLED) + #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) if (CDC_ACM_INTERFACE == i) { if (CDC_Setup(setup) == false) { @@ -410,7 +416,7 @@ uint32_t EndPoints[] = { USB_ENDPOINT_TYPE_CONTROL, -#ifdef CDC_ENABLED +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) USB_ENDPOINT_TYPE_INTERRUPT | USB_ENDPOINT_IN(0), // CDC_ENDPOINT_ACM USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_OUT(0), // CDC_ENDPOINT_OUT USB_ENDPOINT_TYPE_BULK | USB_ENDPOINT_IN(0), // CDC_ENDPOINT_IN @@ -825,7 +831,7 @@ bool USBDeviceClass::handleStandardSetup(USBSetup &setup) initEndpoints(); _usbConfiguration = setup.wValueL; - #if defined(CDC_ENABLED) + #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) // Enable interrupt for CDC reception from host (OUT packet) usbd.epBank1EnableTransferComplete(CDC_ENDPOINT_ACM); usbd.epBank0EnableTransferComplete(CDC_ENDPOINT_OUT); diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 21bf70b1d..2c4314250 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -19,8 +19,6 @@ #ifndef __USBCORE_H__ #define __USBCORE_H__ -#include "USBDesc.h" - // Standard requests #define GET_STATUS 0 #define CLEAR_FEATURE 1 diff --git a/cores/arduino/USB/USBDesc.h b/cores/arduino/USB/USBDesc.h index b7c9067e3..38fa87185 100644 --- a/cores/arduino/USB/USBDesc.h +++ b/cores/arduino/USB/USBDesc.h @@ -19,37 +19,11 @@ #ifndef __USBDESC_H__ #define __USBDESC_H__ -#if !defined(ARDUINO_USB_UART_DISABLED) && !defined(ARDUINO_UART_ONLY) +#if !defined(USB_DISABLED) #define PLUGGABLE_USB_ENABLED #endif -// These are controlled by the boards.txt menu system. -// Now that there is Pluggable USB, these will be eliminated -// once an alternate method for USB PID allocation is found. -#if defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) -#define CDC_ENABLED -#if defined(ARDUINO_CDC_ONLY) || defined(ARDUINO_CDC_UART) -#define CDC_ONLY -#else -#define IAD_PRESENT -#endif -#endif - -#if defined(ARDUINO_HID_ONLY) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_HID) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) -#define HID_ENABLED -#endif - -#if defined(ARDUINO_MIDI_ONLY) || defined(ARDUINO_MIDI_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) -#define MIDI_ENABLED -#define IAD_PRESENT -#endif - -#if defined(ARDUINO_MSD_ONLY) || defined(ARDUINO_MSD_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) -#define MSD_ENABLED -#endif - - -#ifdef CDC_ENABLED +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define CDC_INTERFACE_COUNT 2 #define CDC_ENPOINT_COUNT 3 #else @@ -65,7 +39,7 @@ #define CDC_ENDPOINT_OUT 2 #define CDC_ENDPOINT_IN 3 -#ifdef CDC_ENABLED +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define CDC_RX CDC_ENDPOINT_OUT #define CDC_TX CDC_ENDPOINT_IN #endif diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index ec33ff39e..e3867e5aa 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -23,6 +23,7 @@ #include "../Arduino.h" #include "variant.h" +#include "WVariant.h" #include "USB_host.h" #include "samd21_host.h" #include "sam.h" @@ -67,7 +68,14 @@ void UHD_Init(void) USB_SetHandler(&UHD_Handler); /* Enable USB clock */ +#if (SAMD21 || SAMD11) PM->APBBMASK.reg |= PM_APBBMASK_USB; +#elif (SAML21) + MCLK->APBBMASK.reg |= MCLK_APBBMASK_USB; +#else + #error "samd21_host.c: Unsupported chip" +#endif + /* Set up the USB DP/DM pins */ pinPeripheral( PIN_USB_DM, PIO_COM ); @@ -82,14 +90,13 @@ void UHD_Init(void) /* ---------------------------------------------------------------------------------------------- * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) */ - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(6) | // Generic Clock Multiplexer 6 - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN; - - while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) - { - /* Wait for synchronization */ - } +#if (SAMD21 || SAMD11) + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GCM_USB ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); +#else + GCLK->PCHCTRL[GCM_USB].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); +#endif /* Reset */ USB->HOST.CTRLA.bit.SWRST = 1; diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index d8123dff6..b0c0bd9ad 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -18,6 +18,7 @@ #include "Arduino.h" #include "wiring_private.h" +#include "sam.h" #include @@ -34,8 +35,17 @@ static void __initialize() NVIC_EnableIRQ(EIC_IRQn); // Enable GCLK for IEC (External Interrupt Controller) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_EIC)); - +#if (SAMD21 || SAMD11) + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GCM_EIC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); +#elif (SAML21 || SAMC21) + GCLK->PCHCTRL[GCM_EIC].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); +#else + #error "WInterrupts.c: Unsupported chip" +#endif + +#if (SAMD21 || SAMD11) /* Shall we do that? // Do a software reset on EIC EIC->CTRL.SWRST.bit = 1 ; @@ -45,6 +55,17 @@ static void __initialize() // Enable EIC EIC->CTRL.bit.ENABLE = 1; while (EIC->STATUS.bit.SYNCBUSY == 1) { } +#elif (SAML21 || SAMC21) +/* Shall we do that? + // Do a software reset on EIC + EIC->CTRLA.SWRST.bit = 1 ; + while ((EIC->CTRLA.SWRST.bit == 1) && (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK)) { } +*/ + + // Enable EIC + EIC->CTRLA.bit.ENABLE = 1; + while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } +#endif } /* @@ -70,8 +91,10 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) return; - // Enable wakeup capability on pin in case being used during sleep + // Enable wakeup capability on pin in case being used during sleep (WAKEUP always enabled on SAML and SAMC) +#if (SAMD21 || SAMD11) EIC->WAKEUP.reg |= (1 << in); +#endif // Assign callback to interrupt callbacksInt[in] = callback; @@ -84,29 +107,10 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) } // Configure the interrupt mode - pos = (in - (8 * config)) << 2; - switch (mode) - { - case LOW: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_LOW_Val << pos; - break; - - case HIGH: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_HIGH_Val << pos; - break; - - case CHANGE: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_BOTH_Val << pos; - break; - - case FALLING: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_FALL_Val << pos; - break; - - case RISING: - EIC->CONFIG[config].reg |= EIC_CONFIG_SENSE0_RISE_Val << pos; - break; - } + pos = (in - (8 * config)) << 2; // compute position (ie: 0, 4, 8, 12, ...) + uint32_t regConfig = EIC->CONFIG[config].reg; // copy register to variable + // insert new mode and write to register (the hardware numbering for the 5 interrupt modes is in reverse order to the arduino numbering, so using '5-mode'). + EIC->CONFIG[config].reg = (regConfig | ((5-mode) << pos)); // Enable the interrupt EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << in); @@ -123,8 +127,10 @@ void detachInterrupt(uint32_t pin) EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << in); - // Disable wakeup capability on pin during sleep + // Disable wakeup capability on pin during sleep (WAKEUP always enabled on SAML and SAMC) +#if (SAMD21 || SAMD11) EIC->WAKEUP.reg &= ~(1 << in); +#endif } /* @@ -133,7 +139,7 @@ void detachInterrupt(uint32_t pin) void EIC_Handler(void) { // Test the normal interrupts - for (uint32_t i=EXTERNAL_INT_0; i<=EXTERNAL_NUM_INTERRUPTS; i++) + for (uint32_t i=EXTERNAL_INT_0; i<=EXTERNAL_INT_15; i++) { if ((EIC->INTFLAG.reg & (1 << i)) != 0) { diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index f7650411c..2f689f307 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -20,15 +20,13 @@ #include #include "sam.h" +#include "variant.h" #ifdef __cplusplus extern "C" { #endif /* Definitions and types for pins */ -/* ADC channels for ATSAMD21GxxA and ATSAMD21JxxA: All but 8 and 9 */ -/* ADC channels for ATSAMD21ExxA: All but 2, 3, 8, 9, and 10 */ -/* ADC channels for ATSAMD11D14AM: 0 through 9 */ typedef enum _EAnalogChannel { No_ADC_Channel=-1, @@ -53,53 +51,68 @@ typedef enum _EAnalogChannel ADC_Channel18=18, ADC_Channel19=19, DAC_Channel0, + DAC_Channel1, } EAnalogChannel ; // Definitions for TC channels +// RESERVED (1 bit, used for negative) | Timer Number (3 bits: 0-7) | Timer Type (1 bit: 0=TCC, 1=TC) | Timer Channel (3 bits: 0-7) typedef enum _ETCChannel { NOT_ON_TIMER=-1, - TCC0_CH0 = (0<<8)|(0), - TCC0_CH1 = (0<<8)|(1), - TCC0_CH2 = (0<<8)|(2), - TCC0_CH3 = (0<<8)|(3), - TCC0_CH4 = (0<<8)|(0), // Channel 4 is 0! - TCC0_CH5 = (0<<8)|(1), // Channel 5 is 1! - TCC0_CH6 = (0<<8)|(2), // Channel 6 is 2! - TCC0_CH7 = (0<<8)|(3), // Channel 7 is 3! - TCC1_CH0 = (1<<8)|(0), - TCC1_CH1 = (1<<8)|(1), - TCC1_CH2 = (1<<8)|(0), // Channel 2 is 0! - TCC1_CH3 = (1<<8)|(1), // Channel 3 is 1! - 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! - TC0_CH0 = (0<<8)|(0), - TC0_CH1 = (0<<8)|(1), - TC1_CH0 = (1<<8)|(0), - TC1_CH1 = (1<<8)|(1), - TC2_CH0 = (2<<8)|(0), - TC2_CH1 = (2<<8)|(1), - 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), - TC6_CH0 = (6<<8)|(0), - TC6_CH1 = (6<<8)|(1), - TC7_CH0 = (7<<8)|(0), - TC7_CH1 = (7<<8)|(1), + TCC0_CH0 = (0<<4)|(0<<3)|(0), + TCC0_CH1 = (0<<4)|(0<<3)|(1), + TCC0_CH2 = (0<<4)|(0<<3)|(2), + TCC0_CH3 = (0<<4)|(0<<3)|(3), + TCC0_CH4 = (0<<4)|(0<<3)|(0), // Channel 4 is 0! + TCC0_CH5 = (0<<4)|(0<<3)|(1), // Channel 5 is 1! + TCC0_CH6 = (0<<4)|(0<<3)|(2), // Channel 6 is 2! + TCC0_CH7 = (0<<4)|(0<<3)|(3), // Channel 7 is 3! + TCC1_CH0 = (1<<4)|(0<<3)|(0), + TCC1_CH1 = (1<<4)|(0<<3)|(1), + TCC1_CH2 = (1<<4)|(0<<3)|(0), // Channel 2 is 0! + TCC1_CH3 = (1<<4)|(0<<3)|(1), // Channel 3 is 1! + TCC2_CH0 = (2<<4)|(0<<3)|(0), + TCC2_CH1 = (2<<4)|(0<<3)|(1), + TCC2_CH2 = (2<<4)|(0<<3)|(0), // Channel 2 is 0! + TCC2_CH3 = (2<<4)|(0<<3)|(1), // Channel 3 is 1! + TC0_CH0 = (0<<4)|(1<<3)|(0), + TC0_CH1 = (0<<4)|(1<<3)|(1), + TC1_CH0 = (1<<4)|(1<<3)|(0), + TC1_CH1 = (1<<4)|(1<<3)|(1), + TC2_CH0 = (2<<4)|(1<<3)|(0), + TC2_CH1 = (2<<4)|(1<<3)|(1), + TC3_CH0 = (3<<4)|(1<<3)|(0), + TC3_CH1 = (3<<4)|(1<<3)|(1), + TC4_CH0 = (4<<4)|(1<<3)|(0), + TC4_CH1 = (4<<4)|(1<<3)|(1), + TC5_CH0 = (5<<4)|(1<<3)|(0), + TC5_CH1 = (5<<4)|(1<<3)|(1), + TC6_CH0 = (6<<4)|(1<<3)|(0), + TC6_CH1 = (6<<4)|(1<<3)|(1), + TC7_CH0 = (7<<4)|(1<<3)|(0), + TC7_CH1 = (7<<4)|(1<<3)|(1), } ETCChannel ; extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; -#define GetTCNumber( x ) ( (x) >> 8 ) -#define GetTCChannelNumber( x ) ( (x) & 0xff ) -#define GetTC( x ) ( g_apTCInstances[(x) >> 8] ) +#define GetTCNumber( x ) ( ((x) >> 4) & 0x07 ) +#define GetTCType( x ) ( ((x) >> 3) & 0x01 ) +#define GetTCChannelNumber( x ) ( (x) & 0x07 ) +#if (SAMD) +#define GetTC( x ) ( g_apTCInstances[((x) >> 4) & 0x07] ) +#elif (SAML21 || SAMC21) +#define GetTC( x ) ( ( ((x) >> 3) & 0x01 ) == 0 ? g_apTCInstances[((x) >> 4) & 0x07] : g_apTCInstances[(((x) >> 4) & 0x07) + TCC_INST_NUM] ) +#else +#error "WVariant.h: Unsupported chip" +#endif + +// Definitions for GCLK_CCL column TODO, AC? +// RESERVED (1 bit, used for negative) | GCLK (3 bits: 0-7) | CCL (4 bits: 2 for CCL number, 2 for pin) +typedef enum _EGCLK_CCL +{ + GCLK_CCL_NONE=-1, +} EGCLK_CCL ; -/* Only PORTA on D21E and D11 */ typedef enum _EPortType { NOT_A_PORT=-1, @@ -108,7 +121,6 @@ typedef enum _EPortType PORTC=2, } EPortType ; -/* The D11 has only INT 0 though 7 (the SAMD11C14A lacks INT 0 as well */ typedef enum { EXTERNAL_INT_0 = 0, @@ -119,7 +131,6 @@ typedef enum EXTERNAL_INT_5, EXTERNAL_INT_6, EXTERNAL_INT_7, -#if !defined(__SAMD11D14AM__) && !defined(__SAMD11C14A__) && !defined(__SAMD11D14AS__) EXTERNAL_INT_8, EXTERNAL_INT_9, EXTERNAL_INT_10, @@ -128,7 +139,6 @@ typedef enum EXTERNAL_INT_13, EXTERNAL_INT_14, EXTERNAL_INT_15, -#endif EXTERNAL_INT_NMI, EXTERNAL_NUM_INTERRUPTS, NOT_AN_INTERRUPT = -1, @@ -155,13 +165,17 @@ typedef enum _EPioType PIO_ANALOG_ADC=5, /* The pin is controlled by the ANALOG peripheral and is an ADC input. */ PIO_ANALOG_DAC=6, /* The pin is controlled by the ANALOG peripheral and is a DAC output. */ PIO_ANALOG_REF=7, /* The pin is controlled by the ANALOG peripheral and is a voltage reference input (3.3V MAX). */ + PIO_ANALOG_AC=8, /* The pin is controlled by the ANALOG peripheral and is used by the AC (analog comparator). */ + PIO_ANALOG_PTC=9, /* The pin is controlled by the ANALOG peripheral and is used by the PTC (peripheral touch controller). */ + PIO_ANALOG_SDADC=10, /* The pin is controlled by the ANALOG peripheral and is used by the PTC (peripheral touch controller). */ - PIO_TIMER_PWM=8, /* The pin is controlled by a TIMER peripheral and is a PWM output. */ - PIO_TIMER_CAPTURE=9, /* The pin is controlled by a TIMER peripheral and is a capture input. */ + PIO_TIMER_PWM=11, /* The pin is controlled by a TIMER peripheral and is a PWM output. */ + PIO_TIMER_CAPTURE=12, /* The pin is controlled by a TIMER peripheral and is a capture input. */ - PIO_SERCOM=10, /* The pin is controlled by a SERCOM peripheral (UART, SPI, or I2C). */ - PIO_COM=11, /* The pin is controlled by the COM peripheral (USB or I2S). */ - PIO_AC_GCLK=12, /* The pin is controlled by the AC_GCLK peripheral (output). */ + PIO_SERCOM=13, /* The pin is controlled by a SERCOM peripheral (UART, SPI, or I2C). */ + PIO_COM=14, /* The pin is controlled by the COM peripheral (USB or I2S). */ + PIO_AC_GCLK=15, /* The pin is controlled by the AC_GCLK peripheral (I/O). */ + PIO_CCL=16, /* The pin is controlled by the CCL (configurable custom logic) peripheral (I/O). */ PIO_MULTI, /* The pin can be configured to any type based on the attributes. */ @@ -184,19 +198,24 @@ typedef enum _EPioType #define PIN_ATTR_ADC (1UL << PIO_ANALOG_ADC) #define PIN_ATTR_DAC (1UL << PIO_ANALOG_DAC) #define PIN_ATTR_REF (1UL << PIO_ANALOG_REF) +#define PIN_ATTR_AC (1UL << PIO_ANALOG_AC) +#define PIN_ATTR_PTC (1UL << PIO_ANALOG_PTC) +#define PIN_ATTR_SDADC (1UL << PIO_ANALOG_SDADC) #define PIN_ATTR_ANALOG PIN_ATTR_ADC #define PIN_ATTR_TIMER_PWM (1UL << PIO_TIMER_PWM) #define PIN_ATTR_TIMER_CAPTURE (1UL << PIO_TIMER_CAPTURE) -#define PIN_ATTR_TIMER (PIN_ATTR_TIMER_PWM|PIN_ATTR_TIMER_CAPTURE) +#define PIN_ATTR_TIMER_BOTH (PIN_ATTR_TIMER_PWM|PIN_ATTR_TIMER_CAPTURE) +#define PIN_ATTR_TIMER PIN_ATTR_TIMER_BOTH #define PIN_ATTR_SERCOM (1UL << PIO_SERCOM) #define PIN_ATTR_COM (1UL << PIO_COM) -#define PIN_ATTR_AC_CLK (1UL << PIO_AC_GCLK) +#define PIN_ATTR_AC_GCLK (1UL << PIO_AC_GCLK) +#define PIN_ATTR_CCL (1UL << PIO_CCL) -//A B C D E F G H -//EIC REF ADC AC PTC DAC SERCOM SERCOM_ALT TC/TCC TCC COM AC/GCLK +// A B C D E F G H I +//EIC REF ADC AC PTC DAC SERCOM SERCOM_ALT TC/TCC TCC COM AC/GCLK CCL typedef enum _EPioPeripheral { PER_PORT=-1, /* The pin is controlled by PORT. */ @@ -208,6 +227,7 @@ typedef enum _EPioPeripheral PER_TIMER_ALT=5, /* The pin is controlled by the associated signal of peripheral F. */ PER_COM=6, /* The pin is controlled by the associated signal of peripheral G. */ PER_AC_CLK=7, /* The pin is controlled by the associated signal of peripheral H. */ + PER_CCL=8, /* The pin is controlled by the associated signal of peripheral I. */ } EPioPeripheral ; /** @@ -237,6 +257,10 @@ typedef enum _EPioPeripheral #define PER_ATTR_INPUT_SYNCHRONIZER_ALWAYS_ON (1UL<<5) #define PER_ATTR_INPUT_SYNCHRONIZER_MASK (1UL<<5) +#define PER_ATTR_ADC_STD (0UL<<6) +#define PER_ATTR_ADC_ALT (1UL<<6) +#define PER_ATTR_ADC_MASK (1UL<<6) + /* Types used for the table below * This struct MUST be 12 bytes long (elements are ordered to prevent unaligned access). @@ -248,15 +272,24 @@ typedef struct _PinDescription uint8_t ulPinType ; // Must be 8 bits uint8_t ulPeripheralAttribute ; // Must be 8 bit bitfield uint32_t ulPinAttribute ; // Must be 32 bit bitfield - uint16_t ulTCChannel ; // Must be 16 bits +#if defined(MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE) && (MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10608) + uint8_t ulTCChannel ; // Must be 8 bits uint8_t ulADCChannelNumber ; // Must be 8 bits uint8_t ulExtInt ; // Must be 8 bits + uint8_t ulGCLKCCL ; // Must be 8 bits +#else + uint16_t ulTCChannel ; // Must be 16 bits + uint8_t ulADCChannelNumber ; // Must be 8 bits + uint8_t ulExtInt ; // Must be 8 bits +#endif } PinDescription ; /* Pins table to be instantiated into variant.cpp */ extern const PinDescription g_APinDescription[] ; /* Generic Clock Multiplexer IDs */ +#if (SAMD21 || SAMD11) + #define GCM_DFLL48M_REF (0x00U) #define GCM_FDPLL96M_INPUT (0x01U) #define GCM_FDPLL96M_32K (0x02U) @@ -270,9 +303,7 @@ extern const PinDescription g_APinDescription[] ; #define GCM_EVSYS_CHANNEL_3 (0x0AU) #define GCM_EVSYS_CHANNEL_4 (0x0BU) #define GCM_EVSYS_CHANNEL_5 (0x0CU) - -#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) - +#if (SAMD11) #define GCM_SERCOMx_SLOW (0x0DU) #define GCM_SERCOM0_CORE (0x0EU) #define GCM_SERCOM1_CORE (0x0FU) @@ -284,9 +315,7 @@ extern const PinDescription g_APinDescription[] ; #define GCM_AC_ANA (0x15U) #define GCM_DAC (0x16U) #define GCM_PTC (0x17U) - #else - #define GCM_EVSYS_CHANNEL_6 (0x0DU) #define GCM_EVSYS_CHANNEL_7 (0x0EU) #define GCM_EVSYS_CHANNEL_8 (0x0FU) @@ -311,6 +340,87 @@ extern const PinDescription g_APinDescription[] ; #define GCM_PTC (0x22U) #define GCM_I2S_0 (0x23U) #define GCM_I2S_1 (0x24U) +#endif + +#elif (SAML21) +#define GCM_DFLL48M_REF (0x00U) +#define GCM_FDPLL96M_INPUT (0x01U) +#define GCM_FDPLL96M_32K (0x02U) +#define GCM_EIC (0x03U) +#define GCM_USB (0x04U) +#define GCM_EVSYS_CHANNEL_0 (0x05U) +#define GCM_EVSYS_CHANNEL_1 (0x06U) +#define GCM_EVSYS_CHANNEL_2 (0x07U) +#define GCM_EVSYS_CHANNEL_3 (0x08U) +#define GCM_EVSYS_CHANNEL_4 (0x09U) +#define GCM_EVSYS_CHANNEL_5 (0x0AU) +#define GCM_EVSYS_CHANNEL_6 (0x0BU) +#define GCM_EVSYS_CHANNEL_7 (0x0CU) +#define GCM_EVSYS_CHANNEL_8 (0x0DU) +#define GCM_EVSYS_CHANNEL_9 (0x0EU) +#define GCM_EVSYS_CHANNEL_10 (0x0FU) +#define GCM_EVSYS_CHANNEL_11 (0x10U) +#define GCM_SERCOMx_SLOW (0x11U) +#define GCM_SERCOM0_CORE (0x12U) +#define GCM_SERCOM1_CORE (0x13U) +#define GCM_SERCOM2_CORE (0x14U) +#define GCM_SERCOM3_CORE (0x15U) +#define GCM_SERCOM4_CORE (0x16U) +#define GCM_SERCOM5_SLOW (0x17U) +#define GCM_SERCOM5_CORE (0x18U) +#define GCM_TCC0_TCC1 (0x19U) +#define GCM_TCC2 (0x1AU) +#define GCM_TC0_TC1 (0x1BU) +#define GCM_TC2_TC3 (0x1CU) +#define GCM_TC4 (0x1DU) +#define GCM_ADC (0x1EU) +#define GCM_AC (0x1FU) +#define GCM_DAC (0x20U) +#define GCM_PTC (0x21U) +#define GCM_CCL (0x22U) + +#elif (SAMC21) +#define GCM_FDPLL96M_INPUT (0x00U) +#define GCM_FDPLL96M_32K (0x01U) +#define GCM_EIC (0x02U) +#define GCM_FREQM_MEASURE (0x03U) +#define GCM_FREQM_REF (0x04U) +#define GCM_TSENS (0x05U) +#define GCM_EVSYS_CHANNEL_0 (0x06U) +#define GCM_EVSYS_CHANNEL_1 (0x07U) +#define GCM_EVSYS_CHANNEL_2 (0x08U) +#define GCM_EVSYS_CHANNEL_3 (0x09U) +#define GCM_EVSYS_CHANNEL_4 (0x0AU) +#define GCM_EVSYS_CHANNEL_5 (0x0BU) +#define GCM_EVSYS_CHANNEL_6 (0x0CU) +#define GCM_EVSYS_CHANNEL_7 (0x0DU) +#define GCM_EVSYS_CHANNEL_8 (0x0EU) +#define GCM_EVSYS_CHANNEL_9 (0x0FU) +#define GCM_EVSYS_CHANNEL_10 (0x10U) +#define GCM_EVSYS_CHANNEL_11 (0x11U) +#define GCM_SERCOMx_SLOW (0x12U) +#define GCM_SERCOM0_CORE (0x13U) +#define GCM_SERCOM1_CORE (0x14U) +#define GCM_SERCOM2_CORE (0x15U) +#define GCM_SERCOM3_CORE (0x16U) +#define GCM_SERCOM4_CORE (0x17U) +#define GCM_SERCOM5_SLOW (0x18U) +#define GCM_SERCOM5_CORE (0x19U) +#define GCM_CAN0 (0x1AU) +#define GCM_CAN1 (0x1BU) +#define GCM_TCC0_TCC1 (0x1CU) +#define GCM_TCC2 (0x1DU) +#define GCM_TC0_TC1 (0x1EU) +#define GCM_TC2_TC3 (0x1FU) +#define GCM_TC4 (0x20U) +#define GCM_ADC0 (0x21U) +#define GCM_ADC1 (0x22U) +#define GCM_SDADC (0x23U) +#define GCM_AC (0x22U) +#define GCM_DAC (0x24U) +#define GCM_PTC (0x25U) +#define GCM_CCL (0x26U) +#define GCM_NVMCTRL (0x27U) #endif diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c index 5a848d148..ef8f390c0 100644 --- a/cores/arduino/cortex_handlers.c +++ b/cores/arduino/cortex_handlers.c @@ -43,11 +43,14 @@ void PendSV_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SysTick_Handler (void); /* Peripherals handlers */ +void SYSTEM_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void PM_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SYSCTRL_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void WDT_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void RTC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void EIC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void FREQM_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TSENS_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void NVMCTRL_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void DMAC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void USB_Handler (void) __attribute__ ((weak)); @@ -58,21 +61,29 @@ void SERCOM2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM3_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM4_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SERCOM5_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void CAN0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void CAN1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TCC2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TC0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC2_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC3_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC4_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); -void TC5_Handler (void) __attribute__ ((weak)); // Used in Tone.cpp +void TC5_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC6_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void TC7_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void ADC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void ADC0_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void ADC1_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void AC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void DAC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void SDADC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void PTC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void I2S_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void AES_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); +void TRNG_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); /* Initialize segments */ extern uint32_t __etext; @@ -105,6 +116,7 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = (void*) SysTick_Handler, /* Configurable interrupts */ +#if (SAMD21_SERIES || SAMD11_SERIES) (void*) PM_Handler, /* 0 Power Manager */ (void*) SYSCTRL_Handler, /* 1 System Control */ (void*) WDT_Handler, /* 2 Watchdog Timer */ @@ -117,17 +129,13 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = (void*) SERCOM0_Handler, /* 9 Serial Communication Interface 0 */ (void*) SERCOM1_Handler, /* 10 Serial Communication Interface 1 */ (void*) SERCOM2_Handler, /* 11 Serial Communication Interface 2 */ -#if defined(__SAMD21E15A__) || defined(__SAMD21E16A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || \ - defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ - defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) +#if (SAMD21_SERIES) (void*) SERCOM3_Handler, /* 12 Serial Communication Interface 3 */ (void*) SERCOM4_Handler, /* 13 Serial Communication Interface 4 */ (void*) SERCOM5_Handler, /* 14 Serial Communication Interface 5 */ #endif (void*) TCC0_Handler, /* 15 / 12 Timer Counter Control 0 */ -#if defined(__SAMD21E15A__) || defined(__SAMD21E16A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || \ - defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ - defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) +#if (SAMD21_SERIES) (void*) TCC1_Handler, /* 16 Timer Counter Control 1 */ (void*) TCC2_Handler, /* 17 Timer Counter Control 2 */ (void*) TC3_Handler, /* 18 Basic Timer Counter 3 */ @@ -143,11 +151,63 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = (void*) AC_Handler, /* 24 / 16 Analog Comparators */ (void*) DAC_Handler, /* 25 / 17 Digital Analog Converter */ (void*) PTC_Handler, /* 26 / 18 Peripheral Touch Controller */ -#if defined(__SAMD21E15A__) || defined(__SAMD21E16A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || \ - defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ - defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) +#if (SAMD21_SERIES) (void*) I2S_Handler /* 27 Inter-IC Sound Interface */ #endif + +#elif (SAML21_SERIES || SAMC21_SERIES) + (void*) SYSTEM_Handler, /* 0 SYSTEM handler (includes SYSTEM, MCLK, OSCCTRL, OSC32KCTRL, PAC, PM, SUPC, and TAL) */ + (void*) WDT_Handler, /* 1 Watchdog Timer */ + (void*) RTC_Handler, /* 2 Real-Time Counter */ + (void*) EIC_Handler, /* 3 External Interrupt Controller */ +#if (SAMC21_SERIES) + (void*) FREQM_Handler, /* 4 FREQM */ + (void*) TSENS_Handler, /* 5 TSENS */ +#endif + (void*) NVMCTRL_Handler, /* 4 / 6 Non-Volatile Memory Controller */ + (void*) DMAC_Handler, /* 5 / 7 Direct Memory Access Controller */ +#if (SAML21_SERIES) + (void*) USB_Handler, /* 6 Universal Serial Bus */ +#endif + (void*) EVSYS_Handler, /* 7 / 8 Event System Interface */ + (void*) SERCOM0_Handler, /* 8 / 9 Serial Communication Interface 0 */ + (void*) SERCOM1_Handler, /* 9 / 10 Serial Communication Interface 1 */ + (void*) SERCOM2_Handler, /* 10 / 11 Serial Communication Interface 2 */ + (void*) SERCOM3_Handler, /* 11 / 12 Serial Communication Interface 3 */ + (void*) SERCOM4_Handler, /* 12 / 13 Serial Communication Interface 4 */ + (void*) SERCOM5_Handler, /* 13 / 14 Serial Communication Interface 5 */ +#if (SAMC21_SERIES) + (void*) CAN0_Handler, /* 15 CAN0 */ + (void*) CAN1_Handler, /* 16 CAN1 */ +#endif + (void*) TCC0_Handler, /* 14 / 17 Timer Counter Control 0 */ + (void*) TCC1_Handler, /* 15 / 18 Timer Counter Control 1 */ + (void*) TCC2_Handler, /* 16 / 19 Timer Counter Control 2 */ + (void*) TC0_Handler, /* 17 / 20 Basic Timer Counter 0 */ + (void*) TC1_Handler, /* 18 / 21 Basic Timer Counter 1 */ + (void*) TC2_Handler, /* 19 / 22 Basic Timer Counter 2 */ + (void*) TC3_Handler, /* 20 / 23 Basic Timer Counter 3 */ + (void*) TC4_Handler, /* 21 / 24 Basic Timer Counter 4 */ +#if (SAMC21_SERIES) + (void*) ADC0_Handler, /* 25 ADC0 */ + (void*) ADC1_Handler, /* 26 ADC1 */ +#else + (void*) ADC_Handler, /* 22 Analog Digital Converter */ +#endif + (void*) AC_Handler, /* 23 / 27 Analog Comparators */ + (void*) DAC_Handler, /* 24 / 28 Digital Analog Converter */ +#if (SAMC21_SERIES) + (void*) SDADC_Handler, /* 29 SDADC */ +#endif + (void*) PTC_Handler, /* 25 / 30 Peripheral Touch Controller */ +#if (SAML21_SERIES) + (void*) AES_Handler, /* 26 AES */ + (void*) TRNG_Handler, /* 27 TRNG */ +#endif + +#else +#error "cortex_handlers.c: Unsupported chip" +#endif }; extern int main(void); @@ -173,6 +233,20 @@ void Reset_Handler(void) *pDest = 0; } + /* Change default QOS values to have the best performance and correct USB behaviour (applies to D21/D11). From startup_samd21.c from ASF 3.32. */ +#if (SAMD21_SERIES || SAMD11_SERIES) + SBMATRIX->SFR[SBMATRIX_SLAVE_HMCRAMC0].reg = 2; +#endif + +#if defined(ID_USB) + USB->DEVICE.QOSCTRL.bit.CQOS = 2; + USB->DEVICE.QOSCTRL.bit.DQOS = 2; +#endif + + DMAC->QOSCTRL.bit.DQOS = 2; + DMAC->QOSCTRL.bit.FQOS = 2; + DMAC->QOSCTRL.bit.WRBQOS = 2; + /* Initialize the C library */ __libc_init_array(); @@ -194,6 +268,7 @@ void SysTick_Handler(void) SysTick_DefaultHandler(); } +#if !defined(USB_DISABLED) static void (*usb_isr)(void) = NULL; void USB_Handler(void) @@ -206,3 +281,4 @@ void USB_SetHandler(void (*new_usb_isr)(void)) { usb_isr = new_usb_isr; } +#endif diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 6154d27e0..11a95e9a3 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -18,6 +18,7 @@ #define ARDUINO_MAIN #include "Arduino.h" +#include "sam.h" // Weak empty variant initialization function. // May be redefined by variant files. @@ -34,11 +35,9 @@ int main( void ) initVariant(); delay(1); -#if defined(USBCON) - #if !defined(ARDUINO_USB_UART_DISABLED) && !defined(ARDUINO_UART_ONLY) +#if defined(USBCON) && !defined(USB_DISABLED) USBDevice.init(); USBDevice.attach(); - #endif #endif setup(); diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index c93780a2f..1675a9bcf 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -45,50 +45,71 @@ void waitForSync( void ) { - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ) - { - /* Wait for synchronization */ - } +#if (SAMD) + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); +#elif (SAML21 || SAMC21) + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); +#else + #error "startup.c: Unsupported chip" +#endif } +#if (SAMD || SAML21) void waitForDFLL( void ) { - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ) - { - /* Wait for synchronization */ - } +#if (SAMD) + while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ); +#elif (SAML21) + while ( (OSCCTRL->STATUS.reg & OSCCTRL_STATUS_DFLLRDY) == 0 ); +#endif } +#endif void SystemInit( void ) { /* Set 1 Flash Wait State for 48MHz, cf tables 20.9 and 35.27 in SAMD21 Datasheet */ - NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_HALF_Val ; +#if (SAMD) + NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_HALF_Val ; // one wait state +#elif (SAML21 || SAMC21) + NVMCTRL->CTRLB.reg |= NVMCTRL_CTRLB_RWS_DUAL ; // two wait states +#endif /* Turn on the digital interface clock */ +#if (SAMD) PM->APBAMASK.reg |= PM_APBAMASK_GCLK ; +#elif (SAML21 || SAMC21) + MCLK->APBAMASK.reg |= MCLK_APBAMASK_GCLK ; +#endif /* ---------------------------------------------------------------------------------------------- - * 1) Enable XOSC32K clock (External on-board 32.768Hz oscillator) + * 0) Software reset the GCLK module to ensure it is re-initialized correctly */ +#if (SAMD) + GCLK->CTRL.reg = GCLK_CTRL_SWRST ; + + while ( (GCLK->CTRL.reg & GCLK_CTRL_SWRST) && (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) ); /* Wait for reset to complete */ +#elif (SAML21 || SAMC21) + GCLK->CTRLA.reg = GCLK_CTRLA_SWRST ; + + while ( (GCLK->CTRLA.reg & GCLK_CTRLA_SWRST) && (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK) ); /* Wait for reset to complete */ +#endif + + /* ---------------------------------------------------------------------------------------------- + * 1) Enable XOSC32K clock (External on-board 32.768Hz crystal oscillator) + */ +#if (SAMD) SYSCTRL->XOSC32K.reg = SYSCTRL_XOSC32K_STARTUP( 0x6u ) | /* cf table 15.10 of product datasheet in chapter 15.8.6 */ SYSCTRL_XOSC32K_XTALEN | SYSCTRL_XOSC32K_EN32K ; SYSCTRL->XOSC32K.bit.ENABLE = 1 ; /* separate call, as described in chapter 15.6.3 */ - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSC32KRDY) == 0 ) - { - /* Wait for oscillator stabilization */ - } + while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ +#elif (SAML21 || SAMC21) + OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_STARTUP( 0x4u ) | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K ; + OSC32KCTRL->XOSC32K.bit.ENABLE = 1 ; /* separate call, as described in chapter 15.6.3 */ - /* Software reset the module to ensure it is re-initialized correctly */ - /* Note: Due to synchronization, there is a delay from writing CTRL.SWRST until the reset is complete. - * CTRL.SWRST and STATUS.SYNCBUSY will both be cleared when the reset is complete, as described in chapter 13.8.1 - */ - GCLK->CTRL.reg = GCLK_CTRL_SWRST ; - - while ( (GCLK->CTRL.reg & GCLK_CTRL_SWRST) && (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) ) - { - /* Wait for reset to complete */ - } + while ( (OSC32KCTRL->STATUS.reg & OSC32KCTRL_STATUS_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ + #error "SAML and SAMC porting is not yet complete. I still need to modify the clock code (adding support for more sources). See later commit." +#endif /* ---------------------------------------------------------------------------------------------- * 2) Put XOSC32K as source of Generic Clock Generator 1 @@ -98,19 +119,14 @@ void SystemInit( void ) waitForSync(); /* Write Generic Clock Generator 1 configuration */ - GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_XOSC32K ) | // Generic Clock Generator 1 - GCLK_GENCTRL_SRC_XOSC32K | // Selected source is External 32KHz Oscillator -// GCLK_GENCTRL_OE | // Output clock to a pin for tests - GCLK_GENCTRL_GENEN ; + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_XOSC32K ) | GCLK_GENCTRL_SRC_XOSC32K | GCLK_GENCTRL_GENEN ); waitForSync(); /* ---------------------------------------------------------------------------------------------- * 3) Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 0 (DFLL48M reference) */ - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GENERIC_CLOCK_MULTIPLEXER_DFLL48M ) | // Generic Clock Multiplexer 0 - GCLK_CLKCTRL_GEN_GCLK1 | // Generic Clock Generator 1 is source - GCLK_CLKCTRL_CLKEN ; + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GENERIC_CLOCK_MULTIPLEXER_DFLL48M ) | GCLK_CLKCTRL_GEN_GCLK1 | GCLK_CLKCTRL_CLKEN ); waitForSync(); @@ -142,10 +158,7 @@ void SystemInit( void ) SYSCTRL->DFLLCTRL.reg |= SYSCTRL_DFLLCTRL_ENABLE ; while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKC) == 0 || - (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKF) == 0 ) - { - /* Wait for locks flags */ - } + (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKF) == 0 ); /* Wait for locks flags */ waitForDFLL(); @@ -157,11 +170,7 @@ void SystemInit( void ) waitForSync(); /* Write Generic Clock Generator 0 configuration */ - GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | // Generic Clock Generator 0 - GCLK_GENCTRL_SRC_DFLL48M | // Selected source is DFLL 48MHz -// GCLK_GENCTRL_OE | // Output clock to a pin for tests - GCLK_GENCTRL_IDC | // Set 50/50 duty cycle - GCLK_GENCTRL_GENEN ; + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DFLL48M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); @@ -177,21 +186,23 @@ void SystemInit( void ) GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_OSC8M ) ; // Generic Clock Generator 3 /* Write Generic Clock Generator 3 configuration */ - GCLK->GENCTRL.reg = GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_OSC8M ) | // Generic Clock Generator 3 - GCLK_GENCTRL_SRC_OSC8M | // Selected source is RC OSC 8MHz (already enabled at reset) -// GCLK_GENCTRL_OE | // Output clock to a pin for tests - GCLK_GENCTRL_GENEN ; + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_OSC8M ) | GCLK_GENCTRL_SRC_OSC8M | GCLK_GENCTRL_GENEN ); waitForSync(); + /* * Now that all system clocks are configured, we can set CPU and APBx BUS clocks. * There values are normally the one present after Reset. */ +#if (SAMD) PM->CPUSEL.reg = PM_CPUSEL_CPUDIV_DIV1 ; PM->APBASEL.reg = PM_APBASEL_APBADIV_DIV1_Val ; PM->APBBSEL.reg = PM_APBBSEL_APBBDIV_DIV1_Val ; PM->APBCSEL.reg = PM_APBCSEL_APBCDIV_DIV1_Val ; +#elif (SAML21 || SAMC21) + MCLK->CPUDIV.reg = MCLK_CPUDIV_CPUDIV_DIV1 ; +#endif SystemCoreClock=VARIANT_MCK ; @@ -199,6 +210,7 @@ void SystemInit( void ) * 8) Load ADC factory calibration values */ +#if (SAMD) // ADC Bias Calibration uint32_t bias = (*((uint32_t *) ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; @@ -210,8 +222,24 @@ void SystemInit( void ) ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); +#elif (SAML21) + uint32_t biasrefbuf = (*((uint32_t *) ADC_FUSES_BIASREFBUF_ADDR) & ADC_FUSES_BIASREFBUF_Msk) >> ADC_FUSES_BIASREFBUF_Pos; + uint32_t biascomp = (*((uint32_t *) ADC_FUSES_BIASCOMP_ADDR) & ADC_FUSES_BIASCOMP_Msk) >> ADC_FUSES_BIASCOMP_Pos; + + ADC->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); + +#elif (SAMC21) + uint32_t biasrefbuf = (*((uint32_t *) ADC0_FUSES_BIASREFBUF_ADDR) & ADC0_FUSES_BIASREFBUF_Msk) >> ADC0_FUSES_BIASREFBUF_Pos; + uint32_t biascomp = (*((uint32_t *) ADC0_FUSES_BIASCOMP_ADDR) & ADC0_FUSES_BIASCOMP_Msk) >> ADC0_FUSES_BIASCOMP_Pos; + ADC0->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); + + biasrefbuf = (*((uint32_t *) ADC1_FUSES_BIASREFBUF_ADDR) & ADC1_FUSES_BIASREFBUF_Msk) >> ADC1_FUSES_BIASREFBUF_Pos; + biascomp = (*((uint32_t *) ADC1_FUSES_BIASCOMP_ADDR) & ADC1_FUSES_BIASCOMP_Msk) >> ADC1_FUSES_BIASCOMP_Pos; + ADC1->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); +#endif + /* - * 9) Disable automatic NVM write operations + * 9) Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21) */ NVMCTRL->CTRLB.bit.MANW = 1; } diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index 67ef41751..ac92bf01a 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -17,11 +17,32 @@ */ #include "Arduino.h" +#include "sam.h" #ifdef __cplusplus extern "C" { #endif +// not defined for SAML or SAMC in version of CMSIS used +#ifndef ADC_INPUTCTRL_MUXNEG_GND +#define ADC_INPUTCTRL_MUXNEG_GND (0x18ul << ADC_INPUTCTRL_MUXNEG_Pos) +#endif + +// Wait for synchronization of registers between the clock domains +static __inline__ void syncADC() __attribute__((always_inline, unused)); +static void syncADC() { +#if (SAMD) + while ( ADC->STATUS.bit.SYNCBUSY == 1 ); +#elif (SAML21) + while ( ADC->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); +#elif (SAMC21) + while ( ADC0->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); + while ( ADC1->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); +#else + #error "wiring_analog.c: Unsupported chip" +#endif +} + /* * System Core Clock is at 1MHz (8MHz/8) at Reset. * It is switched to 48MHz in the Reset Handler (startup.c) @@ -72,30 +93,61 @@ void init( void ) // // Clock EIC for I/O interrupts // PM->APBAMASK.reg |= PM_APBAMASK_EIC ; - // Clock SERCOM for Serial -#if defined(__SAMD21G15A__) || defined(__SAMD21G16A__) || defined(__SAMD21G17A__) || defined(__SAMD21G18A__) || \ - defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) - PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ; -#elif defined(__SAMD11D14AM__) || defined(__SAMD11D14AS__) - PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 ; -#elif defined(__SAMD11C14A__) - PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 ; + // Clock SERCOM for Serial, TC/TCC for Pulse and Analog, and ADC/DAC for Analog +#if (SAMD21 || SAMD11) + uint32_t regAPBCMASK = PM->APBCMASK.reg; + + #if (SAMD11C) + regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 ; + regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TC1 | PM_APBCMASK_TC2 ; // Note that on the D11C, TC2 is not routed to pins (but can be used internally) + #elif (SAMD11D) + regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 ; + regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TC1 | PM_APBCMASK_TC2 ; + #elif (SAMD21E) + regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 ; + regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 + #elif (SAMD21G) + regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ; + regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ; + #elif (SAMD21J) + regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ; + regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 | PM_APBCMASK_TC6 | PM_APBCMASK_TC7 ; + #endif + + regAPBCMASK |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ; + + PM->APBCMASK.reg |= regAPBCMASK ; +#elif (SAML21 || SAMC21) + uint32_t regAPBCMASK = MCLK->APBCMASK.reg; + + #if (SAML) + regAPBCMASK |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 ; + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM5; // On the SAML, SERCOM5 is on the low power bridge + regAPBCMASK |= MCLK_APBCMASK_TCC0 | MCLK_APBCMASK_TCC1 | MCLK_APBCMASK_TCC2 | MCLK_APBCMASK_TC0 | MCLK_APBCMASK_TC1 | MCLK_APBCMASK_TC2 ; + #if (SAML21J) + regAPBCMASK |= MCLK_APBCMASK_TC3 ; + MCLK->APBDMASK.reg |= MCLK_APBDMASK_TC4; // On the SAML, TC4 is on the low power bridge + #endif + #elif (SAMC21E) + regAPBCMASK |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 ; + regAPBCMASK |= MCLK_APBCMASK_TCC0 | MCLK_APBCMASK_TCC1 | MCLK_APBCMASK_TCC2 | MCLK_APBCMASK_TC0 | MCLK_APBCMASK_TC1 | MCLK_APBCMASK_TC2 | MCLK_APBCMASK_TC3 | MCLK_APBCMASK_TC4 ; + #elif (SAMC21G) || (SAMC21J) + regAPBCMASK |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 | MCLK_APBCMASK_SERCOM5 ; + regAPBCMASK |= MCLK_APBCMASK_TCC0 | MCLK_APBCMASK_TCC1 | MCLK_APBCMASK_TCC2 | MCLK_APBCMASK_TC0 | MCLK_APBCMASK_TC1 | MCLK_APBCMASK_TC2 | MCLK_APBCMASK_TC3 | MCLK_APBCMASK_TC4 ; + #endif + + #if (SAML) + regAPBCMASK |= MCLK_APBCMASK_DAC ; + MCLK->APBDMASK.reg |= MCLK_APBDMASK_ADC; // On the SAML, TC4 is on the low power bridge + #elif (SAMC) + regAPBCMASK |= MCLK_APBCMASK_ADC0 | MCLK_APBCMASK_ADC1 | MCLK_APBCMASK_DAC ; + #endif + + MCLK->APBCMASK.reg |= regAPBCMASK ; #else - PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 ; + #error "wiring.c: Unsupported chip" #endif - // Clock TC/TCC for Pulse and Analog -#if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) - PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 | PM_APBCMASK_TC6 | PM_APBCMASK_TC7 ; -#elif defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) - PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TC1 | PM_APBCMASK_TC2 ; -#else - PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ; -#endif - - // Clock ADC/DAC for Analog - PM->APBCMASK.reg |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ; - //Setup all pins (digital and analog) in STARTUP mode (enable INEN only) for ( ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ ) { @@ -104,39 +156,87 @@ void init( void ) // Initialize Analog Controller // Setting clock - while(GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY); +#if (SAMD) + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_ADC ) | // Generic Clock ADC - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN ; + GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_ADC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ; - while( ADC->STATUS.bit.SYNCBUSY == 1 ); // Wait for synchronization of registers between the clock domains + syncADC(); // Wait for synchronization of registers between the clock domains ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV512 | // Divide Clock by 512. - ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default - - ADC->SAMPCTRL.reg = 0x3f; // Set max Sampling Time Length - - while( ADC->STATUS.bit.SYNCBUSY == 1 ); // Wait for synchronization of registers between the clock domains + ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default +#elif (SAML21 || SAMC21) + SUPC->VREF.reg |= SUPC_VREF_VREFOE; // Enable Supply Controller Reference output for use with ADC and DAC (AR_INTREF) + + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); + + GCLK->PCHCTRL[GCM_ADC].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + + syncADC(); // Wait for synchronization of registers between the clock domains + + #if (SAML21) + ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV256; // Divide Clock by 256. + ADC->CTRLC.reg = ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default + #elif (SAMC21) + ADC0->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV256; // Divide Clock by 256. + ADC0->CTRLC.reg = ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default + ADC1->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV256; // Divide Clock by 256. + ADC1->CTRLC.reg = ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default + #endif + syncADC(); // Wait for synchronization of registers between the clock domains +#endif + +#if (SAMD || SAML21) + ADC->SAMPCTRL.reg = 0x3f; // Set max Sampling Time Length (in CLK_ADC cycles for SAMD, half CLK_ADC cycles for SAML and SAMC) + syncADC(); // Wait for synchronization of registers between the clock domains ADC->INPUTCTRL.reg = ADC_INPUTCTRL_MUXNEG_GND; // No Negative input (Internal Ground) + syncADC(); // Wait for synchronization of registers between the clock domains // Averaging (see datasheet table in AVGCTRL register description) ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 | // 1 sample only (no oversampling nor averaging) ADC_AVGCTRL_ADJRES(0x0ul); // Adjusting result by 0 +#elif (SAMC21) + ADC0->SAMPCTRL.reg = 0x3f; // Set max Sampling Time Length (in CLK_ADC cycles for SAMD, half CLK_ADC cycles for SAML and SAMC) + ADC1->SAMPCTRL.reg = 0x3f; + syncADC(); // Wait for synchronization of registers between the clock domains + + ADC0->INPUTCTRL.reg = ADC_INPUTCTRL_MUXNEG_GND; // No Negative input (Internal Ground) + ADC1->INPUTCTRL.reg = ADC_INPUTCTRL_MUXNEG_GND; + syncADC(); // Wait for synchronization of registers between the clock domains + + // Averaging (see datasheet table in AVGCTRL register description) + ADC0->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 | // 1 sample only (no oversampling nor averaging) + ADC_AVGCTRL_ADJRES(0x0ul); // Adjusting result by 0 + ADC1->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 | ADC_AVGCTRL_ADJRES(0x0ul); +#endif analogReference( VARIANT_AR_DEFAULT ) ; // Use default reference from variant.h // Initialize DAC // Setting clock +#if (SAMD) while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_DAC ) | // Generic Clock ADC - GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source - GCLK_CLKCTRL_CLKEN ; + GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_DAC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ; while ( DAC->STATUS.bit.SYNCBUSY == 1 ); // Wait for synchronization of registers between the clock domains DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC | // Using the 3.3V reference DAC_CTRLB_EOEN ; // External Output Enable (Vout) +#elif (SAML21 || SAMC21) + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); + + GCLK->PCHCTRL[GCM_DAC].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + + while ( DAC->SYNCBUSY.reg & DAC_SYNCBUSY_MASK ); + + #if (SAMC21) + DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC; + #elif (SAML21) + DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VDDANA; + DAC->DACCTRL[0].reg = DAC_DACCTRL_REFRESH(2); // setup refresh + DAC->DACCTRL[1].reg = DAC_DACCTRL_REFRESH(2); // setup refresh + #endif +#endif } #ifdef __cplusplus diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 6f8646ac7..7a73960b4 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -18,11 +18,46 @@ #include "Arduino.h" #include "wiring_private.h" +#include "variant.h" #ifdef __cplusplus extern "C" { #endif +/* Mapping of timer numbers (array index) to generic clock IDs + * GCM_* values are defined in WVariant.h in the core. + */ +const uint8_t timerClockIDs[] = +{ +#if (SAMD11) + GCM_TCC0, + GCM_TC1_TC2, + GCM_TC1_TC2, +#elif (SAMD21) + GCM_TCC0_TCC1, + GCM_TCC0_TCC1, + GCM_TCC2_TC3, + GCM_TCC2_TC3, + GCM_TC4_TC5, + GCM_TC4_TC5, + #if (SAMD21J) + GCM_TC6_TC7, + GCM_TC6_TC7, + #endif +#elif (SAML21 || SAMC21) + GCM_TCC0_TCC1, + GCM_TCC0_TCC1, + GCM_TCC2, + GCM_TC0_TC1, + GCM_TC0_TC1, + GCM_TC2_TC3, + GCM_TC2_TC3, + GCM_TC4, +#else +#error "wiring_analog.c: Unsupported chip" +#endif +}; + static int _readResolution = 10; static int _ADCResolution = 10; static int _writeResolution = 8; @@ -30,21 +65,34 @@ static int _writeResolution = 8; // Wait for synchronization of registers between the clock domains static __inline__ void syncADC() __attribute__((always_inline, unused)); static void syncADC() { - while (ADC->STATUS.bit.SYNCBUSY == 1) - ; +#if (SAMD) + while ( ADC->STATUS.bit.SYNCBUSY == 1 ); +#elif (SAML21) + while ( ADC->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); +#elif (SAMC21) + while ( ADC0->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); + while ( ADC1->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); +#endif } // Wait for synchronization of registers between the clock domains static __inline__ void syncDAC() __attribute__((always_inline, unused)); static void syncDAC() { - while (DAC->STATUS.bit.SYNCBUSY == 1) - ; +#if (SAMD) + while ( DAC->STATUS.bit.SYNCBUSY == 1 ); +#elif (SAML21 || SAMC21) + while ( DAC->SYNCBUSY.reg & DAC_SYNCBUSY_MASK ); +#endif } // Wait for synchronization of registers between the clock domains static __inline__ void syncTC_8(Tc* TCx) __attribute__((always_inline, unused)); static void syncTC_8(Tc* TCx) { +#if (SAMD) while (TCx->COUNT8.STATUS.bit.SYNCBUSY); +#elif (SAML21 || SAMC21) + while (TCx->SYNCBUSY.reg); +#endif } // Wait for synchronization of registers between the clock domains @@ -58,17 +106,38 @@ void analogReadResolution( int res ) _readResolution = res ; if (res > 10) { +#if (SAMD) ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_12BIT_Val; +#elif (SAML21) + ADC->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_12BIT_Val; +#elif (SAMC21) + ADC0->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_12BIT_Val; + ADC1->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_12BIT_Val; +#endif _ADCResolution = 12; } else if (res > 8) { +#if (SAMD) ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_10BIT_Val; +#elif (SAML21) + ADC->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_10BIT_Val; +#elif (SAMC21) + ADC0->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_10BIT_Val; + ADC1->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_10BIT_Val; +#endif _ADCResolution = 10; } else { +#if (SAMD) ADC->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_8BIT_Val; +#elif (SAML21) + ADC->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_8BIT_Val; +#elif (SAMC21) + ADC0->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_8BIT_Val; + ADC1->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_8BIT_Val; +#endif _ADCResolution = 8; } syncADC(); @@ -97,48 +166,54 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to } /* - * Default Internal Reference is at 1.65V (with ADC gain of 1/2) - * External Reference should be between 1v and VDDANA-0.6v=2.7v + * Default Internal Reference for the SAMD is at 1.65V (with ADC gain of 1/2) + * External Reference for the SAMD should be between 1v and VDDANA-0.6v=2.7v * - * Warning : On Arduino Zero board the input/output voltage for SAMD21G18 is 3.3 volts maximum + * Warning : The maximum IO voltage is Vcc (for SAMD/SAML Vcc can be up to 3.6 volts) */ void analogReference( eAnalogReference ulMode ) { - uint32_t gain = ADC_INPUTCTRL_GAIN_1X_Val; // Default Gain Factor Selection - uint32_t refsel; - syncADC(); - switch ( ulMode ) - { - case AR_INTERNAL: - case AR_INTERNAL2V23: - refsel = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/1.48 VDDANA = 1/1.48* 3V3 = 2.2297 - break; - - case AR_EXTERNAL: - if ( pinPeripheral(REFA_PIN, PIO_ANALOG_REF) == RET_STATUS_OK ) - { - refsel = ADC_REFCTRL_REFSEL_AREFA_Val; - } - break; - case AR_INTERNAL1V0: - refsel = ADC_REFCTRL_REFSEL_INT1V_Val; // 1.0V voltage reference - break; + if (ulMode == AR_EXTERNAL_REFA) { + if ( pinPeripheral(REFA_PIN, PIO_ANALOG_REF) != RET_STATUS_OK ) { + return; + } + } - case AR_INTERNAL1V65: - refsel = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V - break; +#if (SAMD || SAML21) + if (ulMode == AR_EXTERNAL_REFB) { + if ( pinPeripheral(REFB_PIN, PIO_ANALOG_REF) != RET_STATUS_OK ) { + return; + } + } +#endif - case AR_DEFAULT: - default: - gain = ADC_INPUTCTRL_GAIN_DIV2_Val; // This allows values up to VDDANA (3.3V) on the pin - refsel = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V - break; +#if (SAMD) + if (ulMode == AR_DEFAULT) { + ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val; // GAIN_DIV2 allows values up to VDDANA on the pin + ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA + } else { + ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; + ADC->REFCTRL.bit.REFSEL = ulMode; + } +#elif (SAML21 || SAMC21) + if (ulMode == 0) { // Set to 1.0V for the SAML, 1.024V for the SAMC + SUPC->VREF.reg &= ~SUPC_VREF_SEL_Msk; + } else if (ulMode > 5) { // Values above 5 are used for the Supply Controller reference (AR_INTREF) + SUPC->VREF.reg &= ~SUPC_VREF_SEL_Msk; + SUPC->VREF.reg |= SUPC_VREF_SEL(ulMode - 6); // + ulMode = 0; } + #if (SAML21) + ADC->REFCTRL.bit.REFSEL = ulMode; + #elif (SAMC21) + ADC0->REFCTRL.bit.REFSEL = ulMode; + ADC1->REFCTRL.bit.REFSEL = ulMode; + #endif +#endif - ADC->INPUTCTRL.bit.GAIN = gain; - ADC->REFCTRL.bit.REFSEL = refsel; + syncADC(); } uint32_t analogRead( uint32_t ulPin ) @@ -147,14 +222,35 @@ uint32_t analogRead( uint32_t ulPin ) REMAP_ANALOG_PIN_ID ; +#if (SAMC21) + Adc* ADC; + if ( (g_APinDescription[ulPin].ulPeripheralAttribute & PER_ATTR_ADC_MASK) == PER_ATTR_ADC_STD ) { + ADC = ADC0; + } else { + ADC = ADC1; + } +#endif + if ( pinPeripheral(ulPin, PIO_ANALOG_ADC) == RET_STATUS_OK ) { // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled if ( (g_APinDescription[ulPin].ulPinAttribute & PIN_ATTR_DAC) == PIN_ATTR_DAC ) { syncDAC(); +#if (SAMD || SAMC21) DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC //DAC->CTRLB.bit.EOEN = 0x00; // The DAC output is turned off. +#elif (SAML21) + DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC controller + uint8_t DACNumber = 0x00; + if ( (g_APinDescription[ulPin].ulPort == 0) && (g_APinDescription[ulPin].ulPin == 5) ) { + DACNumber = 0x01; + } + syncDAC(); + DAC->DACCTRL[DACNumber].bit.ENABLE = 0x00; // The DACx output is turned off. + syncDAC(); + DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC controller (in case other DACx is in use) +#endif syncDAC(); } @@ -208,12 +304,27 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) { if ( pinPeripheral(ulPin, PIO_ANALOG_DAC) == RET_STATUS_OK ) { - ulValue = mapResolution(ulValue, _writeResolution, 10); - syncDAC(); +#if (SAMD || SAMC21) + ulValue = mapResolution(ulValue, _writeResolution, 10); DAC->DATA.reg = ulValue & 0x3FF; // DAC on 10 bits. syncDAC(); DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC +#elif (SAML21) + DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC controller (so that DACCTRL can be modified) + uint8_t DACNumber = 0x00; + if ( (g_APinDescription[ulPin].ulPort == 0) && (g_APinDescription[ulPin].ulPin == 5) ) { + DACNumber = 0x01; + } + ulValue = mapResolution(ulValue, _writeResolution, 12); + syncDAC(); + DAC->DATA[DACNumber].reg = ulValue & 0xFFF; // DACx on 12 bits. + syncDAC(); + DAC->DACCTRL[DACNumber].bit.ENABLE = 0x01; // The DACx output is turned on. + syncDAC(); + while ( (DAC->STATUS.reg & (1 << DACNumber)) == 0 ); // Must wait for DACx to start + DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC controller +#endif syncDAC(); return ; } @@ -222,58 +333,37 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) Tc* TCx = 0 ; Tcc* TCCx = 0 ; uint8_t Channelx = GetTCChannelNumber( g_APinDescription[ulPin].ulTCChannel ) ; - if ( GetTCNumber( g_APinDescription[ulPin].ulTCChannel ) >= TCC_INST_NUM ) - { + uint8_t Timerx = GetTCNumber( g_APinDescription[ulPin].ulTCChannel ) ; + uint8_t Typex = GetTCType( g_APinDescription[ulPin].ulTCChannel ) ; + + if ( Typex == 1 ) { TCx = (Tc*) GetTC( g_APinDescription[ulPin].ulTCChannel ) ; - } - else - { + } else { TCCx = (Tcc*) GetTC( g_APinDescription[ulPin].ulTCChannel ) ; } - // Enable clocks according to TCCx instance to use - switch ( GetTCNumber( g_APinDescription[ulPin].ulTCChannel ) ) - { -#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) - case 0: // TCC0 - // Enable GCLK for TCC0 and TCC1 (timer counter input clock) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0 )) ; - break ; - - case 1: // TC1 - case 2: // TC2 - // Enable GCLK for TCC2 and TC3 (timer counter input clock) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC1_TC2 )) ; - break ; + // Enable peripheral clock + if ( TCx ) { +#if (SAML21) + if (TCx == TC4) { + timerIndex = 7; // TC4 is on a different lower-power bridge on the SAML + } else { + timerIndex = (uint8_t)(((uint32_t)TCx - (uint32_t)TCC0) >> 10); + } #else - case 0: // TCC0 - case 1: // TCC1 - // Enable GCLK for TCC0 and TCC1 (timer counter input clock) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0_TCC1 )) ; - break ; - - case 2: // TCC2 - case 3: // TC3 - // Enable GCLK for TCC2 and TC3 (timer counter input clock) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC2_TC3 )) ; - break ; - - case 4: // TC4 - case 5: // TC5 - // Enable GCLK for TC4 and TC5 (timer counter input clock) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC4_TC5 )); - break ; -#endif -#if defined(__SAMD21J15A__) || defined(__SAMD21J16A__) || defined(__SAMD21J17A__) || defined(__SAMD21J18A__) - case 6: // TC6 (not available on Zero) - case 7: // TC7 (not available on Zero) - // Enable GCLK for TC6 and TC7 (timer counter input clock) - GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TC6_TC7 )); - break ; + timerIndex = (uint8_t)(((uint32_t)TCx - (uint32_t)TCC0) >> 10); #endif + } else { + timerIndex = (uint8_t)(((uint32_t)TCCx - (uint32_t)TCC0) >> 10); } +#if (SAMD) + GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( timerClockIDs[timerIndex] )) ; while ( GCLK->STATUS.bit.SYNCBUSY == 1 ) ; +#elif (SAML21 || SAMC21) + GCLK->PCHCTRL[timerClockIDs[timerIndex]].reg = (GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); +#endif ulValue = mapResolution(ulValue, _writeResolution, 8); @@ -281,14 +371,18 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) if ( TCx ) { // -- Configure TC - // Disable TCx TCx->COUNT8.CTRLA.reg &= ~TC_CTRLA_ENABLE; syncTC_8(TCx); // Set Timer counter Mode to 8 bits TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8; // Set TCx as normal PWM +#if (SAMD) TCx->COUNT8.CTRLA.reg |= TC_CTRLA_WAVEGEN_NPWM; +#elif (SAML21 || SAMC21) + TCx->WAVE.reg = TC_WAVE_WAVEGEN_NPWM; +#endif + syncTC_8(TCx); // Set TCx in waveform mode Normal PWM TCx->COUNT8.CC[Channelx].reg = (uint8_t) ulValue; syncTC_8(TCx); diff --git a/cores/arduino/wiring_analog.h b/cores/arduino/wiring_analog.h index cca46359c..ac487b78a 100644 --- a/cores/arduino/wiring_analog.h +++ b/cores/arduino/wiring_analog.h @@ -19,22 +19,64 @@ #pragma once #include +#include "sam.h" #ifdef __cplusplus extern "C" { #endif /* - * \brief SAMD products have only one reference for ADC + * \brief TODO Analog reference selection. + * For values <= 5, the actual register value is used. + * For values > 5 (SAML and SAMC only), the SUPC_VREF_SEL register value is: (ulMode - 6). + * Values for the Supply Controller (SUPC) reference on the L21 or C21. + * Used when AR_INTREF is selected as the reference. */ typedef enum _eAnalogReference { - AR_DEFAULT, - AR_INTERNAL, - AR_EXTERNAL, - AR_INTERNAL1V0, - AR_INTERNAL1V65, - AR_INTERNAL2V23 +#if (SAMD) + AR_INTERNAL1V0 = 0, + AR_INTERNAL_INTVCC0 = 1, + AR_INTERNAL_INTVCC1 = 2, + AR_EXTERNAL_REFA = 3, + AR_EXTERNAL_REFB = 4, + AR_DEFAULT = 5, // On the SAMD, this also uses 1/2 gain on each input +#elif (SAML21) + AR_INTREF = 0, + AR_INTERNAL_INTVCC0 = 1, + AR_INTERNAL_INTVCC1 = 2, + AR_EXTERNAL_REFA = 3, + AR_EXTERNAL_REFB = 4, + AR_INTERNAL_INTVCC2 = 5, + AR_INTREF_1V0 = 6, + AR_INTREF_1V1 = 7, + AR_INTREF_1V2 = 8, + AR_INTREF_1V25 = 9, + AR_INTREF_2V0 = 10, + AR_INTREF_2V2 = 11, + AR_INTREF_2V4 = 12, + AR_INTREF_2V5 = 13, + AR_DEFAULT = AR_INTERNAL_INTVCC2, + AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAML is 1.0V +#elif (SAMC21) + AR_INTREF = 0, + AR_INTERNAL_INTVCC0 = 1, + AR_INTERNAL_INTVCC1 = 2, + AR_EXTERNAL_REFA = 3, + AR_EXTERNAL_DAC = 4, + AR_INTERNAL_INTVCC2 = 5, + AR_INTREF_1V024 = 6, + AR_INTREF_2V048 = 7, + AR_INTREF_4V096 = 8, + AR_DEFAULT = AR_INTERNAL_INTVCC2, + AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAMC is 1.024V +#else + #error "wiring_analog.c: Unsupported chip" +#endif + AR_INTERNAL = AR_INTERNAL_INTVCC0, + AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0, // 2.23V only when Vcc = 3.3V + AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1, // 1.65V only when Vcc = 3.3V + AR_EXTERNAL = AR_EXTERNAL_REFA, } eAnalogReference ; diff --git a/cores/arduino/wiring_private.c b/cores/arduino/wiring_private.c index 9746ac117..f9739ed10 100644 --- a/cores/arduino/wiring_private.c +++ b/cores/arduino/wiring_private.c @@ -1,5 +1,6 @@ /* Copyright (c) 2015 Arduino LLC. All right reserved. + Copyright (c) 2015-2016, Justin Mattair (justin@mattair.net) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -176,23 +177,7 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) case PIO_SERCOM: case PIO_COM: case PIO_AC_GCLK: -#if 0 - // Is the pio pin in the lower 16 ones? - // The WRCONFIG register allows update of only 16 pin max out of 32 - if ( g_APinDescription[ulPin].ulPin < 16 ) - { - PORT->Group[g_APinDescription[ulPin].ulPort].WRCONFIG.reg = PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_PMUXEN | PORT_WRCONFIG_PMUX( ulPeripheral ) | - PORT_WRCONFIG_WRPINCFG | - PORT_WRCONFIG_PINMASK( g_APinDescription[ulPin].ulPin ) ; - } - else - { - PORT->Group[g_APinDescription[ulPin].ulPort].WRCONFIG.reg = PORT_WRCONFIG_HWSEL | - PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_PMUXEN | PORT_WRCONFIG_PMUX( ulPeripheral ) | - PORT_WRCONFIG_WRPINCFG | - PORT_WRCONFIG_PINMASK( g_APinDescription[ulPin].ulPin - 16 ) ; - } -#else + if ( pinNum & 1 ) // is pin odd? { uint32_t temp ; @@ -212,7 +197,7 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) PORT->Group[pinPort].PMUX[pinNum >> 1].reg = temp|PORT_PMUX_PMUXE( peripheral ) ; PORT->Group[pinPort].PINCFG[pinNum].reg |= PORT_PINCFG_PMUXEN ; // Enable port mux } -#endif + break ; default: diff --git a/platform.txt b/platform.txt index 8a4d86f30..ee67f92c6 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=MattairTech SAM M0+ Boards -version=1.6.7 +version=1.6.8 # Compile variables # ----------------- @@ -79,13 +79,13 @@ build.usb_manufacturer="Unknown" # ---------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" ## Compile S files -recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" ## Create archives # archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value @@ -93,7 +93,7 @@ archive_file_path={build.path}/{archive_file} recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript_path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group ## Create output (bin file) recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" @@ -152,3 +152,17 @@ tools.openocd.erase.pattern= tools.openocd.bootloader.params.verbose=-d3 tools.openocd.bootloader.params.quiet=-d0 tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown" + +# +# AVRDUDE +# +tools.avrdude.path={runtime.tools.avrdude.path} +tools.avrdude.cmd.path={path}/bin/avrdude +tools.avrdude.config.path={path}/etc/avrdude.conf + +tools.avrdude.upload.params.verbose=-v -v +tools.avrdude.upload.params.quiet=-q -q +# tools.avrdude.upload.verify is needed for backwards compatibility with IDE 1.6.8 or older, IDE 1.6.9 or newer overrides this value +tools.avrdude.upload.verify= +tools.avrdude.upload.params.noverify=-V +tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.emu.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} "-Uflash:w:{build.path}/{build.project_name}.hex:i" diff --git a/variants/MT_D11/README.md b/variants/MT_D11/README.md new file mode 100644 index 000000000..7d157dc24 --- /dev/null +++ b/variants/MT_D11/README.md @@ -0,0 +1,198 @@ +# MattairTech MT-D11 (ATsamD11D14AM) + +``` +=========================== MattairTech MT-D11 (ATsamD11D14AM) ========================== +Other COM PWM Analog INT Arduino* Arduino* INT PWM COM Other +========================================================================================= + ------------------- +DAC * | A2 | USB | Gnd | +REF * | A3 | | Vcc | + TCC00 * * | A4 ----- A31 | 31 * TC21 RX1 SWDIO + TCC01 * * | A5 A30 | 30 TC20 TX1 SWDCLK + TCC02 * | A6 A27 | 27 * + TCC03 * | A7 A23 | 23 SCL + MOSI / TX2 * * | A10 A22 | 22 * SDA + SCK / RX2 * | A11 A17 | 17 TC11 + MISO * NMI | A14 A16 | 16 * TC10 LED +BTN SS * * | A15 RST | BOOT + ------------------- + +* Some pins can be used for more than one function. The same port pin number printed on + the board is also used in Arduino (without the 'A') for all of the supported functions + (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* Tone available on TC2. DO NOT connect voltages higher than 3.3V! +``` + + +# Pins descriptions for the MattairTech MT-D11 +## PIN_MAP_STANDARD +============================================================================================================================================ +Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | --- | ---- | NOT A PIN | NOT A PIN +1 | --- | ---- | NOT A PIN | NOT A PIN +2 | A2 | PA02 | DAC | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +4 | A4 | PA04 | REFB / VM | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] +7 | A7 | PA07 | | !EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] +8 | -- | PA08 | Xin32 / Xin | Xin32 +9 | -- | PA09 | Xout32 / Xout | Xout32 +10 | A10 | PA10 | SPI MOSI / TX2 | EIC/EXTINT[2] ADC/AIN[8] PTC/X[2] PTC/Y[8] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TC2/WO[0] !TCC0/WO[2] +11 | A11 | PA11 | SPI SCK / RX2 | !EIC/EXTINT[3] ADC/AIN[9] PTC/X[3] PTC/Y[9] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TC2/WO[1] !TCC0/WO[3] +12 | --- | ---- | NOT A PIN | NOT A PIN +13 | --- | ---- | NOT A PIN | NOT A PIN +14 | A14 | PA14 | SPI MISO | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] +15 | A15 | PA15 | Button / SPI SS | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[1] Button +16 | A16 | PA16 | LED | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] LED +17 | A17 | PA17 | HOST_ENABLE | !EIC/EXTINT[1] PTC/X[5] PTC/Y[11] !SERCOM1/PAD[3] !SERCOM2/PAD[3] TC1/WO[1] !TCC0/WO[7] HOST_ENABLE +18 | --- | ---- | NOT A PIN | NOT A PIN +19 | --- | ---- | NOT A PIN | NOT A PIN +20 | --- | ---- | NOT A PIN | NOT A PIN +21 | --- | ---- | NOT A PIN | NOT A PIN +22 | A22 | PA22 | I2C/SDA w/pullup | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] +23 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[0] !TC1/WO[1] !TCC0/WO[5] +24 | --- | PA24 | USB_NEGATIVE | USB/DM +25 | --- | PA25 | USB_POSITIVE | USB/DP +26 | --- | ---- | NOT A PIN | NOT A PIN +27 | A27 | PA27 | | EIC/EXTINT[7] PTC/X[10] +28 | A28 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +29 | --- | ---- | NOT A PIN | NOT A PIN +30 | A30 | PA30 | TX1 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +31 | A31 | PA31 | RX1 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO +============================================================================================================================================ + +## PIN_MAP_COMPACT +============================================================================================================================================ +Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | A2 | PA02 | DAC | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +1 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +2 | A4 | PA04 | REFB / VM | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +3 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +4 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] +5 | A7 | PA07 | | !EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] +6 | A10 | PA10 | SPI MOSI / TX2 | EIC/EXTINT[2] ADC/AIN[8] PTC/X[2] PTC/Y[8] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TC2/WO[0] !TCC0/WO[2] +7 | A11 | PA11 | SPI SCK / RX2 | !EIC/EXTINT[3] ADC/AIN[9] PTC/X[3] PTC/Y[9] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TC2/WO[1] !TCC0/WO[3] +8 | A14 | PA14 | SPI MISO | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] +9 | A15 | PA15 | Button / SPI SS | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[1] Button +10 | A16 | PA16 | LED | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] LED +11 | A17 | PA17 | HOST_ENABLE | !EIC/EXTINT[1] PTC/X[5] PTC/Y[11] !SERCOM1/PAD[3] !SERCOM2/PAD[3] TC1/WO[1] !TCC0/WO[7] HOST_ENABLE +12 | A22 | PA22 | I2C/SDA w/pullup | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] +13 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[0] !TC1/WO[1] !TCC0/WO[5] +14 | A27 | PA27 | | EIC/EXTINT[7] PTC/X[10] +15 | A30 | PA30 | TX1 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +16 | A31 | PA31 | RX1 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO +============================================================================================================================================ + +* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') + for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* The following Arduino pin numbers are not mapped to a physical pin: 0, 1, 8, 9, 12, 13, 18, 19, 20, 21, 24, 25, 26, 28, and 29. +* Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). +* The tone library uses TC2. +* Pins 8 and 9 are by default connected to the 32.768KHz crystal. + + + +# PinDescription table format + +## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +## Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +## Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +## See WVariant.h in cores/arduino for the definitions used in the table. + +### Port: +This is the port (ie: PORTA). + +### Pin: +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType: +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/MT_D11/variant.cpp b/variants/MT_D11/variant.cpp index d0cd1a7d5..cdd318843 100644 --- a/variants/MT_D11/variant.cpp +++ b/variants/MT_D11/variant.cpp @@ -14,153 +14,13 @@ 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 - */ - -/* - * Modified 8 August 2015 by Justin Mattair - * for MattairTech MT-D11 boards (www.mattairtech.com) - */ - -/* -=========================== MattairTech MT-D11 (ATsamd11D14AM) ========================== -Other INT PWM Digital Analog Digital PWM INT Other -========================================================================================= - ------------------- -DAC 2 2(ADC0) | A2 | USB | Gnd | -REF 3 3(ADC1) | A3 | | Vcc | - 4(INT4) 4(TCC00) 4 4(ADC2) | A4 ----- A31 | 31 31(TC21) 31(INT3) RX/SWDIO - 5(INT5) 5(TCC01) 5 5(ADC3) | A5 A30 | 30 30(TC20) TX/SWDCLK - 6(TCC02) 6 6(ADC4) | A6 A27 | 27 27(INT7) - 7(TCC03) 7 7(ADC5) | A7 A23 | 23 SCL -MOSI 10(INT2) 10 10(ADC8) | A10 A22 | 22 22(INT6) SDA -SCK 11 11(ADC9) | A11 A17 | 17 17(TC11) -MISO 14(INTNMI) 14 14(ADC6) | A14 A16 | 16 16(TC10) 16(INT0) LED -BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | Reset - ------------------- -Most pins have multiple configurations available (even analog pins). For example, pin -4 can be an analog input, a PWM output, Digital I/O, or interrupt input. These -always reference the pin number printed on the board but without the 'A' (with the -usable pins starting at 2). Tone available on TC2. -DO NOT connect voltages higher than 3.3V! */ - -/* The PinDescription table describes how each of the pins can be used by the Arduino - * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, - * communications, etc.), and the PinDescription table configures which functions can - * be used for each pin. This table is mainly accessed by the pinPeripheral function in - * wiring_private.c, which is used to attach a pin to a particular peripheral function. - * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), - * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to - * verify that the pin can perform the function requested, and to configure the pin for - * that function. Most of the contents of pinMode() are now in pinPeripheral(). - * - * There are two ways that pins can be mapped. The first is to map pins contiguously - * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space - * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps - * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). - * This only works when there is one port. Because not all port pins are available, - * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. - * For an example of both types, see variant.cpp from the MT-D11 variant. - * - * Explanation of PinDescription table: - * - * Port This is the port (ie: PORTA). - * Pin This is the pin (bit) within the port. Valid values are 0-31. - * PinType This indicates what peripheral function the pin can be - * attached to. In most cases, this is PIO_MULTI, which means - * that the pin can be anything listed in the PinAttribute field. - * It can also be set to a specific peripheral. In this case, any - * attempt to configure the pin (using pinPeripheral or pinMode) - * as anything else will fail (and pinPeripheral will return -1). - * This can be used to prevent accidental re-configuration of a - * pin that is configured for only one function (ie: USB D- and - * D+ pins). If a pin is not used or does not exist, - * PIO_NOT_A_PIN must be entered in this field. See WVariant.h - * for valid entries. These entries are also used as a parameter - * to pinPeripheral() with the exception of PIO_NOT_A_PIN and - * PIO_MULTI. The pinMode function now calls pinPeripheral() with - * the desired mode. Note that this field is not used to select - * between the two peripherals possible with each of the SERCOM - * and TIMER functions. PeripheralAttribute is now used for this. - * PeripheralAttribute This is an 8-bit bitfield used for various peripheral - * configuration. It is primarily used to select between the two - * peripherals possible with each of the SERCOM and TIMER - * functions. TIMER pins are individual, while SERCOM uses a - * group of two to four pins. This group of pins can span both - * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E - * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses - * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each - * pin. This bitfield is also used to set the pin drive strength. - * In the future, other attributes (like input buffer - * configuration) may be added. See WVariant.h for valid entries. - * PinAttribute This is a 32-bit bitfield used to list all of the valid - * peripheral functions that a pin can attach to. This includes - * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are - * shorthand for a combination of other attributes. - * PIN_ATTR_DIGITAL includes all of the GPIO functions, while - * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and - * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). - * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is - * only one DAC channel, so PIN_ATTR_DAC appears only once. This - * bitfield is useful for limiting a pin to only input related - * functions or output functions. This allows a pin to have a - * more flexible configuration, while restricting the direction - * (ie: to avoid contention). See WVariant.h for valid entries. - * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some - * TC channels are available on multiple pins (ie: TCC0/WO[0] is - * available on pin A4 or pin A8 on the MT-D21E). In general, - * only one pin should be configured (in the pinDescription - * table) per TC channel. See WVariant.h for valid entries. - * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). - * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See - * WVariant.h for valid entries. - * ExtInt This is the interrupt (if any) assigned to the pin. Some - * interrupt numbers are available on multiple pins (ie: - * EIC/EXTINT[2] is available on pin A2 or pin A18 on the - * MT-D21E). In general, only one pin should be configured (in - * the pinDescription table) per interrupt number. Thus, if an - * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved - * from pin 18. See WVariant.h for valid entries. - */ - - -/* Pins descriptions for the MattairTech MT-D11 - * - * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (! means unavailable with this variant) - * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- - * | 0 | 2 | A2 | PA02 | DAC | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT - * | 1 | 3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] - * | 2 | 4 | A4 | PA04 | REFB / VM | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[2] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] - * | 3 | 5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] - * | 4 | 6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] - * | 5 | 7 | A7 | PA07 | | !EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] - * | -- | -- | -- | PA08 | Xin32 / Xin | Xin32 - * | -- | -- | -- | PA09 | Xout32 / Xout | Xout32 - * | 6 | 10 | A10 | PA10 | SPI MOSI | EIC/EXTINT[2] ADC/AIN[8] PTC/X[2] PTC/Y[8] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TC2/WO[0] !TCC0/WO[2] - * | 7 | 11 | A11 | PA11 | SPI SCK | !EIC/EXTINT[3] ADC/AIN[9] PTC/X[3] PTC/Y[9] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TC2/WO[1] !TCC0/WO[3] - * | 8 | 14 | A14 | PA14 | SPI MISO | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] - * | 9 | 15 | A15 | PA15 | Button / SPI SS | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[1] Button - * | 10 | -- | RST | PA28 | Reset | Reset - * | 11 | 16 | A16 | PA16 | LED | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] LED - * | 12 | 17 | A17 | PA17 | HOST_ENABLE | !EIC/EXTINT[1] PTC/X[5] PTC/Y[11] !SERCOM1/PAD[3] !SERCOM2/PAD[3] TC1/WO[1] !TCC0/WO[7] HOST_ENABLE - * | 13 | 22 | A22 | PA22 | I2C/SDA w/pullup | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] - * | 14 | 23 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[0] !TC1/WO[1] !TCC0/WO[5] - * | -- | -- | --- | PA24 | USB_NEGATIVE | USB/DM - * | -- | -- | --- | PA25 | USB_POSITIVE | USB/DP - * | 15 | 27 | A27 | PA27 | | EIC/EXTINT[7] PTC/X[10] - * | 16 | 30 | A30 | PA30 | TX / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK - * | 17 | 31 | A31 | PA31 | RX / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO - * | 18 | -- | Vcc | ---- | | Vcc - * | 19 | -- | Gnd | ---- | | Ground - * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- - * - * You may use Arduino pin numbers ranging from 0 to 31. The Arduino pin corresponds to the silkscreen (without the 'A'). - * For example, use pinMode(16, OUTPUT) to set the LED pin (marked as A16) as an output. - * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 8, 9, 12, 13, 18, 19, 20, 21, 24, 25, 26, 28, and 29. - * Pins 8 and 9 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). - * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). - * The tone library uses TC2. +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information */ @@ -173,92 +33,92 @@ DO NOT connect voltages higher than 3.3V! const PinDescription g_APinDescription[]= { // 0..1 pins don't exist - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 2..7 - Analog capable pins (DAC available on 2) - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, - { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, - { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4 }, - { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5 }, - { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE }, - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_NONE }, + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 8..9 are unused (pins in use by 32.768KHz crystal, which in turn is used by the Arduino core) - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 10..11 - SERCOM/SPI (SPI) or Analog or Digital functions - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_2 }, // SPI MOSI - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE }, // SPI SCK + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SPI SCK // 12..13 pins don't exist - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 14..15 - SERCOM/SPI (SPI) or Analog or Digital functions (Button available on pin 15) - { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI }, // SPI MISO - { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_1 }, // Button / SPI SS (unused) + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // SPI MISO + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, // Button / SPI SS (unused) // 16..17 Digital functions (LED available on pin 16) - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // LED - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // LED + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 18..21 pins don't exist - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 22..23 SERCOM/I2C (Wire) or Digital functions - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCL + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SDA + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SCL // 24..26 are unused (25 and 26 in use by USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist) - { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DM - { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DP - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 27..29 Digital functions (pin 28 is Reset and pin 29 does not exist) - { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7 }, - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused (Reset) - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 30..31 SERCOM/UART (Serial1) or Digital functions or Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // TX / SWD CLK - { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3 }, // RX / SWD IO + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // RX / SWD IO } ; #elif defined PIN_MAP_COMPACT const PinDescription g_APinDescription[]= { // 0..5 - Analog capable pins (DAC available on 0) - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, - { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, - { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4 }, - { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5 }, - { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE }, - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_NONE }, + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 6..9 - SERCOM/SPI (SPI) or Analog or Digital functions (Button available on pin 9) - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_2 }, // SPI MOSI - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE }, // SPI SCK - { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI }, // SPI MISO - { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_1 }, // Button / SPI SS (unused) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SPI SCK + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // SPI MISO + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, // Button / SPI SS (unused) // 10..11 Digital functions (LED available on pin 10) - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // LED - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // LED + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 12..13 SERCOM/I2C (Wire) or Digital functions - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCL + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SDA + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SCL // 14 Digital functions - { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7 }, + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // 15..16 SERCOM/UART (Serial1) or Digital functions or Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // TX / SWD CLK - { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3 }, // RX / SWD IO + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // RX / SWD IO } ; #endif @@ -269,7 +129,7 @@ SERCOM sercom0( SERCOM0 ) ; SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; -#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) +#if defined(ONE_UART) || defined(TWO_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; void SERCOM1_Handler() @@ -277,3 +137,12 @@ void SERCOM1_Handler() Serial1.IrqHandler(); } #endif + +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM0_Handler() +{ + Serial2.IrqHandler(); +} +#endif diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index 5c81b6b00..15aa682bb 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -17,13 +17,21 @@ */ /* - * Modified 20 May 2016 by Justin Mattair - * for MattairTech MT-D11 boards (www.mattairtech.com) + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information */ #ifndef _VARIANT_MATTAIRTECH_MT_D11_ #define _VARIANT_MATTAIRTECH_MT_D11_ +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + /*---------------------------------------------------------------------------- * Definitions *----------------------------------------------------------------------------*/ @@ -32,13 +40,14 @@ #define VARIANT_MAINOSC (32768ul) /** Master clock frequency */ -#define VARIANT_MCK (48000000ul) +#define VARIANT_MCK (48000000ul) /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ #include "WVariant.h" +#include "sam.h" #ifdef __cplusplus #include "SERCOM.h" @@ -66,8 +75,8 @@ extern "C" #error "variant.h: You must set PIN_MAP_STANDARD or PIN_MAP_COMPACT" #endif -#define PINS_COUNT (32u) -#define NUM_DIGITAL_PINS (32u) +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT #define NUM_ANALOG_INPUTS (10u) #define NUM_ANALOG_OUTPUTS (1u) #define analogInputToDigitalPin(p) (p) @@ -95,9 +104,16 @@ extern "C" * The RX and TX LEDs are not present. * You may optionally add them to any free pins. */ +#if defined PIN_MAP_STANDARD #define PIN_LED_13 (16u) #define PIN_LED_RXL (10u) #define PIN_LED_TXL (11u) +#elif defined PIN_MAP_COMPACT +#define PIN_LED_13 (10u) +#define PIN_LED_RXL (6u) +#define PIN_LED_TXL (7u) +#endif + #define PIN_LED PIN_LED_13 #define PIN_LED2 PIN_LED_RXL #define PIN_LED3 PIN_LED_TXL @@ -109,13 +125,19 @@ extern "C" * Thre is a debouncing capacitor connected, so delay reading the pin * at least 6ms after turning on the pullup to allow the capacitor to charge. */ +#if defined PIN_MAP_STANDARD #define BUTTON (15u) +#elif defined PIN_MAP_COMPACT +#define BUTTON (9u) +#endif + #define BUTTON_BUILTIN BUTTON /* * Analog pins */ +#if defined PIN_MAP_STANDARD #define PIN_A2 (2ul) #define PIN_A3 (3ul) #define PIN_A4 (4ul) @@ -127,6 +149,19 @@ extern "C" #define PIN_A14 (14ul) #define PIN_A15 (15ul) #define PIN_DAC0 (2ul) +#elif defined PIN_MAP_COMPACT +#define PIN_A2 (0ul) +#define PIN_A3 (1ul) +#define PIN_A4 (2ul) +#define PIN_A5 (3ul) +#define PIN_A6 (4ul) +#define PIN_A7 (5ul) +#define PIN_A10 (6ul) +#define PIN_A11 (7ul) +#define PIN_A14 (8ul) +#define PIN_A15 (9ul) +#define PIN_DAC0 (0ul) +#endif static const uint8_t A2 = PIN_A2; static const uint8_t A3 = PIN_A3; @@ -149,13 +184,22 @@ static const uint8_t DAC0 = PIN_DAC0; #define VARIANT_AR_DEFAULT AR_DEFAULT /* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#if defined PIN_MAP_STANDARD #define REFA_PIN (3ul) #define REFB_PIN (4ul) +#elif defined PIN_MAP_COMPACT +#define REFA_PIN (1ul) +#define REFB_PIN (2ul) +#endif // The ATN pin may be used in the future as the first SPI chip select. // On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#if defined PIN_MAP_STANDARD #define PIN_ATN (15ul) +#elif defined PIN_MAP_COMPACT +#define PIN_ATN (9ul) +#endif static const uint8_t ATN = PIN_ATN; @@ -163,23 +207,49 @@ static const uint8_t ATN = PIN_ATN; * Serial interfaces */ // Serial1 +#if defined PIN_MAP_STANDARD #define PIN_SERIAL1_RX (31ul) #define PIN_SERIAL1_TX (30ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL1_RX (16ul) +#define PIN_SERIAL1_TX (15ul) +#endif + #define PAD_SERIAL1_TX (UART_TX_PAD_2) #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) - #define SERCOM_INSTANCE_SERIAL1 &sercom1 +// Serial2 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL2_RX (11ul) +#define PIN_SERIAL2_TX (10ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL2_RX (7ul) +#define PIN_SERIAL2_TX (6ul) +#endif + +#define PAD_SERIAL2_TX (UART_TX_PAD_2) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) +#define SERCOM_INSTANCE_SERIAL2 &sercom0 + /* * SPI Interfaces */ #define SPI_INTERFACES_COUNT 1 +#if defined PIN_MAP_STANDARD #define PIN_SPI_MISO (14u) #define PIN_SPI_MOSI (10u) #define PIN_SPI_SCK (11u) #define PIN_SPI_SS (15u) +#elif defined PIN_MAP_COMPACT +#define PIN_SPI_MISO (8u) +#define PIN_SPI_MOSI (6u) +#define PIN_SPI_SCK (7u) +#define PIN_SPI_SS (9u) +#endif + #define PERIPH_SPI sercom0 #define PAD_SPI_TX SPI_PAD_2_SCK_3 #define PAD_SPI_RX SERCOM_RX_PAD_0 @@ -195,8 +265,14 @@ static const uint8_t SCK = PIN_SPI_SCK ; */ #define WIRE_INTERFACES_COUNT 1 +#if defined PIN_MAP_STANDARD #define PIN_WIRE_SDA (22u) #define PIN_WIRE_SCL (23u) +#elif defined PIN_MAP_COMPACT +#define PIN_WIRE_SDA (12u) +#define PIN_WIRE_SCL (13u) +#endif + #define PERIPH_WIRE sercom2 #define WIRE_IT_HANDLER SERCOM2_Handler @@ -207,9 +283,17 @@ static const uint8_t SCL = PIN_WIRE_SCL; /* * USB */ +#if defined PIN_MAP_STANDARD #define PIN_USB_DM (24ul) #define PIN_USB_DP (25ul) #define PIN_USB_HOST_ENABLE (17ul) +#elif defined PIN_MAP_COMPACT +// USB pins not directly accessible using PIN_MAP_COMPACT +#define PIN_USB_DM (0ul) +#define PIN_USB_DP (0ul) +#define PIN_USB_HOST_ENABLE (0ul) +#endif + #define PIN_USB_HOST_ENABLE_VALUE HIGH #ifdef __cplusplus @@ -232,6 +316,7 @@ extern SERCOM sercom1; extern SERCOM sercom2; extern Uart Serial1; +extern Uart Serial2; #endif diff --git a/variants/MT_D21E/README.md b/variants/MT_D21E/README.md new file mode 100644 index 000000000..4763044e8 --- /dev/null +++ b/variants/MT_D21E/README.md @@ -0,0 +1,187 @@ +# MattairTech MT-D21E (ATsamD21EXXA) + +``` +============================= MattairTech MT-D21E (ATsamD21EXXA) ======================== +Other COM PWM Analog INT Arduino* Arduino* INT PWM COM Other +========================================================================================= + ------------------- +Xin32 | A0 RST | BOOT +Xout32 | A1 NC | +DAC * 2 | A2 NC | +REFA * 3 | A3 A31 | 31 * TCC11 SWDIO* +REFB * * 4 | A4 A30 | 30 * TCC10 SWDCLK + * * 5 | A5 NC | + * 6 | A6 A28 | 28 * LED +VM * 7 | A7 A27 | 27 * BTNA + TCC00 * NMI 8 | A8 A23 | 23 * TC41 SS + TCC01 * * 9 | A9 A22 | 22 * TC40 MISO + TX1 TCC02 * 10 | A10 A19 | 19 * SCK + RX1 TCC03 * 11 | A11 A18 | 18 * MOSI + TX2 TC30 * 14 | A14 A17 | 17 * TCC21 SCL + RX2 TC31 15 | A15 A16 | 16 * TCC20 SDA + | NC NC | + | NC NC | + | Vbus 3.3V| * Button B available on 31. +USB D- TC50 | A24- _____ Vcc | +USB D+ TC51 | A25+ | | Vin | + | Gnd | USB | Gnd | + ------------------- + +Some pins can be used for more than one function. The same port pin number printed on +the board is also used in Arduino (without the 'A') for all of the supported functions +(ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +DO NOT connect voltages higher than 3.3V! +``` + +# Pins descriptions for the MattairTech MT-D21E +============================================================================================================================================ +Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | A0 | PA00 | Xin32 | Xin32 +1 | A1 | PA01 | Xout32 | Xout32 +2 | A2 | PA02 | | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[0] !TCC0/WO[0] +5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] +6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] +7 | A7 | PA07 | Voltage Divider | !EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] +8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] +9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] +10 | A10 | PA10 | TX1 | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] +11 | A11 | PA11 | RX1 | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] +12 | --- | ---- | NOT A PIN | NOT A PIN +13 | --- | ---- | NOT A PIN | NOT A PIN +14 | A14 | PA14 | Xin, TX2 | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE +15 | A15 | PA15 | Xout, RX2 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout +16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] +17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] +18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] +19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] +20 | --- | ---- | NOT A PIN | NOT A PIN +21 | --- | ---- | NOT A PIN | NOT A PIN +22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] +23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] +24 | A24- | PA24 | USB_NEGATIVE | USB/DM TC5/WO[0] +25 | A25+ | PA25 | USB_POSITIVE | USB/DP TC5/WO[1] +26 | --- | ---- | NOT A PIN | NOT A PIN +27 | A27 | PA27 | Button A | EIC/EXTINT[15] Button A +28 | A28 | PA28 | LED | EIC/EXTINT[8] LED +29 | --- | ---- | NOT A PIN | NOT A PIN +30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] TCC1/WO[0] SWD CLK +31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO +-- | RST | ---- | | Reset, BOOT (double tap bootloader entry) +============================================================================================================================================ + +* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') + for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). + +* The following Arduino pin numbers are not mapped to a physical pin: 12, 13, 20, 21, 26, and 29. + +* Pins 24 and 25 are by default in use by USB (USB_NEGATIVE and USB_POSITIVE). TC5(D21) is available on these pins otherwise. + The tone library uses TC5. + +* A0 and A1 are by default connected to the 32.768KHz crystal. + + + +# PinDescription table format + +## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +## Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +## Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +## See WVariant.h in cores/arduino for the definitions used in the table. + +### Port: +This is the port (ie: PORTA). + +### Pin: +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType: +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index 841733b84..0b3c22612 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -17,175 +17,10 @@ */ /* - Modified 8 August 2015 by Justin Mattair - for MattairTech MT-D21E boards (www.mattairtech.com) -*/ - -/* -============================= MattairTech MT-D21E (ATsamd21eXXa) ======================== -Other INT PWM Digital Analog Digital PWM INT Other -========================================================================================= - ------------------- -Xin32 | A0 RST | Reset -Xout32 | A1 NC | -DAC 2 2(ADC0) | A2 NC | -REF 3 3(ADC1) | A3 A31 | 31 31(TCC11) 31(INT11) SWDIO* - 4(INT4) 4 4(ADC4) | A4 A30 | 30 30(TCC10) 30(INT10) SWDCLK - 5(INT5) 5 5(ADC5) | A5 NC | - 6 6(ADC6) | A6 A28 | 28 28(INT8) LED -VDIV 7 7(ADC7) | A7 A27 | 27 27(INT15) BTNA - 8(INTNMI) 8(TCC00) 8 8(ADC16) | A8 A23 | 23 23(TC41) 23(INT7) SS - 9(INT9) 9(TCC01) 9 9(ADC17) | A9 A22 | 22 22(TC40) 22(INT6) MISO -TX1 10(TCC02) 10 10(ADC18)| A10 A19 | 19 19(INT3) SCK -RX1 11(TCC03) 11 11(ADC19)| A11 A18 | 18 18(INT2) MOSI -TX2 14(INT14) 14(TC30) 14 | A14 A17 | 17 17(TCC21) 17(INT1) SCL -RX2 15(TC31) 15 | A15 A16 | 16 16(TCC20) 16(INT0) SDA - | NC NC | - | NC NC | - | Vbus 3.3V| * Button B available on 31 -USB D- | A24- _____ Vcc | -USB D+ | A25+ | | Vin | - | Gnd | USB | Gnd | - ------------------- -Most pins have multiple configurations available (even analog pins). For example, pin -10 can be an analog input, a PWM output, Digital I/O, or the TX pin of 'Serial1'. These -always reference the pin number printed on the board but without the 'A' (with the -usable pins starting at 2). DO NOT connect voltages higher than 3.3V! -*/ - - -/* The PinDescription table describes how each of the pins can be used by the Arduino - * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, - * communications, etc.), and the PinDescription table configures which functions can - * be used for each pin. This table is mainly accessed by the pinPeripheral function in - * wiring_private.c, which is used to attach a pin to a particular peripheral function. - * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), - * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to - * verify that the pin can perform the function requested, and to configure the pin for - * that function. Most of the contents of pinMode() are now in pinPeripheral(). - * - * There are two ways that pins can be mapped. The first is to map pins contiguously - * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space - * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps - * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). - * This only works when there is one port. Because not all port pins are available, - * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. - * For an example of both types, see variant.cpp from the MT-D11 variant. - * - * Explanation of PinDescription table: - * - * Port This is the port (ie: PORTA). - * Pin This is the pin (bit) within the port. Valid values are 0-31. - * PinType This indicates what peripheral function the pin can be - * attached to. In most cases, this is PIO_MULTI, which means - * that the pin can be anything listed in the PinAttribute field. - * It can also be set to a specific peripheral. In this case, any - * attempt to configure the pin (using pinPeripheral or pinMode) - * as anything else will fail (and pinPeripheral will return -1). - * This can be used to prevent accidental re-configuration of a - * pin that is configured for only one function (ie: USB D- and - * D+ pins). If a pin is not used or does not exist, - * PIO_NOT_A_PIN must be entered in this field. See WVariant.h - * for valid entries. These entries are also used as a parameter - * to pinPeripheral() with the exception of PIO_NOT_A_PIN and - * PIO_MULTI. The pinMode function now calls pinPeripheral() with - * the desired mode. Note that this field is not used to select - * between the two peripherals possible with each of the SERCOM - * and TIMER functions. PeripheralAttribute is now used for this. - * PeripheralAttribute This is an 8-bit bitfield used for various peripheral - * configuration. It is primarily used to select between the two - * peripherals possible with each of the SERCOM and TIMER - * functions. TIMER pins are individual, while SERCOM uses a - * group of two to four pins. This group of pins can span both - * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E - * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses - * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each - * pin. This bitfield is also used to set the pin drive strength. - * In the future, other attributes (like input buffer - * configuration) may be added. See WVariant.h for valid entries. - * PinAttribute This is a 32-bit bitfield used to list all of the valid - * peripheral functions that a pin can attach to. This includes - * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are - * shorthand for a combination of other attributes. - * PIN_ATTR_DIGITAL includes all of the GPIO functions, while - * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and - * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). - * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is - * only one DAC channel, so PIN_ATTR_DAC appears only once. This - * bitfield is useful for limiting a pin to only input related - * functions or output functions. This allows a pin to have a - * more flexible configuration, while restricting the direction - * (ie: to avoid contention). See WVariant.h for valid entries. - * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some - * TC channels are available on multiple pins (ie: TCC0/WO[0] is - * available on pin A4 or pin A8 on the MT-D21E). In general, - * only one pin should be configured (in the pinDescription - * table) per TC channel. See WVariant.h for valid entries. - * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). - * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See - * WVariant.h for valid entries. - * ExtInt This is the interrupt (if any) assigned to the pin. Some - * interrupt numbers are available on multiple pins (ie: - * EIC/EXTINT[2] is available on pin A2 or pin A18 on the - * MT-D21E). In general, only one pin should be configured (in - * the pinDescription table) per interrupt number. Thus, if an - * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved - * from pin 18. See WVariant.h for valid entries. - */ - - -/* Pins descriptions for the MattairTech MT-D21E - * - * | PCB Pin | Arduino Pin Number | Silkscreen | PIN | Alt. Function | Comments (! means unavailable with this variant) - * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- - * | 0 | -- | A0 | PA00 | Xin32 | Xin32 - * | 1 | -- | A1 | PA01 | Xout32 | Xout32 - * | 2 | 2 | A2 | PA02 | | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT - * | 3 | 3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] - * | 4 | 4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[0] !TCC0/WO[0] - * | 5 | 5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] - * | 6 | 6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] - * | 7 | 7 | A7 | PA07 | Voltage Divider | !EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] - * | 8 | 8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] - * | 9 | 9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] - * | 10 | 10 | A10 | PA10 | TX | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] - * | 11 | 11 | A11 | PA11 | RX | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] - * | 12 | 14 | A14 | PA14 | Xin, HOST_ENABLE | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE - * | 13 | 15 | A15 | PA15 | Xout | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout - * | 14 | -- | NC | ---- | | Not Connected - * | 15 | -- | NC | ---- | | Not Connected - * | 16 | -- | Vbus | ---- | | USB Vbus - * | 17 | -- | A24- | PA24 | USB_NEGATIVE | USB/DM - * | 18 | -- | A25+ | PA25 | USB_POSITIVE | USB/DP - * | 19 | -- | Gnd | ---- | | Ground - * | 20 | -- | Gnd | ---- | | Ground - * | 21 | -- | Vin | ---- | | Vin - * | 22 | -- | Vcc | ---- | | Vcc - * | 23 | -- | 3.3V | ---- | | 3.3V - * | 24 | -- | NC | ---- | | Not Connected - * | 25 | -- | NC | ---- | | Not Connected - * | 26 | 16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] - * | 27 | 17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] - * | 28 | 18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] - * | 29 | 19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] - * | 30 | 22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] - * | 31 | 23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] - * | 32 | 27 | A27 | PA27 | Button A | EIC/EXTINT[15] Button A - * | 33 | 28 | A28 | PA28 | LED | EIC/EXTINT[8] LED - * | 34 | -- | NC | ---- | | Not Connected - * | 35 | 30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] TCC1/WO[0] SWD CLK - * | 36 | 31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO - * | 37 | -- | NC | ---- | | Not Connected - * | 38 | -- | NC | ---- | | Not Connected - * | 39 | -- | RST | ---- | | Reset - * +---------+--------------------+------------------+--------+-------------------+------------------------------------------------- - * - * You may use Arduino pin numbers ranging from 0 to 31. The Arduino pin corresponds to the silkscreen (without the 'A'). - * For example, use pinMode(28, OUTPUT) to set the LED pin (marked as A28) as an output. - * However, the following Arduino pin numbers are not mapped to a physical pin: 0, 1, 12, 13, 20, 21, 24, 25, 26, and 29. - * Pins 0 and 1 are used by the 32.768KHz crystal which in turn is used by the Arduino core (the 16MHz crystal is unused by Arduino). - * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). - * The tone library uses TC5. + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information */ @@ -196,57 +31,57 @@ usable pins starting at 2). DO NOT connect voltages higher than 3.3V! */ const PinDescription g_APinDescription[]= { - // 0..1 are unused (pins in use by 32.768KHz crystal, which in turn is used by the Arduino core) - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + // 0..1 are unused by default (pins in use by 32.768KHz crystal, which is used by the Arduino core) + { PORTA, 0, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 1, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 2..9 - Analog capable pins (DAC available on 2) - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC - { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // ADC/AIN[1] - { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4 }, // ADC/AIN[4] - { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5 }, // ADC/AIN[5] - { PORTA, 6, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NONE }, // ADC/AIN[6] - { PORTA, 7, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9 }, // TCC0/WO[1] + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[0] / DAC + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[1] + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4, GCLK_CCL_NONE }, // ADC/AIN[4] + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, // ADC/AIN[5] + { PORTA, 6, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[6] + { PORTA, 7, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE }, // TX: SERCOM0/PAD[2] - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE }, // RX: SERCOM0/PAD[3] + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] // 12..13 pins don't exist - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused - // 14..15 - Digital functions - { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14 }, // TC3/WO[0], HOST_ENABLE - { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // TC3/WO[1], ATN + // 14..15 - SERCOM/UART (Serial2) or Digital functions + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // TC3/WO[0], HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN // 16..17 SERCOM/I2C (Wire) or Digital functions - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // SDA: SERCOM1/PAD[0] - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // SCL: SERCOM1/PAD[1] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // SDA: SERCOM1/PAD[0] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // SCL: SERCOM1/PAD[1] // 18..23 - SERCOM/SPI (SPI) or Digital functions (pins 20..21 do not exist) - { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2 }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) - { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3 }, // SPI SCK: SERCOM3/PAD[3] (PIN_ATTR_SERCOM_ALT) - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6 }, // SPI MISO: SERCOM3/PAD[0] - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7 }, // SPI SS: SERCOM3/PAD[1] + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SPI SCK: SERCOM3/PAD[3] (PIN_ATTR_SERCOM_ALT) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SPI MISO: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // SPI SS: SERCOM3/PAD[1] - // 24..26 are unused (25 and 26 in use by USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist) - { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DM - { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DP - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + // 24..26 - USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist + { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 27..29 Button A and LED (pin 29 does not exist) - { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_INPUT_PULLUP|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_15 }, // Button A - { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_OUTPUT|PIN_ATTR_INPUT|PIN_ATTR_INPUT_PULLDOWN|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_8 }, // LED - { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // Unused + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_15, GCLK_CCL_NONE }, // Button A + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_8, GCLK_CCL_NONE }, // LED + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH0, No_ADC_Channel, EXTERNAL_INT_10 }, // TCC1/WO[0] / SWD CLK - { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH1, No_ADC_Channel, EXTERNAL_INT_11 }, // TCC1/WO[1] / SWD IO + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH0, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH1, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO } ; const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; @@ -257,18 +92,20 @@ SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; SERCOM sercom3( SERCOM3 ) ; -#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) +#if defined(ONE_UART) || defined(TWO_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; -Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; void SERCOM0_Handler() { Serial1.IrqHandler(); } +#endif + +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; void SERCOM2_Handler() { Serial2.IrqHandler(); } #endif - diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index d3d251743..0815874cf 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -17,13 +17,21 @@ */ /* - Modified 20 May 2016 by Justin Mattair - for MattairTech MT-D21E boards (www.mattairtech.com) -*/ + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ #ifndef _VARIANT_MATTAIRTECH_MT_D21E_ #define _VARIANT_MATTAIRTECH_MT_D21E_ +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + /*---------------------------------------------------------------------------- * Definitions *----------------------------------------------------------------------------*/ @@ -32,13 +40,14 @@ #define VARIANT_MAINOSC (32768ul) /** Master clock frequency */ -#define VARIANT_MCK (48000000ul) +#define VARIANT_MCK (48000000ul) /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ #include "WVariant.h" +#include "sam.h" #ifdef __cplusplus #include "SERCOM.h" @@ -57,8 +66,8 @@ extern "C" // Number of pins defined in PinDescription array #define NUM_PIN_DESCRIPTION_ENTRIES (32u) -#define PINS_COUNT (32u) -#define NUM_DIGITAL_PINS (32u) +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT #define NUM_ANALOG_INPUTS (10u) #define NUM_ANALOG_OUTPUTS (1u) #define analogInputToDigitalPin(p) (p) @@ -97,8 +106,8 @@ extern "C" /* Buttons * Note that Button B is connected to Reset by default. * A solder jumper can be changed to route Button B to pin 31 instead. - * If the debouncing capacitor is connected (default), delay reading the - * pin at least 6ms after turning on the pullup to allow the capacitor to charge. + * There is a debouncing capacitor connected, so delay reading the pin for + * at least 6ms after turning on the pullup to allow the capacitor to charge. */ #define BUTTON_A (27u) #define BUTTON_B (31u) diff --git a/variants/arduino_zero/README.md b/variants/arduino_zero/README.md new file mode 100644 index 000000000..6e652727b --- /dev/null +++ b/variants/arduino_zero/README.md @@ -0,0 +1,195 @@ +# Pins descriptions for the Arduino/Genuino Zero + +``` +/* + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * + Pin number + ZERO Board pin | PIN | Label/Name | Comments (* is for available peripherals with this configuration) + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | Digital Low | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 0 | 0 -> RX | PA11 | | *EIC/EXTINT[11] *ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] SERCOM2/PAD[3] TCC0/WO[3] TCC1/WO[1] + * | 1 | 1 <- TX | PA10 | | *EIC/EXTINT[10] *ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] TCC0/WO[2] TCC1/WO[0] + * | 2 | 2 | PA14 | | *EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] TC3/WO[0] TCC0/WO[4] + * | 3 | ~3 | PA09 | | *EIC/EXTINT[9] *ADC/AIN[17] PTC/X[1] SERCOM0/PAD[1] *SERCOM2/PAD[1] *TCC0/WO[1] TCC1/WO[3] + * | 4 | ~4 | PA08 | | *EIC/NMI *ADC/AIN[16] PTC/X[0] SERCOM0/PAD[0] *SERCOM2/PAD[0] *TCC0/WO[0] TCC1/WO[2] + * | 5 | ~5 | PA15 | | *EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] *TC3/WO[1] TCC0/WO[5] + * | 6 | ~6 | PA20 | | *EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TCC0/WO[6] + * | 7 | 7 | PA21 | | *EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] TCC0/WO[7] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | Digital High | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 8 | ~8 | PA06 | | EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[2] *TCC1/WO[0] + * | 9 | ~9 | PA07 | | EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[3] *TCC1/WO[1] + * | 10 | ~10 | PA18 | | *EIC/EXTINT[2] PTC/X[6] *SERCOM1/PAD[2] SERCOM3/PAD[2] *TC3/WO[0] TCC0/WO[2] + * | 11 | ~11 | PA16 | | *EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6] + * | 12 | ~12 | PA19 | | *EIC/EXTINT[3] PTC/X[7] *SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] *TCC0/WO[3] + * | 13 | ~13 | PA17 | LED | *EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] SERCOM3/PAD[1] *TCC2/WO[1] TCC0/WO[7] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | Analog Connector | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 14 | A0 | PA02 | A0 | EIC/EXTINT[2] *ADC/AIN[0] *DAC/VOUT PTC/Y[0] + * | 15 | A1 | PB08 | A1 | *EIC/EXTINT[8] *ADC/AIN[2] PTC/Y[14] SERCOM4/PAD[0] TC4/WO[0] + * | 16 | A2 | PB09 | A2 | EIC/EXTINT[9] *ADC/AIN[3] PTC/Y[15] SERCOM4/PAD[1] TC4/WO[1] + * | 17 | A3 | PA04 | A3 | EIC/EXTINT[4] *ADC/AIN[4] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[0] TCC0/WO[0] + * | 18 | A4 | PA05 | A4 | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[5] SERCOM0/PAD[1] TCC0/WO[1] + * | 19 | A5 | PB02 | A5 | EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | Wire | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 20 | SDA | PA22 | SDA | *EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] SERCOM5/PAD[0] *TC4/WO[0] TCC0/WO[4] + * | 21 | SCL | PA23 | SCL | *EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] SERCOM5/PAD[1] *TC4/WO[1] TCC0/WO[5] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | |SPI (Legacy ICSP) | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 22 | 1 | PA12 | MISO | *EIC/EXTINT[12] SERCOM2/PAD[0] *SERCOM4/PAD[0] TCC2/WO[0] TCC0/WO[6] + * | | 2 | | 5V0 | + * | 23 | 4 | PB10 | MOSI | EIC/EXTINT[10] *SERCOM4/PAD[2] *TC5/WO[0] TCC0/WO[4] + * | 24 | 3 | PB11 | SCK | EIC/EXTINT[11] *SERCOM4/PAD[3] *TC5/WO[1] TCC0/WO[5] + * | | 5 | | RESET | + * | | 6 | | GND | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | LEDs | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 25 | | PB03 | RX | + * | 26 | | PA27 | TX | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | USB | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 27 | | PA28 | USB_HOST_ENABLE | EIC/EXTINT[8] + * | 28 | | PA24 | USB_NEGATIVE | *USB/DM + * | 29 | | PA25 | USB_POSITIVE | *USB/DP + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | EDBG | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 30 | | PB22 | EDBG_UART TX | *SERCOM5/PAD[2] + * | 31 | | PB23 | EDBG_UART RX | *SERCOM5/PAD[3] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 32 | | PA22 | EDBG_SDA | Pin 20 (SDA) + * | 33 | | PA23 | EDBG_SCL | Pin 21 (SCL) + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 34 | | PA19 | EDBG_MISO | EIC/EXTINT[3] *SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] TCC0/WO[3] + * | 35 | | PA16 | EDBG_MOSI | EIC/EXTINT[0] *SERCOM1/PAD[0] SERCOM3/PAD[0] TCC2/WO[0] TCC0/WO[6] + * | 36 | | PA18 | EDBG_SS | EIC/EXTINT[2] *SERCOM1/PAD[2] SERCOM3/PAD[2] TC3/WO[0] TCC0/WO[2] + * | 37 | | PA17 | EDBG_SCK | EIC/EXTINT[1] *SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] TCC0/WO[7] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | 38 | ATN | PA13 | EDBG_GPIO0 | *EIC/EXTINT[13] SERCOM2/PAD[1] SERCOM4/PAD[1] TCC2/WO[1] TCC0/WO[7] + * | 39 | | PA21 | EDBG_GPIO1 | Pin 7 + * | 40 | | PA06 | EDBG_GPIO2 | Pin 8 + * | 41 | | PA07 | EDBG_GPIO3 | Pin 9 + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | GND | | | + * | 42 | AREF | PA03 | | EIC/EXTINT[3] *[ADC|DAC]/VREFA *ADC/AIN[1] PTC/Y[1] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | |32.768KHz Crystal | | | + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * | | | PA00 | XIN32 | EIC/EXTINT[0] SERCOM1/PAD[0] TCC2/WO[0] + * | | | PA01 | XOUT32 | EIC/EXTINT[1] SERCOM1/PAD[1] TCC2/WO[1] + * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + */ +``` + + + +# PinDescription table format + +## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +## Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +## Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +## See WVariant.h in cores/arduino for the definitions used in the table. + +### Port: +This is the port (ie: PORTA). + +### Pin: +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType: +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/arduino_zero/variant.cpp b/variants/arduino_zero/variant.cpp index 88e7a42d1..aef56041b 100644 --- a/variants/arduino_zero/variant.cpp +++ b/variants/arduino_zero/variant.cpp @@ -16,171 +16,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -/* The PinDescription table describes how each of the pins can be used by the Arduino - * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, - * communications, etc.), and the PinDescription table configures which functions can - * be used for each pin. This table is mainly accessed by the pinPeripheral function in - * wiring_private.c, which is used to attach a pin to a particular peripheral function. - * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), - * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to - * verify that the pin can perform the function requested, and to configure the pin for - * that function. Most of the contents of pinMode() are now in pinPeripheral(). - * - * There are two ways that pins can be mapped. The first is to map pins contiguously - * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space - * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps - * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). - * This only works when there is one port. Because not all port pins are available, - * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. - * For an example of both types, see variant.cpp from the MT-D11 variant. - * - * Explanation of PinDescription table: - * - * Port This is the port (ie: PORTA). - * Pin This is the pin (bit) within the port. Valid values are 0-31. - * PinType This indicates what peripheral function the pin can be - * attached to. In most cases, this is PIO_MULTI, which means - * that the pin can be anything listed in the PinAttribute field. - * It can also be set to a specific peripheral. In this case, any - * attempt to configure the pin (using pinPeripheral or pinMode) - * as anything else will fail (and pinPeripheral will return -1). - * This can be used to prevent accidental re-configuration of a - * pin that is configured for only one function (ie: USB D- and - * D+ pins). If a pin is not used or does not exist, - * PIO_NOT_A_PIN must be entered in this field. See WVariant.h - * for valid entries. These entries are also used as a parameter - * to pinPeripheral() with the exception of PIO_NOT_A_PIN and - * PIO_MULTI. The pinMode function now calls pinPeripheral() with - * the desired mode. Note that this field is not used to select - * between the two peripherals possible with each of the SERCOM - * and TIMER functions. PeripheralAttribute is now used for this. - * PeripheralAttribute This is an 8-bit bitfield used for various peripheral - * configuration. It is primarily used to select between the two - * peripherals possible with each of the SERCOM and TIMER - * functions. TIMER pins are individual, while SERCOM uses a - * group of two to four pins. This group of pins can span both - * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E - * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses - * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each - * pin. This bitfield is also used to set the pin drive strength. - * In the future, other attributes (like input buffer - * configuration) may be added. See WVariant.h for valid entries. - * PinAttribute This is a 32-bit bitfield used to list all of the valid - * peripheral functions that a pin can attach to. This includes - * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are - * shorthand for a combination of other attributes. - * PIN_ATTR_DIGITAL includes all of the GPIO functions, while - * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and - * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). - * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is - * only one DAC channel, so PIN_ATTR_DAC appears only once. This - * bitfield is useful for limiting a pin to only input related - * functions or output functions. This allows a pin to have a - * more flexible configuration, while restricting the direction - * (ie: to avoid contention). See WVariant.h for valid entries. - * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some - * TC channels are available on multiple pins (ie: TCC0/WO[0] is - * available on pin A4 or pin A8 on the MT-D21E). In general, - * only one pin should be configured (in the pinDescription - * table) per TC channel. See WVariant.h for valid entries. - * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). - * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See - * WVariant.h for valid entries. - * ExtInt This is the interrupt (if any) assigned to the pin. Some - * interrupt numbers are available on multiple pins (ie: - * EIC/EXTINT[2] is available on pin A2 or pin A18 on the - * MT-D21E). In general, only one pin should be configured (in - * the pinDescription table) per interrupt number. Thus, if an - * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved - * from pin 18. See WVariant.h for valid entries. - */ - /* - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * + Pin number + ZERO Board pin | PIN | Label/Name | Comments (* is for available peripherals with this configuration) - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | Digital Low | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 0 | 0 -> RX | PA11 | | *EIC/EXTINT[11] *ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] SERCOM2/PAD[3] TCC0/WO[3] TCC1/WO[1] - * | 1 | 1 <- TX | PA10 | | *EIC/EXTINT[10] *ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] TCC0/WO[2] TCC1/WO[0] - * | 2 | 2 | PA14 | | *EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] TC3/WO[0] TCC0/WO[4] - * | 3 | ~3 | PA09 | | *EIC/EXTINT[9] *ADC/AIN[17] PTC/X[1] SERCOM0/PAD[1] *SERCOM2/PAD[1] *TCC0/WO[1] TCC1/WO[3] - * | 4 | ~4 | PA08 | | *EIC/NMI *ADC/AIN[16] PTC/X[0] SERCOM0/PAD[0] *SERCOM2/PAD[0] *TCC0/WO[0] TCC1/WO[2] - * | 5 | ~5 | PA15 | | *EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] *TC3/WO[1] TCC0/WO[5] - * | 6 | ~6 | PA20 | | *EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TCC0/WO[6] - * | 7 | 7 | PA21 | | *EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] TCC0/WO[7] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | Digital High | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 8 | ~8 | PA06 | | EIC/EXTINT[6] *ADC/AIN[6] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[2] *TCC1/WO[0] - * | 9 | ~9 | PA07 | | EIC/EXTINT[7] *ADC/AIN[7] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[3] *TCC1/WO[1] - * | 10 | ~10 | PA18 | | *EIC/EXTINT[2] PTC/X[6] *SERCOM1/PAD[2] SERCOM3/PAD[2] *TC3/WO[0] TCC0/WO[2] - * | 11 | ~11 | PA16 | | *EIC/EXTINT[0] PTC/X[4] *SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6] - * | 12 | ~12 | PA19 | | *EIC/EXTINT[3] PTC/X[7] *SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] *TCC0/WO[3] - * | 13 | ~13 | PA17 | LED | *EIC/EXTINT[1] PTC/X[5] *SERCOM1/PAD[1] SERCOM3/PAD[1] *TCC2/WO[1] TCC0/WO[7] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | Analog Connector | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 14 | A0 | PA02 | A0 | EIC/EXTINT[2] *ADC/AIN[0] *DAC/VOUT PTC/Y[0] - * | 15 | A1 | PB08 | A1 | *EIC/EXTINT[8] *ADC/AIN[2] PTC/Y[14] SERCOM4/PAD[0] TC4/WO[0] - * | 16 | A2 | PB09 | A2 | EIC/EXTINT[9] *ADC/AIN[3] PTC/Y[15] SERCOM4/PAD[1] TC4/WO[1] - * | 17 | A3 | PA04 | A3 | EIC/EXTINT[4] *ADC/AIN[4] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[0] TCC0/WO[0] - * | 18 | A4 | PA05 | A4 | EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[5] SERCOM0/PAD[1] TCC0/WO[1] - * | 19 | A5 | PB02 | A5 | EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | Wire | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 20 | SDA | PA22 | SDA | *EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] SERCOM5/PAD[0] *TC4/WO[0] TCC0/WO[4] - * | 21 | SCL | PA23 | SCL | *EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] SERCOM5/PAD[1] *TC4/WO[1] TCC0/WO[5] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | |SPI (Legacy ICSP) | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 22 | 1 | PA12 | MISO | *EIC/EXTINT[12] SERCOM2/PAD[0] *SERCOM4/PAD[0] TCC2/WO[0] TCC0/WO[6] - * | | 2 | | 5V0 | - * | 23 | 4 | PB10 | MOSI | EIC/EXTINT[10] *SERCOM4/PAD[2] *TC5/WO[0] TCC0/WO[4] - * | 24 | 3 | PB11 | SCK | EIC/EXTINT[11] *SERCOM4/PAD[3] *TC5/WO[1] TCC0/WO[5] - * | | 5 | | RESET | - * | | 6 | | GND | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | LEDs | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 25 | | PB03 | RX | - * | 26 | | PA27 | TX | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | USB | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 27 | | PA28 | USB_HOST_ENABLE | EIC/EXTINT[8] - * | 28 | | PA24 | USB_NEGATIVE | *USB/DM - * | 29 | | PA25 | USB_POSITIVE | *USB/DP - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | EDBG | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 30 | | PB22 | EDBG_UART TX | *SERCOM5/PAD[2] - * | 31 | | PB23 | EDBG_UART RX | *SERCOM5/PAD[3] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 32 | | PA22 | EDBG_SDA | Pin 20 (SDA) - * | 33 | | PA23 | EDBG_SCL | Pin 21 (SCL) - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 34 | | PA19 | EDBG_MISO | EIC/EXTINT[3] *SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] TCC0/WO[3] - * | 35 | | PA16 | EDBG_MOSI | EIC/EXTINT[0] *SERCOM1/PAD[0] SERCOM3/PAD[0] TCC2/WO[0] TCC0/WO[6] - * | 36 | | PA18 | EDBG_SS | EIC/EXTINT[2] *SERCOM1/PAD[2] SERCOM3/PAD[2] TC3/WO[0] TCC0/WO[2] - * | 37 | | PA17 | EDBG_SCK | EIC/EXTINT[1] *SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] TCC0/WO[7] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | 38 | ATN | PA13 | EDBG_GPIO0 | *EIC/EXTINT[13] SERCOM2/PAD[1] SERCOM4/PAD[1] TCC2/WO[1] TCC0/WO[7] - * | 39 | | PA21 | EDBG_GPIO1 | Pin 7 - * | 40 | | PA06 | EDBG_GPIO2 | Pin 8 - * | 41 | | PA07 | EDBG_GPIO3 | Pin 9 - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | GND | | | - * | 42 | AREF | PA03 | | EIC/EXTINT[3] *[ADC|DAC]/VREFA *ADC/AIN[1] PTC/Y[1] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | |32.768KHz Crystal | | | - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- - * | | | PA00 | XIN32 | EIC/EXTINT[0] SERCOM1/PAD[0] TCC2/WO[0] - * | | | PA01 | XOUT32 | EIC/EXTINT[1] SERCOM1/PAD[1] TCC2/WO[1] - * +------------+------------------+--------+-----------------+-------------------------------------------------------------------------------------------------------- + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information */ @@ -194,88 +34,88 @@ const PinDescription g_APinDescription[]= // 0..13 - Digital pins // ---------------------- // 0/1 - SERCOM/UART (Serial1) - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel19, EXTERNAL_INT_11 }, // RX: SERCOM0/PAD[3] - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel18, EXTERNAL_INT_10 }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel19, EXTERNAL_INT_11, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel18, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] // 2..12 // Digital Low - { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_14 }, - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9 }, // TCC0/WO[1] SCL: SERCOM2/PAD[1] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI }, // TCC0/WO[0] SDA: SERCOM2/PAD[0] - { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_15 }, // TC3/WO[1] - { PORTA, 20, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH6, No_ADC_Channel, EXTERNAL_INT_4 }, // TCC0/WO[6] - { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5 }, + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] SCL: SERCOM2/PAD[1] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] SDA: SERCOM2/PAD[0] + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_15, GCLK_CCL_NONE }, // TC3/WO[1] + { PORTA, 20, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH6, No_ADC_Channel, EXTERNAL_INT_4, GCLK_CCL_NONE }, // TCC0/WO[6] + { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5, GCLK_CCL_NONE }, // Digital High - { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_6 }, // TCC1/WO[0] ADC/AIN[6] - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_7 }, // TCC1/WO[1] ADC/AIN[7] - { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2 }, // TC3/WO[0] SS: SERCOM1/PAD[2] - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // TCC2/WO[0] MOSI: SERCOM1/PAD[0] - { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3 }, // TCC0/WO[3] MISO: SERCOM1/PAD[3] + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_6, GCLK_CCL_NONE }, // TCC1/WO[0] ADC/AIN[6] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_7, GCLK_CCL_NONE }, // TCC1/WO[1] ADC/AIN[7] + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // TC3/WO[0] SS: SERCOM1/PAD[2] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // TCC2/WO[0] MOSI: SERCOM1/PAD[0] + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // TCC0/WO[3] MISO: SERCOM1/PAD[3] // 13 (LED) - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // TCC2/WO[1] SCK: SERCOM1/PAD[1] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // TCC2/WO[1] SCK: SERCOM1/PAD[1] // 14..19 - Analog pins // -------------------- - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC - { PORTB, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel2, EXTERNAL_INT_8 }, // ADC/AIN[2] - { PORTB, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel3, EXTERNAL_INT_NONE }, // ADC/AIN[3] - { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_NONE }, // ADC/AIN[4] - { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_NONE }, // ADC/AIN[5] - { PORTB, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel10, EXTERNAL_INT_NONE }, // ADC/AIN[10] + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[0] / DAC + { PORTB, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel2, EXTERNAL_INT_8, GCLK_CCL_NONE }, // ADC/AIN[2] + { PORTB, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel3, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[3] + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[4] + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[5] + { PORTB, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel10, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[10] // 20..21 I2C pins (SDA/SCL and also EDBG:SDA/SCL) // ---------------------- - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // SDA: SERCOM3/PAD[0] - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCL: SERCOM3/PAD[1] + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SDA: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SCL: SERCOM3/PAD[1] // 22..24 - SPI pins (ICSP:MISO,SCK,MOSI) // ---------------------- - { PORTA, 12, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_12 }, // MISO: SERCOM4/PAD[0] - { PORTB, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_NONE }, // MOSI: SERCOM4/PAD[2] - { PORTB, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE }, // SCK: SERCOM4/PAD[3] + { PORTA, 12, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_12, GCLK_CCL_NONE }, // MISO: SERCOM4/PAD[0] + { PORTB, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // MOSI: SERCOM4/PAD[2] + { PORTB, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SCK: SERCOM4/PAD[3] // 25..26 - RX/TX LEDS (PB03/PA27) // -------------------- - { PORTB, 3, PIO_OUTPUT, PER_ATTR_DRIVE_STRONG, PIN_ATTR_OUTPUT, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // used as output only - { PORTA, 27, PIO_OUTPUT, PER_ATTR_DRIVE_STRONG, PIN_ATTR_OUTPUT, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // used as output only + { PORTB, 3, PIO_OUTPUT, PER_ATTR_DRIVE_STRONG, PIN_ATTR_OUTPUT, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // used as output only + { PORTA, 27, PIO_OUTPUT, PER_ATTR_DRIVE_STRONG, PIN_ATTR_OUTPUT, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // used as output only // 27..29 - USB // -------------------- - { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB Host enable - { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DM - { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // USB/DP + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB Host enable + { PORTA, 24, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_COM, PER_ATTR_NONE, PIN_ATTR_COM, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP // 30..41 - EDBG // ---------------------- // 30/31 - EDBG/UART - { PORTB, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // TX: SERCOM5/PAD[2] - { PORTB, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE }, // RX: SERCOM5/PAD[3] + { PORTB, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM5/PAD[2] + { PORTB, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM5/PAD[3] // 32/33 I2C (SDA/SCL and also EDBG:SDA/SCL). These are duplicate entries of pins 20 and 21 - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6 }, // SDA: SERCOM3/PAD[0] - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7 }, // SCL: SERCOM3/PAD[1] + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SDA: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // SCL: SERCOM3/PAD[1] // 34..37 - EDBG/SPI. These are duplicate entries of pins 12, 11, 10, and 13. - { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3 }, // MISO: SERCOM1/PAD[3] - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0 }, // MOSI: SERCOM1/PAD[0] - { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2 }, // SS: SERCOM1/PAD[2] - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1 }, // SCK: SERCOM1/PAD[1] + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // MISO: SERCOM1/PAD[3] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // MOSI: SERCOM1/PAD[0] + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SS: SERCOM1/PAD[2] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // SCK: SERCOM1/PAD[1] // 38..41 - EDBG/Digital - { PORTA, 13, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_13 }, // EIC/EXTINT[13] PIN_ATN + { PORTA, 13, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_13, GCLK_CCL_NONE }, // EIC/EXTINT[13] PIN_ATN // 39..41 These are duplicate entries of pins 7, 8, and 9 so that AREF and DAC are still available on pins 42 and 43 - { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5 }, - { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE }, // TCC1/WO[0] ADC/AIN[6] - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE }, // TCC1/WO[1] ADC/AIN[7] + { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TCC1/WO[0] ADC/AIN[6] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TCC1/WO[1] ADC/AIN[7] // 42 (AREF) - { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE }, // VREF ADC/AIN[1] + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // VREF ADC/AIN[1] - // 43 - Alternate use of A0 (DAC output). This is a duplicate entry of pin - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE }, // ADC/AIN[0] / DAC + // 43 - Alternate use of A0 (DAC output). This is a duplicate entry of pin 14 + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[0] / DAC } ; const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; @@ -288,13 +128,8 @@ SERCOM sercom3( SERCOM3 ) ; SERCOM sercom4( SERCOM4 ) ; SERCOM sercom5( SERCOM5 ) ; -#if defined(ARDUINO_UART_ONLY) || defined(ARDUINO_CDC_HID_UART) || defined(ARDUINO_CDC_UART) || defined(ARDUINO_HID_UART) || defined(ARDUINO_CDC_MIDI_HID_UART) || defined(ARDUINO_CDC_MSD_HID_UART) || defined(ARDUINO_CDC_MSD_MIDI_HID_UART) -Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; +#if defined(ONE_UART) || defined(TWO_UART) Uart Serial( SERCOM_INSTANCE_SERIAL, PIN_SERIAL_RX, PIN_SERIAL_TX, PAD_SERIAL_RX, PAD_SERIAL_TX ) ; -void SERCOM0_Handler() -{ - Serial1.IrqHandler(); -} void SERCOM5_Handler() { @@ -302,3 +137,12 @@ void SERCOM5_Handler() } #endif +#if defined(TWO_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM0_Handler() +{ + Serial1.IrqHandler(); +} +#endif + diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 980a4b51b..144fa61b7 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -19,6 +19,12 @@ #ifndef _VARIANT_ARDUINO_ZERO_ #define _VARIANT_ARDUINO_ZERO_ +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + /*---------------------------------------------------------------------------- * Definitions *----------------------------------------------------------------------------*/ @@ -27,13 +33,14 @@ #define VARIANT_MAINOSC (32768ul) /** Master clock frequency */ -#define VARIANT_MCK (48000000ul) +#define VARIANT_MCK (48000000ul) /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ #include "WVariant.h" +#include "sam.h" #ifdef __cplusplus #include "SERCOM.h" @@ -139,7 +146,13 @@ static const uint8_t ATN = PIN_ATN; /* * SPI Interfaces */ +#if defined(TWO_SPI) #define SPI_INTERFACES_COUNT 2 +#elif defined(THREE_SPI) +#define SPI_INTERFACES_COUNT 3 +#else +#define SPI_INTERFACES_COUNT 1 +#endif #define PIN_SPI_MISO (22u) #define PIN_SPI_MOSI (23u) @@ -163,7 +176,13 @@ static const uint8_t SCK = PIN_SPI_SCK ; /* * Wire Interfaces */ +#if defined(TWO_WIRE) #define WIRE_INTERFACES_COUNT 2 +#elif defined(THREE_WIRE) +#define WIRE_INTERFACES_COUNT 3 +#else +#define WIRE_INTERFACES_COUNT 1 +#endif #define PIN_WIRE_SDA (20u) #define PIN_WIRE_SCL (21u) @@ -184,7 +203,7 @@ static const uint8_t SCL = PIN_WIRE_SCL; #define PIN_USB_DM (28ul) #define PIN_USB_DP (29ul) #define PIN_USB_HOST_ENABLE (27ul) -#define PIN_USB_HOST_ENABLE_VALUE HIGH +#define PIN_USB_HOST_ENABLE_VALUE 1 #ifdef __cplusplus } From 05ac82403e7d60460ef76e4c578632db5cf9f5ea Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 6 Mar 2017 02:15:30 +0000 Subject: [PATCH 081/124] Add L21 and C21 support to libraries --- libraries/HID/HID.h | 4 ++-- .../SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.cpp | 7 +++++++ libraries/SPI/SPI.h | 9 ++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index 60a348aaa..45900f99e 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -23,8 +23,8 @@ #include #include "USB/PluggableUSB.h" -#if !defined(HID_ENABLED) -#error Please select an appropriate option that includes HID in the Tools->Communications menu. +#if !defined(CDC_HID) || !defined(HID_ONLY) || !defined(WITH_CDC) +#error Please select CDC_HID, HID_ONLY, or WITH_CDC in the Tools->USB menu. #endif #if defined(USBCON) diff --git a/libraries/SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.cpp b/libraries/SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.cpp index 1681b0a43..3b5d07a47 100644 --- a/libraries/SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.cpp +++ b/libraries/SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.cpp @@ -25,7 +25,14 @@ void analogReadCorrection (int offset, uint16_t gain) ADC->GAINCORR.reg = ADC_GAINCORR_GAINCORR(gain); // Enable digital correction logic +#if (SAMD) ADC->CTRLB.bit.CORREN = 1; while(ADC->STATUS.bit.SYNCBUSY); +#elif (SAML21 || SAMC21) + ADC->CTRLC.bit.CORREN = 1; + while ( ADC->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); +#else + #error "SAMD_AnalogCorrection.h: Unsupported chip" +#endif } diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index c45b27b0a..8db271dbc 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -22,6 +22,7 @@ #include #include +#include "sam.h" // SPI_HAS_TRANSACTION means SPI has // - beginTransaction() @@ -35,14 +36,16 @@ #define SPI_MODE2 0x03 #define SPI_MODE3 0x01 -#if defined(__SAMD21G18A__) +#if (SAMD || SAML21) // Even if not specified on the datasheet, the SAMD21G18A MCU // doesn't operate correctly with clock dividers lower than 4. // This allows a theoretical maximum SPI clock speed of 12Mhz - #define SPI_MIN_CLOCK_DIVIDER 4 // Other SAMD21xxxxx MCU may be affected as well -#else #define SPI_MIN_CLOCK_DIVIDER 4 +#elif (SAMC21) + #define SPI_MIN_CLOCK_DIVIDER 8 +#else + #error "SPI.h: Unsupported chip" #endif class SPISettings { From bfed5bb98898990bd6c00b2bb837f506c9e7fc5e Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 6 Mar 2017 02:18:55 +0000 Subject: [PATCH 082/124] Reorganized linker scripts, openocd scripts, and debug scripts. Updated boards.txt with new menu items. --- boards.txt | 1174 +++++++++++------ .../flash_16KB.ld} | 0 .../flash_16KB.ld} | 0 .../debug_scripts/SAMC21E15A.gdb} | 2 +- .../debug_scripts/SAMC21E16A.gdb} | 2 +- variants/MT_D21E/debug_scripts/SAMC21E17A.gdb | 31 + variants/MT_D21E/debug_scripts/SAMC21E18A.gdb | 31 + variants/MT_D21E/debug_scripts/SAML21E15B.gdb | 31 + variants/MT_D21E/debug_scripts/SAML21E16B.gdb | 31 + variants/MT_D21E/debug_scripts/SAML21E17B.gdb | 31 + variants/MT_D21E/debug_scripts/SAML21E18B.gdb | 31 + .../flash_128KB.ld} | 0 .../flash_256KB.ld} | 0 .../flash_32KB.ld} | 0 .../flash_64KB.ld} | 0 .../flash_128KB.ld} | 0 .../flash_256KB.ld} | 0 .../flash_32KB.ld} | 0 .../flash_64KB.ld} | 0 .../flash_128KB.ld} | 0 .../flash_256KB.ld} | 0 .../flash_32KB.ld} | 0 .../flash_64KB.ld} | 0 .../MT_D21E/openocd_scripts/SAMC21E15A.cfg | 30 + .../MT_D21E/openocd_scripts/SAMC21E16A.cfg | 30 + .../MT_D21E/openocd_scripts/SAMC21E17A.cfg | 30 + .../MT_D21E/openocd_scripts/SAMC21E18A.cfg | 30 + .../MT_D21E/openocd_scripts/SAML21E15B.cfg | 30 + .../MT_D21E/openocd_scripts/SAML21E16B.cfg | 30 + .../MT_D21E/openocd_scripts/SAML21E17B.cfg | 30 + .../MT_D21E/openocd_scripts/SAML21E18B.cfg | 30 + .../arduino_zero/debug_scripts/SAMC21G15A.gdb | 31 + .../arduino_zero/debug_scripts/SAMC21G16A.gdb | 31 + .../arduino_zero/debug_scripts/SAMC21G17A.gdb | 31 + .../arduino_zero/debug_scripts/SAMC21G18A.gdb | 31 + .../arduino_zero/debug_scripts/SAMD21G15A.gdb | 31 + .../arduino_zero/debug_scripts/SAMD21G16A.gdb | 31 + .../arduino_zero/debug_scripts/SAMD21G17A.gdb | 31 + .../{variant.gdb => SAMD21G18A.gdb} | 0 .../arduino_zero/debug_scripts/SAML21G16B.gdb | 31 + .../arduino_zero/debug_scripts/SAML21G17B.gdb | 31 + .../arduino_zero/debug_scripts/SAML21G18B.gdb | 31 + .../gcc/16KB_Bootloader/flash_128KB.ld | 212 +++ .../gcc/16KB_Bootloader/flash_256KB.ld | 212 +++ .../gcc/16KB_Bootloader/flash_32KB.ld} | 2 +- .../gcc/16KB_Bootloader/flash_64KB.ld | 212 +++ .../gcc/8KB_Bootloader/flash_128KB.ld} | 4 +- .../flash_256KB.ld} | 0 .../gcc/8KB_Bootloader/flash_32KB.ld} | 2 +- .../gcc/8KB_Bootloader/flash_64KB.ld | 212 +++ .../gcc/No_Bootloader/flash_128KB.ld | 213 +++ .../flash_256KB.ld} | 0 .../gcc/No_Bootloader/flash_32KB.ld} | 5 +- .../gcc/No_Bootloader/flash_64KB.ld | 213 +++ .../openocd_scripts/SAMC21G15A.cfg | 30 + .../openocd_scripts/SAMC21G16A.cfg | 30 + .../openocd_scripts/SAMC21G17A.cfg | 30 + .../openocd_scripts/SAMC21G18A.cfg | 30 + .../openocd_scripts/SAMD21G15A.cfg} | 2 +- .../openocd_scripts/SAMD21G16A.cfg} | 2 +- .../openocd_scripts/SAMD21G17A.cfg | 30 + .../{arduino_zero.cfg => SAMD21G18A.cfg} | 0 .../openocd_scripts/SAML21G16B.cfg | 30 + .../openocd_scripts/SAML21G17B.cfg | 30 + .../openocd_scripts/SAML21G18B.cfg | 30 + 65 files changed, 3039 insertions(+), 406 deletions(-) rename variants/MT_D11/linker_scripts/gcc/{SAMD11C14A_with_4KB_bootloader.ld => 4KB_Bootloader/flash_16KB.ld} (100%) rename variants/MT_D11/linker_scripts/gcc/{SAMD11C14A_without_bootloader.ld => No_Bootloader/flash_16KB.ld} (100%) rename variants/{MT_D11/debug_scripts/SAMD11C14A.gdb => MT_D21E/debug_scripts/SAMC21E15A.gdb} (92%) rename variants/{MT_D11/debug_scripts/SAMD11D14AS.gdb => MT_D21E/debug_scripts/SAMC21E16A.gdb} (91%) create mode 100644 variants/MT_D21E/debug_scripts/SAMC21E17A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAMC21E18A.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAML21E15B.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAML21E16B.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAML21E17B.gdb create mode 100644 variants/MT_D21E/debug_scripts/SAML21E18B.gdb rename variants/MT_D21E/linker_scripts/gcc/{flash_128KB_with_16KB_bootloader.ld => 16KB_Bootloader/flash_128KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_256KB_with_16KB_bootloader.ld => 16KB_Bootloader/flash_256KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_32KB_with_16KB_bootloader.ld => 16KB_Bootloader/flash_32KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_64KB_with_16KB_bootloader.ld => 16KB_Bootloader/flash_64KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_128KB_with_8KB_bootloader.ld => 8KB_Bootloader/flash_128KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_256KB_with_8KB_bootloader.ld => 8KB_Bootloader/flash_256KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_32KB_with_8KB_bootloader.ld => 8KB_Bootloader/flash_32KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_64KB_with_8KB_bootloader.ld => 8KB_Bootloader/flash_64KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_128KB_without_bootloader.ld => No_Bootloader/flash_128KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_256KB_without_bootloader.ld => No_Bootloader/flash_256KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_32KB_without_bootloader.ld => No_Bootloader/flash_32KB.ld} (100%) rename variants/MT_D21E/linker_scripts/gcc/{flash_64KB_without_bootloader.ld => No_Bootloader/flash_64KB.ld} (100%) create mode 100644 variants/MT_D21E/openocd_scripts/SAMC21E15A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMC21E16A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMC21E17A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAMC21E18A.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAML21E15B.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAML21E16B.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAML21E17B.cfg create mode 100644 variants/MT_D21E/openocd_scripts/SAML21E18B.cfg create mode 100644 variants/arduino_zero/debug_scripts/SAMC21G15A.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAMC21G16A.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAMC21G17A.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAMC21G18A.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAMD21G15A.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAMD21G16A.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAMD21G17A.gdb rename variants/arduino_zero/debug_scripts/{variant.gdb => SAMD21G18A.gdb} (100%) create mode 100644 variants/arduino_zero/debug_scripts/SAML21G16B.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAML21G17B.gdb create mode 100644 variants/arduino_zero/debug_scripts/SAML21G18B.gdb create mode 100644 variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld create mode 100644 variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld rename variants/{MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld => arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld} (97%) create mode 100644 variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld rename variants/{MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld => arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld} (96%) rename variants/arduino_zero/linker_scripts/gcc/{flash_with_bootloader.ld => 8KB_Bootloader/flash_256KB.ld} (100%) rename variants/{MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld => arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld} (97%) create mode 100644 variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld create mode 100644 variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_128KB.ld rename variants/arduino_zero/linker_scripts/gcc/{flash_without_bootloader.ld => No_Bootloader/flash_256KB.ld} (100%) rename variants/{MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld => arduino_zero/linker_scripts/gcc/No_Bootloader/flash_32KB.ld} (97%) create mode 100644 variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_64KB.ld create mode 100644 variants/arduino_zero/openocd_scripts/SAMC21G15A.cfg create mode 100644 variants/arduino_zero/openocd_scripts/SAMC21G16A.cfg create mode 100644 variants/arduino_zero/openocd_scripts/SAMC21G17A.cfg create mode 100644 variants/arduino_zero/openocd_scripts/SAMC21G18A.cfg rename variants/{MT_D11/openocd_scripts/SAMD11C14A.cfg => arduino_zero/openocd_scripts/SAMD21G15A.cfg} (97%) rename variants/{MT_D11/openocd_scripts/SAMD11D14AS.cfg => arduino_zero/openocd_scripts/SAMD21G16A.cfg} (97%) create mode 100644 variants/arduino_zero/openocd_scripts/SAMD21G17A.cfg rename variants/arduino_zero/openocd_scripts/{arduino_zero.cfg => SAMD21G18A.cfg} (100%) create mode 100644 variants/arduino_zero/openocd_scripts/SAML21G16B.cfg create mode 100644 variants/arduino_zero/openocd_scripts/SAML21G17B.cfg create mode 100644 variants/arduino_zero/openocd_scripts/SAML21G18B.cfg diff --git a/boards.txt b/boards.txt index 9b167e57e..fcfb42349 100644 --- a/boards.txt +++ b/boards.txt @@ -14,425 +14,807 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -menu.cpu=Processor -menu.com=Communications +menu.cpu=Microcontroller +menu.clock=Clock Source +menu.usb=USB Config +menu.serial=Serial Config +menu.bootloader=Bootloader Size -# MattairTech MT-D21E (default 8KB bootloader) -mattairtech_mt_d21e_bl8k.name=MattairTech MT-D21E (SAM-BA bootloader) -mattairtech_mt_d21e_bl8k.vid.0=0x16D0 -mattairtech_mt_d21e_bl8k.pid.0=0x0557 -mattairtech_mt_d21e_bl8k.vid.1=0x16D0 -mattairtech_mt_d21e_bl8k.pid.1=0x0856 -mattairtech_mt_d21e_bl8k.upload.tool=MattairTech_Arduino:bossac -# mattairtech_mt_d21e_bl8k.upload.tool=arduino:bossac -mattairtech_mt_d21e_bl8k.upload.protocol=sam-ba -mattairtech_mt_d21e_bl8k.upload.use_1200bps_touch=true -mattairtech_mt_d21e_bl8k.upload.wait_for_upload_port=true -mattairtech_mt_d21e_bl8k.upload.native_usb=true -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a=SAMD21E18A -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.upload.maximum_size=253952 -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ -D__8KB_BOOTLOADER__ {build.usb_flags} -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a=SAMD21E17A -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.upload.maximum_size=122880 -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ -D__8KB_BOOTLOADER__ {build.usb_flags} -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a=SAMD21E16A -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.upload.maximum_size=57344 -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ -D__8KB_BOOTLOADER__ {build.usb_flags} -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a=SAMD21E15A -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.upload.maximum_size=24576 -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ -D__8KB_BOOTLOADER__ {build.usb_flags} -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg -mattairtech_mt_d21e_bl8k.build.mcu=cortex-m0plus -mattairtech_mt_d21e_bl8k.build.f_cpu=48000000L -mattairtech_mt_d21e_bl8k.build.usb_product="MT-D21E" -mattairtech_mt_d21e_bl8k.build.usb_manufacturer="MattairTech" -mattairtech_mt_d21e_bl8k.build.board=CDC_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_uart=CDC_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.board=CDC_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_uart.build.pid=0x0557 -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart=CDC_HID_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid_uart.build.pid=0x0856 -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid=CDC_HID -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.board=CDC_HID -mattairtech_mt_d21e_bl8k.menu.com.cdc_hid.build.pid=0x0856 -mattairtech_mt_d21e_bl8k.menu.com.cdc=CDC_ONLY -mattairtech_mt_d21e_bl8k.menu.com.cdc.build.board=CDC_ONLY -mattairtech_mt_d21e_bl8k.menu.com.cdc.build.pid=0x0557 -mattairtech_mt_d21e_bl8k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -mattairtech_mt_d21e_bl8k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 -# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 -# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d21e_bl8k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 -# mattairtech_mt_d21e_bl8k.menu.com.msd_uart=MSD_UART -# mattairtech_mt_d21e_bl8k.menu.com.msd_uart.build.board=MSD_UART -# mattairtech_mt_d21e_bl8k.menu.com.msd_uart.build.pid=0x0A0C -mattairtech_mt_d21e_bl8k.menu.com.uart=UART_ONLY -mattairtech_mt_d21e_bl8k.menu.com.uart.build.board=UART_ONLY -mattairtech_mt_d21e_bl8k.menu.com.uart.build.pid=0x0856 -mattairtech_mt_d21e_bl8k.menu.com.none=USB_UART_DISABLED -mattairtech_mt_d21e_bl8k.menu.com.none.build.board=USB_UART_DISABLED -mattairtech_mt_d21e_bl8k.menu.com.none.build.pid=0x0856 -mattairtech_mt_d21e_bl8k.build.core=arduino -mattairtech_mt_d21e_bl8k.build.variant=MT_D21E -mattairtech_mt_d21e_bl8k.build.variant_system_lib= -mattairtech_mt_d21e_bl8k.build.vid=0x16D0 -mattairtech_mt_d21e_bl8k.bootloader.tool=arduino:openocd -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E18A.bin -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E17A.bin -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E16A.bin -mattairtech_mt_d21e_bl8k.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E15A.bin +# MattairTech MT-D21E +mattairtech_mt_d21e.name=MattairTech MT-D21E +mattairtech_mt_d21e.vid.0=0x16D0 +mattairtech_mt_d21e.pid.0=0x0557 +mattairtech_mt_d21e.vid.1=0x16D0 +mattairtech_mt_d21e.pid.1=0x0856 +mattairtech_mt_d21e.vid.2=0x16D0 +mattairtech_mt_d21e.pid.2=0x0B41 +mattairtech_mt_d21e.build.mcu=cortex-m0plus +mattairtech_mt_d21e.build.f_cpu=48000000L +mattairtech_mt_d21e.build.usb_product="MT-D21E" +mattairtech_mt_d21e.build.usb_manufacturer="MattairTech" +mattairtech_mt_d21e.build.board=SAMD_ZERO +mattairtech_mt_d21e.build.core=arduino +mattairtech_mt_d21e.build.variant=MT_D21E +mattairtech_mt_d21e.build.variant_system_lib= +mattairtech_mt_d21e.build.vid=0x16D0 +mattairtech_mt_d21e.upload.protocol=sam-ba +mattairtech_mt_d21e.bootloader.tool=arduino:openocd +mattairtech_mt_d21e.menu.clock.crystal_32k=32KHZ_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +mattairtech_mt_d21e.menu.clock.internal=INTERNAL +mattairtech_mt_d21e.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mattairtech_mt_d21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mattairtech_mt_d21e.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mattairtech_mt_d21e.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.menu.cpu.samd21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E18A.bin +mattairtech_mt_d21e.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.menu.cpu.samd21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E17A.bin +mattairtech_mt_d21e.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.menu.cpu.samd21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E16A.bin +mattairtech_mt_d21e.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.menu.cpu.samd21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E15A.bin +mattairtech_mt_d21e.menu.bootloader.8kb=8KB +mattairtech_mt_d21e.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +mattairtech_mt_d21e.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +mattairtech_mt_d21e.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21e.menu.bootloader.8kb.upload.use_1200bps_touch=true +mattairtech_mt_d21e.menu.bootloader.8kb.upload.wait_for_upload_port=true +mattairtech_mt_d21e.menu.bootloader.8kb.upload.native_usb=true +mattairtech_mt_d21e.menu.bootloader.16kb=16KB +mattairtech_mt_d21e.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +mattairtech_mt_d21e.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +mattairtech_mt_d21e.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21e.menu.bootloader.16kb.upload.use_1200bps_touch=true +mattairtech_mt_d21e.menu.bootloader.16kb.upload.wait_for_upload_port=true +mattairtech_mt_d21e.menu.bootloader.16kb.upload.native_usb=true +mattairtech_mt_d21e.menu.bootloader.0kb=NO_BOOTLOADER +mattairtech_mt_d21e.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mattairtech_mt_d21e.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mattairtech_mt_d21e.menu.bootloader.0kb.upload.tool=arduino:openocd +mattairtech_mt_d21e.menu.bootloader.0kb.upload.use_1200bps_touch=false +mattairtech_mt_d21e.menu.bootloader.0kb.upload.wait_for_upload_port=false +mattairtech_mt_d21e.menu.bootloader.0kb.upload.native_usb=false +mattairtech_mt_d21e.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_uart=NO_UART +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.usb.cdc=CDC_ONLY +mattairtech_mt_d21e.menu.usb.cdc.build.usbcom=CDC_ONLY +mattairtech_mt_d21e.menu.usb.cdc.build.pid=0x0557 +mattairtech_mt_d21e.menu.usb.cdc_hid=CDC_HID +mattairtech_mt_d21e.menu.usb.cdc_hid.build.usbcom=CDC_HID +mattairtech_mt_d21e.menu.usb.cdc_hid.build.pid=0x0856 +mattairtech_mt_d21e.menu.usb.withcdc=WITH_CDC +mattairtech_mt_d21e.menu.usb.withcdc.build.usbcom=WITH_CDC +mattairtech_mt_d21e.menu.usb.withcdc.build.pid=0x0B41 +mattairtech_mt_d21e.menu.usb.hid=HID_ONLY +mattairtech_mt_d21e.menu.usb.hid.build.usbcom=HID_ONLY +mattairtech_mt_d21e.menu.usb.hid.build.pid=0x0B40 +mattairtech_mt_d21e.menu.usb.nocdc=WITHOUT_CDC +mattairtech_mt_d21e.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mattairtech_mt_d21e.menu.usb.nocdc.build.pid=0x0A0C +mattairtech_mt_d21e.menu.usb.none=USB_DISABLED +mattairtech_mt_d21e.menu.usb.none.build.usbcom=USB_DISABLED +mattairtech_mt_d21e.menu.usb.none.build.pid=0x0856 -# MattairTech MT-D21E (16KB bootloader), build only -#mattairtech_mt_d21e_bl16k.name=MattairTech MT-D21E (MSD bootloader) -#mattairtech_mt_d21e_bl16k.vid.0=0x16D0 -#mattairtech_mt_d21e_bl16k.pid.0=0x0557 -#mattairtech_mt_d21e_bl16k.vid.1=0x16D0 -#mattairtech_mt_d21e_bl16k.pid.1=0x0856 -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a=SAMD21E18A -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a.upload.maximum_size=245760 -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ -D__16KB_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a=SAMD21E17A -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a.upload.maximum_size=114688 -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ -D__16KB_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a=SAMD21E16A -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a.upload.maximum_size=49152 -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ -D__16KB_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a=SAMD21E15A -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a.upload.maximum_size=16384 -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ -D__16KB_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl16k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld -#mattairtech_mt_d21e_bl16k.build.mcu=cortex-m0plus -#mattairtech_mt_d21e_bl16k.build.f_cpu=48000000L -#mattairtech_mt_d21e_bl16k.build.usb_product="MT-D21E" -#mattairtech_mt_d21e_bl16k.build.usb_manufacturer="MattairTech" -#mattairtech_mt_d21e_bl16k.build.board=CDC_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_uart=CDC_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.board=CDC_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_uart.build.pid=0x0557 -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart=CDC_HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid_uart.build.pid=0x0856 -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid=CDC_HID -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.board=CDC_HID -#mattairtech_mt_d21e_bl16k.menu.com.cdc_hid.build.pid=0x0856 -#mattairtech_mt_d21e_bl16k.menu.com.cdc=CDC_ONLY -#mattairtech_mt_d21e_bl16k.menu.com.cdc.build.board=CDC_ONLY -#mattairtech_mt_d21e_bl16k.menu.com.cdc.build.pid=0x0557 -#mattairtech_mt_d21e_bl16k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -#mattairtech_mt_d21e_bl16k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 -# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 -# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d21e_bl16k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 -# mattairtech_mt_d21e_bl16k.menu.com.msd_uart=MSD_UART -# mattairtech_mt_d21e_bl16k.menu.com.msd_uart.build.board=MSD_UART -# mattairtech_mt_d21e_bl16k.menu.com.msd_uart.build.pid=0x0A0C -#mattairtech_mt_d21e_bl16k.menu.com.uart=UART_ONLY -#mattairtech_mt_d21e_bl16k.menu.com.uart.build.board=UART_ONLY -#mattairtech_mt_d21e_bl16k.menu.com.uart.build.pid=0x0856 -#mattairtech_mt_d21e_bl16k.menu.com.none=USB_UART_DISABLED -#mattairtech_mt_d21e_bl16k.menu.com.none.build.board=USB_UART_DISABLED -#mattairtech_mt_d21e_bl16k.menu.com.none.build.pid=0x0856 -#mattairtech_mt_d21e_bl16k.build.core=arduino -#mattairtech_mt_d21e_bl16k.build.variant=MT_D21E -#mattairtech_mt_d21e_bl16k.build.variant_system_lib= -#mattairtech_mt_d21e_bl16k.build.vid=0x16D0 -#mattairtech_mt_d21e_bl16k.build.pid=0x0856 +# MattairTech MT-D21E (rev B) +mattairtech_mt_d21e.name=MattairTech MT-D21E (rev B) +mattairtech_mt_d21e.vid.0=0x16D0 +mattairtech_mt_d21e.pid.0=0x0557 +mattairtech_mt_d21e.vid.1=0x16D0 +mattairtech_mt_d21e.pid.1=0x0856 +mattairtech_mt_d21e.vid.2=0x16D0 +mattairtech_mt_d21e.pid.2=0x0B41 +mattairtech_mt_d21e.build.mcu=cortex-m0plus +mattairtech_mt_d21e.build.f_cpu=48000000L +mattairtech_mt_d21e.build.usb_product="MT-D21E" +mattairtech_mt_d21e.build.usb_manufacturer="MattairTech" +mattairtech_mt_d21e.build.board=SAMD_ZERO +mattairtech_mt_d21e.build.core=arduino +mattairtech_mt_d21e.build.variant=MT_D21E_revB +mattairtech_mt_d21e.build.variant_system_lib= +mattairtech_mt_d21e.build.vid=0x16D0 +mattairtech_mt_d21e.upload.protocol=sam-ba +mattairtech_mt_d21e.bootloader.tool=arduino:openocd +mattairtech_mt_d21e.menu.clock.crystal_32k=32KHZ_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +mattairtech_mt_d21e.menu.clock.internal=INTERNAL +mattairtech_mt_d21e.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mattairtech_mt_d21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mattairtech_mt_d21e.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mattairtech_mt_d21e.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e.menu.cpu.samd21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E18A.bin +mattairtech_mt_d21e.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e.menu.cpu.samd21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E17A.bin +mattairtech_mt_d21e.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e.menu.cpu.samd21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E16A.bin +mattairtech_mt_d21e.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e.menu.cpu.samd21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +mattairtech_mt_d21e.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E15A.bin +mattairtech_mt_d21e.menu.cpu.saml21e18b=SAML21E18B +mattairtech_mt_d21e.menu.cpu.saml21e18b.upload.maximum_size=253952 +mattairtech_mt_d21e.menu.cpu.saml21e18b.build.extra_flags=-D__SAML21E18B__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.saml21e18b.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e.menu.cpu.saml21e18b.build.openocdscript=openocd_scripts/SAML21E18B.cfg +mattairtech_mt_d21e.menu.cpu.saml21e18b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21E18B.bin +mattairtech_mt_d21e.menu.cpu.saml21e17b=SAML21E17B +mattairtech_mt_d21e.menu.cpu.saml21e17b.upload.maximum_size=122880 +mattairtech_mt_d21e.menu.cpu.saml21e17b.build.extra_flags=-D__SAML21E17B__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.saml21e17b.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e.menu.cpu.saml21e17b.build.openocdscript=openocd_scripts/SAML21E17B.cfg +mattairtech_mt_d21e.menu.cpu.saml21e17b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21E17B.bin +mattairtech_mt_d21e.menu.cpu.saml21e16b=SAML21E16B +mattairtech_mt_d21e.menu.cpu.saml21e16b.upload.maximum_size=57344 +mattairtech_mt_d21e.menu.cpu.saml21e16b.build.extra_flags=-D__SAML21E16B__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.saml21e16b.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e.menu.cpu.saml21e16b.build.openocdscript=openocd_scripts/SAML21E16B.cfg +mattairtech_mt_d21e.menu.cpu.saml21e16b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21E16B.bin +mattairtech_mt_d21e.menu.cpu.saml21e15b=SAML21E15B +mattairtech_mt_d21e.menu.cpu.saml21e15b.upload.maximum_size=24576 +mattairtech_mt_d21e.menu.cpu.saml21e15b.build.extra_flags=-D__SAML21E15B__ {build.usb_flags} +mattairtech_mt_d21e.menu.cpu.saml21e15b.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e.menu.cpu.saml21e15b.build.openocdscript=openocd_scripts/SAML21E15B.cfg +mattairtech_mt_d21e.menu.cpu.saml21e15b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21E15B.bin +mattairtech_mt_d21e.menu.cpu.samc21e18a=SAMC21E18A +mattairtech_mt_d21e.menu.cpu.samc21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e.menu.cpu.samc21e18a.build.extra_flags=-D__SAMC21E18A__ +mattairtech_mt_d21e.menu.cpu.samc21e18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e.menu.cpu.samc21e18a.build.openocdscript=openocd_scripts/SAMC21E18A.cfg +mattairtech_mt_d21e.menu.cpu.samc21e18a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21E18A.bin +mattairtech_mt_d21e.menu.cpu.samc21e17a=SAMC21E17A +mattairtech_mt_d21e.menu.cpu.samc21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e.menu.cpu.samc21e17a.build.extra_flags=-D__SAMC21E17A__ +mattairtech_mt_d21e.menu.cpu.samc21e17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e.menu.cpu.samc21e17a.build.openocdscript=openocd_scripts/SAMC21E17A.cfg +mattairtech_mt_d21e.menu.cpu.samc21e17a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21E17A.bin +mattairtech_mt_d21e.menu.cpu.samc21e16a=SAMC21E16A +mattairtech_mt_d21e.menu.cpu.samc21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e.menu.cpu.samc21e16a.build.extra_flags=-D__SAMC21E16A__ +mattairtech_mt_d21e.menu.cpu.samc21e16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e.menu.cpu.samc21e16a.build.openocdscript=openocd_scripts/SAMC21E16A.cfg +mattairtech_mt_d21e.menu.cpu.samc21e16a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21E16A.bin +mattairtech_mt_d21e.menu.cpu.samc21e15a=SAMC21E15A +mattairtech_mt_d21e.menu.cpu.samc21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e.menu.cpu.samc21e15a.build.extra_flags=-D__SAMC21E15A__ +mattairtech_mt_d21e.menu.cpu.samc21e15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e.menu.cpu.samc21e15a.build.openocdscript=openocd_scripts/SAMC21E15A.cfg +mattairtech_mt_d21e.menu.cpu.samc21e15a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21E15A.bin +mattairtech_mt_d21e.menu.bootloader.8kb=8KB +mattairtech_mt_d21e.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +mattairtech_mt_d21e.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +mattairtech_mt_d21e.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21e.menu.bootloader.8kb.upload.use_1200bps_touch=true +mattairtech_mt_d21e.menu.bootloader.8kb.upload.wait_for_upload_port=true +mattairtech_mt_d21e.menu.bootloader.8kb.upload.native_usb=true +mattairtech_mt_d21e.menu.bootloader.16kb=16KB +mattairtech_mt_d21e.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +mattairtech_mt_d21e.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +mattairtech_mt_d21e.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21e.menu.bootloader.16kb.upload.use_1200bps_touch=true +mattairtech_mt_d21e.menu.bootloader.16kb.upload.wait_for_upload_port=true +mattairtech_mt_d21e.menu.bootloader.16kb.upload.native_usb=true +mattairtech_mt_d21e.menu.bootloader.0kb=NO_BOOTLOADER +mattairtech_mt_d21e.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mattairtech_mt_d21e.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mattairtech_mt_d21e.menu.bootloader.0kb.upload.tool=arduino:openocd +mattairtech_mt_d21e.menu.bootloader.0kb.upload.use_1200bps_touch=false +mattairtech_mt_d21e.menu.bootloader.0kb.upload.wait_for_upload_port=false +mattairtech_mt_d21e.menu.bootloader.0kb.upload.native_usb=false +mattairtech_mt_d21e.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_uart=NO_UART +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.usb.cdc=CDC_ONLY +mattairtech_mt_d21e.menu.usb.cdc.build.usbcom=CDC_ONLY +mattairtech_mt_d21e.menu.usb.cdc.build.pid=0x0557 +mattairtech_mt_d21e.menu.usb.cdc_hid=CDC_HID +mattairtech_mt_d21e.menu.usb.cdc_hid.build.usbcom=CDC_HID +mattairtech_mt_d21e.menu.usb.cdc_hid.build.pid=0x0856 +mattairtech_mt_d21e.menu.usb.withcdc=WITH_CDC +mattairtech_mt_d21e.menu.usb.withcdc.build.usbcom=WITH_CDC +mattairtech_mt_d21e.menu.usb.withcdc.build.pid=0x0B41 +mattairtech_mt_d21e.menu.usb.hid=HID_ONLY +mattairtech_mt_d21e.menu.usb.hid.build.usbcom=HID_ONLY +mattairtech_mt_d21e.menu.usb.hid.build.pid=0x0B40 +mattairtech_mt_d21e.menu.usb.nocdc=WITHOUT_CDC +mattairtech_mt_d21e.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mattairtech_mt_d21e.menu.usb.nocdc.build.pid=0x0A0C +mattairtech_mt_d21e.menu.usb.none=USB_DISABLED +mattairtech_mt_d21e.menu.usb.none.build.usbcom=USB_DISABLED +mattairtech_mt_d21e.menu.usb.none.build.pid=0x0856 -# MattairTech MT-D21E (no bootloader) -#mattairtech_mt_d21e_bl0k.name=MattairTech MT-D21E (no bootloader) -#mattairtech_mt_d21e_bl0k.vid.0=0x16D0 -#mattairtech_mt_d21e_bl0k.pid.0=0x0557 -#mattairtech_mt_d21e_bl0k.vid.1=0x16D0 -#mattairtech_mt_d21e_bl0k.pid.1=0x0856 -#mattairtech_mt_d21e_bl0k.upload.tool=arduino:openocd -#mattairtech_mt_d21e_bl0k.upload.protocol=sam-ba -#mattairtech_mt_d21e_bl0k.upload.use_1200bps_touch=false -#mattairtech_mt_d21e_bl0k.upload.wait_for_upload_port=false -#mattairtech_mt_d21e_bl0k.upload.native_usb=false -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a=SAMD21E18A -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a.upload.maximum_size=262144 -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ -D__NO_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e18a.build.ldscript=linker_scripts/gcc/flash_256KB_without_bootloader.ld -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a=SAMD21E17A -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a.upload.maximum_size=131072 -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ -D__NO_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e17a.build.ldscript=linker_scripts/gcc/flash_128KB_without_bootloader.ld -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a=SAMD21E16A -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a.upload.maximum_size=65536 -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ -D__NO_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e16a.build.ldscript=linker_scripts/gcc/flash_64KB_without_bootloader.ld -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a=SAMD21E15A -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a.upload.maximum_size=32768 -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ -D__NO_BOOTLOADER__ {build.usb_flags} -#mattairtech_mt_d21e_bl0k.menu.cpu.samd21e15a.build.ldscript=linker_scripts/gcc/flash_32KB_without_bootloader.ld -#mattairtech_mt_d21e_bl0k.build.mcu=cortex-m0plus -#mattairtech_mt_d21e_bl0k.build.f_cpu=48000000L -#mattairtech_mt_d21e_bl0k.build.usb_product="MT-D21E" -#mattairtech_mt_d21e_bl0k.build.usb_manufacturer="MattairTech" -#mattairtech_mt_d21e_bl0k.build.board=CDC_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_uart=CDC_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.board=CDC_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_uart.build.pid=0x0557 -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid=CDC_HID -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.board=CDC_HID -#mattairtech_mt_d21e_bl0k.menu.com.cdc_hid.build.pid=0x0856 -#mattairtech_mt_d21e_bl0k.menu.com.cdc=CDC_ONLY -#mattairtech_mt_d21e_bl0k.menu.com.cdc.build.board=CDC_ONLY -#mattairtech_mt_d21e_bl0k.menu.com.cdc.build.pid=0x0557 -#mattairtech_mt_d21e_bl0k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -#mattairtech_mt_d21e_bl0k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 -# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 -# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d21e_bl0k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 -# mattairtech_mt_d21e_bl0k.menu.com.msd_uart=MSD_UART -# mattairtech_mt_d21e_bl0k.menu.com.msd_uart.build.board=MSD_UART -# mattairtech_mt_d21e_bl0k.menu.com.msd_uart.build.pid=0x0A0C -#mattairtech_mt_d21e_bl0k.menu.com.uart=UART_ONLY -#mattairtech_mt_d21e_bl0k.menu.com.uart.build.board=UART_ONLY -#mattairtech_mt_d21e_bl0k.menu.com.uart.build.pid=0x0856 -#mattairtech_mt_d21e_bl0k.menu.com.none=USB_UART_DISABLED -#mattairtech_mt_d21e_bl0k.menu.com.none.build.board=USB_UART_DISABLED -#mattairtech_mt_d21e_bl0k.menu.com.none.build.pid=0x0856 -#mattairtech_mt_d21e_bl0k.build.core=arduino -#mattairtech_mt_d21e_bl0k.build.variant=MT_D21E -#mattairtech_mt_d21e_bl0k.build.variant_system_lib= -#mattairtech_mt_d21e_bl0k.build.vid=0x16D0 -#mattairtech_mt_d21e_bl0k.build.pid=0x0856 +# MattairTech MT-D21J +mattairtech_mt_d21j.name=MattairTech MT-D21J +mattairtech_mt_d21j.vid.0=0x16D0 +mattairtech_mt_d21j.pid.0=0x0557 +mattairtech_mt_d21j.vid.1=0x16D0 +mattairtech_mt_d21j.pid.1=0x0856 +mattairtech_mt_d21j.vid.2=0x16D0 +mattairtech_mt_d21j.pid.2=0x0B41 +mattairtech_mt_d21j.build.mcu=cortex-m0plus +mattairtech_mt_d21j.build.f_cpu=48000000L +mattairtech_mt_d21j.build.usb_product="MT-D21J" +mattairtech_mt_d21j.build.usb_manufacturer="MattairTech" +mattairtech_mt_d21j.build.board=SAMD_ZERO +mattairtech_mt_d21j.build.core=arduino +mattairtech_mt_d21j.build.variant=MT_L21J +mattairtech_mt_d21j.build.variant_system_lib= +mattairtech_mt_d21j.build.vid=0x16D0 +mattairtech_mt_d21j.upload.protocol=sam-ba +mattairtech_mt_d21j.bootloader.tool=arduino:openocd +mattairtech_mt_d21j.menu.clock.crystal_32k=32KHZ_CRYSTAL +mattairtech_mt_d21j.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mattairtech_mt_d21j.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +mattairtech_mt_d21j.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +mattairtech_mt_d21j.menu.clock.internal=INTERNAL +mattairtech_mt_d21j.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mattairtech_mt_d21j.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mattairtech_mt_d21j.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mattairtech_mt_d21j.menu.cpu.samd21j18a=SAMD21J18A +mattairtech_mt_d21j.menu.cpu.samd21j18a.upload.maximum_size=253952 +mattairtech_mt_d21j.menu.cpu.samd21j18a.build.extra_flags=-D__SAMD21J18A__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.samd21j18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21j.menu.cpu.samd21j18a.build.openocdscript=openocd_scripts/SAMD21J18A.cfg +mattairtech_mt_d21j.menu.cpu.samd21j18a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21J18A.bin +mattairtech_mt_d21j.menu.cpu.samd21j17a=SAMD21J17A +mattairtech_mt_d21j.menu.cpu.samd21j17a.upload.maximum_size=122880 +mattairtech_mt_d21j.menu.cpu.samd21j17a.build.extra_flags=-D__SAMD21J17A__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.samd21j17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21j.menu.cpu.samd21j17a.build.openocdscript=openocd_scripts/SAMD21J17A.cfg +mattairtech_mt_d21j.menu.cpu.samd21j17a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21J17A.bin +mattairtech_mt_d21j.menu.cpu.samd21j16a=SAMD21J16A +mattairtech_mt_d21j.menu.cpu.samd21j16a.upload.maximum_size=57344 +mattairtech_mt_d21j.menu.cpu.samd21j16a.build.extra_flags=-D__SAMD21J16A__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.samd21j16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21j.menu.cpu.samd21j16a.build.openocdscript=openocd_scripts/SAMD21J16A.cfg +mattairtech_mt_d21j.menu.cpu.samd21j16a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21J16A.bin +mattairtech_mt_d21j.menu.cpu.samd21j15a=SAMD21J15A +mattairtech_mt_d21j.menu.cpu.samd21j15a.upload.maximum_size=24576 +mattairtech_mt_d21j.menu.cpu.samd21j15a.build.extra_flags=-D__SAMD21J15A__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.samd21j15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21j.menu.cpu.samd21j15a.build.openocdscript=openocd_scripts/SAMD21J15A.cfg +mattairtech_mt_d21j.menu.cpu.samd21j15a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21J15A.bin +mattairtech_mt_d21j.menu.cpu.saml21j18b=SAML21J18B +mattairtech_mt_d21j.menu.cpu.saml21j18b.upload.maximum_size=253952 +mattairtech_mt_d21j.menu.cpu.saml21j18b.build.extra_flags=-D__SAML21J18B__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.saml21j18b.build.ldscript=flash_256KB.ld +mattairtech_mt_d21j.menu.cpu.saml21j18b.build.openocdscript=openocd_scripts/SAML21J18B.cfg +mattairtech_mt_d21j.menu.cpu.saml21j18b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21J18B.bin +mattairtech_mt_d21j.menu.cpu.saml21j17b=SAML21J17B +mattairtech_mt_d21j.menu.cpu.saml21j17b.upload.maximum_size=122880 +mattairtech_mt_d21j.menu.cpu.saml21j17b.build.extra_flags=-D__SAML21J17B__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.saml21j17b.build.ldscript=flash_128KB.ld +mattairtech_mt_d21j.menu.cpu.saml21j17b.build.openocdscript=openocd_scripts/SAML21J17B.cfg +mattairtech_mt_d21j.menu.cpu.saml21j17b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21J17B.bin +mattairtech_mt_d21j.menu.cpu.saml21j16b=SAML21J16B +mattairtech_mt_d21j.menu.cpu.saml21j16b.upload.maximum_size=57344 +mattairtech_mt_d21j.menu.cpu.saml21j16b.build.extra_flags=-D__SAML21J16B__ {build.usb_flags} +mattairtech_mt_d21j.menu.cpu.saml21j16b.build.ldscript=flash_64KB.ld +mattairtech_mt_d21j.menu.cpu.saml21j16b.build.openocdscript=openocd_scripts/SAML21J16B.cfg +mattairtech_mt_d21j.menu.cpu.saml21j16b.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAML21J16B.bin +mattairtech_mt_d21j.menu.cpu.samc21j18a=SAMC21J18A +mattairtech_mt_d21j.menu.cpu.samc21j18a.upload.maximum_size=253952 +mattairtech_mt_d21j.menu.cpu.samc21j18a.build.extra_flags=-D__SAMC21J18A__ +mattairtech_mt_d21j.menu.cpu.samc21j18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21j.menu.cpu.samc21j18a.build.openocdscript=openocd_scripts/SAMC21J18A.cfg +mattairtech_mt_d21j.menu.cpu.samc21j18a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21J18A.bin +mattairtech_mt_d21j.menu.cpu.samc21j17a=SAMC21J17A +mattairtech_mt_d21j.menu.cpu.samc21j17a.upload.maximum_size=122880 +mattairtech_mt_d21j.menu.cpu.samc21j17a.build.extra_flags=-D__SAMC21J17A__ +mattairtech_mt_d21j.menu.cpu.samc21j17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21j.menu.cpu.samc21j17a.build.openocdscript=openocd_scripts/SAMC21J17A.cfg +mattairtech_mt_d21j.menu.cpu.samc21j17a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21J17A.bin +mattairtech_mt_d21j.menu.cpu.samc21j16a=SAMC21J16A +mattairtech_mt_d21j.menu.cpu.samc21j16a.upload.maximum_size=57344 +mattairtech_mt_d21j.menu.cpu.samc21j16a.build.extra_flags=-D__SAMC21J16A__ +mattairtech_mt_d21j.menu.cpu.samc21j16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21j.menu.cpu.samc21j16a.build.openocdscript=openocd_scripts/SAMC21J16A.cfg +mattairtech_mt_d21j.menu.cpu.samc21j16a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21J16A.bin +mattairtech_mt_d21j.menu.cpu.samc21j15a=SAMC21J15A +mattairtech_mt_d21j.menu.cpu.samc21j15a.upload.maximum_size=24576 +mattairtech_mt_d21j.menu.cpu.samc21j15a.build.extra_flags=-D__SAMC21J15A__ +mattairtech_mt_d21j.menu.cpu.samc21j15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21j.menu.cpu.samc21j15a.build.openocdscript=openocd_scripts/SAMC21J15A.cfg +mattairtech_mt_d21j.menu.cpu.samc21j15a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMC21J15A.bin +mattairtech_mt_d21j.menu.bootloader.8kb=8KB +mattairtech_mt_d21j.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +mattairtech_mt_d21j.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +mattairtech_mt_d21j.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21j.menu.bootloader.8kb.upload.use_1200bps_touch=true +mattairtech_mt_d21j.menu.bootloader.8kb.upload.wait_for_upload_port=true +mattairtech_mt_d21j.menu.bootloader.8kb.upload.native_usb=true +mattairtech_mt_d21j.menu.bootloader.16kb=16KB +mattairtech_mt_d21j.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +mattairtech_mt_d21j.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +mattairtech_mt_d21j.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21j.menu.bootloader.16kb.upload.use_1200bps_touch=true +mattairtech_mt_d21j.menu.bootloader.16kb.upload.wait_for_upload_port=true +mattairtech_mt_d21j.menu.bootloader.16kb.upload.native_usb=true +mattairtech_mt_d21j.menu.bootloader.0kb=NO_BOOTLOADER +mattairtech_mt_d21j.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mattairtech_mt_d21j.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mattairtech_mt_d21j.menu.bootloader.0kb.upload.tool=arduino:openocd +mattairtech_mt_d21j.menu.bootloader.0kb.upload.use_1200bps_touch=false +mattairtech_mt_d21j.menu.bootloader.0kb.upload.wait_for_upload_port=false +mattairtech_mt_d21j.menu.bootloader.0kb.upload.native_usb=false +mattairtech_mt_d21j.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21j.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mattairtech_mt_d21j.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21j.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21j.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +mattairtech_mt_d21j.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +mattairtech_mt_d21j.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21j.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21j.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +mattairtech_mt_d21j.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +mattairtech_mt_d21j.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +mattairtech_mt_d21j.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21j.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21j.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mattairtech_mt_d21j.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21j.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21j.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21j.menu.serial.three_uart.build.serialcom_uart=THREE_UART +mattairtech_mt_d21j.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21j.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21j.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +mattairtech_mt_d21j.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +mattairtech_mt_d21j.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21j.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21j.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +mattairtech_mt_d21j.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +mattairtech_mt_d21j.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +mattairtech_mt_d21j.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21j.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21j.menu.serial.no_uart.build.serialcom_uart=NO_UART +mattairtech_mt_d21j.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21j.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21j.menu.usb.cdc=CDC_ONLY +mattairtech_mt_d21j.menu.usb.cdc.build.usbcom=CDC_ONLY +mattairtech_mt_d21j.menu.usb.cdc.build.pid=0x0557 +mattairtech_mt_d21j.menu.usb.cdc_hid=CDC_HID +mattairtech_mt_d21j.menu.usb.cdc_hid.build.usbcom=CDC_HID +mattairtech_mt_d21j.menu.usb.cdc_hid.build.pid=0x0856 +mattairtech_mt_d21j.menu.usb.withcdc=WITH_CDC +mattairtech_mt_d21j.menu.usb.withcdc.build.usbcom=WITH_CDC +mattairtech_mt_d21j.menu.usb.withcdc.build.pid=0x0B41 +mattairtech_mt_d21j.menu.usb.hid=HID_ONLY +mattairtech_mt_d21j.menu.usb.hid.build.usbcom=HID_ONLY +mattairtech_mt_d21j.menu.usb.hid.build.pid=0x0B40 +mattairtech_mt_d21j.menu.usb.nocdc=WITHOUT_CDC +mattairtech_mt_d21j.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mattairtech_mt_d21j.menu.usb.nocdc.build.pid=0x0A0C +mattairtech_mt_d21j.menu.usb.none=USB_DISABLED +mattairtech_mt_d21j.menu.usb.none.build.usbcom=USB_DISABLED +mattairtech_mt_d21j.menu.usb.none.build.pid=0x0856 - -# MattairTech MT-D11 (4KB bootloader) -mattairtech_mt_d11.name=MattairTech MT-D11 (SAM-BA bootloader) +# MattairTech MT-D11 (D11D14AM, QFN-24) +mattairtech_mt_d11.name=MattairTech MT-D11 mattairtech_mt_d11.vid.0=0x16D0 mattairtech_mt_d11.pid.0=0x0557 mattairtech_mt_d11.vid.1=0x16D0 mattairtech_mt_d11.pid.1=0x0856 -mattairtech_mt_d11.upload.tool=MattairTech_Arduino:bossac -mattairtech_mt_d11.upload.protocol=sam-ba -mattairtech_mt_d11.upload.use_1200bps_touch=true -mattairtech_mt_d11.upload.wait_for_upload_port=true -mattairtech_mt_d11.upload.native_usb=true -mattairtech_mt_d11.upload.maximum_size=12288 -mattairtech_mt_d11.build.extra_flags=-D__SAMD11D14AM__ -D__4KB_BOOTLOADER__ {build.usb_flags} -mattairtech_mt_d11.build.ldscript=linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld -mattairtech_mt_d11.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg +mattairtech_mt_d11.vid.2=0x16D0 +mattairtech_mt_d11.pid.2=0x0B41 mattairtech_mt_d11.build.mcu=cortex-m0plus mattairtech_mt_d11.build.f_cpu=48000000L mattairtech_mt_d11.build.usb_product="MT-D11" mattairtech_mt_d11.build.usb_manufacturer="MattairTech" -mattairtech_mt_d11.build.board=CDC_UART -mattairtech_mt_d11.menu.com.cdc_uart=CDC_UART -mattairtech_mt_d11.menu.com.cdc_uart.build.board=CDC_UART -mattairtech_mt_d11.menu.com.cdc_uart.build.pid=0x0557 -mattairtech_mt_d11.menu.com.cdc_hid_uart=CDC_HID_UART -mattairtech_mt_d11.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -mattairtech_mt_d11.menu.com.cdc_hid_uart.build.pid=0x0856 -mattairtech_mt_d11.menu.com.cdc_hid=CDC_HID -mattairtech_mt_d11.menu.com.cdc_hid.build.board=CDC_HID -mattairtech_mt_d11.menu.com.cdc_hid.build.pid=0x0856 -mattairtech_mt_d11.menu.com.cdc=CDC_ONLY -mattairtech_mt_d11.menu.com.cdc.build.board=CDC_ONLY -mattairtech_mt_d11.menu.com.cdc.build.pid=0x0557 -mattairtech_mt_d11.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -mattairtech_mt_d11.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -mattairtech_mt_d11.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 -# mattairtech_mt_d11.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# mattairtech_mt_d11.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# mattairtech_mt_d11.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 -# mattairtech_mt_d11.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d11.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d11.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 -# mattairtech_mt_d11.menu.com.msd_uart=MSD_UART -# mattairtech_mt_d11.menu.com.msd_uart.build.board=MSD_UART -# mattairtech_mt_d11.menu.com.msd_uart.build.pid=0x0A0C -mattairtech_mt_d11.menu.com.uart=UART_ONLY -mattairtech_mt_d11.menu.com.uart.build.board=UART_ONLY -mattairtech_mt_d11.menu.com.uart.build.pid=0x0856 -mattairtech_mt_d11.menu.com.none=USB_UART_DISABLED -mattairtech_mt_d11.menu.com.none.build.board=USB_UART_DISABLED -mattairtech_mt_d11.menu.com.none.build.pid=0x0856 +mattairtech_mt_d11.build.board=SAMD_ZERO mattairtech_mt_d11.build.core=arduino mattairtech_mt_d11.build.variant=MT_D11 mattairtech_mt_d11.build.variant_system_lib= mattairtech_mt_d11.build.vid=0x16D0 -mattairtech_mt_d11.build.pid=0x0856 +mattairtech_mt_d11.upload.protocol=sam-ba mattairtech_mt_d11.bootloader.tool=arduino:openocd +mattairtech_mt_d11.menu.clock.crystal_32k=32KHZ_CRYSTAL +mattairtech_mt_d11.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mattairtech_mt_d11.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +mattairtech_mt_d11.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +mattairtech_mt_d11.menu.clock.internal=INTERNAL +mattairtech_mt_d11.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mattairtech_mt_d11.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mattairtech_mt_d11.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mattairtech_mt_d11.build.extra_flags=-D__SAMD11D14AM__ {build.usb_flags} +mattairtech_mt_d11.build.ldscript=linker_scripts/gcc/flash_16KB.ld +mattairtech_mt_d11.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg mattairtech_mt_d11.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD11D14AM.bin +mattairtech_mt_d11.menu.bootloader.4kb=4KB +mattairtech_mt_d11.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +mattairtech_mt_d11.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +mattairtech_mt_d11.menu.bootloader.4kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d11.menu.bootloader.4kb.upload.use_1200bps_touch=true +mattairtech_mt_d11.menu.bootloader.4kb.upload.wait_for_upload_port=true +mattairtech_mt_d11.menu.bootloader.4kb.upload.native_usb=true +mattairtech_mt_d11.menu.bootloader.4kb.upload.maximum_size=12288 +mattairtech_mt_d11.menu.bootloader.0kb=NO_BOOTLOADER +mattairtech_mt_d11.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mattairtech_mt_d11.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mattairtech_mt_d11.menu.bootloader.0kb.upload.tool=arduino:openocd +mattairtech_mt_d11.menu.bootloader.0kb.upload.use_1200bps_touch=false +mattairtech_mt_d11.menu.bootloader.0kb.upload.wait_for_upload_port=false +mattairtech_mt_d11.menu.bootloader.0kb.upload.native_usb=false +mattairtech_mt_d11.menu.bootloader.0kb.upload.maximum_size=16384 +mattairtech_mt_d11.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d11.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mattairtech_mt_d11.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d11.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d11.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d11.menu.serial.no_uart.build.serialcom_uart=NO_UART +mattairtech_mt_d11.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d11.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d11.menu.serial.two_uart=TWO_UART_ONE_WIRE_NO_SPI +mattairtech_mt_d11.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mattairtech_mt_d11.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d11.menu.serial.two_uart.build.serialcom_spi=NO_SPI +mattairtech_mt_d11.menu.usb.cdc=CDC_ONLY +mattairtech_mt_d11.menu.usb.cdc.build.usbcom=CDC_ONLY +mattairtech_mt_d11.menu.usb.cdc.build.pid=0x0557 +mattairtech_mt_d11.menu.usb.cdc_hid=CDC_HID +mattairtech_mt_d11.menu.usb.cdc_hid.build.usbcom=CDC_HID +mattairtech_mt_d11.menu.usb.cdc_hid.build.pid=0x0856 +mattairtech_mt_d11.menu.usb.withcdc=WITH_CDC +mattairtech_mt_d11.menu.usb.withcdc.build.usbcom=WITH_CDC +mattairtech_mt_d11.menu.usb.withcdc.build.pid=0x0B41 +mattairtech_mt_d11.menu.usb.hid=HID_ONLY +mattairtech_mt_d11.menu.usb.hid.build.usbcom=HID_ONLY +mattairtech_mt_d11.menu.usb.hid.build.pid=0x0B40 +mattairtech_mt_d11.menu.usb.nocdc=WITHOUT_CDC +mattairtech_mt_d11.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mattairtech_mt_d11.menu.usb.nocdc.build.pid=0x0A0C +mattairtech_mt_d11.menu.usb.none=USB_DISABLED +mattairtech_mt_d11.menu.usb.none.build.usbcom=USB_DISABLED +mattairtech_mt_d11.menu.usb.none.build.pid=0x0856 + +# Generic D11C14A (SOIC-14) +d11c14a.name=Generic D11C14A +d11c14a.vid.0=0x16D0 +d11c14a.pid.0=0x0557 +d11c14a.vid.1=0x16D0 +d11c14a.pid.1=0x0856 +d11c14a.vid.2=0x16D0 +d11c14a.pid.2=0x0B41 +d11c14a.build.mcu=cortex-m0plus +d11c14a.build.f_cpu=48000000L +d11c14a.build.usb_product="D11C14A" +d11c14a.build.usb_manufacturer="MattairTech" +d11c14a.build.board=SAMD_ZERO +d11c14a.build.core=arduino +d11c14a.build.variant=D11C14A +d11c14a.build.variant_system_lib= +d11c14a.build.vid=0x16D0 +d11c14a.upload.protocol=sam-ba +d11c14a.bootloader.tool=arduino:openocd +d11c14a.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11c14a.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11c14a.menu.clock.internal=INTERNAL +d11c14a.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11c14a.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +d11c14a.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11c14a.build.extra_flags=-D__SAMD11C14A__ {build.usb_flags} +d11c14a.build.ldscript=linker_scripts/gcc/flash_16KB.ld +d11c14a.build.openocdscript=openocd_scripts/SAMD11C14A.cfg +d11c14a.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD11C14A.bin +d11c14a.menu.bootloader.4kb=4KB +d11c14a.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11c14a.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11c14a.menu.bootloader.4kb.upload.tool=MattairTech_Arduino:bossac +d11c14a.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11c14a.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11c14a.menu.bootloader.4kb.upload.native_usb=true +d11c14a.menu.bootloader.4kb.upload.maximum_size=12288 +d11c14a.menu.bootloader.0kb=NO_BOOTLOADER +d11c14a.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11c14a.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11c14a.menu.bootloader.0kb.upload.tool=arduino:openocd +d11c14a.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11c14a.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11c14a.menu.bootloader.0kb.upload.native_usb=false +d11c14a.menu.bootloader.0kb.upload.maximum_size=16384 +d11c14a.menu.serial.one_uart=ONE_UART_ONE_WIRE_NO_SPI +d11c14a.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.one_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi=ONE_UART_NO_WIRE_ONE_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +d11c14a.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11c14a.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11c14a.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11c14a.menu.serial.two_uart=TWO_UART_NO_WIRE_NO_SPI +d11c14a.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11c14a.menu.serial.two_uart.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.usb.cdc=CDC_ONLY +d11c14a.menu.usb.cdc.build.usbcom=CDC_ONLY +d11c14a.menu.usb.cdc.build.pid=0x0557 +d11c14a.menu.usb.cdc_hid=CDC_HID +d11c14a.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11c14a.menu.usb.cdc_hid.build.pid=0x0856 +d11c14a.menu.usb.withcdc=WITH_CDC +d11c14a.menu.usb.withcdc.build.usbcom=WITH_CDC +d11c14a.menu.usb.withcdc.build.pid=0x0B41 +d11c14a.menu.usb.hid=HID_ONLY +d11c14a.menu.usb.hid.build.usbcom=HID_ONLY +d11c14a.menu.usb.hid.build.pid=0x0B40 +d11c14a.menu.usb.nocdc=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.pid=0x0A0C +d11c14a.menu.usb.none=USB_DISABLED +d11c14a.menu.usb.none.build.usbcom=USB_DISABLED +d11c14a.menu.usb.none.build.pid=0x0856 -# MattairTech MT-D11 (no bootloader) -mattairtech_mt_d11_bl0k.name=MattairTech MT-D11 (no bootloader) -mattairtech_mt_d11_bl0k.vid.0=0x16D0 -mattairtech_mt_d11_bl0k.pid.0=0x0557 -mattairtech_mt_d11_bl0k.vid.1=0x16D0 -mattairtech_mt_d11_bl0k.pid.1=0x0856 -mattairtech_mt_d11_bl0k.upload.tool=arduino:openocd -mattairtech_mt_d11_bl0k.upload.protocol=sam-ba -mattairtech_mt_d11_bl0k.upload.use_1200bps_touch=false -mattairtech_mt_d11_bl0k.upload.wait_for_upload_port=false -mattairtech_mt_d11_bl0k.upload.native_usb=false -mattairtech_mt_d11_bl0k.upload.maximum_size=16384 -mattairtech_mt_d11_bl0k.build.extra_flags=-D__SAMD11D14AM__ -D__NO_BOOTLOADER__ {build.usb_flags} -mattairtech_mt_d11_bl0k.build.ldscript=linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld -mattairtech_mt_d11_bl0k.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg -mattairtech_mt_d11_bl0k.build.mcu=cortex-m0plus -mattairtech_mt_d11_bl0k.build.f_cpu=48000000L -mattairtech_mt_d11_bl0k.build.usb_product="MT-D11" -mattairtech_mt_d11_bl0k.build.usb_manufacturer="MattairTech" -mattairtech_mt_d11_bl0k.build.board=CDC_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_uart=CDC_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_uart.build.board=CDC_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_uart.build.pid=0x0557 -mattairtech_mt_d11_bl0k.menu.com.cdc_hid_uart=CDC_HID_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_hid_uart.build.pid=0x0856 -mattairtech_mt_d11_bl0k.menu.com.cdc_hid=CDC_HID -mattairtech_mt_d11_bl0k.menu.com.cdc_hid.build.board=CDC_HID -mattairtech_mt_d11_bl0k.menu.com.cdc_hid.build.pid=0x0856 -mattairtech_mt_d11_bl0k.menu.com.cdc=CDC_ONLY -mattairtech_mt_d11_bl0k.menu.com.cdc.build.board=CDC_ONLY -mattairtech_mt_d11_bl0k.menu.com.cdc.build.pid=0x0557 -mattairtech_mt_d11_bl0k.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -mattairtech_mt_d11_bl0k.menu.com.cdc_midi_hid_uart.build.pid=0x0B34 -# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_hid_uart.build.pid=0x0B40 -# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# mattairtech_mt_d11_bl0k.menu.com.cdc_msd_midi_hid_uart.build.pid=0x0B41 -# mattairtech_mt_d11_bl0k.menu.com.msd_uart=MSD_UART -# mattairtech_mt_d11_bl0k.menu.com.msd_uart.build.board=MSD_UART -# mattairtech_mt_d11_bl0k.menu.com.msd_uart.build.pid=0x0A0C -mattairtech_mt_d11_bl0k.menu.com.uart=UART_ONLY -mattairtech_mt_d11_bl0k.menu.com.uart.build.board=UART_ONLY -mattairtech_mt_d11_bl0k.menu.com.uart.build.pid=0x0856 -mattairtech_mt_d11_bl0k.menu.com.none=USB_UART_DISABLED -mattairtech_mt_d11_bl0k.menu.com.none.build.board=USB_UART_DISABLED -mattairtech_mt_d11_bl0k.menu.com.none.build.pid=0x0856 -mattairtech_mt_d11_bl0k.build.core=arduino -mattairtech_mt_d11_bl0k.build.variant=MT_D11 -mattairtech_mt_d11_bl0k.build.variant_system_lib= -mattairtech_mt_d11_bl0k.build.vid=0x16D0 -mattairtech_mt_d11_bl0k.build.pid=0x0856 +# MattairTech Core for Arduino/Genuino Zero (Autodetect Port) +arduino_zero.name=Arduino/Genuino Zero (Autodetect Port) +arduino_zero.vid.0=0x2341 +arduino_zero.pid.0=0x804d +arduino_zero.vid.1=0x2341 +arduino_zero.pid.1=0x004d +# If the board is a 2341:824d use 2341:824d for build and set other parameters as well +arduino_zero.vid.2=0x2341 +arduino_zero.pid.2=0x824d +arduino_zero.vid.2.build.vid=0x2341 +arduino_zero.vid.2.build.pid=0x824d +arduino_zero.vid.2.build.usb_product="Genuino Zero" +# If the board is a 2341:024d use 2341:824d for build and set other parameters as well +arduino_zero.vid.3=0x2341 +arduino_zero.pid.3=0x024d +arduino_zero.vid.3.build.vid=0x2341 +arduino_zero.vid.3.build.pid=0x824d +arduino_zero.vid.3.build.usb_product="Genuino Zero" +# Programming port +arduino_zero.vid.4=0x03eb +arduino_zero.pid.4=0x2157 +arduino_zero.vid.4.upload.tool=arduino:openocd +arduino_zero.vid.4.upload.use_1200bps_touch=false +arduino_zero.vid.4.upload.wait_for_upload_port=false +arduino_zero.vid.4.upload.native_usb=false +arduino_zero.upload.tool=MattairTech_Arduino:bossac +arduino_zero.upload.use_1200bps_touch=true +arduino_zero.upload.wait_for_upload_port=true +arduino_zero.upload.native_usb=true +arduino_zero.build.mcu=cortex-m0plus +arduino_zero.build.f_cpu=48000000L +arduino_zero.build.usb_product="Arduino Zero" +arduino_zero.build.usb_manufacturer="Arduino LLC" +arduino_zero.build.board=SAMD_ZERO +arduino_zero.build.core=arduino +arduino_zero.build.variant=arduino_zero +arduino_zero.build.variant_system_lib= +arduino_zero.build.vid=0x2341 +arduino_zero.build.pid=0x804d +arduino_zero.upload.protocol=sam-ba +arduino_zero.menu.clock.crystal_32k=32KHZ_CRYSTAL +arduino_zero.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +arduino_zero.menu.clock.internal=INTERNAL +arduino_zero.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +arduino_zero.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +arduino_zero.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +arduino_zero.bootloader.tool=arduino:openocd +arduino_zero.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} +arduino_zero.build.ldscript=flash_256KB.ld +arduino_zero.build.openocdscript=openocd_scripts/SAMD21G18A.cfg +arduino_zero.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21G18A.bin +arduino_zero.menu.bootloader.8kb=8KB +arduino_zero.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +arduino_zero.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +arduino_zero.menu.bootloader.8kb.upload.maximum_size=253952 +arduino_zero.menu.bootloader.16kb=16KB +arduino_zero.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +arduino_zero.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +arduino_zero.menu.bootloader.16kb.upload.maximum_size=245760 +arduino_zero.menu.bootloader.0kb=NO_BOOTLOADER +arduino_zero.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +arduino_zero.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +arduino_zero.menu.bootloader.0kb.upload.tool=arduino:openocd +arduino_zero.menu.bootloader.0kb.upload.use_1200bps_touch=false +arduino_zero.menu.bootloader.0kb.upload.wait_for_upload_port=false +arduino_zero.menu.bootloader.0kb.upload.native_usb=false +arduino_zero.menu.bootloader.0kb.upload.maximum_size=262144 +arduino_zero.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +arduino_zero.menu.serial.one_uart.build.serialcom_uart=ONE_UART +arduino_zero.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +arduino_zero.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +arduino_zero.menu.serial.one_uart_two_wire_two_spi=ONE_UART_TWO_WIRE_TWO_SPI +arduino_zero.menu.serial.one_uart_two_wire_two_spi.build.serialcom_uart=ONE_UART +arduino_zero.menu.serial.one_uart_two_wire_two_spi.build.serialcom_wire=TWO_WIRE +arduino_zero.menu.serial.one_uart_two_wire_two_spi.build.serialcom_spi=TWO_SPI +arduino_zero.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +arduino_zero.menu.serial.two_uart.build.serialcom_uart=TWO_UART +arduino_zero.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +arduino_zero.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +arduino_zero.menu.serial.two_uart_two_wire_two_spi=TWO_UART_TWO_WIRE_TWO_SPI +arduino_zero.menu.serial.two_uart_two_wire_two_spi.build.serialcom_uart=TWO_UART +arduino_zero.menu.serial.two_uart_two_wire_two_spi.build.serialcom_wire=TWO_WIRE +arduino_zero.menu.serial.two_uart_two_wire_two_spi.build.serialcom_spi=TWO_SPI +arduino_zero.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +arduino_zero.menu.serial.no_uart.build.serialcom_uart=NO_UART +arduino_zero.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +arduino_zero.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +arduino_zero.menu.serial.no_uart_two_wire_two_spi=NO_UART_TWO_WIRE_TWO_SPI +arduino_zero.menu.serial.no_uart_two_wire_two_spi.build.serialcom_uart=NO_UART +arduino_zero.menu.serial.no_uart_two_wire_two_spi.build.serialcom_wire=TWO_WIRE +arduino_zero.menu.serial.no_uart_two_wire_two_spi.build.serialcom_spi=TWO_SPI +arduino_zero.menu.usb.cdc=CDC_ONLY +arduino_zero.menu.usb.cdc.build.usbcom=CDC_ONLY +arduino_zero.menu.usb.cdc_hid=CDC_HID +arduino_zero.menu.usb.cdc_hid.build.usbcom=CDC_HID +arduino_zero.menu.usb.withcdc=WITH_CDC +arduino_zero.menu.usb.withcdc.build.usbcom=WITH_CDC +arduino_zero.menu.usb.hid=HID_ONLY +arduino_zero.menu.usb.hid.build.usbcom=HID_ONLY +arduino_zero.menu.usb.nocdc=WITHOUT_CDC +arduino_zero.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +arduino_zero.menu.usb.none=USB_DISABLED +arduino_zero.menu.usb.none.build.usbcom=USB_DISABLED -# MattairTech Core for Arduino Zero (8KB bootloader, Native USB Port) -arduino_zero_native.name=Arduino Zero (Native USB Port) -arduino_zero_native.vid.0=0x2341 -arduino_zero_native.pid.0=0x804d -arduino_zero_native.vid.1=0x2341 -arduino_zero_native.pid.1=0x004d -arduino_zero_native.upload.tool=MattairTech_Arduino:bossac -arduino_zero_native.upload.protocol=sam-ba -arduino_zero_native.upload.maximum_size=262144 -arduino_zero_native.upload.use_1200bps_touch=true -arduino_zero_native.upload.wait_for_upload_port=true -arduino_zero_native.upload.native_usb=true -arduino_zero_native.build.mcu=cortex-m0plus -arduino_zero_native.build.f_cpu=48000000L -arduino_zero_native.build.usb_product="Arduino Zero" -arduino_zero_native.build.usb_manufacturer="Arduino LLC" -arduino_zero_native.build.board=SAMD_ZERO -arduino_zero_native.menu.com.cdc_uart=CDC_UART -arduino_zero_native.menu.com.cdc_uart.build.board=CDC_UART -arduino_zero_native.menu.com.cdc_hid_uart=CDC_HID_UART -arduino_zero_native.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -arduino_zero_native.menu.com.cdc_hid=CDC_HID -arduino_zero_native.menu.com.cdc_hid.build.board=CDC_HID -arduino_zero_native.menu.com.cdc=CDC_ONLY -arduino_zero_native.menu.com.cdc.build.board=CDC_ONLY -arduino_zero_native.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -arduino_zero_native.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -# arduino_zero_native.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# arduino_zero_native.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# arduino_zero_native.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# arduino_zero_native.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# arduino_zero_native.menu.com.msd_uart=MSD_UART -# arduino_zero_native.menu.com.msd_uart.build.board=MSD_UART -arduino_zero_native.menu.com.uart=UART_ONLY -arduino_zero_native.menu.com.uart.build.board=UART_ONLY -arduino_zero_native.menu.com.none=USB_UART_DISABLED -arduino_zero_native.menu.com.none.build.board=USB_UART_DISABLED -arduino_zero_native.build.core=arduino -arduino_zero_native.build.extra_flags=-D__SAMD21G18A__ -D__8KB_BOOTLOADER__ {build.usb_flags} -arduino_zero_native.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld -arduino_zero_native.build.openocdscript=openocd_scripts/arduino_zero.cfg -arduino_zero_native.build.variant=arduino_zero -arduino_zero_native.build.variant_system_lib= -arduino_zero_native.build.vid=0x2341 -arduino_zero_native.build.pid=0x804d -# MattairTech Core for Arduino Zero (8KB bootloader, Programming Port) -#arduino_zero_edbg.name=Arduino Zero (Programming Port) -#arduino_zero_edbg.vid.0=0x03eb -#arduino_zero_edbg.pid.0=0x2157 -#arduino_zero_edbg.upload.tool=arduino:openocd -#arduino_zero_edbg.upload.protocol=sam-ba -#arduino_zero_edbg.upload.maximum_size=262144 -#arduino_zero_edbg.upload.use_1200bps_touch=false -#arduino_zero_edbg.upload.wait_for_upload_port=false -#arduino_zero_edbg.upload.native_usb=false -#arduino_zero_edbg.build.mcu=cortex-m0plus -#arduino_zero_edbg.build.f_cpu=48000000L -#arduino_zero_edbg.build.usb_product="Arduino Zero" -#arduino_zero_edbg.build.usb_manufacturer="Arduino LLC" -#arduino_zero_edbg.build.board=SAMD_ZERO -#arduino_zero_edbg.menu.com.cdc_uart=CDC_UART -#arduino_zero_edbg.menu.com.cdc_uart.build.board=CDC_UART -#arduino_zero_edbg.menu.com.cdc_hid_uart=CDC_HID_UART -#arduino_zero_edbg.menu.com.cdc_hid_uart.build.board=CDC_HID_UART -#arduino_zero_edbg.menu.com.cdc_hid=CDC_HID -#arduino_zero_edbg.menu.com.cdc_hid.build.board=CDC_HID -#arduino_zero_edbg.menu.com.cdc=CDC_ONLY -#arduino_zero_edbg.menu.com.cdc.build.board=CDC_ONLY -#arduino_zero_edbg.menu.com.cdc_midi_hid_uart=CDC_MIDI_HID_UART -#arduino_zero_edbg.menu.com.cdc_midi_hid_uart.build.board=CDC_MIDI_HID_UART -# arduino_zero_edbg.menu.com.cdc_msd_hid_uart=CDC_MSD_HID_UART -# arduino_zero_edbg.menu.com.cdc_msd_hid_uart.build.board=CDC_MSD_HID_UART -# arduino_zero_edbg.menu.com.cdc_msd_midi_hid_uart=CDC_MSD_MIDI_HID_UART -# arduino_zero_edbg.menu.com.cdc_msd_midi_hid_uart.build.board=CDC_MSD_MIDI_HID_UART -# arduino_zero_edbg.menu.com.msd_uart=MSD_UART -# arduino_zero_edbg.menu.com.msd_uart.build.board=MSD_UART -#arduino_zero_edbg.menu.com.uart=UART_ONLY -#arduino_zero_edbg.menu.com.uart.build.board=UART_ONLY -#arduino_zero_edbg.menu.com.none=USB_UART_DISABLED -#arduino_zero_edbg.menu.com.none.build.board=USB_UART_DISABLED -#arduino_zero_edbg.build.core=arduino -#arduino_zero_edbg.build.extra_flags=-D__SAMD21G18A__ -D__8KB_BOOTLOADER__ {build.usb_flags} -#arduino_zero_edbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld -#arduino_zero_edbg.build.openocdscript=openocd_scripts/arduino_zero.cfg -#arduino_zero_edbg.build.variant=arduino_zero -#arduino_zero_edbg.build.variant_system_lib= -#arduino_zero_edbg.build.vid=0x2341 -#arduino_zero_edbg.build.pid=0x804d -#arduino_zero_edbg.bootloader.tool=arduino:openocd -#arduino_zero_edbg.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21E18A.bin +# MattairTech Core for Arduino M0 / M0 Pro (Autodetect Port) +mzero.name=Arduino M0 / M0 Pro (Autodetect Port) +# M0 Pro (Programming port) +mzero.vid.0=0x03eb +mzero.pid.0=0x2111 +mzero.vid.0.upload.tool=arduino:openocd +mzero.vid.0.upload.use_1200bps_touch=false +mzero.vid.0.upload.wait_for_upload_port=false +mzero.vid.0.upload.native_usb=false +# M0 Pro (Native Port) +mzero.vid.1=0x2a03 +mzero.pid.1=0x004d +mzero.vid.2=0x2a03 +mzero.pid.2=0x804d +mzero.vid.3=0x2a03 +mzero.pid.3=0x004f +mzero.vid.4=0x2a03 +mzero.pid.4=0x804f +mzero.build.vid=0x2a03 +mzero.build.pid=0x804f +# M0 +mzero.vid.5=0x2a03 +mzero.pid.5=0x004e +mzero.vid.5.build.vid=0x2a03 +mzero.vid.5.build.pid=0x804e +mzero.vid.6=0x2a03 +mzero.pid.6=0x804e +mzero.vid.6.build.vid=0x2a03 +mzero.vid.6.build.pid=0x804e +mzero.upload.tool=MattairTech_Arduino:bossac +mzero.upload.protocol=sam-ba +mzero.upload.use_1200bps_touch=true +mzero.upload.wait_for_upload_port=true +mzero.upload.native_usb=true +mzero.build.mcu=cortex-m0plus +mzero.build.f_cpu=48000000L +mzero.build.usb_product="Arduino M0 / M0 Pro" +mzero.build.board=SAM_ZERO +mzero.build.core=arduino +mzero.build.variant=arduino_m0_m0_pro +mzero.build.variant_system_lib= +mzero.menu.clock.crystal_32k=32KHZ_CRYSTAL +mzero.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mzero.menu.clock.internal=INTERNAL +mzero.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mzero.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mzero.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mzero.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags} +mzero.build.ldscript=flash_256KB.ld +mzero.build.openocdscript=openocd_scripts/SAMD21G18A.cfg +mzero.bootloader.file=zero/binaries/sam_m0p_sam_ba_SAMD21G18A.bin +mzero.bootloader.tool=arduino:openocd +mzero.menu.bootloader.16kb=16KB +mzero.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +mzero.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +mzero.menu.bootloader.16kb.upload.maximum_size=245760 +mzero.menu.bootloader.16kb.upload.tool=arduino:avrdude +mzero.menu.bootloader.16kb.upload.protocol=stk500v2 +mzero.menu.bootloader.16kb.upload.speed=57600 +mzero.menu.bootloader.16kb.build.emu.mcu=atmega2560 +mzero.menu.bootloader.8kb=8KB +mzero.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +mzero.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +mzero.menu.bootloader.8kb.upload.maximum_size=253952 +mzero.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac +mzero.menu.bootloader.0kb=NO_BOOTLOADER +mzero.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mzero.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mzero.menu.bootloader.0kb.upload.tool=arduino:openocd +mzero.menu.bootloader.0kb.upload.use_1200bps_touch=false +mzero.menu.bootloader.0kb.upload.wait_for_upload_port=false +mzero.menu.bootloader.0kb.upload.native_usb=false +mzero.menu.bootloader.0kb.upload.maximum_size=262144 +mzero.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mzero.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mzero.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mzero.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mzero.menu.serial.one_uart_two_wire_two_spi=ONE_UART_TWO_WIRE_TWO_SPI +mzero.menu.serial.one_uart_two_wire_two_spi.build.serialcom_uart=ONE_UART +mzero.menu.serial.one_uart_two_wire_two_spi.build.serialcom_wire=TWO_WIRE +mzero.menu.serial.one_uart_two_wire_two_spi.build.serialcom_spi=TWO_SPI +mzero.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +mzero.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mzero.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mzero.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +mzero.menu.serial.two_uart_two_wire_two_spi=TWO_UART_TWO_WIRE_TWO_SPI +mzero.menu.serial.two_uart_two_wire_two_spi.build.serialcom_uart=TWO_UART +mzero.menu.serial.two_uart_two_wire_two_spi.build.serialcom_wire=TWO_WIRE +mzero.menu.serial.two_uart_two_wire_two_spi.build.serialcom_spi=TWO_SPI +mzero.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mzero.menu.serial.no_uart.build.serialcom_uart=NO_UART +mzero.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mzero.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mzero.menu.serial.no_uart_two_wire_two_spi=NO_UART_TWO_WIRE_TWO_SPI +mzero.menu.serial.no_uart_two_wire_two_spi.build.serialcom_uart=NO_UART +mzero.menu.serial.no_uart_two_wire_two_spi.build.serialcom_wire=TWO_WIRE +mzero.menu.serial.no_uart_two_wire_two_spi.build.serialcom_spi=TWO_SPI +mzero.menu.usb.cdc=CDC_ONLY +mzero.menu.usb.cdc.build.usbcom=CDC_ONLY +mzero.menu.usb.cdc_hid=CDC_HID +mzero.menu.usb.cdc_hid.build.usbcom=CDC_HID +mzero.menu.usb.withcdc=WITH_CDC +mzero.menu.usb.withcdc.build.usbcom=WITH_CDC +mzero.menu.usb.hid=HID_ONLY +mzero.menu.usb.hid.build.usbcom=HID_ONLY +mzero.menu.usb.nocdc=WITHOUT_CDC +mzero.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mzero.menu.usb.none=USB_DISABLED +mzero.menu.usb.none.build.usbcom=USB_DISABLED diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_with_4KB_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld similarity index 100% rename from variants/MT_D11/linker_scripts/gcc/SAMD11C14A_with_4KB_bootloader.ld rename to variants/MT_D11/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11C14A_without_bootloader.ld b/variants/MT_D11/linker_scripts/gcc/No_Bootloader/flash_16KB.ld similarity index 100% rename from variants/MT_D11/linker_scripts/gcc/SAMD11C14A_without_bootloader.ld rename to variants/MT_D11/linker_scripts/gcc/No_Bootloader/flash_16KB.ld diff --git a/variants/MT_D11/debug_scripts/SAMD11C14A.gdb b/variants/MT_D21E/debug_scripts/SAMC21E15A.gdb similarity index 92% rename from variants/MT_D11/debug_scripts/SAMD11C14A.gdb rename to variants/MT_D21E/debug_scripts/SAMC21E15A.gdb index ff7008e6e..070351956 100644 --- a/variants/MT_D11/debug_scripts/SAMD11C14A.gdb +++ b/variants/MT_D21E/debug_scripts/SAMC21E15A.gdb @@ -28,4 +28,4 @@ break main # End of 'reset' command end -target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd11c14a" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" +target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samc21e15" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D11/debug_scripts/SAMD11D14AS.gdb b/variants/MT_D21E/debug_scripts/SAMC21E16A.gdb similarity index 91% rename from variants/MT_D11/debug_scripts/SAMD11D14AS.gdb rename to variants/MT_D21E/debug_scripts/SAMC21E16A.gdb index 1daf3ccc2..acabddd1d 100644 --- a/variants/MT_D11/debug_scripts/SAMD11D14AS.gdb +++ b/variants/MT_D21E/debug_scripts/SAMC21E16A.gdb @@ -28,4 +28,4 @@ break main # End of 'reset' command end -target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd11d14as" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" +target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samc21e16" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMC21E17A.gdb b/variants/MT_D21E/debug_scripts/SAMC21E17A.gdb new file mode 100644 index 000000000..4ae2dd669 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMC21E17A.gdb @@ -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 at91samc21e17" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAMC21E18A.gdb b/variants/MT_D21E/debug_scripts/SAMC21E18A.gdb new file mode 100644 index 000000000..2ca3b2cdc --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAMC21E18A.gdb @@ -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 at91samc21e18" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAML21E15B.gdb b/variants/MT_D21E/debug_scripts/SAML21E15B.gdb new file mode 100644 index 000000000..f4cdf835f --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAML21E15B.gdb @@ -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 at91saml21e15" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAML21E16B.gdb b/variants/MT_D21E/debug_scripts/SAML21E16B.gdb new file mode 100644 index 000000000..50e424551 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAML21E16B.gdb @@ -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 at91saml21e16" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAML21E17B.gdb b/variants/MT_D21E/debug_scripts/SAML21E17B.gdb new file mode 100644 index 000000000..29323011f --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAML21E17B.gdb @@ -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 at91saml21e17" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/debug_scripts/SAML21E18B.gdb b/variants/MT_D21E/debug_scripts/SAML21E18B.gdb new file mode 100644 index 000000000..b48a48445 --- /dev/null +++ b/variants/MT_D21E/debug_scripts/SAML21E18B.gdb @@ -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 at91saml21e18" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_16KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_16KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_16KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_16KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_128KB_with_8KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_256KB_with_8KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_32KB_with_8KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_64KB_with_8KB_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_128KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_128KB_without_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_128KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_256KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_256KB_without_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_256KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_32KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_32KB_without_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_32KB.ld diff --git a/variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld b/variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_64KB.ld similarity index 100% rename from variants/MT_D21E/linker_scripts/gcc/flash_64KB_without_bootloader.ld rename to variants/MT_D21E/linker_scripts/gcc/No_Bootloader/flash_64KB.ld diff --git a/variants/MT_D21E/openocd_scripts/SAMC21E15A.cfg b/variants/MT_D21E/openocd_scripts/SAMC21E15A.cfg new file mode 100644 index 000000000..b6b72ccda --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMC21E15A.cfg @@ -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 at91samc21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMC21E16A.cfg b/variants/MT_D21E/openocd_scripts/SAMC21E16A.cfg new file mode 100644 index 000000000..613b357da --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMC21E16A.cfg @@ -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 at91samc21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMC21E17A.cfg b/variants/MT_D21E/openocd_scripts/SAMC21E17A.cfg new file mode 100644 index 000000000..c687b08f0 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMC21E17A.cfg @@ -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 at91samc21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAMC21E18A.cfg b/variants/MT_D21E/openocd_scripts/SAMC21E18A.cfg new file mode 100644 index 000000000..b87fb0116 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAMC21E18A.cfg @@ -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 at91samc21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAML21E15B.cfg b/variants/MT_D21E/openocd_scripts/SAML21E15B.cfg new file mode 100644 index 000000000..82fbb0650 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAML21E15B.cfg @@ -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 at91saml21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAML21E16B.cfg b/variants/MT_D21E/openocd_scripts/SAML21E16B.cfg new file mode 100644 index 000000000..c74f6102a --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAML21E16B.cfg @@ -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 at91saml21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAML21E17B.cfg b/variants/MT_D21E/openocd_scripts/SAML21E17B.cfg new file mode 100644 index 000000000..3b844e436 --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAML21E17B.cfg @@ -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 at91saml21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E/openocd_scripts/SAML21E18B.cfg b/variants/MT_D21E/openocd_scripts/SAML21E18B.cfg new file mode 100644 index 000000000..4e7a27fde --- /dev/null +++ b/variants/MT_D21E/openocd_scripts/SAML21E18B.cfg @@ -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 at91saml21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/arduino_zero/debug_scripts/SAMC21G15A.gdb b/variants/arduino_zero/debug_scripts/SAMC21G15A.gdb new file mode 100644 index 000000000..f818c9bbe --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMC21G15A.gdb @@ -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 at91samc21g15" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAMC21G16A.gdb b/variants/arduino_zero/debug_scripts/SAMC21G16A.gdb new file mode 100644 index 000000000..5c258d3ac --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMC21G16A.gdb @@ -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 at91samc21g16" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAMC21G17A.gdb b/variants/arduino_zero/debug_scripts/SAMC21G17A.gdb new file mode 100644 index 000000000..0387ce888 --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMC21G17A.gdb @@ -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 at91samc21g17" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAMC21G18A.gdb b/variants/arduino_zero/debug_scripts/SAMC21G18A.gdb new file mode 100644 index 000000000..1d0b9d1c0 --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMC21G18A.gdb @@ -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 at91samc21g18" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAMD21G15A.gdb b/variants/arduino_zero/debug_scripts/SAMD21G15A.gdb new file mode 100644 index 000000000..f8b1d04e3 --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMD21G15A.gdb @@ -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 at91samd21g15" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAMD21G16A.gdb b/variants/arduino_zero/debug_scripts/SAMD21G16A.gdb new file mode 100644 index 000000000..2f9de5a98 --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMD21G16A.gdb @@ -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 at91samd21g16" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAMD21G17A.gdb b/variants/arduino_zero/debug_scripts/SAMD21G17A.gdb new file mode 100644 index 000000000..be4c3e9ab --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAMD21G17A.gdb @@ -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 at91samd21g17" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/variant.gdb b/variants/arduino_zero/debug_scripts/SAMD21G18A.gdb similarity index 100% rename from variants/arduino_zero/debug_scripts/variant.gdb rename to variants/arduino_zero/debug_scripts/SAMD21G18A.gdb diff --git a/variants/arduino_zero/debug_scripts/SAML21G16B.gdb b/variants/arduino_zero/debug_scripts/SAML21G16B.gdb new file mode 100644 index 000000000..d229f8f0c --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAML21G16B.gdb @@ -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 at91saml21g16" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAML21G17B.gdb b/variants/arduino_zero/debug_scripts/SAML21G17B.gdb new file mode 100644 index 000000000..f67cdcb2f --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAML21G17B.gdb @@ -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 at91saml21g17" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/debug_scripts/SAML21G18B.gdb b/variants/arduino_zero/debug_scripts/SAML21G18B.gdb new file mode 100644 index 000000000..b5230803b --- /dev/null +++ b/variants/arduino_zero/debug_scripts/SAML21G18B.gdb @@ -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 at91saml21g18" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..497c7d1ac --- /dev/null +++ b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00020000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..3bded2906 --- /dev/null +++ b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00040000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld similarity index 97% rename from variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld rename to variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld index f85765ef4..9f4943b59 100644 --- a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_without_bootloader.ld +++ b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld @@ -25,7 +25,7 @@ */ MEMORY { - FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00008000-0x4000 /* First 16KB used by bootloader */ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 } diff --git a/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..c578a262e --- /dev/null +++ b/variants/arduino_zero/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00010000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld similarity index 96% rename from variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld rename to variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld index 984eb4113..234181a93 100644 --- a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_with_4KB_bootloader.ld +++ b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld @@ -25,8 +25,8 @@ */ MEMORY { - FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00020000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 } /* Linker script to place sections and symbol values. Should be used together diff --git a/variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld similarity index 100% rename from variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld rename to variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld similarity index 97% rename from variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld rename to variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld index 984eb4113..418992b15 100644 --- a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AS_with_4KB_bootloader.ld +++ b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld @@ -25,7 +25,7 @@ */ MEMORY { - FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00008000-0x2000 /* First 8KB used by bootloader */ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 } diff --git a/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..e0313532a --- /dev/null +++ b/variants/arduino_zero/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld @@ -0,0 +1,212 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00010000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_128KB.ld b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..fc8be6591 --- /dev/null +++ b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_128KB.ld @@ -0,0 +1,213 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_256KB.ld similarity index 100% rename from variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld rename to variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_256KB.ld diff --git a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_32KB.ld similarity index 97% rename from variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld rename to variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_32KB.ld index f85765ef4..8c0eea088 100644 --- a/variants/MT_D11/linker_scripts/gcc/SAMD11D14AM_without_bootloader.ld +++ b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_32KB.ld @@ -25,7 +25,7 @@ */ MEMORY { - FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 } @@ -58,6 +58,7 @@ MEMORY * __StackLimit * __StackTop * __stack + * __ram_end__ */ ENTRY(Reset_Handler) @@ -201,7 +202,7 @@ SECTIONS /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ - __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; __StackLimit = __StackTop - SIZEOF(.stack_dummy); PROVIDE(__stack = __StackTop); diff --git a/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_64KB.ld b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..6b0d2a661 --- /dev/null +++ b/variants/arduino_zero/linker_scripts/gcc/No_Bootloader/flash_64KB.ld @@ -0,0 +1,213 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/arduino_zero/openocd_scripts/SAMC21G15A.cfg b/variants/arduino_zero/openocd_scripts/SAMC21G15A.cfg new file mode 100644 index 000000000..10c51c4db --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAMC21G15A.cfg @@ -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 at91samc21g15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/arduino_zero/openocd_scripts/SAMC21G16A.cfg b/variants/arduino_zero/openocd_scripts/SAMC21G16A.cfg new file mode 100644 index 000000000..ffb0146b7 --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAMC21G16A.cfg @@ -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 at91samc21g16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/arduino_zero/openocd_scripts/SAMC21G17A.cfg b/variants/arduino_zero/openocd_scripts/SAMC21G17A.cfg new file mode 100644 index 000000000..5066d74c6 --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAMC21G17A.cfg @@ -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 at91samc21g17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/arduino_zero/openocd_scripts/SAMC21G18A.cfg b/variants/arduino_zero/openocd_scripts/SAMC21G18A.cfg new file mode 100644 index 000000000..2946d9391 --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAMC21G18A.cfg @@ -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 at91samc21g18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D11/openocd_scripts/SAMD11C14A.cfg b/variants/arduino_zero/openocd_scripts/SAMD21G15A.cfg similarity index 97% rename from variants/MT_D11/openocd_scripts/SAMD11C14A.cfg rename to variants/arduino_zero/openocd_scripts/SAMD21G15A.cfg index 2e1525a73..e5d7eb8bb 100644 --- a/variants/MT_D11/openocd_scripts/SAMD11C14A.cfg +++ b/variants/arduino_zero/openocd_scripts/SAMD21G15A.cfg @@ -21,7 +21,7 @@ source [find interface/cmsis-dap.cfg] # chip name -set CHIPNAME at91samd11c14a +set CHIPNAME at91samd21g15 set ENDIAN little # choose a port here diff --git a/variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg b/variants/arduino_zero/openocd_scripts/SAMD21G16A.cfg similarity index 97% rename from variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg rename to variants/arduino_zero/openocd_scripts/SAMD21G16A.cfg index 2b1d4c72f..677c80012 100644 --- a/variants/MT_D11/openocd_scripts/SAMD11D14AS.cfg +++ b/variants/arduino_zero/openocd_scripts/SAMD21G16A.cfg @@ -21,7 +21,7 @@ source [find interface/cmsis-dap.cfg] # chip name -set CHIPNAME at91samd11d14as +set CHIPNAME at91samd21g16 set ENDIAN little # choose a port here diff --git a/variants/arduino_zero/openocd_scripts/SAMD21G17A.cfg b/variants/arduino_zero/openocd_scripts/SAMD21G17A.cfg new file mode 100644 index 000000000..68641e118 --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAMD21G17A.cfg @@ -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 at91samd21g17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/arduino_zero/openocd_scripts/arduino_zero.cfg b/variants/arduino_zero/openocd_scripts/SAMD21G18A.cfg similarity index 100% rename from variants/arduino_zero/openocd_scripts/arduino_zero.cfg rename to variants/arduino_zero/openocd_scripts/SAMD21G18A.cfg diff --git a/variants/arduino_zero/openocd_scripts/SAML21G16B.cfg b/variants/arduino_zero/openocd_scripts/SAML21G16B.cfg new file mode 100644 index 000000000..c5ef10770 --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAML21G16B.cfg @@ -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 at91saml21g16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/arduino_zero/openocd_scripts/SAML21G17B.cfg b/variants/arduino_zero/openocd_scripts/SAML21G17B.cfg new file mode 100644 index 000000000..48ad58a4d --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAML21G17B.cfg @@ -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 at91saml21g17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/arduino_zero/openocd_scripts/SAML21G18B.cfg b/variants/arduino_zero/openocd_scripts/SAML21G18B.cfg new file mode 100644 index 000000000..0a162e7f5 --- /dev/null +++ b/variants/arduino_zero/openocd_scripts/SAML21G18B.cfg @@ -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 at91saml21g18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] From 472e3a4706eb47395e5b040f4e14636fd38cbaa5 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 6 Mar 2017 02:31:41 +0000 Subject: [PATCH 083/124] Minor changes to bootloader --- bootloaders/zero/Makefile | 7 ++++--- bootloaders/zero/board_definitions.h | 5 +++++ bootloaders/zero/sam_ba_usb.c | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index f67ebdb33..62bef31ac 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -26,22 +26,23 @@ MCU?=SAMD21E18A # Size of FLASH: 16KB, 32KB, 64KB, 128KB, 256KB FLASHSIZE?=256KB +# The rest of this Config is optional ######## + ifeq ($(FLASHSIZE),16KB) # set to 0 when building a 4KB bootloader ARDUINO_EXTENDED_CAPABILITIES_MK?=0 # set to only one interface when building a 4KB bootloader SAM_BA_INTERFACE_MK?=SAM_BA_USBCDC_ONLY else -# set to 0 when building a 4KB bootloader ARDUINO_EXTENDED_CAPABILITIES_MK?=1 -# set to only one interface when building a 4KB bootloader SAM_BA_INTERFACE_MK?=SAM_BA_BOTH_INTERFACES endif LINKER_SCRIPT?=bootloader_sam_m0p_$(FLASHSIZE).ld # MattairTech SAM M0+ Boards (PID == 0x0557) -CFLAGS_EXTRA?=-D__$(MCU)__ -DUSB_PID_HIGH=0x05 -DUSB_PID_LOW=0x57 -DUSB_VID_LOW=0xD0 -DUSB_VID_HIGH=0x16 -DARDUINO_EXTENDED_CAPABILITIES=$(ARDUINO_EXTENDED_CAPABILITIES_MK) -DSAM_BA_INTERFACE=$(SAM_BA_INTERFACE_MK) +CFLAGS_EXTRA?=-D__$(MCU)__ -DUSB_PID_HIGH=0x05 -DUSB_PID_LOW=0x57 -DUSB_VID_LOW=0xD0 -DUSB_VID_HIGH=0x16 +CFLAGS_EXTRA+=-DARDUINO_EXTENDED_CAPABILITIES=$(ARDUINO_EXTENDED_CAPABILITIES_MK) -DSAM_BA_INTERFACE=$(SAM_BA_INTERFACE_MK) '-DSTRING_MANUFACTURER="MattairTech LLC"' '-DSTRING_PRODUCT="M0+ Boards"' # Arduino Zero (PID == 0x004D) # CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x4D -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23 diff --git a/bootloaders/zero/board_definitions.h b/bootloaders/zero/board_definitions.h index f40a7f51d..667098c47 100644 --- a/bootloaders/zero/board_definitions.h +++ b/bootloaders/zero/board_definitions.h @@ -58,8 +58,13 @@ /* * LEDs definitions */ +#if defined(__SAMD11D14AM__) || defined(__SAMD11C14A__) || defined(__SAMD11D14AS__) +#define BOARD_LED_PORT (0) +#define BOARD_LED_PIN (16) +#else #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (28) +#endif #define BOARD_LEDRX_PORT (0) #define BOARD_LEDRX_PIN (28) diff --git a/bootloaders/zero/sam_ba_usb.c b/bootloaders/zero/sam_ba_usb.c index 2913b9d44..8b71bb5f4 100644 --- a/bootloaders/zero/sam_ba_usb.c +++ b/bootloaders/zero/sam_ba_usb.c @@ -205,13 +205,13 @@ void sam_ba_usb_CDC_Enumerate(P_USB_CDC pCdc) else { #if 0 // TODO: pending validation + uint16_t STRING_LANGUAGE[2] = { (STD_GET_DESCRIPTOR_STRING<<8) | 4, 0x0409 }; + if (wValue>>8 == STD_GET_DESCRIPTOR_STRING) { switch ( wValue & 0xff ) { case STRING_INDEX_LANGUAGES: - uint16_t STRING_LANGUAGE[2] = { (STD_GET_DESCRIPTOR_STRING<<8) | 4, 0x0409 }; - USB_Write(pCdc->pUsb, (const char*)STRING_LANGUAGE, SAM_BA_MIN(sizeof(STRING_LANGUAGE), wLength), USB_EP_CTRL); break; From a09e683578f2b5b78f0e5bd59d9a396a7a0d759c Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 6 Mar 2017 02:32:25 +0000 Subject: [PATCH 084/124] Add udev rules for Linux. Minor doc update. --- README.md | 259 ++++++++++++++++++--------- drivers/99-mattairtech-USB-CDC.rules | 20 +++ 2 files changed, 196 insertions(+), 83 deletions(-) create mode 100644 drivers/99-mattairtech-USB-CDC.rules diff --git a/README.md b/README.md index c28be7758..c96ae83c5 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then cl ## What's New Beta (1.6.7-beta) * 1.6.7-beta-b0: - * OS X support added (bossac for OS X can now upload to all supported chips) (Thanks @joseangeljimenez for testing) + * OS X support added (bossac can now upload to all supported chips) (Thanks @joseangeljimenez for testing) * New bossac upload tool (added support for SAML and SAMC) * New bootloader from upstream SAMD CORE (see bootloaders/zero/README.md) * New beta release method (see README.md) @@ -150,6 +150,78 @@ BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | ------------------- ``` +# MattairTech MT-D21J (ATsamX21JXXX) + +``` +============================= MattairTech MT-D21J (ATsamX21JXXX) ======================== +Other COM PWM Analog INT Arduino* Arduino* INT Analog PWM COM Other +========================================================================================= + ------------------- + Board Variant: | (no external pin) | + B=Basic, S=Standard, A=Advanced | |-- B3 | 49 I O VBAT(L)/SDCD(+B) + M=Memory device installed | |-- B5 | 48 I INT1(+B) + | |-- B4 | 47 3SEN(+B) + | | +XBDS(B) O 0 | B0 RST | BOOT(+B) +MECS(+M) O 1 | B1 A31 | 31 RX1 SWDIO/XBDO(+B) +DAC0 O I 2 | A2 A30 | 30 SWDCLK(+B) +REFA(B) O 3 | A3 A28(D/C)| 28 SHCS(D/C) +3SVO(S)/REFB O 4 | A4 A27 | 27 I INT2 +DAC1(L) O 5 | A5 X34 (B2)| 34 O TC60~ LED(+B)/XBRT +CMVO(A) O 6 | B6 X33(B16)| 33 I INT0(+B)/BTN +ASEN(+A) O 7 | B7 X32(B17)| 32 I TC61~ MOPS(+S) + TX3 O I 8 | B8 A23 | 23 TC41~ + RX3 O I 9 | B9 A22 | 22 TC40~ +VHDV(A) MOSI1 O I 10 | A10 A21 | 21 TC71~ +VBDV(+A) SCK1 O I 11 | A11 A20 | 20 I TC70~ +XBCT(B) SDA1/MISO1 TCC20 I 12 | A12 A19 | 19 TC31~ CMRI(S) + SCL1/SS1 TCC21 I 13 | A13 A18 | 18 TC30~ TX1 XBDI(+B) +HSEN(A) TC50~ I 14 | B14 A17 | 17 SCL SCL(+B) +BKFS(+A) TC51~ 15 | B15 A16 | 16 SDA SDA(+B) + | Vaux 3.3V | +USB D- (D/L)+B, CAN TX (C) | A24 _____ VccL | ! VccL is 3.3V by default. +USB D+ (D/L)+B, CAN RX (C) | A25 | | VccH | DO NOT exceed 3.6V on VccL or + | Gnd | USB | Gnd | on any IO pin with the D21 or + Chip Variant: ------------------- L21 installed. 5V is allowed + D=D21, L=L21, C=C21 ONLY with the C21 installed. + 1------------------- By default, VccH is 5V. +MISO(+B) 43 | B30 Vcon | +SCK(+B) 44 | B23 SPI B22 | 45 MOSI(+B) +SHCS(D/C) or (SDCS(+B)) 28(46)| A28(B31) Gnd | + ------------------- + + 1------------------- +LVL_SHIFT_0(+S) TX2 O I 35 | A6 A7 | 36 I O RX2 LVL_SHIFT_1(+S) +LVL_SHIFT_2(+S) TCC12 O NMI 37 | A8 LEVEL A9 | 38 O TCC13 LVL_SHIFT_3(+S) + | VccH SHIFT VccH | + | Gnd Gnd | +MOTOR_BOUT1(+S) TCC04 39 | B10 B11 | 40 TCC05 MOTOR_BOUT2(+S) +MOTOR_AOUT1(+S) TCC06 41 | B12 MOTOR B13 | 42 TCC07 MOTOR_AOUT2(+S) + | Vmotor Gnd | + ------------------- + +* Most pins can be used for more than one function. The same port pin number printed on + the board is also used in Arduino (without the 'A') for all of the supported functions + (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). + +* Different variants have different hardware installed onboard. The alternate functions + column shows for which board variant(s) the associated hardware is installed: B=Basic, + S=Standard, A=Advanced, and M=Memory device installed. The Advanced variant has all of + the hardware that the Standard and Basic have installed, and the Standard variant has + all of the Basic hardware. + ++ This function is enabled by default depending on the variant indicated by the letter. + Thus, the associated header pin cannot be used. In most cases (except most +A pins), + solder jumpers can be used to enable or disable the alternate onboard function. + +~ TC3, TC4, TC5, TC6, and TC7 on the D21 are instead + TC4, TC0, TC1, TC2, and TC3 respectively on the L21 and C21. + +Silkscreen Legend: + Top: A circle around pin is analog function, '~' is timer, small 'I' is interrupt + Bottom: A box around pin means 'Other' function enabled by default depending on variant +``` + #### All pins operate at 3.3 volts. DO NOT connect voltages higher than 3.3V! ### Pin Capabilities @@ -294,11 +366,13 @@ Vista, 7, 8, and 10. #### Linux 0. No driver installation is needed. -1. On some distros, you may need to add your user to the same group as the port (ie: dialout) and/or set udev rules. +1. On some distros, you may need to add your user to the same group as the port (ie: dialout) or set udev rules: + * See the file https://github.com/mattairtech/ArduinoCore-samd/tree/master/drivers/99-mattairtech-USB-CDC.rules. 2. You MAY have to install and use Arduino as the root user in order to get reliable access to the serial port. * This is true even when group permissions are set correctly, and it may fail after previously working. * You can also create/modify a udev rule to set permissions on the port so *everyone* can read / write. -3. Continue with SAM M0+ Core Installation below. +3. If you are running modemmanager (ie: Ubuntu), disable it, or use the udev rules file above. +4. Continue with SAM M0+ Core Installation below. #### OS X @@ -454,86 +528,105 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## New PinDescription Table -``` -/* The PinDescription table describes how each of the pins can be used by the Arduino - * core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, - * communications, etc.), and the PinDescription table configures which functions can - * be used for each pin. This table is mainly accessed by the pinPeripheral function in - * wiring_private.c, which is used to attach a pin to a particular peripheral function. - * The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), - * analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to - * verify that the pin can perform the function requested, and to configure the pin for - * that function. Most of the contents of pinMode() are now in pinPeripheral(). - * - * There are two ways that pins can be mapped. The first is to map pins contiguously - * (no PIO_NOT_A_PIN entries) in the table. This results in the least amount of space - * used by the table. A second method, used by default by the MT-D21E and MT-D11, maps - * Arduino pin numbers to the actual port pin number (ie: Arduino pin 28 = Port A28). - * This only works when there is one port. Because not all port pins are available, - * PIO_NOT_A_PIN entries must be added for these pins and more FLASH space is consumed. - * For an example of both types, see variant.cpp from the MT-D11 variant. - * - * Explanation of PinDescription table: - * - * Port This is the port (ie: PORTA). - * Pin This is the pin (bit) within the port. Valid values are 0-31. - * PinType This indicates what peripheral function the pin can be - * attached to. In most cases, this is PIO_MULTI, which means - * that the pin can be anything listed in the PinAttribute field. - * It can also be set to a specific peripheral. In this case, any - * attempt to configure the pin (using pinPeripheral or pinMode) - * as anything else will fail (and pinPeripheral will return -1). - * This can be used to prevent accidental re-configuration of a - * pin that is configured for only one function (ie: USB D- and - * D+ pins). If a pin is not used or does not exist, - * PIO_NOT_A_PIN must be entered in this field. See WVariant.h - * for valid entries. These entries are also used as a parameter - * to pinPeripheral() with the exception of PIO_NOT_A_PIN and - * PIO_MULTI. The pinMode function now calls pinPeripheral() with - * the desired mode. Note that this field is not used to select - * between the two peripherals possible with each of the SERCOM - * and TIMER functions. PeripheralAttribute is now used for this. - * PeripheralAttribute This is an 8-bit bitfield used for various peripheral - * configuration. It is primarily used to select between the two - * peripherals possible with each of the SERCOM and TIMER - * functions. TIMER pins are individual, while SERCOM uses a - * group of two to four pins. This group of pins can span both - * peripherals. For example, pin 19 (SPI1 SCK) on the MT-D21E - * uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses - * PER_ATTR_SERCOM_STD. Both TIMER and SERCOM can exist for each - * pin. This bitfield is also used to set the pin drive strength. - * In the future, other attributes (like input buffer - * configuration) may be added. See WVariant.h for valid entries. - * PinAttribute This is a 32-bit bitfield used to list all of the valid - * peripheral functions that a pin can attach to. This includes - * GPIO functions like PIN_ATTR_OUTPUT. Certain attributes are - * shorthand for a combination of other attributes. - * PIN_ATTR_DIGITAL includes all of the GPIO functions, while - * PIN_ATTR_TIMER includes both PIN_ATTR_TIMER_PWM and - * PIN_ATTR_TIMER_CAPTURE (capture is not used yet). - * PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. There is - * only one DAC channel, so PIN_ATTR_DAC appears only once. This - * bitfield is useful for limiting a pin to only input related - * functions or output functions. This allows a pin to have a - * more flexible configuration, while restricting the direction - * (ie: to avoid contention). See WVariant.h for valid entries. - * TCChannel This is the TC(C) channel (if any) assigned to the pin. Some - * TC channels are available on multiple pins (ie: TCC0/WO[0] is - * available on pin A4 or pin A8 on the MT-D21E). In general, - * only one pin should be configured (in the pinDescription - * table) per TC channel. See WVariant.h for valid entries. - * The tone library uses TC5 (MT-D21E) or TC2 (MT-D11). - * ADCChannelNumber This is the ADC channel (if any) assigned to the pin. See - * WVariant.h for valid entries. - * ExtInt This is the interrupt (if any) assigned to the pin. Some - * interrupt numbers are available on multiple pins (ie: - * EIC/EXTINT[2] is available on pin A2 or pin A18 on the - * MT-D21E). In general, only one pin should be configured (in - * the pinDescription table) per interrupt number. Thus, if an - * interrupt was needed on pin 2, EXTERNAL_INT_2 can be moved - * from pin 18. See WVariant.h for valid entries. - */ -``` +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +### Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +### Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +### See WVariant.h in cores/arduino for the definitions used in the table. + +#### Port: +This is the port (ie: PORTA). + +#### Pin: +This is the pin (bit) within the port. Valid values are 0-31. + +#### PinType: +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +#### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +#### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +#### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +#### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +#### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +#### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). ## Possible Future Additions diff --git a/drivers/99-mattairtech-USB-CDC.rules b/drivers/99-mattairtech-USB-CDC.rules new file mode 100644 index 000000000..2719bc888 --- /dev/null +++ b/drivers/99-mattairtech-USB-CDC.rules @@ -0,0 +1,20 @@ +# udev rules for USB CDC devices on MattairTech development boards +# +# Copy this file to the location of your distribution's udev rules, for example on Ubuntu: +# sudo cp 99-mattairtech-USB-CDC.rules /etc/udev/rules.d/ +# Then reload udev configuration by executing: +# sudo reload udev +# Or if that doesn't work try: +# sudo udevadm control --reload-rules +# sudo udevadm trigger + +# Rule to access MattairTech USB CDC devices without running Arduino as root. +# Should work as-is for Ubuntu. Other distributions might need to change +# GROUP="dialout" to another group (ie: "users"). +SUBSYSTEM=="usb", ATTR{idProduct}=="0557", ATTRS{idVendor}=="16D0", MODE="0660", GROUP="dialout" +SUBSYSTEM=="usb", ATTR{idProduct}=="0856", ATTRS{idVendor}=="16D0", MODE="0660", GROUP="dialout" +SUBSYSTEM=="usb", ATTR{idProduct}=="0B41", ATTRS{idVendor}=="16D0", MODE="0660", GROUP="dialout" + +# Rule to blacklist MattairTech USB CDC devices from being manipulated by ModemManager. +# Fixes issue with hanging references to /dev/ttyACM* devices. +ATTRS{idVendor}=="16D0", ENV{ID_MM_DEVICE_IGNORE}="1" From 1f06c856ffd4e629f595f489f124379454e41a2d Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Wed, 5 Apr 2017 08:52:54 +0000 Subject: [PATCH 085/124] Added MT-D21E Rev B variant --- variants/MT_D21E_revB/README.md | 198 ++++++++++++ .../MT_D21E_revB/debug_scripts/SAMC21E15A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMC21E16A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMC21E17A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMC21E18A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMD21E15A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMD21E16A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMD21E17A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAMD21E18A.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAML21E15B.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAML21E16B.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAML21E17B.gdb | 31 ++ .../MT_D21E_revB/debug_scripts/SAML21E18B.gdb | 31 ++ .../gcc/16KB_Bootloader/flash_128KB.ld | 217 +++++++++++++ .../gcc/16KB_Bootloader/flash_256KB.ld | 217 +++++++++++++ .../gcc/16KB_Bootloader/flash_32KB.ld | 217 +++++++++++++ .../gcc/16KB_Bootloader/flash_64KB.ld | 217 +++++++++++++ .../gcc/8KB_Bootloader/flash_128KB.ld | 217 +++++++++++++ .../gcc/8KB_Bootloader/flash_256KB.ld | 217 +++++++++++++ .../gcc/8KB_Bootloader/flash_32KB.ld | 217 +++++++++++++ .../gcc/8KB_Bootloader/flash_64KB.ld | 217 +++++++++++++ .../gcc/No_Bootloader/flash_128KB.ld | 214 ++++++++++++ .../gcc/No_Bootloader/flash_256KB.ld | 214 ++++++++++++ .../gcc/No_Bootloader/flash_32KB.ld | 214 ++++++++++++ .../gcc/No_Bootloader/flash_64KB.ld | 214 ++++++++++++ .../openocd_scripts/SAMC21E15A.cfg | 30 ++ .../openocd_scripts/SAMC21E16A.cfg | 30 ++ .../openocd_scripts/SAMC21E17A.cfg | 30 ++ .../openocd_scripts/SAMC21E18A.cfg | 30 ++ .../openocd_scripts/SAMD21E15A.cfg | 30 ++ .../openocd_scripts/SAMD21E16A.cfg | 30 ++ .../openocd_scripts/SAMD21E17A.cfg | 30 ++ .../openocd_scripts/SAMD21E18A.cfg | 30 ++ .../openocd_scripts/SAML21E15B.cfg | 30 ++ .../openocd_scripts/SAML21E16B.cfg | 30 ++ .../openocd_scripts/SAML21E17B.cfg | 30 ++ .../openocd_scripts/SAML21E18B.cfg | 30 ++ variants/MT_D21E_revB/pins_arduino.h | 21 ++ variants/MT_D21E_revB/variant.cpp | 160 +++++++++ variants/MT_D21E_revB/variant.h | 306 ++++++++++++++++++ 40 files changed, 4009 insertions(+) create mode 100644 variants/MT_D21E_revB/README.md create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMC21E15A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMC21E16A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMC21E17A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMC21E18A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMD21E15A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMD21E16A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMD21E17A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAMD21E18A.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAML21E15B.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAML21E16B.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAML21E17B.gdb create mode 100644 variants/MT_D21E_revB/debug_scripts/SAML21E18B.gdb create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_128KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_256KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_32KB.ld create mode 100644 variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_64KB.ld create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMC21E15A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMC21E16A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMC21E17A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMC21E18A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMD21E15A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMD21E16A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMD21E17A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAMD21E18A.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAML21E15B.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAML21E16B.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAML21E17B.cfg create mode 100644 variants/MT_D21E_revB/openocd_scripts/SAML21E18B.cfg create mode 100644 variants/MT_D21E_revB/pins_arduino.h create mode 100644 variants/MT_D21E_revB/variant.cpp create mode 100644 variants/MT_D21E_revB/variant.h diff --git a/variants/MT_D21E_revB/README.md b/variants/MT_D21E_revB/README.md new file mode 100644 index 000000000..eff1831c0 --- /dev/null +++ b/variants/MT_D21E_revB/README.md @@ -0,0 +1,198 @@ +# MattairTech MT-D21E (rev B) (ATSAMx21Exxx) + +``` +========================== MattairTech MT-D21E rev B (ATSAMx21Exxx) ===================== +Other COM PWM Analog INT Arduino* Arduino* INT PWM COM Other +========================================================================================= + ------------------- +XI32(+) | A0 RST | BOOT(+) +XO32(+) | A1 Gnd | +DAC * 2 | A2 Vbat | +REFA * 3 | A3 A31 | 31 * IO/B(+) +REFB * * 4 | A4 A30 | 30 * CLK(+) +DAC1(L) * * 5 | A5 NC | +LED(+) TCC10 * 6 | A6 A28 (D/C)| 28 * +VM TCC11 * 7 | A7 A27 | 27 * A/CS(+M) + TCC00 * NMI 8 | A8 A23 | 23 * TC41/TC01~ SS + TCC01 * * 9 | A9 A22 | 22 * TC40/TC00~ MISO(+M) + TX1 TCC02 * 10 | A10 A19 | 19 * SCK(+M) + RX1 TCC03 * 11 | A11 A18 | 18 * MOSI(+M) + TX2 TC30/TC40~ * 14 | A14 A17 | 17 * TCC21 SCL(+) + RX2 TC31/TC41~ 15 | A15 A16 | 16 * TCC20 SDA(+) + | NC NC | + M=Memory device installed | NC NC | ! Vcc is 3.3V by default. + | Vbus 3.3V| DO NOT exceed 3.6V on Vcc or +USB D- (D/L)(+), CAN TX (C) TC50 24 | A24 _____ Vcc | any IO pin with the D21 or +USB D+ (D/L)(+), CAN RX (C) TC51 25 | A25 | | Vin | L21 installed. 5V is allowed + | Gnd | USB | Gnd | ONLY with the C21 installed. + Chip Variant: ------------------- + D=D21, L=L21, C=C21 + +* Most pins can be used for more than one function. The same port pin number printed on + the board is also used in Arduino (without the 'A') for all of the supported functions + (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). + ++ This alternate function is enabled by default (+M functions enabled only when a memory + device is installed). Thus, the associated header pin cannot be used. Solder jumpers + can be used to enable or disable the alternate onboard function. + +~ When two timers are shown, the second is for L21/C21. TC5 is TC1 on the L21/C21. + +Silkscreen Legend: + Top: A circled pin means analog function and '*' means alternate function (see + above) + Bottom: A circled pin means analog function +``` + + +# Pins descriptions for the MattairTech MT-D21E (rev B) +============================================================================================================================================ +Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | A0 | PA00 | Xin32 | Xin32 +1 | A1 | PA01 | Xout32 | Xout32 +2 | A2 | PA02 | DAC0 | !EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +3 | A3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +4 | A4 | PA04 | REFB | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[0] !TCC0/WO[0] +5 | A5 | PA05 | DAC1(L21) | EIC/EXTINT[5] ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] DAC1(L21) +6 | A6 | PA06 | LED | !EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] LED +7 | A7 | PA07 | Voltage Measurement | !EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] +8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] +9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] +10 | A10 | PA10 | TX1 | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] +11 | A11 | PA11 | RX1 | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] +12 | --- | ---- | NOT A PIN | NOT A PIN +13 | --- | ---- | NOT A PIN | NOT A PIN +14 | A14 | PA14 | Xin, TX2 | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE +15 | A15 | PA15 | Xout, RX2 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout +16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] +17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] +18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] +19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] +20 | --- | ---- | NOT A PIN | NOT A PIN +21 | --- | ---- | NOT A PIN | NOT A PIN +22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] +23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] +24 | A24- | PA24 | USB_NEGATIVE | USB/DM TC5/WO[0] +25 | A25+ | PA25 | USB_POSITIVE | USB/DP TC5/WO[1] +26 | --- | ---- | NOT A PIN | NOT A PIN +27 | A27 | PA27 | A/CS | EIC/EXTINT[15] A/CS (Jumper A / memory device chip select) +28 | A28 | PA28 | | EIC/EXTINT[8] +29 | --- | ---- | NOT A PIN | NOT A PIN +30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] TCC1/WO[0] SWD CLK, leave floating during boot +31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO +-- | RST | ---- | | Reset, BOOT (double tap bootloader entry) +============================================================================================================================================ + +* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') + for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). + +* The following Arduino pin numbers are not mapped to a physical pin: 12, 13, 20, 21, 26, and 29. + +* Pins 24 and 25 are by default in use by USB (USB_NEGATIVE and USB_POSITIVE). TC5(D21) is available on these pins otherwise. + The tone library uses TC5. + +* A0 and A1 are by default connected to the 32.768KHz crystal. + + + +# PinDescription table format + +## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +## Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +## Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +## See WVariant.h in cores/arduino for the definitions used in the table. + +### Port: +This is the port (ie: PORTA). + +### Pin: +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType: +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/MT_D21E_revB/debug_scripts/SAMC21E15A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMC21E15A.gdb new file mode 100644 index 000000000..070351956 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMC21E15A.gdb @@ -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 at91samc21e15" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMC21E16A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMC21E16A.gdb new file mode 100644 index 000000000..acabddd1d --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMC21E16A.gdb @@ -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 at91samc21e16" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMC21E17A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMC21E17A.gdb new file mode 100644 index 000000000..4ae2dd669 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMC21E17A.gdb @@ -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 at91samc21e17" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMC21E18A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMC21E18A.gdb new file mode 100644 index 000000000..2ca3b2cdc --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMC21E18A.gdb @@ -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 at91samc21e18" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMD21E15A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMD21E15A.gdb new file mode 100644 index 000000000..4ae3c04f0 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMD21E15A.gdb @@ -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 at91samd21e15" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMD21E16A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMD21E16A.gdb new file mode 100644 index 000000000..eb114b493 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMD21E16A.gdb @@ -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 at91samd21e16" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMD21E17A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMD21E17A.gdb new file mode 100644 index 000000000..cb1c7c44e --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMD21E17A.gdb @@ -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 at91samd21e17" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAMD21E18A.gdb b/variants/MT_D21E_revB/debug_scripts/SAMD21E18A.gdb new file mode 100644 index 000000000..13ee2a173 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAMD21E18A.gdb @@ -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 at91samd21e18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAML21E15B.gdb b/variants/MT_D21E_revB/debug_scripts/SAML21E15B.gdb new file mode 100644 index 000000000..f4cdf835f --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAML21E15B.gdb @@ -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 at91saml21e15" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAML21E16B.gdb b/variants/MT_D21E_revB/debug_scripts/SAML21E16B.gdb new file mode 100644 index 000000000..50e424551 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAML21E16B.gdb @@ -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 at91saml21e16" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAML21E17B.gdb b/variants/MT_D21E_revB/debug_scripts/SAML21E17B.gdb new file mode 100644 index 000000000..29323011f --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAML21E17B.gdb @@ -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 at91saml21e17" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/debug_scripts/SAML21E18B.gdb b/variants/MT_D21E_revB/debug_scripts/SAML21E18B.gdb new file mode 100644 index 000000000..b48a48445 --- /dev/null +++ b/variants/MT_D21E_revB/debug_scripts/SAML21E18B.gdb @@ -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 at91saml21e18" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..c541d8cd0 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00020000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..a0b9f951f --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00040000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld new file mode 100644 index 000000000..5d8d047a9 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00008000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..3f7223790 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00010000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..07940acbd --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00020000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..825aee666 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld new file mode 100644 index 000000000..0d3aaf7a9 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00008000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..1c36f57e1 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00010000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_128KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..941e0adee --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_128KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_256KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..865514cbb --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_256KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_32KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_32KB.ld new file mode 100644 index 000000000..407777c80 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_32KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_64KB.ld b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..6f3d4d3e8 --- /dev/null +++ b/variants/MT_D21E_revB/linker_scripts/gcc/No_Bootloader/flash_64KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMC21E15A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMC21E15A.cfg new file mode 100644 index 000000000..b6b72ccda --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMC21E15A.cfg @@ -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 at91samc21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMC21E16A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMC21E16A.cfg new file mode 100644 index 000000000..613b357da --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMC21E16A.cfg @@ -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 at91samc21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMC21E17A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMC21E17A.cfg new file mode 100644 index 000000000..c687b08f0 --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMC21E17A.cfg @@ -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 at91samc21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMC21E18A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMC21E18A.cfg new file mode 100644 index 000000000..b87fb0116 --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMC21E18A.cfg @@ -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 at91samc21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMD21E15A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMD21E15A.cfg new file mode 100644 index 000000000..0355cc401 --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMD21E15A.cfg @@ -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 at91samd21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMD21E16A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMD21E16A.cfg new file mode 100644 index 000000000..4eaf7acfc --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMD21E16A.cfg @@ -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 at91samd21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMD21E17A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMD21E17A.cfg new file mode 100644 index 000000000..6b5641483 --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMD21E17A.cfg @@ -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 at91samd21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAMD21E18A.cfg b/variants/MT_D21E_revB/openocd_scripts/SAMD21E18A.cfg new file mode 100644 index 000000000..b99d610ef --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAMD21E18A.cfg @@ -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 at91samd21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAML21E15B.cfg b/variants/MT_D21E_revB/openocd_scripts/SAML21E15B.cfg new file mode 100644 index 000000000..82fbb0650 --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAML21E15B.cfg @@ -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 at91saml21e15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAML21E16B.cfg b/variants/MT_D21E_revB/openocd_scripts/SAML21E16B.cfg new file mode 100644 index 000000000..c74f6102a --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAML21E16B.cfg @@ -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 at91saml21e16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAML21E17B.cfg b/variants/MT_D21E_revB/openocd_scripts/SAML21E17B.cfg new file mode 100644 index 000000000..3b844e436 --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAML21E17B.cfg @@ -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 at91saml21e17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E_revB/openocd_scripts/SAML21E18B.cfg b/variants/MT_D21E_revB/openocd_scripts/SAML21E18B.cfg new file mode 100644 index 000000000..4e7a27fde --- /dev/null +++ b/variants/MT_D21E_revB/openocd_scripts/SAML21E18B.cfg @@ -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 at91saml21e18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/MT_D21E_revB/pins_arduino.h b/variants/MT_D21E_revB/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/MT_D21E_revB/pins_arduino.h @@ -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" + diff --git a/variants/MT_D21E_revB/variant.cpp b/variants/MT_D21E_revB/variant.cpp new file mode 100644 index 000000000..c37b16fff --- /dev/null +++ b/variants/MT_D21E_revB/variant.cpp @@ -0,0 +1,160 @@ +/* + 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 +*/ + +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +const PinDescription g_APinDescription[]= +{ + // 0..1 are unused by default (pins in use by 32.768KHz crystal, which is used by the Arduino core) + { PORTA, 0, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 1, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + + // 2..9 - Analog capable pins (DAC available on 2) + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[0] / DAC + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[1] + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4, GCLK_CCL_NONE }, // ADC/AIN[4] +#if (SAMD || SAMC) + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, // ADC/AIN[5] +#elif (SAML) + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, +#endif + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[6], LED +#if (SAMD) + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] +#elif (SAML) + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] +#elif (SAMC) + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel10, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel11, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] +#endif + + // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions +#if (SAMD) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] +#elif (SAML) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] +#elif (SAMC) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel10, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel11, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] +#endif + + // 12..13 pins don't exist + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + + // 14..15 - SERCOM/UART (Serial2) or Digital functions +#if (SAMD) + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // TC3/WO[0], HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN +#elif (SAML || SAMC) + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // TC3/WO[0], HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN +#endif + + // 16..17 SERCOM/I2C (Wire) or Digital functions + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // SDA: SERCOM1/PAD[0] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // SCL: SERCOM1/PAD[1] + + // 18..23 - SERCOM/SPI (SPI) or Digital functions (pins 20..21 do not exist) + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SPI SCK: SERCOM3/PAD[3] (PIN_ATTR_SERCOM_ALT) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused +#if (SAMD) + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SPI MISO: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // SPI SS: SERCOM3/PAD[1] +#elif (SAML || SAMC) + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SPI MISO: SERCOM3/PAD[0] + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // SPI SS: SERCOM3/PAD[1] +#endif + + // 24..26 - USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist +#if (SAMD) + { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP +#elif (SAML || SAMC) + { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP +#endif + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + + // 27..29 Digital functions / A/CS (pin 29 does not exist) + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_15, GCLK_CCL_NONE }, // A/CS +#if (SAMD || SAMC) + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_8, GCLK_CCL_NONE }, // +#elif (SAML) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused +#endif + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + + // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO +} ; + +#if (SAMD) +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; +#elif (SAML21 || SAMC21) +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC2 } ; +#endif + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; +SERCOM sercom3( SERCOM3 ) ; +#if (SAML) +SERCOM sercom4( SERCOM4 ) ; +SERCOM sercom5( SERCOM5 ) ; +#endif + +#if defined(ONE_UART) || defined(TWO_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM0_Handler() +{ + Serial1.IrqHandler(); +} +#endif + +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM2_Handler() +{ + Serial2.IrqHandler(); +} +#endif diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h new file mode 100644 index 000000000..4e2f14b0a --- /dev/null +++ b/variants/MT_D21E_revB/variant.h @@ -0,0 +1,306 @@ +/* + 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 +*/ + +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + +#ifndef _VARIANT_MATTAIRTECH_MT_D21E_REVB_ +#define _VARIANT_MATTAIRTECH_MT_D21E_REVB_ + +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + +/*---------------------------------------------------------------------------- + * Definitions + *----------------------------------------------------------------------------*/ + +/** Frequency of the board main oscillator */ +#define VARIANT_MAINOSC (32768ul) + +/** Master clock frequency */ +#define VARIANT_MCK (48000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" +#include "sam.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define NUM_PIN_DESCRIPTION_ENTRIES (32u) + +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT +#define NUM_ANALOG_INPUTS (10u) + +#if (SAMD || SAMC) +#define NUM_ANALOG_OUTPUTS (1u) +#elif (SAML) +#define NUM_ANALOG_OUTPUTS (2u) +#else +#error "variant.h: Unsupported chip" +#endif + +#define analogInputToDigitalPin(p) (p) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +/* LEDs + * None of these defines are currently used by the core. + * The MT-D21E (rev B) onboard LED is on pin 6. + * The RX and TX LEDs are not present. + * You may optionally add them to any free pins. + */ +#define PIN_LED_13 (6u) +#define PIN_LED_RXL (30u) +#define PIN_LED_TXL (31u) +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + +/* Buttons + * Note that Button B is connected to Reset by default. + * A solder jumper can be changed to route Button B to pin 31 instead. + * There is a debouncing capacitor connected, so delay reading the pin for + * at least 45ms after turning on the pullup to allow the capacitor to charge. + */ +#define JUMPER_A (27u) +#define BUTTON_B (31u) +#define BUTTON_BUILTIN BUTTON_A + + +/* + * Analog pins + */ +#define PIN_A2 (2ul) +#define PIN_A3 (3ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A6 (6ul) +#define PIN_A7 (7ul) +#define PIN_A8 (8ul) +#define PIN_A9 (9ul) +#define PIN_A10 (10ul) +#define PIN_A11 (11ul) +#define PIN_DAC0 (2ul) +#if (SAML) +#define PIN_DAC1 (5ul) +#endif + +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +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; +#if (SAML) +static const uint8_t DAC1 = PIN_DAC1; +#endif + +#define ADC_RESOLUTION 12 + +// #define REMAP_ANALOG_PIN_ID(pin) if ( pin < A0 ) pin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#define REFA_PIN (3ul) +#define REFB_PIN (4ul) + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#define PIN_ATN (15ul) +static const uint8_t ATN = PIN_ATN; + + +/* + * Serial interfaces + */ +// Serial1 +#define PIN_SERIAL1_RX (11ul) +#define PIN_SERIAL1_TX (10ul) +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL1 &sercom0 + +// Serial2 +#define PIN_SERIAL2_RX (15ul) +#define PIN_SERIAL2_TX (14ul) +#define PAD_SERIAL2_TX (UART_TX_PAD_2) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL2 &sercom2 + + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (22u) +#define PIN_SPI_MOSI (18u) +#define PIN_SPI_SCK (19u) +#define PIN_SPI_SS (23u) +#define PERIPH_SPI sercom3 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (16u) +#define PIN_WIRE_SCL (17u) +#define PERIPH_WIRE sercom1 +#define WIRE_IT_HANDLER SERCOM1_Handler + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +/* + * USB + */ +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +#define PIN_USB_HOST_ENABLE (14ul) +#define PIN_USB_HOST_ENABLE_VALUE HIGH + +/* + * I2S Interfaces + */ +#define I2S_INTERFACES_COUNT 1 + +#define I2S_DEVICE 0 +#define I2S_CLOCK_GENERATOR 3 +#define PIN_I2S_SD (9u) +#define PIN_I2S_SCK (1u) +#define PIN_I2S_FS (0u) + +#ifdef __cplusplus +} +#endif + + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; +extern SERCOM sercom3; + +extern Uart Serial1; +extern Uart Serial2; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#define SERIAL_PORT_MONITOR Serial1 +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. +#define Serial SerialUSB + +#endif /* _VARIANT_ARDUINO_ZERO_ */ From 91aafeb22b53de306a9a25c4436d5ecea6f9c102 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Wed, 5 Apr 2017 09:04:31 +0000 Subject: [PATCH 086/124] Added Generic D11C14A board variant --- boards.txt | 83 +++++ variants/Generic_D11C14A/README.md | 193 ++++++++++ .../debug_scripts/SAMD11C14A.gdb | 31 ++ .../gcc/4KB_Bootloader/flash_16KB.ld | 217 ++++++++++++ .../gcc/No_Bootloader/flash_16KB.ld | 214 +++++++++++ .../openocd_scripts/SAMD11C14A.cfg | 30 ++ variants/Generic_D11C14A/pins_arduino.h | 21 ++ variants/Generic_D11C14A/variant.cpp | 115 ++++++ variants/Generic_D11C14A/variant.h | 333 ++++++++++++++++++ 9 files changed, 1237 insertions(+) create mode 100644 variants/Generic_D11C14A/README.md create mode 100644 variants/Generic_D11C14A/debug_scripts/SAMD11C14A.gdb create mode 100644 variants/Generic_D11C14A/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld create mode 100644 variants/Generic_D11C14A/linker_scripts/gcc/No_Bootloader/flash_16KB.ld create mode 100644 variants/Generic_D11C14A/openocd_scripts/SAMD11C14A.cfg create mode 100644 variants/Generic_D11C14A/pins_arduino.h create mode 100644 variants/Generic_D11C14A/variant.cpp create mode 100644 variants/Generic_D11C14A/variant.h diff --git a/boards.txt b/boards.txt index f55abfcea..125a7b42a 100644 --- a/boards.txt +++ b/boards.txt @@ -355,6 +355,89 @@ mattairtech_mt_d11.menu.usb.none.build.usbcom=USB_DISABLED mattairtech_mt_d11.menu.usb.none.build.pid=0x0856 +# Generic D11C14A (SOIC-14) +d11c14a.name=Generic D11C14A +d11c14a.vid.0=0x16D0 +d11c14a.pid.0=0x0557 +d11c14a.vid.1=0x16D0 +d11c14a.pid.1=0x0856 +d11c14a.vid.2=0x16D0 +d11c14a.pid.2=0x0B41 +d11c14a.build.mcu=cortex-m0plus +d11c14a.build.f_cpu=48000000L +d11c14a.build.usb_product="D11C14A" +d11c14a.build.usb_manufacturer="MattairTech" +d11c14a.build.board=SAMD_ZERO +d11c14a.build.core=arduino +d11c14a.build.variant=Generic_D11C14A +d11c14a.build.variant_system_lib= +d11c14a.build.vid=0x16D0 +d11c14a.upload.protocol=sam-ba +d11c14a.bootloader.tool=arduino:openocd +d11c14a.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11c14a.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11c14a.menu.clock.internal=INTERNAL +d11c14a.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11c14a.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +d11c14a.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11c14a.build.extra_flags=-D__SAMD11C14A__ {build.usb_flags} +d11c14a.build.ldscript=linker_scripts/gcc/flash_16KB.ld +d11c14a.build.openocdscript=openocd_scripts/SAMD11C14A.cfg +d11c14a.bootloader.file=zero/binaries/sam_ba_Generic_D11C14A_SAMD11C14A.bin +d11c14a.menu.bootloader.4kb=4KB +d11c14a.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11c14a.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11c14a.menu.bootloader.4kb.upload.tool=MattairTech_Arduino:bossac +d11c14a.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11c14a.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11c14a.menu.bootloader.4kb.upload.native_usb=true +d11c14a.menu.bootloader.4kb.upload.maximum_size=12288 +d11c14a.menu.bootloader.0kb=NO_BOOTLOADER +d11c14a.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11c14a.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11c14a.menu.bootloader.0kb.upload.tool=arduino:openocd +d11c14a.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11c14a.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11c14a.menu.bootloader.0kb.upload.native_usb=false +d11c14a.menu.bootloader.0kb.upload.maximum_size=16384 +d11c14a.menu.serial.one_uart=ONE_UART_ONE_WIRE_NO_SPI +d11c14a.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.one_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi=ONE_UART_NO_WIRE_ONE_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +d11c14a.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11c14a.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11c14a.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11c14a.menu.serial.two_uart=TWO_UART_NO_WIRE_NO_SPI +d11c14a.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11c14a.menu.serial.two_uart.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.usb.cdc=CDC_ONLY +d11c14a.menu.usb.cdc.build.usbcom=CDC_ONLY +d11c14a.menu.usb.cdc.build.pid=0x0557 +d11c14a.menu.usb.cdc_hid=CDC_HID +d11c14a.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11c14a.menu.usb.cdc_hid.build.pid=0x0856 +d11c14a.menu.usb.withcdc=WITH_CDC +d11c14a.menu.usb.withcdc.build.usbcom=WITH_CDC +d11c14a.menu.usb.withcdc.build.pid=0x0B41 +d11c14a.menu.usb.hid=HID_ONLY +d11c14a.menu.usb.hid.build.usbcom=HID_ONLY +d11c14a.menu.usb.hid.build.pid=0x0B40 +d11c14a.menu.usb.nocdc=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.pid=0x0A0C +d11c14a.menu.usb.none=USB_DISABLED +d11c14a.menu.usb.none.build.usbcom=USB_DISABLED +d11c14a.menu.usb.none.build.pid=0x0856 + + # MattairTech Core for Arduino/Genuino Zero (Autodetect Port) arduino_zero.name=Arduino/Genuino Zero (Autodetect Port) arduino_zero.bootloader.file=zero/binaries/sam_ba_arduino_zero_SAMD21G18A.bin diff --git a/variants/Generic_D11C14A/README.md b/variants/Generic_D11C14A/README.md new file mode 100644 index 000000000..96cd0ec76 --- /dev/null +++ b/variants/Generic_D11C14A/README.md @@ -0,0 +1,193 @@ +# Generic ATsamD11C14A + +``` +====================================== ATsamD11C14A ===================================== +Other COM PWM Analog INT Arduino* Arduino* INT Analog PWM COM Other +========================================================================================= + ------------------- + RX2* TCC01 * * 5 | A5 A4 | 4 * * TCC00 TX2* REF + TX1 / MOSI TCC02 * 8 | A8 A2 | 2 * * DAC + RX1 / SCK TCC03 * 9 | A9 Vdd | + SDA TC10 * NMI 14 | A14 Gnd | + SCL TC11 * * 15 | A15 A25 | 25 USB/DP +BOOT 28 | A28/RST A24 | 24 USB/DM +SWDCLK MISO 30 | A30 A31 | 31 * SS SWDIO + ------------------- + +* Some pins can be used for more than one function. The same port pin number printed on + the board is also used in Arduino (without the 'A') for all of the supported functions + (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* When using ONE_UART_NO_WIRE_ONE_SPI, Serial1() refers to TX2/RX2 instead of TX1/RX1. +* Tone available on TC2. TC2 is not routed to pins with the D11C14A. +* DO NOT connect voltages higher than 3.3V! +``` + + +# Pins descriptions for Generic ATsamD11C14A +## PIN_MAP_STANDARD +==================================================================================================================================== +Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | ---- | NOT A PIN | NOT A PIN +1 | ---- | NOT A PIN | NOT A PIN +2 | PA02 | DAC | EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +3 | ---- | NOT A PIN | NOT A PIN +4 | PA04 | REFB / TX2* / TCC00 | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[2] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +5 | PA05 | RX2* / TCC01 | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +6 | ---- | NOT A PIN | NOT A PIN +7 | ---- | NOT A PIN | NOT A PIN +8 | PA08 | TX1 / MOSI / TCC02 | EIC/EXTINT[6] SERCOM1/PAD[2] !SERCOM0/PAD[2] TCC0/WO[2] !TCC0/WO[4] Xin32 / Xin +9 | PA09 | RX1 / SCK / TCC03 | EIC/EXTINT[7] SERCOM1/PAD[3] !SERCOM0/PAD[3] TCC0/WO[3] !TCC0/WO[5] Xout32 / Xout +10 | ---- | NOT A PIN | NOT A PIN +11 | ---- | NOT A PIN | NOT A PIN +12 | ---- | NOT A PIN | NOT A PIN +13 | ---- | NOT A PIN | NOT A PIN +14 | PA14 | SDA / TC10 | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] TC1/WO[0] !TCC0/WO[0] +15 | PA15 | SCL / TC11 | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] TC1/WO[1] !TCC0/WO[1] +16 | ---- | NOT A PIN | NOT A PIN +17 | ---- | NOT A PIN | NOT A PIN +18 | ---- | NOT A PIN | NOT A PIN +19 | ---- | NOT A PIN | NOT A PIN +20 | ---- | NOT A PIN | NOT A PIN +21 | ---- | NOT A PIN | NOT A PIN +22 | ---- | NOT A PIN | NOT A PIN +23 | ---- | NOT A PIN | NOT A PIN +24 | PA24 | USB_NEGATIVE | USB/DM +25 | PA25 | USB_POSITIVE | USB/DP +26 | ---- | NOT A PIN | NOT A PIN +27 | ---- | NOT A PIN | NOT A PIN +28 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +29 | ---- | NOT A PIN | NOT A PIN +30 | PA30 | MISO / SWD CLK | !EIC/EXTINT[2] SERCOM1/PAD[0] !SERCOM1/PAD[2] !TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +31 | PA31 | SS / SWD IO | EIC/EXTINT[3] SERCOM1/PAD[1] !SERCOM1/PAD[3] !TC2/WO[1] !TCC0/WO[3] SWD IO +==================================================================================================================================== + +## PIN_MAP_COMPACT +==================================================================================================================================== +Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | PA02 | DAC | EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +1 | PA04 | REFB / TX2* / TCC00 | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[2] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +2 | PA05 | RX2* / TCC01 | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +3 | PA08 | TX1 / MOSI / TCC02 | EIC/EXTINT[6] SERCOM1/PAD[2] !SERCOM0/PAD[2] TCC0/WO[2] !TCC0/WO[4] Xin32 / Xin +4 | PA09 | RX1 / SCK / TCC03 | EIC/EXTINT[7] SERCOM1/PAD[3] !SERCOM0/PAD[3] TCC0/WO[3] !TCC0/WO[5] Xout32 / Xout +5 | PA14 | SDA / TC10 | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] TC1/WO[0] !TCC0/WO[0] +6 | PA15 | SCL / TC11 | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] TC1/WO[1] !TCC0/WO[1] +7 | PA24 | USB_NEGATIVE | USB/DM +8 | PA25 | USB_POSITIVE | USB/DP +9 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +10 | PA30 | MISO / SWD CLK | !EIC/EXTINT[2] SERCOM1/PAD[0] !SERCOM1/PAD[2] !TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +11 | PA31 | SS / SWD IO | EIC/EXTINT[3] SERCOM1/PAD[1] !SERCOM1/PAD[3] !TC2/WO[1] !TCC0/WO[3] SWD IO +==================================================================================================================================== + +* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') + for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* NOT A PIN means the Arduino pin number is not mapped to a physical pin. +* Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). +* The tone library uses TC2. TC2 is not routed to pins with the D11C14A (14-pin). +* Pins 8 and 9 are by default connected to the 32.768KHz crystal. +* When using ONE_UART_NO_WIRE_ONE_SPI, Serial1() refers to TX2/RX2 instead of TX1/RX1. +* SERCOM2 does not exist on the D11C14A. + + +# PinDescription table format + +## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +## Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +## Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +## See WVariant.h in cores/arduino for the definitions used in the table. + +### Port: +This is the port (ie: PORTA). + +### Pin: +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType: +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/Generic_D11C14A/debug_scripts/SAMD11C14A.gdb b/variants/Generic_D11C14A/debug_scripts/SAMD11C14A.gdb new file mode 100644 index 000000000..ff7008e6e --- /dev/null +++ b/variants/Generic_D11C14A/debug_scripts/SAMD11C14A.gdb @@ -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 at91samd11c14a" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Generic_D11C14A/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld b/variants/Generic_D11C14A/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld new file mode 100644 index 000000000..1e2d5f052 --- /dev/null +++ b/variants/Generic_D11C14A/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x1000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Generic_D11C14A/linker_scripts/gcc/No_Bootloader/flash_16KB.ld b/variants/Generic_D11C14A/linker_scripts/gcc/No_Bootloader/flash_16KB.ld new file mode 100644 index 000000000..bd135b3dd --- /dev/null +++ b/variants/Generic_D11C14A/linker_scripts/gcc/No_Bootloader/flash_16KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Generic_D11C14A/openocd_scripts/SAMD11C14A.cfg b/variants/Generic_D11C14A/openocd_scripts/SAMD11C14A.cfg new file mode 100644 index 000000000..2e1525a73 --- /dev/null +++ b/variants/Generic_D11C14A/openocd_scripts/SAMD11C14A.cfg @@ -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 at91samd11c14a +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/Generic_D11C14A/pins_arduino.h b/variants/Generic_D11C14A/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/Generic_D11C14A/pins_arduino.h @@ -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" + diff --git a/variants/Generic_D11C14A/variant.cpp b/variants/Generic_D11C14A/variant.cpp new file mode 100644 index 000000000..878482282 --- /dev/null +++ b/variants/Generic_D11C14A/variant.cpp @@ -0,0 +1,115 @@ +/* + 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 +*/ + +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +#if defined PIN_MAP_STANDARD +const PinDescription g_APinDescription[]= +{ + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH2, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH0, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SWD IO +} ; +#elif defined PIN_MAP_COMPACT +const PinDescription g_APinDescription[]= +{ + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH2, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH0, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SWD IO +} ; +#endif + +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TC1, TC2 } ; + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; + +#if defined(ONE_UART) || defined(TWO_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +#if defined (ONE_SPI) +void SERCOM0_Handler() +{ + Serial1.IrqHandler(); +} +#else +void SERCOM1_Handler() +{ + Serial1.IrqHandler(); +} +#endif +#endif + +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM0_Handler() +{ + Serial2.IrqHandler(); +} +#endif diff --git a/variants/Generic_D11C14A/variant.h b/variants/Generic_D11C14A/variant.h new file mode 100644 index 000000000..20998f1c5 --- /dev/null +++ b/variants/Generic_D11C14A/variant.h @@ -0,0 +1,333 @@ +/* + 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 +*/ + +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + +#ifndef _VARIANT_MATTAIRTECH_D11C14A_ +#define _VARIANT_MATTAIRTECH_D11C14A_ + +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + +/*---------------------------------------------------------------------------- + * Definitions + *----------------------------------------------------------------------------*/ + +/** Frequency of the board main oscillator */ +#define VARIANT_MAINOSC (32768ul) + +/** Master clock frequency */ +#define VARIANT_MCK (48000000ul) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" +#include "sam.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define PIN_MAP_STANDARD +//#define PIN_MAP_COMPACT + +#if defined PIN_MAP_STANDARD + #define NUM_PIN_DESCRIPTION_ENTRIES (32u) +#elif defined PIN_MAP_COMPACT + #define NUM_PIN_DESCRIPTION_ENTRIES (12u) +#else + #error "variant.h: You must set PIN_MAP_STANDARD or PIN_MAP_COMPACT" +#endif + +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT +#define NUM_ANALOG_INPUTS (5u) +#define NUM_ANALOG_OUTPUTS (1u) +#define analogInputToDigitalPin(p) (p) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +/* LEDs + * None of these defines are currently used by the core. + */ +#if defined PIN_MAP_STANDARD +#define PIN_LED_13 (5u) +#define PIN_LED_RXL (8u) +#define PIN_LED_TXL (9u) +#elif defined PIN_MAP_COMPACT +#define PIN_LED_13 (2u) +#define PIN_LED_RXL (3u) +#define PIN_LED_TXL (4u) +#endif + +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + +/* + * Analog pins + */ +#if defined PIN_MAP_STANDARD +#define PIN_A2 (2ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A14 (14ul) +#define PIN_A15 (15ul) +#define PIN_DAC0 (2ul) +#elif defined PIN_MAP_COMPACT +#define PIN_A2 (0ul) +#define PIN_A4 (1ul) +#define PIN_A5 (2ul) +#define PIN_A14 (5ul) +#define PIN_A15 (6ul) +#define PIN_DAC0 (2ul) +#endif + +static const uint8_t A2 = PIN_A2; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A14 = PIN_A14; +static const uint8_t A15 = PIN_A15; +static const uint8_t DAC0 = PIN_DAC0; + + +#define ADC_RESOLUTION 12 + +// #define REMAP_ANALOG_PIN_ID(pin) if ( pin < A0 ) pin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#if defined PIN_MAP_STANDARD +#define REFB_PIN (4ul) +#elif defined PIN_MAP_COMPACT +#define REFB_PIN (1ul) +#endif + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#if defined PIN_MAP_STANDARD +#define PIN_ATN (15ul) +#elif defined PIN_MAP_COMPACT +#define PIN_ATN (6ul) +#endif +static const uint8_t ATN = PIN_ATN; + + +/* + * Serial interfaces + */ +// Serial1 +#if defined(ONE_UART) && defined (ONE_SPI) + #if defined PIN_MAP_STANDARD + #define PIN_SERIAL1_RX (5ul) + #define PIN_SERIAL1_TX (4ul) + #elif defined PIN_MAP_COMPACT + #define PIN_SERIAL1_RX (2ul) + #define PIN_SERIAL1_TX (1ul) + #endif + + #define PAD_SERIAL1_TX (UART_TX_PAD_2) + #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + #define SERCOM_INSTANCE_SERIAL1 &sercom0 +#else + #if defined PIN_MAP_STANDARD + #define PIN_SERIAL1_RX (9ul) + #define PIN_SERIAL1_TX (8ul) + #elif defined PIN_MAP_COMPACT + #define PIN_SERIAL1_RX (4ul) + #define PIN_SERIAL1_TX (3ul) + #endif + + #define PAD_SERIAL1_TX (UART_TX_PAD_2) + #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + #define SERCOM_INSTANCE_SERIAL1 &sercom1 +#endif + +// Serial2 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL2_RX (5ul) +#define PIN_SERIAL2_TX (4ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL2_RX (2ul) +#define PIN_SERIAL2_TX (1ul) +#endif + +#define PAD_SERIAL2_TX (UART_TX_PAD_2) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) +#define SERCOM_INSTANCE_SERIAL2 &sercom0 + + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#if defined PIN_MAP_STANDARD +#define PIN_SPI_MISO (30u) +#define PIN_SPI_MOSI (8u) +#define PIN_SPI_SCK (9u) +#define PIN_SPI_SS (31u) +#elif defined PIN_MAP_COMPACT +#define PIN_SPI_MISO (10u) +#define PIN_SPI_MOSI (3u) +#define PIN_SPI_SCK (4u) +#define PIN_SPI_SS (11u) +#endif + +#define PERIPH_SPI sercom1 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#if defined PIN_MAP_STANDARD +#define PIN_WIRE_SDA (14u) +#define PIN_WIRE_SCL (15u) +#elif defined PIN_MAP_COMPACT +#define PIN_WIRE_SDA (5u) +#define PIN_WIRE_SCL (6u) +#endif + +#define PERIPH_WIRE sercom0 +#define WIRE_IT_HANDLER SERCOM0_Handler + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +/* + * USB + */ +#if defined PIN_MAP_STANDARD +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +#define PIN_USB_HOST_ENABLE (14ul) +#elif defined PIN_MAP_COMPACT +#define PIN_USB_DM (7ul) +#define PIN_USB_DP (8ul) +#define PIN_USB_HOST_ENABLE (5ul) +#endif + +#define PIN_USB_HOST_ENABLE_VALUE HIGH + +#ifdef __cplusplus +} +#endif + + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; + +extern Uart Serial1; +extern Uart Serial2; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#define SERIAL_PORT_MONITOR Serial1 +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. +#define Serial SerialUSB + +#endif /* _VARIANT_ARDUINO_ZERO_ */ From 5e375146b7d41d06f4e19241a6675abc58d46cf2 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 15 Apr 2017 20:15:21 +0000 Subject: [PATCH 087/124] Added new clock code, added MT-D21E Rev B support, and numerous changes to get the L21 and C21 to work --- boards.txt | 395 +++++++++++---------- bootloaders/zero/board_init.c | 9 +- bootloaders/zero/main.c | 64 ++-- cores/arduino/Arduino.h | 11 +- cores/arduino/SERCOM.h | 5 + cores/arduino/Tone.cpp | 20 +- cores/arduino/USB/CDC.cpp | 2 + cores/arduino/USB/SAMD21_USBDevice.h | 4 + cores/arduino/USB/USBCore.cpp | 6 +- cores/arduino/USB/USBCore.h | 8 + cores/arduino/USB/samd21_host.c | 2 + cores/arduino/WInterrupts.c | 42 ++- cores/arduino/WVariant.h | 11 +- cores/arduino/cortex_handlers.c | 39 +- cores/arduino/delay.c | 2 + cores/arduino/startup.c | 385 +++++++++++++------- cores/arduino/wiring.c | 102 ++++-- cores/arduino/wiring_analog.c | 154 ++++---- cores/arduino/wiring_private.c | 56 ++- extras/package_index.json.Beta.template | 8 +- extras/package_index.json.PR.template | 8 +- extras/package_index.json.Release.template | 2 +- platform.txt | 18 +- variants/Generic_D11C14A/variant.h | 32 +- variants/MT_D11/variant.h | 32 +- variants/MT_D21E/variant.h | 32 +- variants/MT_D21E_revB/variant.cpp | 2 +- variants/MT_D21E_revB/variant.h | 58 ++- variants/arduino_mzero/variant.h | 33 +- variants/arduino_zero/variant.h | 33 +- 30 files changed, 1034 insertions(+), 541 deletions(-) diff --git a/boards.txt b/boards.txt index 125a7b42a..0b99f5efe 100644 --- a/boards.txt +++ b/boards.txt @@ -20,18 +20,183 @@ menu.usb=USB Config menu.serial=Serial Config menu.bootloader=Bootloader Size + +# MattairTech MT-D21E (rev B) +mattairtech_mt_d21e_revb.name=MattairTech MT-D21E (rev B) +mattairtech_mt_d21e_revb.vid.0=0x16D0 +mattairtech_mt_d21e_revb.pid.0=0x0557 +mattairtech_mt_d21e_revb.vid.1=0x16D0 +mattairtech_mt_d21e_revb.pid.1=0x0856 +mattairtech_mt_d21e_revb.vid.2=0x16D0 +mattairtech_mt_d21e_revb.pid.2=0x0B41 +mattairtech_mt_d21e_revb.vid.3=0x16D0 +mattairtech_mt_d21e_revb.pid.3=0x0B40 +mattairtech_mt_d21e_revb.vid.4=0x16D0 +mattairtech_mt_d21e_revb.pid.4=0x0A0C +mattairtech_mt_d21e_revb.vid.5=0x16D0 +mattairtech_mt_d21e_revb.pid.5=0x0856 +mattairtech_mt_d21e_revb.build.mcu=cortex-m0plus +mattairtech_mt_d21e_revb.build.f_cpu=48000000L +mattairtech_mt_d21e_revb.build.usb_product="MT-D21E Rev B" +mattairtech_mt_d21e_revb.build.usb_manufacturer="MattairTech LLC" +mattairtech_mt_d21e_revb.build.board=SAMD_ZERO +mattairtech_mt_d21e_revb.build.core=arduino +mattairtech_mt_d21e_revb.build.variant=MT_D21E_revB +mattairtech_mt_d21e_revb.build.variant_system_lib= +mattairtech_mt_d21e_revb.build.vid=0x16D0 +mattairtech_mt_d21e_revb.upload.protocol=sam-ba +mattairtech_mt_d21e_revb.bootloader.tool=arduino:openocd +mattairtech_mt_d21e_revb.menu.clock.crystal_32k=32KHZ_CRYSTAL +mattairtech_mt_d21e_revb.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +mattairtech_mt_d21e_revb.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +mattairtech_mt_d21e_revb.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +mattairtech_mt_d21e_revb.menu.clock.internal=INTERNAL_OSCILLATOR +mattairtech_mt_d21e_revb.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mattairtech_mt_d21e_revb.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +mattairtech_mt_d21e_revb.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mattairtech_mt_d21e_revb.menu.cpu.samd21e18a=SAMD21E18A +mattairtech_mt_d21e_revb.menu.cpu.samd21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e_revb.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.samd21e18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E18A.bin +mattairtech_mt_d21e_revb.menu.cpu.samd21e17a=SAMD21E17A +mattairtech_mt_d21e_revb.menu.cpu.samd21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e_revb.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.samd21e17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E17A.bin +mattairtech_mt_d21e_revb.menu.cpu.samd21e16a=SAMD21E16A +mattairtech_mt_d21e_revb.menu.cpu.samd21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e_revb.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.samd21e16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E16A.bin +mattairtech_mt_d21e_revb.menu.cpu.samd21e15a=SAMD21E15A +mattairtech_mt_d21e_revb.menu.cpu.samd21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e_revb.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E15A.bin +mattairtech_mt_d21e_revb.menu.cpu.saml21e18b=SAML21E18B +mattairtech_mt_d21e_revb.menu.cpu.saml21e18b.upload.maximum_size=253952 +mattairtech_mt_d21e_revb.menu.cpu.saml21e18b.build.extra_flags=-D__SAML21E18B__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.saml21e18b.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e_revb.menu.cpu.saml21e18b.build.openocdscript=openocd_scripts/SAML21E18B.cfg +mattairtech_mt_d21e_revb.menu.cpu.saml21e18b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E18B.bin +mattairtech_mt_d21e_revb.menu.cpu.saml21e17b=SAML21E17B +mattairtech_mt_d21e_revb.menu.cpu.saml21e17b.upload.maximum_size=122880 +mattairtech_mt_d21e_revb.menu.cpu.saml21e17b.build.extra_flags=-D__SAML21E17B__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.saml21e17b.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e_revb.menu.cpu.saml21e17b.build.openocdscript=openocd_scripts/SAML21E17B.cfg +mattairtech_mt_d21e_revb.menu.cpu.saml21e17b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E17B.bin +mattairtech_mt_d21e_revb.menu.cpu.saml21e16b=SAML21E16B +mattairtech_mt_d21e_revb.menu.cpu.saml21e16b.upload.maximum_size=57344 +mattairtech_mt_d21e_revb.menu.cpu.saml21e16b.build.extra_flags=-D__SAML21E16B__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.saml21e16b.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e_revb.menu.cpu.saml21e16b.build.openocdscript=openocd_scripts/SAML21E16B.cfg +mattairtech_mt_d21e_revb.menu.cpu.saml21e16b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E16B.bin +mattairtech_mt_d21e_revb.menu.cpu.saml21e15b=SAML21E15B +mattairtech_mt_d21e_revb.menu.cpu.saml21e15b.upload.maximum_size=24576 +mattairtech_mt_d21e_revb.menu.cpu.saml21e15b.build.extra_flags=-D__SAML21E15B__ {build.usb_flags} +mattairtech_mt_d21e_revb.menu.cpu.saml21e15b.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e_revb.menu.cpu.saml21e15b.build.openocdscript=openocd_scripts/SAML21E15B.cfg +mattairtech_mt_d21e_revb.menu.cpu.saml21e15b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E15B.bin +mattairtech_mt_d21e_revb.menu.cpu.samc21e18a=SAMC21E18A +mattairtech_mt_d21e_revb.menu.cpu.samc21e18a.upload.maximum_size=253952 +mattairtech_mt_d21e_revb.menu.cpu.samc21e18a.build.extra_flags=-D__SAMC21E18A__ +mattairtech_mt_d21e_revb.menu.cpu.samc21e18a.build.ldscript=flash_256KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samc21e18a.build.openocdscript=openocd_scripts/SAMC21E18A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samc21e18a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E18A.bin +mattairtech_mt_d21e_revb.menu.cpu.samc21e17a=SAMC21E17A +mattairtech_mt_d21e_revb.menu.cpu.samc21e17a.upload.maximum_size=122880 +mattairtech_mt_d21e_revb.menu.cpu.samc21e17a.build.extra_flags=-D__SAMC21E17A__ +mattairtech_mt_d21e_revb.menu.cpu.samc21e17a.build.ldscript=flash_128KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samc21e17a.build.openocdscript=openocd_scripts/SAMC21E17A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samc21e17a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E17A.bin +mattairtech_mt_d21e_revb.menu.cpu.samc21e16a=SAMC21E16A +mattairtech_mt_d21e_revb.menu.cpu.samc21e16a.upload.maximum_size=57344 +mattairtech_mt_d21e_revb.menu.cpu.samc21e16a.build.extra_flags=-D__SAMC21E16A__ +mattairtech_mt_d21e_revb.menu.cpu.samc21e16a.build.ldscript=flash_64KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samc21e16a.build.openocdscript=openocd_scripts/SAMC21E16A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samc21e16a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E16A.bin +mattairtech_mt_d21e_revb.menu.cpu.samc21e15a=SAMC21E15A +mattairtech_mt_d21e_revb.menu.cpu.samc21e15a.upload.maximum_size=24576 +mattairtech_mt_d21e_revb.menu.cpu.samc21e15a.build.extra_flags=-D__SAMC21E15A__ +mattairtech_mt_d21e_revb.menu.cpu.samc21e15a.build.ldscript=flash_32KB.ld +mattairtech_mt_d21e_revb.menu.cpu.samc21e15a.build.openocdscript=openocd_scripts/SAMC21E15A.cfg +mattairtech_mt_d21e_revb.menu.cpu.samc21e15a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E15A.bin +mattairtech_mt_d21e_revb.menu.bootloader.8kb=8KB_BOOTLOADER +mattairtech_mt_d21e_revb.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +mattairtech_mt_d21e_revb.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +mattairtech_mt_d21e_revb.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21e_revb.menu.bootloader.8kb.upload.use_1200bps_touch=true +mattairtech_mt_d21e_revb.menu.bootloader.8kb.upload.wait_for_upload_port=true +mattairtech_mt_d21e_revb.menu.bootloader.8kb.upload.native_usb=true +mattairtech_mt_d21e_revb.menu.bootloader.16kb=16KB_BOOTLOADER +mattairtech_mt_d21e_revb.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +mattairtech_mt_d21e_revb.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +mattairtech_mt_d21e_revb.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_mt_d21e_revb.menu.bootloader.16kb.upload.use_1200bps_touch=true +mattairtech_mt_d21e_revb.menu.bootloader.16kb.upload.wait_for_upload_port=true +mattairtech_mt_d21e_revb.menu.bootloader.16kb.upload.native_usb=true +mattairtech_mt_d21e_revb.menu.bootloader.0kb=NO_BOOTLOADER +mattairtech_mt_d21e_revb.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mattairtech_mt_d21e_revb.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mattairtech_mt_d21e_revb.menu.bootloader.0kb.upload.tool=arduino:openocd +mattairtech_mt_d21e_revb.menu.bootloader.0kb.upload.use_1200bps_touch=false +mattairtech_mt_d21e_revb.menu.bootloader.0kb.upload.wait_for_upload_port=false +mattairtech_mt_d21e_revb.menu.bootloader.0kb.upload.native_usb=false +mattairtech_mt_d21e_revb.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e_revb.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mattairtech_mt_d21e_revb.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_uart=NO_UART +mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.usb.cdc=CDC_ONLY +mattairtech_mt_d21e_revb.menu.usb.cdc.build.usbcom=CDC_ONLY +mattairtech_mt_d21e_revb.menu.usb.cdc.build.pid=0x0557 +mattairtech_mt_d21e_revb.menu.usb.cdc_hid=CDC_HID +mattairtech_mt_d21e_revb.menu.usb.cdc_hid.build.usbcom=CDC_HID +mattairtech_mt_d21e_revb.menu.usb.cdc_hid.build.pid=0x0856 +mattairtech_mt_d21e_revb.menu.usb.withcdc=WITH_CDC +mattairtech_mt_d21e_revb.menu.usb.withcdc.build.usbcom=WITH_CDC +mattairtech_mt_d21e_revb.menu.usb.withcdc.build.pid=0x0B41 +mattairtech_mt_d21e_revb.menu.usb.hid=HID_ONLY +mattairtech_mt_d21e_revb.menu.usb.hid.build.usbcom=HID_ONLY +mattairtech_mt_d21e_revb.menu.usb.hid.build.pid=0x0B40 +mattairtech_mt_d21e_revb.menu.usb.nocdc=WITHOUT_CDC +mattairtech_mt_d21e_revb.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mattairtech_mt_d21e_revb.menu.usb.nocdc.build.pid=0x0A0C +mattairtech_mt_d21e_revb.menu.usb.none=USB_DISABLED +mattairtech_mt_d21e_revb.menu.usb.none.build.usbcom=USB_DISABLED +mattairtech_mt_d21e_revb.menu.usb.none.build.pid=0x0856 + + # MattairTech MT-D21E -mattairtech_mt_d21e.name=MattairTech MT-D21E +mattairtech_mt_d21e.name=MattairTech MT-D21E (rev A) mattairtech_mt_d21e.vid.0=0x16D0 mattairtech_mt_d21e.pid.0=0x0557 mattairtech_mt_d21e.vid.1=0x16D0 mattairtech_mt_d21e.pid.1=0x0856 mattairtech_mt_d21e.vid.2=0x16D0 mattairtech_mt_d21e.pid.2=0x0B41 +mattairtech_mt_d21e.vid.3=0x16D0 +mattairtech_mt_d21e.pid.3=0x0B40 +mattairtech_mt_d21e.vid.4=0x16D0 +mattairtech_mt_d21e.pid.4=0x0A0C +mattairtech_mt_d21e.vid.5=0x16D0 +mattairtech_mt_d21e.pid.5=0x0856 mattairtech_mt_d21e.build.mcu=cortex-m0plus mattairtech_mt_d21e.build.f_cpu=48000000L -mattairtech_mt_d21e.build.usb_product="MT-D21E" -mattairtech_mt_d21e.build.usb_manufacturer="MattairTech" +mattairtech_mt_d21e.build.usb_product="MT-D21E Rev A" +mattairtech_mt_d21e.build.usb_manufacturer="MattairTech LLC" mattairtech_mt_d21e.build.board=SAMD_ZERO mattairtech_mt_d21e.build.core=arduino mattairtech_mt_d21e.build.variant=MT_D21E @@ -40,12 +205,12 @@ mattairtech_mt_d21e.build.vid=0x16D0 mattairtech_mt_d21e.upload.protocol=sam-ba mattairtech_mt_d21e.bootloader.tool=arduino:openocd mattairtech_mt_d21e.menu.clock.crystal_32k=32KHZ_CRYSTAL -mattairtech_mt_d21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mattairtech_mt_d21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL mattairtech_mt_d21e.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL mattairtech_mt_d21e.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL -mattairtech_mt_d21e.menu.clock.internal=INTERNAL +mattairtech_mt_d21e.menu.clock.internal=INTERNAL_OSCILLATOR mattairtech_mt_d21e.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL -mattairtech_mt_d21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mattairtech_mt_d21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR mattairtech_mt_d21e.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB mattairtech_mt_d21e.menu.cpu.samd21e18a=SAMD21E18A mattairtech_mt_d21e.menu.cpu.samd21e18a.upload.maximum_size=253952 @@ -71,166 +236,14 @@ mattairtech_mt_d21e.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {buil mattairtech_mt_d21e.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld mattairtech_mt_d21e.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg mattairtech_mt_d21e.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_A_SAMD21E15A.bin -mattairtech_mt_d21e.menu.bootloader.8kb=8KB +mattairtech_mt_d21e.menu.bootloader.8kb=8KB_BOOTLOADER mattairtech_mt_d21e.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ mattairtech_mt_d21e.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader mattairtech_mt_d21e.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac mattairtech_mt_d21e.menu.bootloader.8kb.upload.use_1200bps_touch=true mattairtech_mt_d21e.menu.bootloader.8kb.upload.wait_for_upload_port=true mattairtech_mt_d21e.menu.bootloader.8kb.upload.native_usb=true -mattairtech_mt_d21e.menu.bootloader.16kb=16KB -mattairtech_mt_d21e.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ -mattairtech_mt_d21e.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader -mattairtech_mt_d21e.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac -mattairtech_mt_d21e.menu.bootloader.16kb.upload.use_1200bps_touch=true -mattairtech_mt_d21e.menu.bootloader.16kb.upload.wait_for_upload_port=true -mattairtech_mt_d21e.menu.bootloader.16kb.upload.native_usb=true -mattairtech_mt_d21e.menu.bootloader.0kb=NO_BOOTLOADER -mattairtech_mt_d21e.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ -mattairtech_mt_d21e.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader -mattairtech_mt_d21e.menu.bootloader.0kb.upload.tool=arduino:openocd -mattairtech_mt_d21e.menu.bootloader.0kb.upload.use_1200bps_touch=false -mattairtech_mt_d21e.menu.bootloader.0kb.upload.wait_for_upload_port=false -mattairtech_mt_d21e.menu.bootloader.0kb.upload.native_usb=false -mattairtech_mt_d21e.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI -mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_uart=ONE_UART -mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_spi=ONE_SPI -mattairtech_mt_d21e.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI -mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_uart=TWO_UART -mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_spi=ONE_SPI -mattairtech_mt_d21e.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_uart=NO_UART -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_spi=ONE_SPI -mattairtech_mt_d21e.menu.usb.cdc=CDC_ONLY -mattairtech_mt_d21e.menu.usb.cdc.build.usbcom=CDC_ONLY -mattairtech_mt_d21e.menu.usb.cdc.build.pid=0x0557 -mattairtech_mt_d21e.menu.usb.cdc_hid=CDC_HID -mattairtech_mt_d21e.menu.usb.cdc_hid.build.usbcom=CDC_HID -mattairtech_mt_d21e.menu.usb.cdc_hid.build.pid=0x0856 -mattairtech_mt_d21e.menu.usb.withcdc=WITH_CDC -mattairtech_mt_d21e.menu.usb.withcdc.build.usbcom=WITH_CDC -mattairtech_mt_d21e.menu.usb.withcdc.build.pid=0x0B41 -mattairtech_mt_d21e.menu.usb.hid=HID_ONLY -mattairtech_mt_d21e.menu.usb.hid.build.usbcom=HID_ONLY -mattairtech_mt_d21e.menu.usb.hid.build.pid=0x0B40 -mattairtech_mt_d21e.menu.usb.nocdc=WITHOUT_CDC -mattairtech_mt_d21e.menu.usb.nocdc.build.usbcom=WITHOUT_CDC -mattairtech_mt_d21e.menu.usb.nocdc.build.pid=0x0A0C -mattairtech_mt_d21e.menu.usb.none=USB_DISABLED -mattairtech_mt_d21e.menu.usb.none.build.usbcom=USB_DISABLED -mattairtech_mt_d21e.menu.usb.none.build.pid=0x0856 - - -# MattairTech MT-D21E (rev B) -mattairtech_mt_d21e.name=MattairTech MT-D21E (rev B) -mattairtech_mt_d21e.vid.0=0x16D0 -mattairtech_mt_d21e.pid.0=0x0557 -mattairtech_mt_d21e.vid.1=0x16D0 -mattairtech_mt_d21e.pid.1=0x0856 -mattairtech_mt_d21e.vid.2=0x16D0 -mattairtech_mt_d21e.pid.2=0x0B41 -mattairtech_mt_d21e.build.mcu=cortex-m0plus -mattairtech_mt_d21e.build.f_cpu=48000000L -mattairtech_mt_d21e.build.usb_product="MT-D21E" -mattairtech_mt_d21e.build.usb_manufacturer="MattairTech" -mattairtech_mt_d21e.build.board=SAMD_ZERO -mattairtech_mt_d21e.build.core=arduino -mattairtech_mt_d21e.build.variant=MT_D21E_revB -mattairtech_mt_d21e.build.variant_system_lib= -mattairtech_mt_d21e.build.vid=0x16D0 -mattairtech_mt_d21e.upload.protocol=sam-ba -mattairtech_mt_d21e.bootloader.tool=arduino:openocd -mattairtech_mt_d21e.menu.clock.crystal_32k=32KHZ_CRYSTAL -mattairtech_mt_d21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL -mattairtech_mt_d21e.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL -mattairtech_mt_d21e.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL -mattairtech_mt_d21e.menu.clock.internal=INTERNAL -mattairtech_mt_d21e.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL -mattairtech_mt_d21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED -mattairtech_mt_d21e.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB -mattairtech_mt_d21e.menu.cpu.samd21e18a=SAMD21E18A -mattairtech_mt_d21e.menu.cpu.samd21e18a.upload.maximum_size=253952 -mattairtech_mt_d21e.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.samd21e18a.build.ldscript=flash_256KB.ld -mattairtech_mt_d21e.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg -mattairtech_mt_d21e.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E18A.bin -mattairtech_mt_d21e.menu.cpu.samd21e17a=SAMD21E17A -mattairtech_mt_d21e.menu.cpu.samd21e17a.upload.maximum_size=122880 -mattairtech_mt_d21e.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.samd21e17a.build.ldscript=flash_128KB.ld -mattairtech_mt_d21e.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg -mattairtech_mt_d21e.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E17A.bin -mattairtech_mt_d21e.menu.cpu.samd21e16a=SAMD21E16A -mattairtech_mt_d21e.menu.cpu.samd21e16a.upload.maximum_size=57344 -mattairtech_mt_d21e.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.samd21e16a.build.ldscript=flash_64KB.ld -mattairtech_mt_d21e.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg -mattairtech_mt_d21e.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E16A.bin -mattairtech_mt_d21e.menu.cpu.samd21e15a=SAMD21E15A -mattairtech_mt_d21e.menu.cpu.samd21e15a.upload.maximum_size=24576 -mattairtech_mt_d21e.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld -mattairtech_mt_d21e.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg -mattairtech_mt_d21e.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E15A.bin -mattairtech_mt_d21e.menu.cpu.saml21e18b=SAML21E18B -mattairtech_mt_d21e.menu.cpu.saml21e18b.upload.maximum_size=253952 -mattairtech_mt_d21e.menu.cpu.saml21e18b.build.extra_flags=-D__SAML21E18B__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.saml21e18b.build.ldscript=flash_256KB.ld -mattairtech_mt_d21e.menu.cpu.saml21e18b.build.openocdscript=openocd_scripts/SAML21E18B.cfg -mattairtech_mt_d21e.menu.cpu.saml21e18b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E18B.bin -mattairtech_mt_d21e.menu.cpu.saml21e17b=SAML21E17B -mattairtech_mt_d21e.menu.cpu.saml21e17b.upload.maximum_size=122880 -mattairtech_mt_d21e.menu.cpu.saml21e17b.build.extra_flags=-D__SAML21E17B__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.saml21e17b.build.ldscript=flash_128KB.ld -mattairtech_mt_d21e.menu.cpu.saml21e17b.build.openocdscript=openocd_scripts/SAML21E17B.cfg -mattairtech_mt_d21e.menu.cpu.saml21e17b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E17B.bin -mattairtech_mt_d21e.menu.cpu.saml21e16b=SAML21E16B -mattairtech_mt_d21e.menu.cpu.saml21e16b.upload.maximum_size=57344 -mattairtech_mt_d21e.menu.cpu.saml21e16b.build.extra_flags=-D__SAML21E16B__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.saml21e16b.build.ldscript=flash_64KB.ld -mattairtech_mt_d21e.menu.cpu.saml21e16b.build.openocdscript=openocd_scripts/SAML21E16B.cfg -mattairtech_mt_d21e.menu.cpu.saml21e16b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E16B.bin -mattairtech_mt_d21e.menu.cpu.saml21e15b=SAML21E15B -mattairtech_mt_d21e.menu.cpu.saml21e15b.upload.maximum_size=24576 -mattairtech_mt_d21e.menu.cpu.saml21e15b.build.extra_flags=-D__SAML21E15B__ {build.usb_flags} -mattairtech_mt_d21e.menu.cpu.saml21e15b.build.ldscript=flash_32KB.ld -mattairtech_mt_d21e.menu.cpu.saml21e15b.build.openocdscript=openocd_scripts/SAML21E15B.cfg -mattairtech_mt_d21e.menu.cpu.saml21e15b.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E15B.bin -mattairtech_mt_d21e.menu.cpu.samc21e18a=SAMC21E18A -mattairtech_mt_d21e.menu.cpu.samc21e18a.upload.maximum_size=253952 -mattairtech_mt_d21e.menu.cpu.samc21e18a.build.extra_flags=-D__SAMC21E18A__ -mattairtech_mt_d21e.menu.cpu.samc21e18a.build.ldscript=flash_256KB.ld -mattairtech_mt_d21e.menu.cpu.samc21e18a.build.openocdscript=openocd_scripts/SAMC21E18A.cfg -mattairtech_mt_d21e.menu.cpu.samc21e18a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E18A.bin -mattairtech_mt_d21e.menu.cpu.samc21e17a=SAMC21E17A -mattairtech_mt_d21e.menu.cpu.samc21e17a.upload.maximum_size=122880 -mattairtech_mt_d21e.menu.cpu.samc21e17a.build.extra_flags=-D__SAMC21E17A__ -mattairtech_mt_d21e.menu.cpu.samc21e17a.build.ldscript=flash_128KB.ld -mattairtech_mt_d21e.menu.cpu.samc21e17a.build.openocdscript=openocd_scripts/SAMC21E17A.cfg -mattairtech_mt_d21e.menu.cpu.samc21e17a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E17A.bin -mattairtech_mt_d21e.menu.cpu.samc21e16a=SAMC21E16A -mattairtech_mt_d21e.menu.cpu.samc21e16a.upload.maximum_size=57344 -mattairtech_mt_d21e.menu.cpu.samc21e16a.build.extra_flags=-D__SAMC21E16A__ -mattairtech_mt_d21e.menu.cpu.samc21e16a.build.ldscript=flash_64KB.ld -mattairtech_mt_d21e.menu.cpu.samc21e16a.build.openocdscript=openocd_scripts/SAMC21E16A.cfg -mattairtech_mt_d21e.menu.cpu.samc21e16a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E16A.bin -mattairtech_mt_d21e.menu.cpu.samc21e15a=SAMC21E15A -mattairtech_mt_d21e.menu.cpu.samc21e15a.upload.maximum_size=24576 -mattairtech_mt_d21e.menu.cpu.samc21e15a.build.extra_flags=-D__SAMC21E15A__ -mattairtech_mt_d21e.menu.cpu.samc21e15a.build.ldscript=flash_32KB.ld -mattairtech_mt_d21e.menu.cpu.samc21e15a.build.openocdscript=openocd_scripts/SAMC21E15A.cfg -mattairtech_mt_d21e.menu.cpu.samc21e15a.bootloader.file=zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E15A.bin -mattairtech_mt_d21e.menu.bootloader.8kb=8KB -mattairtech_mt_d21e.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ -mattairtech_mt_d21e.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader -mattairtech_mt_d21e.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac -mattairtech_mt_d21e.menu.bootloader.8kb.upload.use_1200bps_touch=true -mattairtech_mt_d21e.menu.bootloader.8kb.upload.wait_for_upload_port=true -mattairtech_mt_d21e.menu.bootloader.8kb.upload.native_usb=true -mattairtech_mt_d21e.menu.bootloader.16kb=16KB +mattairtech_mt_d21e.menu.bootloader.16kb=16KB_BOOTLOADER mattairtech_mt_d21e.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ mattairtech_mt_d21e.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader mattairtech_mt_d21e.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac @@ -284,10 +297,16 @@ mattairtech_mt_d11.vid.1=0x16D0 mattairtech_mt_d11.pid.1=0x0856 mattairtech_mt_d11.vid.2=0x16D0 mattairtech_mt_d11.pid.2=0x0B41 +mattairtech_mt_d11.vid.3=0x16D0 +mattairtech_mt_d11.pid.3=0x0B40 +mattairtech_mt_d11.vid.4=0x16D0 +mattairtech_mt_d11.pid.4=0x0A0C +mattairtech_mt_d11.vid.5=0x16D0 +mattairtech_mt_d11.pid.5=0x0856 mattairtech_mt_d11.build.mcu=cortex-m0plus mattairtech_mt_d11.build.f_cpu=48000000L mattairtech_mt_d11.build.usb_product="MT-D11" -mattairtech_mt_d11.build.usb_manufacturer="MattairTech" +mattairtech_mt_d11.build.usb_manufacturer="MattairTech LLC" mattairtech_mt_d11.build.board=SAMD_ZERO mattairtech_mt_d11.build.core=arduino mattairtech_mt_d11.build.variant=MT_D11 @@ -296,18 +315,18 @@ mattairtech_mt_d11.build.vid=0x16D0 mattairtech_mt_d11.upload.protocol=sam-ba mattairtech_mt_d11.bootloader.tool=arduino:openocd mattairtech_mt_d11.menu.clock.crystal_32k=32KHZ_CRYSTAL -mattairtech_mt_d11.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +mattairtech_mt_d11.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL mattairtech_mt_d11.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL mattairtech_mt_d11.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL -mattairtech_mt_d11.menu.clock.internal=INTERNAL +mattairtech_mt_d11.menu.clock.internal=INTERNAL_OSCILLATOR mattairtech_mt_d11.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL -mattairtech_mt_d11.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mattairtech_mt_d11.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR mattairtech_mt_d11.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB mattairtech_mt_d11.build.extra_flags=-D__SAMD11D14AM__ {build.usb_flags} -mattairtech_mt_d11.build.ldscript=linker_scripts/gcc/flash_16KB.ld +mattairtech_mt_d11.build.ldscript=flash_16KB.ld mattairtech_mt_d11.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg mattairtech_mt_d11.bootloader.file=zero/binaries/sam_ba_MT_D11_SAMD11D14AM.bin -mattairtech_mt_d11.menu.bootloader.4kb=4KB +mattairtech_mt_d11.menu.bootloader.4kb=4KB_BOOTLOADER mattairtech_mt_d11.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ mattairtech_mt_d11.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader mattairtech_mt_d11.menu.bootloader.4kb.upload.tool=MattairTech_Arduino:bossac @@ -363,10 +382,16 @@ d11c14a.vid.1=0x16D0 d11c14a.pid.1=0x0856 d11c14a.vid.2=0x16D0 d11c14a.pid.2=0x0B41 +d11c14a.vid.3=0x16D0 +d11c14a.pid.3=0x0B40 +d11c14a.vid.4=0x16D0 +d11c14a.pid.4=0x0A0C +d11c14a.vid.5=0x16D0 +d11c14a.pid.5=0x0856 d11c14a.build.mcu=cortex-m0plus d11c14a.build.f_cpu=48000000L d11c14a.build.usb_product="D11C14A" -d11c14a.build.usb_manufacturer="MattairTech" +d11c14a.build.usb_manufacturer="MattairTech LLC" d11c14a.build.board=SAMD_ZERO d11c14a.build.core=arduino d11c14a.build.variant=Generic_D11C14A @@ -374,19 +399,19 @@ d11c14a.build.variant_system_lib= d11c14a.build.vid=0x16D0 d11c14a.upload.protocol=sam-ba d11c14a.bootloader.tool=arduino:openocd +d11c14a.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11c14a.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11c14a.menu.clock.internal=INTERNAL_OSCILLATOR +d11c14a.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL d11c14a.menu.clock.crystal_32k=32KHZ_CRYSTAL -d11c14a.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL d11c14a.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL d11c14a.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL -d11c14a.menu.clock.internal=INTERNAL -d11c14a.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL -d11c14a.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED -d11c14a.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB d11c14a.build.extra_flags=-D__SAMD11C14A__ {build.usb_flags} -d11c14a.build.ldscript=linker_scripts/gcc/flash_16KB.ld +d11c14a.build.ldscript=flash_16KB.ld d11c14a.build.openocdscript=openocd_scripts/SAMD11C14A.cfg d11c14a.bootloader.file=zero/binaries/sam_ba_Generic_D11C14A_SAMD11C14A.bin -d11c14a.menu.bootloader.4kb=4KB +d11c14a.menu.bootloader.4kb=4KB_BOOTLOADER d11c14a.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ d11c14a.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader d11c14a.menu.bootloader.4kb.upload.tool=MattairTech_Arduino:bossac @@ -482,20 +507,20 @@ arduino_zero.build.vid=0x2341 arduino_zero.build.pid=0x804d arduino_zero.upload.protocol=sam-ba arduino_zero.menu.clock.crystal_32k=32KHZ_CRYSTAL -arduino_zero.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL -arduino_zero.menu.clock.internal=INTERNAL +arduino_zero.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +arduino_zero.menu.clock.internal=INTERNAL_OSCILLATOR arduino_zero.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL -arduino_zero.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +arduino_zero.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR arduino_zero.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB arduino_zero.bootloader.tool=arduino:openocd arduino_zero.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} arduino_zero.build.ldscript=flash_256KB.ld arduino_zero.build.openocdscript=openocd_scripts/SAMD21G18A.cfg -arduino_zero.menu.bootloader.8kb=8KB +arduino_zero.menu.bootloader.8kb=8KB_BOOTLOADER arduino_zero.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ arduino_zero.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader arduino_zero.menu.bootloader.8kb.upload.maximum_size=253952 -arduino_zero.menu.bootloader.16kb=16KB +arduino_zero.menu.bootloader.16kb=16KB_BOOTLOADER arduino_zero.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ arduino_zero.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader arduino_zero.menu.bootloader.16kb.upload.maximum_size=245760 @@ -587,19 +612,19 @@ mzero.build.f_cpu=48000000L mzero.build.usb_product="Arduino M0 / M0 Pro" mzero.build.board=SAM_ZERO mzero.build.core=arduino -mzero.build.variant=arduino_m0_m0_pro +mzero.build.variant=arduino_mzero mzero.build.variant_system_lib= mzero.menu.clock.crystal_32k=32KHZ_CRYSTAL -mzero.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32KHZ_CRYSTAL -mzero.menu.clock.internal=INTERNAL +mzero.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +mzero.menu.clock.internal=INTERNAL_OSCILLATOR mzero.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL -mzero.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED +mzero.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR mzero.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB mzero.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags} mzero.build.ldscript=flash_256KB.ld mzero.build.openocdscript=openocd_scripts/SAMD21G18A.cfg mzero.bootloader.tool=arduino:openocd -mzero.menu.bootloader.16kb=16KB +mzero.menu.bootloader.16kb=16KB_BOOTLOADER mzero.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ mzero.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader mzero.menu.bootloader.16kb.upload.maximum_size=245760 @@ -607,7 +632,7 @@ mzero.menu.bootloader.16kb.upload.tool=arduino:avrdude mzero.menu.bootloader.16kb.upload.protocol=stk500v2 mzero.menu.bootloader.16kb.upload.speed=57600 mzero.menu.bootloader.16kb.build.emu.mcu=atmega2560 -mzero.menu.bootloader.8kb=8KB +mzero.menu.bootloader.8kb=8KB_BOOTLOADER mzero.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ mzero.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader mzero.menu.bootloader.8kb.upload.maximum_size=253952 diff --git a/bootloaders/zero/board_init.c b/bootloaders/zero/board_init.c index 96ca72fc0..85e5c8640 100644 --- a/bootloaders/zero/board_init.c +++ b/bootloaders/zero/board_init.c @@ -30,10 +30,6 @@ #define GENERIC_CLOCK_GENERATOR_XOSC (1u) #define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT (D21/D11) */ #define GENERIC_CLOCK_GENERATOR_OSC_HS (3u) -#define GENERIC_CLOCK_GENERATOR_FDPLL96M (4u) -#define GENERIC_CLOCK_GENERATOR_XOSC32K (5u) -#define GENERIC_CLOCK_GENERATOR_OSC32K (6u) /* GCLK6 not available on D11 */ -#define GENERIC_CLOCK_GENERATOR_DFLL48M (7u) /* only D and L have the DFLL48M, GCLK7 not available on D11 */ // Constants for Clock multiplexers #if (SAMD || SAML21) @@ -374,10 +370,7 @@ void board_init( void ) waitForSync(); #endif - /* - * Now that all system clocks are configured, we can set CPU and APBx BUS clocks. - * There values are normally the one present after Reset. - */ + /* Set CPU and APB dividers before switching the CPU/APB clocks to the new clock source */ #if (SAMD) PM->CPUSEL.reg = PM_CPUSEL_CPUDIV_DIV1 ; PM->APBASEL.reg = PM_APBASEL_APBADIV_DIV1_Val ; diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 3ea28e943..4789c0005 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -76,6 +76,38 @@ uint32_t* pulSketch_Start_Address; return; } +#if defined(BOOT_LOAD_PIN) + volatile PortGroup *boot_port = (volatile PortGroup *)(&(PORT->Group[BOOT_LOAD_PIN / 32])); + volatile bool boot_en; + + // Enable the input mode in Boot GPIO Pin + boot_port->DIRCLR.reg = BOOT_PIN_MASK; + boot_port->PINCFG[BOOT_LOAD_PIN & 0x1F].reg = PORT_PINCFG_INEN | PORT_PINCFG_PULLEN; + boot_port->OUTSET.reg = BOOT_PIN_MASK; + + /* Allow time for debouncing capacitor to charge (10ms) */ + /* Needed when BOOT_DOUBLE_TAP is not used */ + +#if (SAMD21 || SAMD11) + #define numLoopsDebounce 2500UL +#elif (SAML21 || SAMC21) + #define numLoopsDebounce 10000UL +#endif + for (uint32_t i=0; iIN.reg) & BOOT_PIN_MASK; + + // Check the bootloader enable condition + if (!boot_en) + { + // Stay in bootloader + return; + } +#endif + #if defined(BOOT_DOUBLE_TAP_ENABLED) #define DOUBLE_TAP_MAGIC 0x07738135 @@ -121,38 +153,6 @@ uint32_t* pulSketch_Start_Address; } #endif -#if defined(BOOT_LOAD_PIN) - volatile PortGroup *boot_port = (volatile PortGroup *)(&(PORT->Group[BOOT_LOAD_PIN / 32])); - volatile bool boot_en; - - // Enable the input mode in Boot GPIO Pin - boot_port->DIRCLR.reg = BOOT_PIN_MASK; - boot_port->PINCFG[BOOT_LOAD_PIN & 0x1F].reg = PORT_PINCFG_INEN | PORT_PINCFG_PULLEN; - boot_port->OUTSET.reg = BOOT_PIN_MASK; - - /* Allow time for debouncing capacitor to charge (10ms) */ - /* Needed when BOOT_DOUBLE_TAP is not used */ - -#if (SAMD21 || SAMD11) - #define numLoopsDebounce 2500UL -#elif (SAML21 || SAMC21) - #define numLoopsDebounce 10000UL -#endif - for (uint32_t i=0; iIN.reg) & BOOT_PIN_MASK; - - // Check the bootloader enable condition - if (!boot_en) - { - // Stay in bootloader - return; - } -#endif - /* Rebase the Stack Pointer */ __set_MSP( (uint32_t)(__sketch_vectors_ptr) ); diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 92a719134..d30d916c2 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -65,8 +65,6 @@ void init( void ); void setup( void ) ; void loop( void ) ; -#include "WVariant.h" - #ifdef __cplusplus } // extern "C" #endif @@ -75,6 +73,11 @@ void loop( void ) ; #ifdef __cplusplus #include "WCharacter.h" #include "WString.h" + +extern "C"{ +#include "WVariant.h" +} // extern "C" + #include "Tone.h" #include "WMath.h" #include "HardwareSerial.h" @@ -129,7 +132,9 @@ void loop( void ) ; #include "USB/USBDesc.h" #include "USB/USBCore.h" #include "USB/USBAPI.h" -#include "USB/USB_host.h" +#if (SAMD21 || SAML21) + #include "USB/USB_host.h" +#endif #endif #endif // Arduino_h diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index fe9754b0e..1e8a09d36 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -23,6 +23,11 @@ #define SERCOM_FREQ_REF F_CPU +// Not defined in CMSIS for SAML or SAMC +#ifndef SERCOM_SPI_CTRLA_MODE_SPI_MASTER +#define SERCOM_SPI_CTRLA_MODE_SPI_MASTER (0x3ul << SERCOM_SPI_CTRLA_MODE_Pos) +#endif + typedef enum { UART_EXT_CLOCK = 0, diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index dbe2c5041..1bd0604a0 100644 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -24,7 +24,7 @@ #if (SAMD21 || SAMD11) #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY); #elif (SAML21 || SAMC21) -#define WAIT_TC16_REGS_SYNC(x) while(x->SYNCBUSY.reg); +#define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.SYNCBUSY.reg); #else #error "Tone.cpp: Unsupported chip" #endif @@ -39,20 +39,20 @@ volatile int64_t toggleCount; volatile bool toneIsActive = false; volatile bool firstTimeRunning = false; -/* TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14A as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. */ -#if (SAMD11D14A) +/* TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14 as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. */ +#if (SAMD11D) #define TONE_TC TC2 #define TONE_TC_IRQn TC2_IRQn void TC2_Handler (void) __attribute__ ((alias("Tone_Handler"))); -#elif (SAMD11C14) +#elif (SAMD11C) +#define TONE_TC TC1 +#define TONE_TC_IRQn TC1_IRQn +void TC1_Handler (void) __attribute__ ((alias("Tone_Handler"))); +/* TC5 does not exist on the SAML or SAMC. Using TC1 instead. */ +#elif (SAML || SAMC) #define TONE_TC TC1 #define TONE_TC_IRQn TC1_IRQn void TC1_Handler (void) __attribute__ ((alias("Tone_Handler"))); -/* TC5 does not exist on the SAML or SAMC. Using TC3 instead. It will conflict with the 2 associated TC analogWrite() pins. */ -#elif (SAML_SERIES || SAMC_SERIES) -#define TONE_TC TC3 -#define TONE_TC_IRQn TC3_IRQn -void TC3_Handler (void) __attribute__ ((alias("Tone_Handler"))); #else #define TONE_TC TC5 #define TONE_TC_IRQn TC5_IRQn @@ -161,7 +161,7 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration) WAIT_TC16_REGS_SYNC(TONE_TC) #if (SAML21 || SAMC21) - TONE_TC->WAVE.reg = TC_WAVE_WAVEGEN_MFRQ; + TONE_TC->COUNT16.WAVE.reg = TC_WAVE_WAVEGEN_MFRQ; WAIT_TC16_REGS_SYNC(TONE_TC) #endif diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index d82c68eb1..65953caca 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -23,6 +23,7 @@ #include #include +#if (!SAMC) #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define CDC_SERIAL_BUFFER_SIZE 256 @@ -292,3 +293,4 @@ bool Serial_::rts() { Serial_ SerialUSB(USBDevice); #endif +#endif diff --git a/cores/arduino/USB/SAMD21_USBDevice.h b/cores/arduino/USB/SAMD21_USBDevice.h index a33bc1b0f..f72c7f672 100644 --- a/cores/arduino/USB/SAMD21_USBDevice.h +++ b/cores/arduino/USB/SAMD21_USBDevice.h @@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if (!SAMC) #pragma once #include @@ -44,7 +45,9 @@ class USBDevice_SAMD21G18x { // USB mode (device/host) inline void setUSBDeviceMode() { usb.CTRLA.bit.MODE = USB_CTRLA_MODE_DEVICE_Val; } +#if (SAMD21 || SAML21) inline void setUSBHostMode() { usb.CTRLA.bit.MODE = USB_CTRLA_MODE_HOST_Val; } +#endif inline void runInStandby() { usb.CTRLA.bit.RUNSTDBY = 1; } inline void noRunInStandby() { usb.CTRLA.bit.RUNSTDBY = 0; } @@ -393,3 +396,4 @@ class DoubleBufferedEPOutHandler : public EPHandler { volatile bool notify; }; +#endif diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index d20a0e70d..c1d95a9f0 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -16,13 +16,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "sam.h" + +#if (!SAMC) + #include #include "SAMD21_USBDevice.h" #include "PluggableUSB.h" #include "USBDesc.h" #include "WVariant.h" -#include "sam.h" #include #include @@ -968,3 +971,4 @@ void USBDeviceClass::ISRHandler() // USBDevice class instance USBDeviceClass USBDevice; +#endif diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 6a5f8e163..5f928533e 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -19,6 +19,14 @@ #ifndef __USBCORE_H__ #define __USBCORE_H__ +#ifdef __cplusplus +extern "C" { +#endif +extern void USB_SetHandler(void (*pf_isr)(void)); +#ifdef __cplusplus +} +#endif + // Standard requests #define GET_STATUS 0 #define CLEAR_FEATURE 1 diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index 666c0f505..33f71ef84 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -17,6 +17,7 @@ */ +#if (SAMD21 || SAML21) #include #include #include @@ -524,3 +525,4 @@ uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type) // } #endif // HOST_DEFINED +#endif // (SAMD21 || SAML21) \ No newline at end of file diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 27360fbcf..56c846991 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -40,12 +40,14 @@ static void __initialize() GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GCM_EIC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); #elif (SAML21 || SAMC21) + MCLK->APBAMASK.reg |= MCLK_APBAMASK_EIC; GCLK->PCHCTRL[GCM_EIC].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); - while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); + while ( (GCLK->PCHCTRL[GCM_EIC].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync #else #error "WInterrupts.c: Unsupported chip" #endif +// SAML and SAMC EIC.CONFIG registers are enable-protected, thus must be disabled/enabled for each config change #if (SAMD21 || SAMD11) /* Shall we do that? // Do a software reset on EIC @@ -56,16 +58,6 @@ static void __initialize() // Enable EIC EIC->CTRL.bit.ENABLE = 1; while (EIC->STATUS.bit.SYNCBUSY == 1) { } -#elif (SAML21 || SAMC21) -/* Shall we do that? - // Do a software reset on EIC - EIC->CTRLA.SWRST.bit = 1 ; - while ((EIC->CTRLA.SWRST.bit == 1) && (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK)) { } -*/ - - // Enable EIC - EIC->CTRLA.bit.ENABLE = 1; - while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } #endif } @@ -88,6 +80,12 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) enabled = 1; } +#if (SAML21) + // The CHANGE and RISING interrupt modes on pin A31 on the SAML21 do not seem to work properly + if ((g_APinDescription[pin].ulPort == 0) && (g_APinDescription[pin].ulPin == 31) && ((mode == CHANGE) || (mode == RISING))) + return; +#endif + // Assign pin to EIC if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) return; @@ -109,12 +107,26 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) // Configure the interrupt mode pos = (in - (8 * config)) << 2; // compute position (ie: 0, 4, 8, 12, ...) - uint32_t regConfig = EIC->CONFIG[config].reg; // copy register to variable + +#if (SAML21 || SAMC21) + EIC->CTRLA.reg = 0; // disable EIC before changing CONFIG + while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } +#endif + + uint32_t regConfig = (~(EIC_CONFIG_SENSE0_Msk << pos) & EIC->CONFIG[config].reg); // copy register to variable, clearing mode bits // insert new mode and write to register (the hardware numbering for the 5 interrupt modes is in reverse order to the arduino numbering, so using '5-mode'). EIC->CONFIG[config].reg = (regConfig | ((5-mode) << pos)); +#if (SAML21 || SAMC21) + EIC->CTRLA.reg = EIC_CTRLA_ENABLE; // enable EIC + while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } +#endif + + // Clear the interrupt flag + EIC->INTFLAG.reg = (1 << in); + // Enable the interrupt - EIC->INTENSET.reg = EIC_INTENSET_EXTINT(1 << in); + EIC->INTENSET.reg = (1 << in); } /* @@ -127,7 +139,7 @@ void detachInterrupt(uint32_t pin) return; EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << in); - + // Disable wakeup capability on pin during sleep (WAKEUP always enabled on SAML and SAMC) #if (SAMD21 || SAMD11) EIC->WAKEUP.reg &= ~(1 << in); @@ -140,7 +152,7 @@ void detachInterrupt(uint32_t pin) void EIC_Handler(void) { // Test the normal interrupts - for (uint32_t i=EXTERNAL_INT_0; i<=EXTERNAL_INT_15; i++) + for (uint32_t i=EXTERNAL_INT_0; i<=EXTERNAL_INT_15; i++) { if ((EIC->INTFLAG.reg & (1 << i)) != 0) { diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index a08152020..999ea5a1c 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -101,8 +101,8 @@ extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; #define GetTCChannelNumber( x ) ( (x) & 0x07 ) #if (SAMD) #define GetTC( x ) ( g_apTCInstances[((x) >> 4) & 0x07] ) -#elif (SAML21 || SAMC21) -#define GetTC( x ) ( ( ((x) >> 3) & 0x01 ) == 0 ? g_apTCInstances[((x) >> 4) & 0x07] : g_apTCInstances[(((x) >> 4) & 0x07) + TCC_INST_NUM] ) +#elif (SAML || SAMC) +#define GetTC( x ) ( (((x) >> 3) & 0x01 ) == 0 ? g_apTCInstances[((x) >> 4) & 0x07] : (((((x) >> 4) & 0x07) == 4) ? TC4 : g_apTCInstances[(((x) >> 4) & 0x07) + TCC_INST_NUM]) ) #else #error "WVariant.h: Unsupported chip" #endif @@ -279,9 +279,10 @@ typedef struct _PinDescription uint8_t ulExtInt ; // Must be 8 bits uint8_t ulGCLKCCL ; // Must be 8 bits #else - uint16_t ulTCChannel ; // Must be 16 bits - uint8_t ulADCChannelNumber ; // Must be 8 bits - uint8_t ulExtInt ; // Must be 8 bits +#error "The PinDescription table in the variant.cpp file of your board variant must be updated so that MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10608. See VARIANT_COMPLIANCE_CHANGELOG." +// uint16_t ulTCChannel ; // Must be 16 bits +// uint8_t ulADCChannelNumber ; // Must be 8 bits +// uint8_t ulExtInt ; // Must be 8 bits #endif } PinDescription ; diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c index a13ee4652..fa0b02f72 100644 --- a/cores/arduino/cortex_handlers.c +++ b/cores/arduino/cortex_handlers.c @@ -35,7 +35,7 @@ void Dummy_Handler(void) } /* Cortex-M0+ core handlers */ -void HardFault_Handler(void) __attribute__ ((weak, alias("Dummy_Handler"))); +void HardFault_Handler(void); void Reset_Handler (void); void NMI_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); void SVC_Handler (void) __attribute__ ((weak, alias("Dummy_Handler"))); @@ -152,7 +152,7 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = (void*) DAC_Handler, /* 25 / 17 Digital Analog Converter */ (void*) PTC_Handler, /* 26 / 18 Peripheral Touch Controller */ #if (SAMD21) - (void*) I2S_Handler /* 27 Inter-IC Sound Interface */ + (void*) I2S_Handler, /* 27 Inter-IC Sound Interface */ (void*) (0UL), /* Reserved */ #endif @@ -234,18 +234,16 @@ void Reset_Handler(void) } /* Change default QOS values to have the best performance and correct USB behaviour (applies to D21/D11). From startup_samd21.c from ASF 3.32. */ -#if (SAMD21_SERIES || SAMD11_SERIES) +#if (SAMD21 || SAMD11) SBMATRIX->SFR[SBMATRIX_SLAVE_HMCRAMC0].reg = 2; -#endif - -#if defined(ID_USB) + USB->DEVICE.QOSCTRL.bit.CQOS = 2; USB->DEVICE.QOSCTRL.bit.DQOS = 2; -#endif - + DMAC->QOSCTRL.bit.DQOS = 2; DMAC->QOSCTRL.bit.FQOS = 2; DMAC->QOSCTRL.bit.WRBQOS = 2; +#endif SystemInit(); @@ -279,3 +277,28 @@ void USB_SetHandler(void (*new_usb_isr)(void)) usb_isr = new_usb_isr; } #endif + +void HardFault_Handler(void) +{ + __BKPT(13); + while (1); +} +/* +void NMI_Handler(void) +{ + __BKPT(14); + while (1); +} + +void SVC_Handler(void) +{ + __BKPT(5); + while (1); +} + +void PendSV_Handler(void) +{ + __BKPT(2); + while (1); +} +*/ \ No newline at end of file diff --git a/cores/arduino/delay.c b/cores/arduino/delay.c index ea000abb0..067d7ba94 100644 --- a/cores/arduino/delay.c +++ b/cores/arduino/delay.c @@ -82,7 +82,9 @@ void SysTick_DefaultHandler(void) { // Increment tick count each ms _ulTickCount++; +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) tickReset(); +#endif } #ifdef __cplusplus diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index e600ef238..701f50607 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -23,25 +24,25 @@ /** * \brief SystemInit() configures the needed clocks and according Flash Read Wait States. - * At reset: - * - OSC8M clock source is enabled with a divider by 8 (1MHz). - * - Generic Clock Generator 0 (GCLKMAIN) is using OSC8M as source. - * We need to: - * 1) Enable XOSC32K clock (External on-board 32.768Hz oscillator), will be used as DFLL48M reference. - * 2) Put XOSC32K as source of Generic Clock Generator 1 - * 3) Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 0 (DFLL48M reference) - * 4) Enable DFLL48M clock - * 5) Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz. - * 6) Modify PRESCaler value of OSCM to have 8MHz - * 7) Put OSC8M as source for Generic Clock Generator 3 */ + // Constants for Clock generators #define GENERIC_CLOCK_GENERATOR_MAIN (0u) -#define GENERIC_CLOCK_GENERATOR_XOSC32K (1u) -#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT */ -#define GENERIC_CLOCK_GENERATOR_OSC8M (3u) +#define GENERIC_CLOCK_GENERATOR_XOSC (1u) +#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT (D21/D11) */ +#define GENERIC_CLOCK_GENERATOR_OSC_HS (3u) + // Constants for Clock multiplexers -#define GENERIC_CLOCK_MULTIPLEXER_DFLL48M (0u) +#if (SAMD || SAML21) + #define GENERIC_CLOCK_MULTIPLEXER_DFLL (0u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL (1u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL96M_32K (2u) +#elif (SAMC21) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL (0u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL96M_32K (1u) +#else + #error "startup.c: Unsupported chip" +#endif void waitForSync( void ) { @@ -49,8 +50,6 @@ void waitForSync( void ) while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); #elif (SAML21 || SAMC21) while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); -#else - #error "startup.c: Unsupported chip" #endif } @@ -65,9 +64,16 @@ void waitForDFLL( void ) } #endif +#if (SAML21 || SAMC21) +void waitForPLL( void ) +{ + while ( OSCCTRL->DPLLSYNCBUSY.reg & OSCCTRL_DPLLSYNCBUSY_MASK ); +} +#endif + void SystemInit( void ) { - /* Set 1 Flash Wait State for 48MHz, cf tables 20.9 and 35.27 in SAMD21 Datasheet */ + /* Set 1 Flash Wait State for 48MHz (2 for the L21 and C21), cf tables 20.9 and 35.27 in SAMD21 Datasheet */ #if (SAMD) NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_HALF_Val ; // one wait state #elif (SAML21 || SAMC21) @@ -81,8 +87,15 @@ void SystemInit( void ) MCLK->APBAMASK.reg |= MCLK_APBAMASK_GCLK ; #endif +#if (SAML21) + PM->INTFLAG.reg = PM_INTFLAG_PLRDY; //clear flag + PM->PLCFG.reg |= PM_PLCFG_PLSEL_PL2 ; // must set to highest performance level + while ( (PM->INTFLAG.reg & PM_INTFLAG_PLRDY) != PM_INTFLAG_PLRDY ); + PM->INTFLAG.reg = PM_INTFLAG_PLRDY; //clear flag +#endif + /* ---------------------------------------------------------------------------------------------- - * 0) Software reset the GCLK module to ensure it is re-initialized correctly + * Software reset the GCLK module to ensure it is re-initialized correctly */ #if (SAMD) GCLK->CTRL.reg = GCLK_CTRL_SWRST ; @@ -94,152 +107,284 @@ void SystemInit( void ) while ( (GCLK->CTRLA.reg & GCLK_CTRLA_SWRST) && (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK) ); /* Wait for reset to complete */ #endif + +#if defined(CLOCKCONFIG_32768HZ_CRYSTAL) /* ---------------------------------------------------------------------------------------------- - * 1) Enable XOSC32K clock (External on-board 32.768Hz crystal oscillator) + * Enable XOSC32K clock (External on-board 32.768Hz crystal oscillator) */ + +#if defined(PLL_FRACTIONAL_ENABLE) + #define DPLLRATIO_LDR 2928u + #define DPLLRATIO_LDRFRAC 11u +#else + #define DPLLRATIO_LDR 2929u + #define DPLLRATIO_LDRFRAC 0u +#endif + #if (SAMD) - SYSCTRL->XOSC32K.reg = SYSCTRL_XOSC32K_STARTUP( 0x6u ) | /* cf table 15.10 of product datasheet in chapter 15.8.6 */ - SYSCTRL_XOSC32K_XTALEN | SYSCTRL_XOSC32K_EN32K ; + SYSCTRL->XOSC32K.reg = (SYSCTRL_XOSC32K_STARTUP( 0x6u ) | SYSCTRL_XOSC32K_XTALEN | SYSCTRL_XOSC32K_EN32K) ; SYSCTRL->XOSC32K.bit.ENABLE = 1 ; /* separate call, as described in chapter 15.6.3 */ while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ -#elif (SAML21 || SAMC21) - OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_STARTUP( 0x4u ) | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K ; - OSC32KCTRL->XOSC32K.bit.ENABLE = 1 ; /* separate call, as described in chapter 15.6.3 */ + + SYSCTRL->DPLLRATIO.reg = ( SYSCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | SYSCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ + + SYSCTRL->DPLLCTRLB.reg = SYSCTRL_DPLLCTRLB_REFCLK(0) ; /* select 32KHz crystal input */ + + SYSCTRL->DPLLCTRLA.reg = SYSCTRL_DPLLCTRLA_ENABLE ; + + while ( (SYSCTRL->DPLLSTATUS.reg & SYSCTRL_DPLLSTATUS_CLKRDY) != SYSCTRL_DPLLSTATUS_CLKRDY ); + + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz. */ + GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENDIV_DIV(2) ) ; + waitForSync(); + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + +#elif (SAML21 || SAMC21) + OSC32KCTRL->XOSC32K.reg = (OSC32KCTRL_XOSC32K_STARTUP( 0x4u ) | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_EN1K) ; + OSC32KCTRL->XOSC32K.bit.ENABLE = 1 ; + while ( (OSC32KCTRL->STATUS.reg & OSC32KCTRL_STATUS_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ - #error "SAML and SAMC porting is not yet complete. I still need to modify the clock code (adding support for more sources). See later commit." + + OSCCTRL->DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->DPLLCTRLB.reg = OSCCTRL_DPLLCTRLB_REFCLK(0) ; /* select 32KHz crystal input */ + + OSCCTRL->DPLLPRESC.reg = 0; + waitForPLL(); + + OSCCTRL->DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE ; + waitForPLL(); + + while ( (OSCCTRL->DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_CLKRDY) != OSCCTRL_DPLLSTATUS_CLKRDY ); + + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz. */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); #endif +#elif defined(CLOCKCONFIG_HS_CRYSTAL) /* ---------------------------------------------------------------------------------------------- - * 2) Put XOSC32K as source of Generic Clock Generator 1 + * Enable XOSC clock (External on-board high speed crystal oscillator) */ - GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_XOSC32K ) ; // Generic Clock Generator 1 - waitForSync(); +#if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL)) + #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 4000000UL and 32000000UL" +#endif + +#if defined(PLL_FAST_STARTUP) + #if (HS_CRYSTAL_FREQUENCY_HERTZ < 1000000UL) + #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be at least 1000000UL when PLL_FAST_STARTUP is defined" + #else + #define HS_CRYSTAL_DIVISOR 1000000UL + #endif +#else + #define HS_CRYSTAL_DIVISOR 32000UL +#endif + +#define HS_CRYSTAL_DIVIDER (HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVISOR) +#define DPLLRATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) + +#if defined(PLL_FRACTIONAL_ENABLED) + #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) +#else + #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLLRATIO_LDRFRAC 0 +#endif - /* Write Generic Clock Generator 1 configuration */ - GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_XOSC32K ) | GCLK_GENCTRL_SRC_XOSC32K | GCLK_GENCTRL_GENEN ); +#if (SAMD) + SYSCTRL->XOSC.reg = (SYSCTRL_XOSC_STARTUP( 0x8u ) | SYSCTRL_XOSC_GAIN( 0x4u ) | SYSCTRL_XOSC_XTALEN | SYSCTRL_XOSC_ENABLE) ; // startup time is 8ms + while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSCRDY) == 0 ); /* Wait for oscillator stabilization */ + SYSCTRL->XOSC.reg |= SYSCTRL_XOSC_AMPGC ; // set only after startup time + + /* Connect GCLK1 to XOSC and set prescaler */ + GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_XOSC ) | GCLK_GENDIV_DIV(HS_CRYSTAL_DIVIDER) ) ; // Set divider for generic clock generator 1 waitForSync(); - /* ---------------------------------------------------------------------------------------------- - * 3) Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 0 (DFLL48M reference) - */ - GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GENERIC_CLOCK_MULTIPLEXER_DFLL48M ) | GCLK_CLKCTRL_GEN_GCLK1 | GCLK_CLKCTRL_CLKEN ); + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_XOSC ) | GCLK_GENCTRL_SRC_XOSC | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 1 (FDPLL reference) */ + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GENERIC_CLOCK_MULTIPLEXER_FDPLL ) | GCLK_CLKCTRL_GEN_GCLK1 | GCLK_CLKCTRL_CLKEN ); + waitForSync(); + + /* Configure PLL */ + SYSCTRL->DPLLRATIO.reg = ( SYSCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | SYSCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ + + SYSCTRL->DPLLCTRLB.reg = SYSCTRL_DPLLCTRLB_REFCLK(2) ; /* select GCLK input */ + + SYSCTRL->DPLLCTRLA.reg = SYSCTRL_DPLLCTRLA_ENABLE ; + + while ( (SYSCTRL->DPLLSTATUS.reg & SYSCTRL_DPLLSTATUS_CLKRDY) != SYSCTRL_DPLLSTATUS_CLKRDY ); + + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz. */ + GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENDIV_DIV(2) ) ; + waitForSync(); + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + +#elif (SAML21 || SAMC21) + OSCCTRL->XOSCCTRL.reg = (OSCCTRL_XOSCCTRL_STARTUP( 0x8u ) | OSCCTRL_XOSCCTRL_GAIN( 0x4u ) | OSCCTRL_XOSCCTRL_XTALEN | OSCCTRL_XOSCCTRL_ENABLE) ; // startup time is 8ms + while ( (OSCCTRL->STATUS.reg & OSCCTRL_STATUS_XOSCRDY) == 0 ); /* Wait for oscillator stabilization */ + + OSCCTRL->XOSCCTRL.reg |= OSCCTRL_XOSCCTRL_AMPGC ; // set only after startup time + + /* Connect GCLK1 to XOSC and set prescaler */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_XOSC].reg = ( GCLK_GENCTRL_DIV(HS_CRYSTAL_DIVIDER) | GCLK_GENCTRL_SRC_XOSC | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 1 (FDPLL reference) */ + GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK1 ); + while ( (GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync + + /* Configure PLL */ + OSCCTRL->DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->DPLLCTRLB.reg = OSCCTRL_DPLLCTRLB_REFCLK(2) ; /* select GCLK input */ + + OSCCTRL->DPLLPRESC.reg = 0; + waitForPLL(); + + OSCCTRL->DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE ; + waitForPLL(); + + while ( (OSCCTRL->DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_CLKRDY) != OSCCTRL_DPLLSTATUS_CLKRDY ); + + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz. */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); +#endif +#elif (defined(CLOCKCONFIG_INTERNAL) || defined(CLOCKCONFIG_INTERNAL_USB)) /* ---------------------------------------------------------------------------------------------- - * 4) Enable DFLL48M clock + * Enable DFLL48M clock (D21/L21) or RC oscillator (C21) */ - - /* DFLL Configuration in Closed Loop mode, cf product datasheet chapter 15.6.7.1 - Closed-Loop Operation */ - +#if (SAMD) /* Remove the OnDemand mode, Bug http://avr32.icgroup.norway.atmel.com/bugzilla/show_bug.cgi?id=9905 */ SYSCTRL->DFLLCTRL.bit.ONDEMAND = 0 ; - - waitForDFLL(); - - SYSCTRL->DFLLMUL.reg = SYSCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value - SYSCTRL_DFLLMUL_FSTEP( 511 ) | // Fine step is 511, half of the max value - SYSCTRL_DFLLMUL_MUL( (VARIANT_MCK/VARIANT_MAINOSC) ) ; // External 32KHz is the reference - waitForDFLL(); - + + /* Load NVM Coarse calibration value */ + uint32_t calib = (*((uint32_t *) FUSES_DFLL48M_COARSE_CAL_ADDR) & FUSES_DFLL48M_COARSE_CAL_Msk) >> FUSES_DFLL48M_COARSE_CAL_Pos; + SYSCTRL->DFLLVAL.reg = SYSCTRL_DFLLVAL_COARSE(calib) | SYSCTRL_DFLLVAL_FINE(512); + /* Write full configuration to DFLL control register */ - SYSCTRL->DFLLCTRL.reg |= SYSCTRL_DFLLCTRL_MODE | /* Enable the closed loop mode */ - SYSCTRL_DFLLCTRL_WAITLOCK | - SYSCTRL_DFLLCTRL_QLDIS ; /* Disable Quick lock */ - - waitForDFLL(); - + #if defined(CLOCKCONFIG_INTERNAL_USB) + SYSCTRL->DFLLMUL.reg = SYSCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value + SYSCTRL_DFLLMUL_FSTEP( 0xA ) | // value from datasheet USB Characteristics + SYSCTRL_DFLLMUL_MUL( 0xBB80 ) ; // 1KHz USB SOF signal (48MHz Fcpu / 1KHz SOF) + + SYSCTRL->DFLLCTRL.reg = SYSCTRL_DFLLCTRL_USBCRM | /* USB correction */ + SYSCTRL_DFLLCTRL_MODE | /* Closed loop mode */ + SYSCTRL_DFLLCTRL_CCDIS ; + waitForDFLL(); + #endif + /* Enable the DFLL */ SYSCTRL->DFLLCTRL.reg |= SYSCTRL_DFLLCTRL_ENABLE ; - - while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKC) == 0 || - (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLLCKF) == 0 ); /* Wait for locks flags */ - waitForDFLL(); - - /* ---------------------------------------------------------------------------------------------- - * 5) Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz. - */ + + /* Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz */ GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) ; // Generic Clock Generator 0 - waitForSync(); - /* Write Generic Clock Generator 0 configuration */ GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DFLL48M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); - waitForSync(); + +#elif (SAML21) + /* Defines missing from CMSIS */ + #ifndef FUSES_DFLL48M_COARSE_CAL_ADDR + #define FUSES_DFLL48M_COARSE_CAL_ADDR (NVMCTRL_OTP5) + #endif + #ifndef FUSES_DFLL48M_COARSE_CAL_Pos + #define FUSES_DFLL48M_COARSE_CAL_Pos 26 + #endif + #ifndef FUSES_DFLL48M_COARSE_CAL_Msk + #define FUSES_DFLL48M_COARSE_CAL_Msk (0x3Ful << FUSES_DFLL48M_COARSE_CAL_Pos) + #endif + + OSCCTRL->DFLLCTRL.bit.ONDEMAND = 0 ; + waitForDFLL(); + + /* Load NVM Coarse calibration value */ + uint32_t calib = (*((uint32_t *) FUSES_DFLL48M_COARSE_CAL_ADDR) & FUSES_DFLL48M_COARSE_CAL_Msk) >> FUSES_DFLL48M_COARSE_CAL_Pos; + OSCCTRL->DFLLVAL.reg = OSCCTRL_DFLLVAL_COARSE(calib) | OSCCTRL_DFLLVAL_FINE(512); + + /* Write full configuration to DFLL control register */ + #if defined(CLOCKCONFIG_INTERNAL_USB) + OSCCTRL->DFLLMUL.reg = OSCCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value + OSCCTRL_DFLLMUL_FSTEP( 0xA ) | // value from datasheet USB Characteristics + OSCCTRL_DFLLMUL_MUL( 0xBB80 ) ; // 1KHz USB SOF signal (48MHz Fcpu / 1KHz SOF) + + OSCCTRL->DFLLCTRL.reg = OSCCTRL_DFLLCTRL_USBCRM | /* USB correction */ + OSCCTRL_DFLLCTRL_MODE | /* Closed loop mode */ + OSCCTRL_DFLLCTRL_CCDIS ; + waitForDFLL(); + #endif + + /* Enable the DFLL */ + OSCCTRL->DFLLCTRL.reg |= OSCCTRL_DFLLCTRL_ENABLE ; + waitForDFLL(); + + /* Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DFLL48M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + +#elif (SAMC21) + #if defined(CLOCKCONFIG_INTERNAL_USB) + #error "startup.c: CLOCKCONFIG_INTERNAL_USB setting invalid for C21 chips as they lack USB." + #endif + + /* Change OSC48M divider to /1. CPU will run at 48MHz */ + OSCCTRL->OSC48MDIV.reg = OSCCTRL_OSC48MDIV_DIV(0); + while ( OSCCTRL->OSC48MSYNCBUSY.reg & OSCCTRL_OSC48MSYNCBUSY_OSC48MDIV ); +#endif +#else + #error "startup.c: Clock source must be selected in the boards.txt file (normally through the Tools menu)." +#endif - /* ---------------------------------------------------------------------------------------------- - * 6) Modify PRESCaler value of OSC8M to have 8MHz - */ - SYSCTRL->OSC8M.bit.PRESC = SYSCTRL_OSC8M_PRESC_0_Val ; //CMSIS 4.5 changed the prescaler defines - SYSCTRL->OSC8M.bit.ONDEMAND = 0 ; - - /* ---------------------------------------------------------------------------------------------- - * 7) Put OSC8M as source for Generic Clock Generator 3 - */ - GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_OSC8M ) ; // Generic Clock Generator 3 - - /* Write Generic Clock Generator 3 configuration */ - GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_OSC8M ) | GCLK_GENCTRL_SRC_OSC8M | GCLK_GENCTRL_GENEN ); +#if (SAMD21) + /* Modify PRESCaler value of OSC8M to have 8MHz */ + SYSCTRL->OSC8M.bit.PRESC = SYSCTRL_OSC8M_PRESC_0_Val ; // recent versions of CMSIS from Atmel changed the prescaler defines + //SYSCTRL->OSC8M.bit.ONDEMAND = 0 ; + /* Put OSC8M as source for Generic Clock Generator 3 */ + GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_OSC_HS ) ; // Generic Clock Generator 3 waitForSync(); + GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_OSC_HS ) | GCLK_GENCTRL_SRC_OSC8M | GCLK_GENCTRL_GENEN ); + waitForSync(); + +#elif (SAML21) + /* Note that after reset, the L21 starts with the OSC16M set to 4MHz, NOT the DFLL@48MHz as stated in some documentation. */ + /* Modify FSEL value of OSC16M to have 8MHz */ + OSCCTRL->OSC16MCTRL.bit.FSEL = OSCCTRL_OSC16MCTRL_FSEL_8_Val; - /* - * Now that all system clocks are configured, we can set CPU and APBx BUS clocks. - * There values are normally the one present after Reset. - */ -#if (SAMD) - PM->CPUSEL.reg = PM_CPUSEL_CPUDIV_DIV1 ; - PM->APBASEL.reg = PM_APBASEL_APBADIV_DIV1_Val ; - PM->APBBSEL.reg = PM_APBBSEL_APBBDIV_DIV1_Val ; - PM->APBCSEL.reg = PM_APBCSEL_APBCDIV_DIV1_Val ; -#elif (SAML21 || SAMC21) - MCLK->CPUDIV.reg = MCLK_CPUDIV_CPUDIV_DIV1 ; + /* Put OSC16M as source for Generic Clock Generator 3 */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_OSC_HS].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_OSC16M | GCLK_GENCTRL_GENEN ); + waitForSync(); #endif SystemCoreClock=VARIANT_MCK ; - /* ---------------------------------------------------------------------------------------------- - * 8) Load ADC factory calibration values - */ - -#if (SAMD) - // ADC Bias Calibration - uint32_t bias = (*((uint32_t *) ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; - - // ADC Linearity bits 4:0 - uint32_t linearity = (*((uint32_t *) ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos; - - // ADC Linearity bits 7:5 - linearity |= ((*((uint32_t *) ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; - - ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); - -#elif (SAML21) - uint32_t biasrefbuf = (*((uint32_t *) ADC_FUSES_BIASREFBUF_ADDR) & ADC_FUSES_BIASREFBUF_Msk) >> ADC_FUSES_BIASREFBUF_Pos; - uint32_t biascomp = (*((uint32_t *) ADC_FUSES_BIASCOMP_ADDR) & ADC_FUSES_BIASCOMP_Msk) >> ADC_FUSES_BIASCOMP_Pos; - - ADC->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); - -#elif (SAMC21) - uint32_t biasrefbuf = (*((uint32_t *) ADC0_FUSES_BIASREFBUF_ADDR) & ADC0_FUSES_BIASREFBUF_Msk) >> ADC0_FUSES_BIASREFBUF_Pos; - uint32_t biascomp = (*((uint32_t *) ADC0_FUSES_BIASCOMP_ADDR) & ADC0_FUSES_BIASCOMP_Msk) >> ADC0_FUSES_BIASCOMP_Pos; - ADC0->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); - - biasrefbuf = (*((uint32_t *) ADC1_FUSES_BIASREFBUF_ADDR) & ADC1_FUSES_BIASREFBUF_Msk) >> ADC1_FUSES_BIASREFBUF_Pos; - biascomp = (*((uint32_t *) ADC1_FUSES_BIASCOMP_ADDR) & ADC1_FUSES_BIASCOMP_Msk) >> ADC1_FUSES_BIASCOMP_Pos; - ADC1->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); -#endif + #if (SAMD) + PM->CPUSEL.reg = PM_CPUSEL_CPUDIV_DIV1 ; + PM->APBASEL.reg = PM_APBASEL_APBADIV_DIV1_Val ; + PM->APBBSEL.reg = PM_APBBSEL_APBBDIV_DIV1_Val ; + PM->APBCSEL.reg = PM_APBCSEL_APBCDIV_DIV1_Val ; + #elif (SAML21 || SAMC21) + MCLK->CPUDIV.reg = MCLK_CPUDIV_CPUDIV_DIV1 ; + #endif /* - * 9) Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21) + * Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21) */ NVMCTRL->CTRLB.bit.MANW = 1; } diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index f98129e51..e9f9db0d9 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -88,10 +88,10 @@ void init( void ) NVIC_SetPriority (SysTick_IRQn, (1 << __NVIC_PRIO_BITS) - 2); /* set Priority for Systick Interrupt (2nd lowest) */ // Clock PORT for Digital I/O -// PM->APBBMASK.reg |= PM_APBBMASK_PORT ; +// PM->APBBMASK.reg |= PM_APBBMASK_PORT ; // // // Clock EIC for I/O interrupts -// PM->APBAMASK.reg |= PM_APBAMASK_EIC ; +// PM->APBAMASK.reg |= PM_APBAMASK_EIC ; // Clock SERCOM for Serial, TC/TCC for Pulse and Analog, and ADC/DAC for Analog #if (SAMD21 || SAMD11) @@ -105,7 +105,7 @@ void init( void ) regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TC1 | PM_APBCMASK_TC2 ; #elif (SAMD21E) regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 ; - regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 + regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ; #elif (SAMD21G) regAPBCMASK |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ; regAPBCMASK |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ; @@ -122,11 +122,10 @@ void init( void ) #if (SAML) regAPBCMASK |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 ; - MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM5; // On the SAML, SERCOM5 is on the low power bridge + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM5 | MCLK_APBDMASK_TC4; // On the SAML, SERCOM5 and TC4 are on the low power bridge regAPBCMASK |= MCLK_APBCMASK_TCC0 | MCLK_APBCMASK_TCC1 | MCLK_APBCMASK_TCC2 | MCLK_APBCMASK_TC0 | MCLK_APBCMASK_TC1 | MCLK_APBCMASK_TC2 ; #if (SAML21J) - regAPBCMASK |= MCLK_APBCMASK_TC3 ; - MCLK->APBDMASK.reg |= MCLK_APBDMASK_TC4; // On the SAML, TC4 is on the low power bridge + regAPBCMASK |= MCLK_APBCMASK_TC2 | MCLK_APBCMASK_TC3 ; #endif #elif (SAMC21E) regAPBCMASK |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 ; @@ -138,7 +137,7 @@ void init( void ) #if (SAML) regAPBCMASK |= MCLK_APBCMASK_DAC ; - MCLK->APBDMASK.reg |= MCLK_APBDMASK_ADC; // On the SAML, TC4 is on the low power bridge + MCLK->APBDMASK.reg |= MCLK_APBDMASK_ADC; // On the SAML, ADC is on the low power bridge #elif (SAMC) regAPBCMASK |= MCLK_APBCMASK_ADC0 | MCLK_APBCMASK_ADC1 | MCLK_APBCMASK_DAC ; #endif @@ -154,40 +153,84 @@ void init( void ) pinMode( ul, PIO_STARTUP ) ; } - // Initialize Analog Controller - // Setting clock +// I/O mux table footnote for D21 and D11: enable pullups on PA24 and PA24 when using as GPIO to avoid excessive current +// Errata: disable pull resistors on PA24 or PA25 manually before switching to peripheral +// Errata: do not use continuous sampling (not enabled by default) on PA24 or PA25 +#if (SAMD && defined(USB_DISABLED)) + PORT->Group[0].OUTSET.reg = (uint32_t)(1<Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PULLEN = 1; + PORT->Group[0].OUTSET.reg = (uint32_t)(1<Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PULLEN = 1; +#endif + + + /* ---------------------------------------------------------------------------------------------- + * Initialize Analog Controller + */ + + // Load ADC factory calibration values #if (SAMD) - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); + // ADC Bias Calibration + uint32_t bias = (*((uint32_t *) ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; - GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_ADC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ; + // ADC Linearity bits 4:0 + uint32_t linearity = (*((uint32_t *) ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos; + + // ADC Linearity bits 7:5 + linearity |= ((*((uint32_t *) ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; + ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); + +#elif (SAML21) + uint32_t biasrefbuf = (*((uint32_t *) ADC_FUSES_BIASREFBUF_ADDR) & ADC_FUSES_BIASREFBUF_Msk) >> ADC_FUSES_BIASREFBUF_Pos; + uint32_t biascomp = (*((uint32_t *) ADC_FUSES_BIASCOMP_ADDR) & ADC_FUSES_BIASCOMP_Msk) >> ADC_FUSES_BIASCOMP_Pos; + + ADC->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); + +#elif (SAMC21) + uint32_t biasrefbuf = (*((uint32_t *) ADC0_FUSES_BIASREFBUF_ADDR) & ADC0_FUSES_BIASREFBUF_Msk) >> ADC0_FUSES_BIASREFBUF_Pos; + uint32_t biascomp = (*((uint32_t *) ADC0_FUSES_BIASCOMP_ADDR) & ADC0_FUSES_BIASCOMP_Msk) >> ADC0_FUSES_BIASCOMP_Pos; + ADC0->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); + + biasrefbuf = (*((uint32_t *) ADC1_FUSES_BIASREFBUF_ADDR) & ADC1_FUSES_BIASREFBUF_Msk) >> ADC1_FUSES_BIASREFBUF_Pos; + biascomp = (*((uint32_t *) ADC1_FUSES_BIASCOMP_ADDR) & ADC1_FUSES_BIASCOMP_Msk) >> ADC1_FUSES_BIASCOMP_Pos; + ADC1->CALIB.reg = ADC_CALIB_BIASREFBUF(biasrefbuf) | ADC_CALIB_BIASCOMP(biascomp); +#endif syncADC(); // Wait for synchronization of registers between the clock domains + // Setting clock, prescaler and resolution +#if (SAMD) + GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_ADC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ; + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); + ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV512 | // Divide Clock by 512. ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default #elif (SAML21 || SAMC21) SUPC->VREF.reg |= SUPC_VREF_VREFOE; // Enable Supply Controller Reference output for use with ADC and DAC (AR_INTREF) + #if (SAML21) + GCLK->PCHCTRL[GCM_ADC].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + #elif (SAMC21) + GCLK->PCHCTRL[GCM_ADC0].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + GCLK->PCHCTRL[GCM_ADC1].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + #endif while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); - GCLK->PCHCTRL[GCM_ADC].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); - - syncADC(); // Wait for synchronization of registers between the clock domains - #if (SAML21) ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV256; // Divide Clock by 256. - ADC->CTRLC.reg = ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default + ADC->CTRLC.reg = ADC_CTRLC_RESSEL_10BIT; // 10 bits resolution as default #elif (SAMC21) ADC0->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV256; // Divide Clock by 256. - ADC0->CTRLC.reg = ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default + ADC0->CTRLC.reg = ADC_CTRLC_RESSEL_10BIT | ADC_CTRLC_R2R; // 10 bits resolution as default, R2R requires ADC_SAMPCTRL_OFFCOMP=1 ADC1->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV256; // Divide Clock by 256. - ADC1->CTRLC.reg = ADC_CTRLB_RESSEL_10BIT; // 10 bits resolution as default + ADC1->CTRLC.reg = ADC_CTRLC_RESSEL_10BIT | ADC_CTRLC_R2R; // 10 bits resolution as default, R2R requires ADC_SAMPCTRL_OFFCOMP=1 #endif - syncADC(); // Wait for synchronization of registers between the clock domains #endif - + syncADC(); // Wait for synchronization of registers between the clock domains + + // Setting configuration #if (SAMD || SAML21) - ADC->SAMPCTRL.reg = 0x3f; // Set max Sampling Time Length (in CLK_ADC cycles for SAMD, half CLK_ADC cycles for SAML and SAMC) + ADC->SAMPCTRL.reg = 0x3f; // Set max Sampling Time Length syncADC(); // Wait for synchronization of registers between the clock domains ADC->INPUTCTRL.reg = ADC_INPUTCTRL_MUXNEG_GND; // No Negative input (Internal Ground) @@ -197,8 +240,8 @@ void init( void ) ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 | // 1 sample only (no oversampling nor averaging) ADC_AVGCTRL_ADJRES(0x0ul); // Adjusting result by 0 #elif (SAMC21) - ADC0->SAMPCTRL.reg = 0x3f; // Set max Sampling Time Length (in CLK_ADC cycles for SAMD, half CLK_ADC cycles for SAML and SAMC) - ADC1->SAMPCTRL.reg = 0x3f; + ADC0->SAMPCTRL.reg = (ADC_SAMPCTRL_SAMPLEN(0x0) | ADC_SAMPCTRL_OFFCOMP); // ADC_SAMPCTRL_SAMPLEN must be 0 when ADC_SAMPCTRL_OFFCOMP=1 + ADC1->SAMPCTRL.reg = (ADC_SAMPCTRL_SAMPLEN(0x0) | ADC_SAMPCTRL_OFFCOMP); // ADC_SAMPCTRL_SAMPLEN must be 0 when ADC_SAMPCTRL_OFFCOMP=1 syncADC(); // Wait for synchronization of registers between the clock domains ADC0->INPUTCTRL.reg = ADC_INPUTCTRL_MUXNEG_GND; // No Negative input (Internal Ground) @@ -210,11 +253,14 @@ void init( void ) ADC_AVGCTRL_ADJRES(0x0ul); // Adjusting result by 0 ADC1->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1 | ADC_AVGCTRL_ADJRES(0x0ul); #endif + syncADC(); // Wait for synchronization of registers between the clock domains analogReference( VARIANT_AR_DEFAULT ) ; // Use default reference from variant.h - // Initialize DAC - // Setting clock + + /* ---------------------------------------------------------------------------------------------- + * Initialize DAC + */ #if (SAMD) while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( GCM_DAC ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ; @@ -231,11 +277,11 @@ void init( void ) while ( DAC->SYNCBUSY.reg & DAC_SYNCBUSY_MASK ); #if (SAMC21) - DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC; + DAC->CTRLB.reg = (DAC_CTRLB_REFSEL_AVCC | DAC_CTRLB_EOEN); #elif (SAML21) DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VDDANA; - DAC->DACCTRL[0].reg = DAC_DACCTRL_REFRESH(2); // setup refresh - DAC->DACCTRL[1].reg = DAC_DACCTRL_REFRESH(2); // setup refresh + DAC->DACCTRL[0].reg = (DAC_DACCTRL_REFRESH(3) | DAC_DACCTRL_CCTRL(2)); + DAC->DACCTRL[1].reg = (DAC_DACCTRL_REFRESH(3) | DAC_DACCTRL_CCTRL(2)); #endif #endif } diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 5de433dd5..71cc3db61 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -20,6 +20,7 @@ #include "Arduino.h" #include "wiring_private.h" #include "variant.h" +#include "delay.h" #ifdef __cplusplus extern "C" { @@ -41,10 +42,8 @@ const uint8_t timerClockIDs[] = GCM_TCC2_TC3, GCM_TC4_TC5, GCM_TC4_TC5, - #if (SAMD21J) GCM_TC6_TC7, GCM_TC6_TC7, - #endif #elif (SAML21 || SAMC21) GCM_TCC0_TCC1, GCM_TCC0_TCC1, @@ -62,6 +61,7 @@ const uint8_t timerClockIDs[] = static int _readResolution = 10; static int _ADCResolution = 10; static int _writeResolution = 8; +extern bool dacEnabled[]; // Wait for synchronization of registers between the clock domains static __inline__ void syncADC() __attribute__((always_inline, unused)); @@ -92,7 +92,7 @@ static void syncTC_8(Tc* TCx) { #if (SAMD) while (TCx->COUNT8.STATUS.bit.SYNCBUSY); #elif (SAML21 || SAMC21) - while (TCx->SYNCBUSY.reg); + while (TCx->COUNT8.SYNCBUSY.reg & (TC_SYNCBUSY_SWRST | TC_SYNCBUSY_ENABLE | TC_SYNCBUSY_CTRLB | TC_SYNCBUSY_STATUS | TC_SYNCBUSY_COUNT)); #endif } @@ -164,19 +164,24 @@ static inline uint32_t mapResolution(uint32_t value, uint32_t from, uint32_t to) void analogReference(eAnalogReference mode) { syncADC(); - - if (mode == AR_EXTERNAL_REFA) { - if ( pinPeripheral(REFA_PIN, PIO_ANALOG_REF) != RET_STATUS_OK ) { - return; +#if (!SAMD11C) + #if defined(REFA_PIN) + if (mode == AR_EXTERNAL_REFA) { + if ( pinPeripheral(REFA_PIN, PIO_ANALOG_REF) != RET_STATUS_OK ) { + return; + } } - } + #endif +#endif #if (SAMD || SAML21) - if (mode == AR_EXTERNAL_REFB) { - if ( pinPeripheral(REFB_PIN, PIO_ANALOG_REF) != RET_STATUS_OK ) { - return; + #if defined(REFB_PIN) + if (mode == AR_EXTERNAL_REFB) { + if ( pinPeripheral(REFB_PIN, PIO_ANALOG_REF) != RET_STATUS_OK ) { + return; + } } - } + #endif #endif #if (SAMD) @@ -202,7 +207,30 @@ void analogReference(eAnalogReference mode) ADC1->REFCTRL.bit.REFSEL = mode; #endif #endif + syncADC(); + // Start conversion, since The first conversion after the reference is changed must not be used. +#if (SAMC21) + ADC0->CTRLA.bit.ENABLE = 0x01; // Enable ADC + ADC1->CTRLA.bit.ENABLE = 0x01; // Enable ADC + syncADC(); + ADC0->SWTRIG.bit.START = 1; + ADC1->SWTRIG.bit.START = 1; + syncADC(); + while ((ADC0->INTFLAG.bit.RESRDY == 0) || (ADC1->INTFLAG.bit.RESRDY == 0)); // Waiting for conversion to complete + ADC0->INTFLAG.reg = ADC_INTFLAG_RESRDY; // Clear the Data Ready flag + ADC1->INTFLAG.reg = ADC_INTFLAG_RESRDY; // Clear the Data Ready flag + ADC0->CTRLA.bit.ENABLE = 0x00; // Disable ADC + ADC1->CTRLA.bit.ENABLE = 0x00; // Disable ADC +#else + ADC->CTRLA.bit.ENABLE = 0x01; // Enable ADC + syncADC(); + ADC->SWTRIG.bit.START = 1; + syncADC(); + while (ADC->INTFLAG.bit.RESRDY == 0); // Waiting for conversion to complete + ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY; // Clear the Data Ready flag + ADC->CTRLA.bit.ENABLE = 0x00; // Disable ADC +#endif syncADC(); } @@ -223,63 +251,23 @@ uint32_t analogRead( uint32_t pin ) } #endif + // pinPeripheral now handles disabling the DAC (if active) if ( pinPeripheral(pin, PIO_ANALOG_ADC) == RET_STATUS_OK ) { - // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled - if ( (g_APinDescription[pin].ulPinAttribute & PIN_ATTR_DAC) == PIN_ATTR_DAC ) - { - syncDAC(); -#if (SAMD || SAMC21) - DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC - //DAC->CTRLB.bit.EOEN = 0x00; // The DAC output is turned off. -#elif (SAML21) - DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC controller - uint8_t DACNumber = 0x00; - if ( (g_APinDescription[pin].ulPort == 0) && (g_APinDescription[pin].ulPin == 5) ) { - DACNumber = 0x01; - } - syncDAC(); - DAC->DACCTRL[DACNumber].bit.ENABLE = 0x00; // The DACx output is turned off. - syncDAC(); - DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC controller (in case other DACx is in use) -#endif - syncDAC(); - } - - syncADC(); ADC->INPUTCTRL.bit.MUXPOS = g_APinDescription[pin].ulADCChannelNumber; // Selection for the positive ADC input - - // Control A - /* - * Bit 1 ENABLE: Enable - * 0: The ADC is disabled. - * 1: The ADC is enabled. - * Due to synchronization, there is a delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The - * value written to CTRL.ENABLE will read back immediately and the Synchronization Busy bit in the Status register - * (STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete. - * - * Before enabling the ADC, the asynchronous clock source must be selected and enabled, and the ADC reference must be - * configured. The first conversion after the reference is changed must not be used. - */ syncADC(); + ADC->CTRLA.bit.ENABLE = 0x01; // Enable ADC + syncADC(); // Start conversion - syncADC(); ADC->SWTRIG.bit.START = 1; - - // Clear the Data Ready flag - ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY; - - // Start conversion again, since The first conversion after the reference is changed must not be used. syncADC(); - ADC->SWTRIG.bit.START = 1; // Store the value while (ADC->INTFLAG.bit.RESRDY == 0); // Waiting for conversion to complete valueRead = ADC->RESULT.reg; - syncADC(); ADC->CTRLA.bit.ENABLE = 0x00; // Disable ADC syncADC(); } @@ -301,31 +289,47 @@ void analogWrite(uint32_t pin, uint32_t value) value = mapResolution(value, _writeResolution, 10); DAC->DATA.reg = value & 0x3FF; // DAC on 10 bits. syncDAC(); - DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC + if (!dacEnabled[0]) { + dacEnabled[0] = true; + DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC + syncDAC(); + } #elif (SAML21) - DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC controller (so that DACCTRL can be modified) uint8_t DACNumber = 0x00; + value = mapResolution(value, _writeResolution, 12); + if ( (g_APinDescription[pin].ulPort == 0) && (g_APinDescription[pin].ulPin == 5) ) { DACNumber = 0x01; } - value = mapResolution(value, _writeResolution, 12); - syncDAC(); - DAC->DATA[DACNumber].reg = value & 0xFFF; // DACx on 12 bits. - syncDAC(); - DAC->DACCTRL[DACNumber].bit.ENABLE = 0x01; // The DACx output is turned on. - syncDAC(); - while ( (DAC->STATUS.reg & (1 << DACNumber)) == 0 ); // Must wait for DACx to start - DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC controller + + if (!dacEnabled[DACNumber]) { + dacEnabled[DACNumber] = true; + DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC controller (so that DACCTRL can be modified) + delayMicroseconds(40); // Must delay for at least 30us when turning off while refresh is on due to DAC errata + + DAC->DATA[DACNumber].reg = value & 0xFFF; // DACx on 12 bits. + syncDAC(); + DAC->DACCTRL[DACNumber].bit.ENABLE = 0x01; // The DACx output is turned on. + DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC controller + syncDAC(); + while ( (DAC->STATUS.reg & (1 << DACNumber)) == 0 ); // Must wait for DACx to start + + DAC->DATA[DACNumber].reg = value & 0xFFF; // DACx on 12 bits. + syncDAC(); + } else { + DAC->DATA[DACNumber].reg = value & 0xFFF; // DACx on 12 bits. + syncDAC(); + } #endif - syncDAC(); return; } else if ( pinPeripheral(pin, PIO_TIMER_PWM) == RET_STATUS_OK ) { Tc* TCx = 0 ; Tcc* TCCx = 0 ; + uint8_t timerIndex; uint8_t Channelx = GetTCChannelNumber( g_APinDescription[pin].ulTCChannel ) ; - uint8_t Timerx = GetTCNumber( g_APinDescription[pin].ulTCChannel ) ; + // uint8_t Timerx = GetTCNumber( g_APinDescription[pin].ulTCChannel ) ; uint8_t Typex = GetTCType( g_APinDescription[pin].ulTCChannel ) ; static bool tcEnabled[TCC_INST_NUM+TC_INST_NUM]; @@ -377,7 +381,7 @@ void analogWrite(uint32_t pin, uint32_t value) #if (SAMD) TCx->COUNT8.CTRLA.reg |= TC_CTRLA_WAVEGEN_NPWM; #elif (SAML21 || SAMC21) - TCx->WAVE.reg = TC_WAVE_WAVEGEN_NPWM; + TCx->COUNT8.WAVE.reg = TC_WAVE_WAVEGEN_NPWM; #endif syncTC_8(TCx); // Set the initial value @@ -418,19 +422,21 @@ void analogWrite(uint32_t pin, uint32_t value) TCx->COUNT8.CC[Channelx].reg = (uint8_t) value; #elif (SAML21 || SAMC21) // SAML and SAMC have double-buffered TCs - TCx->CTRLBSET.bit.LUPD = 1; - syncTC_8(TCx); TCx->COUNT8.CCBUF[Channelx].reg = (uint32_t) value; - syncTC_8(TCx); - TCx->CTRLBCLR.bit.LUPD = 1; #endif syncTC_8(TCx); } else { +#if (SAMD) TCCx->CTRLBSET.bit.LUPD = 1; syncTCC(TCCx); TCCx->CCB[Channelx].reg = (uint32_t) value; - syncTCC(TCCx); - TCCx->CTRLBCLR.bit.LUPD = 1; + syncTCC(TCCx); + TCCx->CTRLBCLR.bit.LUPD = 1; +// LUPD caused endless spinning in syncTCC() on SAML (and probably SAMC). Note that CCBUF writes are already +// atomic. The LUPD bit is intended for updating several registers at once, which analogWrite() does not do. +#elif (SAML21 || SAMC21) + TCCx->CCBUF[Channelx].reg = (uint32_t) value; +#endif syncTCC(TCCx); } } diff --git a/cores/arduino/wiring_private.c b/cores/arduino/wiring_private.c index 6d8d1a377..63a46cf48 100644 --- a/cores/arduino/wiring_private.c +++ b/cores/arduino/wiring_private.c @@ -20,6 +20,18 @@ #include "Arduino.h" #include "wiring_private.h" +bool dacEnabled[] = {false, false}; + +// Wait for synchronization of registers between the clock domains +static __inline__ void syncDAC() __attribute__((always_inline, unused)); +static void syncDAC() { +#if (SAMD) + while ( DAC->STATUS.bit.SYNCBUSY == 1 ); +#elif (SAML21 || SAMC21) + while ( DAC->SYNCBUSY.reg & DAC_SYNCBUSY_MASK ); +#endif +} + int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) { // Prevent out of bounds access @@ -124,12 +136,52 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) break ; } - noInterrupts(); // Avoid possible invalid interim pin state - uint8_t pinPort = g_APinDescription[ulPin].ulPort; uint8_t pinNum = g_APinDescription[ulPin].ulPin; uint8_t pinCfg = PORT_PINCFG_INEN; // INEN should be enabled for both input and output (but not analog) + // Disable DAC, if analogWrite() used previously the DAC is enabled + // Note that on the L21, the DAC output would interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected + if ((pinAttribute & PIN_ATTR_DAC) && !((1UL << ulPeripheral) & PIN_ATTR_DAC)) + { +#if (SAMD || SAMC21) + if (dacEnabled[0]) { + dacEnabled[0] = false; + syncDAC(); + DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC + //DAC->CTRLB.bit.EOEN = 0x00; // The DAC output is turned off. + syncDAC(); + } +#elif (SAML21) + uint8_t DACNumber = 0x00; + + if ( (pinPort == 0) && (pinNum == 5) ) { + DACNumber = 0x01; + } + + if (dacEnabled[DACNumber]) { + dacEnabled[DACNumber] = false; + syncDAC(); + DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC controller (so that DACCTRL can be modified) + delayMicroseconds(40); // Must delay for at least 30us when turning off while refresh is on due to DAC errata + + DAC->DACCTRL[DACNumber].bit.ENABLE = 0x00; // The DACx output is turned off. + + if (dacEnabled[0] || dacEnabled[1]) { + DAC->CTRLA.bit.ENABLE = 0x01; // Enable DAC controller, so that the other DAC can function + syncDAC(); + if (DACNumber == 0) { + while ( (DAC->STATUS.reg & (1 << 1)) == 0 ); // Must wait for DACx to start + } else { + while ( (DAC->STATUS.reg & (1 << 0)) == 0 ); // Must wait for DACx to start + } + } + } +#endif + } + + noInterrupts(); // Avoid possible invalid interim pin state + switch ( ulPeripheral ) { case PIO_STARTUP: diff --git a/extras/package_index.json.Beta.template b/extras/package_index.json.Beta.template index 14fdceb16..86b11968c 100644 --- a/extras/package_index.json.Beta.template +++ b/extras/package_index.json.Beta.template @@ -23,7 +23,11 @@ "size": "%%SIZE%%", "boards": [ {"name": "MT-D21E"}, - {"name": "MT-D11"} + {"name": "MT-D21E_revB"}, + {"name": "MT-D11"}, + {"name": "Generic_D11C14A"}, + {"name": "arduino_zero"}, + {"name": "arduino_mzero"} ], "toolsDependencies": [ { @@ -39,7 +43,7 @@ { "packager": "arduino", "name": "openocd", - "version": "0.9.0-arduino6-static" + "version": "0.9.0-arduino" }, { "packager": "arduino", diff --git a/extras/package_index.json.PR.template b/extras/package_index.json.PR.template index a2b4f1ed0..14c0d839c 100644 --- a/extras/package_index.json.PR.template +++ b/extras/package_index.json.PR.template @@ -23,7 +23,11 @@ "size": "%%SIZE%%", "boards": [ {"name": "MT-D21E"}, - {"name": "MT-D11"} + {"name": "MT-D21E_revB"}, + {"name": "MT-D11"}, + {"name": "Generic_D11C14A"}, + {"name": "arduino_zero"}, + {"name": "arduino_mzero"} ], "toolsDependencies": [ { @@ -39,7 +43,7 @@ { "packager": "arduino", "name": "openocd", - "version": "0.9.0-arduino6-static" + "version": "0.9.0-arduino" }, { "packager": "arduino", diff --git a/extras/package_index.json.Release.template b/extras/package_index.json.Release.template index f8edfc725..ae5f4677e 100644 --- a/extras/package_index.json.Release.template +++ b/extras/package_index.json.Release.template @@ -25,7 +25,7 @@ { "packager": "arduino", "name": "openocd", - "version": "0.9.0-arduino6-static" + "version": "0.9.0-arduino" }, { "packager": "arduino", diff --git a/platform.txt b/platform.txt index 4e0262224..5439983fb 100644 --- a/platform.txt +++ b/platform.txt @@ -58,15 +58,15 @@ compiler.readelf.cmd=arm-none-eabi-readelf build.extra_flags= # These can be overridden in platform.local.txt -compiler.c.extra_flags= +compiler.c.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} compiler.c.elf.extra_flags= #compiler.c.elf.extra_flags=-v -compiler.cpp.extra_flags= -compiler.S.extra_flags= +compiler.cpp.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.S.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} compiler.ar.extra_flags= compiler.elf2hex.extra_flags= -compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" +compiler.arm.cmsis.c.flags= compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math # USB Flags @@ -81,13 +81,13 @@ build.usb_manufacturer="Unknown" # ---------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" ## Compile S files -recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" ## Create archives # archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value @@ -156,7 +156,7 @@ tools.bossac.upload.network_pattern="{network_cmd}" -address {serial.port} -port # OpenOCD sketch upload # -tools.openocd.path={runtime.tools.openocd-0.9.0-arduino6-static.path} +tools.openocd.path={runtime.tools.openocd-0.9.0-arduino.path} tools.openocd.cmd=bin/openocd tools.openocd.cmd.windows=bin/openocd.exe @@ -185,7 +185,7 @@ tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/ # FIXME: this programmer is a workaround for default options being overwritten by uploadUsingPreferences # -tools.openocd-withbootsize.path={runtime.tools.openocd-0.9.0-arduino6-static.path} +tools.openocd-withbootsize.path={runtime.tools.openocd-0.9.0-arduino.path} tools.openocd-withbootsize.cmd=bin/openocd tools.openocd-withbootsize.cmd.windows=bin/openocd.exe diff --git a/variants/Generic_D11C14A/variant.h b/variants/Generic_D11C14A/variant.h index 20998f1c5..f92c1d9e6 100644 --- a/variants/Generic_D11C14A/variant.h +++ b/variants/Generic_D11C14A/variant.h @@ -33,15 +33,37 @@ #define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 /*---------------------------------------------------------------------------- - * Definitions + * Clock Configuration *----------------------------------------------------------------------------*/ -/** Frequency of the board main oscillator */ -#define VARIANT_MAINOSC (32768ul) - -/** Master clock frequency */ +/** Master clock frequency (also Fcpu frequency) */ #define VARIANT_MCK (48000000ul) +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index 0ea981bd1..199258135 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -33,15 +33,37 @@ #define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 /*---------------------------------------------------------------------------- - * Definitions + * Clock Configuration *----------------------------------------------------------------------------*/ -/** Frequency of the board main oscillator */ -#define VARIANT_MAINOSC (32768ul) - -/** Master clock frequency */ +/** Master clock frequency (also Fcpu frequency) */ #define VARIANT_MCK (48000000ul) +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index a782a9cb0..1fabacc24 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -33,15 +33,37 @@ #define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 /*---------------------------------------------------------------------------- - * Definitions + * Clock Configuration *----------------------------------------------------------------------------*/ -/** Frequency of the board main oscillator */ -#define VARIANT_MAINOSC (32768ul) - -/** Master clock frequency */ +/** Master clock frequency (also Fcpu frequency) */ #define VARIANT_MCK (48000000ul) +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ diff --git a/variants/MT_D21E_revB/variant.cpp b/variants/MT_D21E_revB/variant.cpp index c37b16fff..c0212735f 100644 --- a/variants/MT_D21E_revB/variant.cpp +++ b/variants/MT_D21E_revB/variant.cpp @@ -128,7 +128,7 @@ const PinDescription g_APinDescription[]= #if (SAMD) const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; #elif (SAML21 || SAMC21) -const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC2 } ; +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC4 } ; #endif // Multi-serial objects instantiation diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h index 4e2f14b0a..88a595aae 100644 --- a/variants/MT_D21E_revB/variant.h +++ b/variants/MT_D21E_revB/variant.h @@ -33,15 +33,37 @@ #define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 /*---------------------------------------------------------------------------- - * Definitions + * Clock Configuration *----------------------------------------------------------------------------*/ -/** Frequency of the board main oscillator */ -#define VARIANT_MAINOSC (32768ul) - -/** Master clock frequency */ +/** Master clock frequency (also Fcpu frequency) */ #define VARIANT_MCK (48000000ul) +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ @@ -285,22 +307,38 @@ extern Uart Serial2; // // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX // pins are NOT connected to anything by default. -#define SERIAL_PORT_USBVIRTUAL SerialUSB +#if (!SAMC) + #define SERIAL_PORT_USBVIRTUAL SerialUSB +#endif // SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). // It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. // The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. // Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get // the USB Host debugging output. -#define SERIAL_PORT_MONITOR Serial1 +#if (SAMC) + #define SERIAL_PORT_MONITOR Serial2 +#else + #define SERIAL_PORT_MONITOR Serial1 +#endif + // Serial has no physical pins broken out, so it's not listed as HARDWARE port -#define SERIAL_PORT_HARDWARE Serial1 -#define SERIAL_PORT_HARDWARE_OPEN Serial1 +#if (SAMC) + #define SERIAL_PORT_HARDWARE Serial2 + #define SERIAL_PORT_HARDWARE_OPEN Serial2 +#else + #define SERIAL_PORT_HARDWARE Serial1 + #define SERIAL_PORT_HARDWARE_OPEN Serial1 +#endif // The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge // accessible using Serial (the Arduino serial monitor is normally connected to this). // So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. // Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. // Remember to use while(!Serial); to wait for a connection before Serial printing. -#define Serial SerialUSB +#if (SAMC) + #define Serial Serial1 +#else + #define Serial SerialUSB +#endif #endif /* _VARIANT_ARDUINO_ZERO_ */ diff --git a/variants/arduino_mzero/variant.h b/variants/arduino_mzero/variant.h index f1efc0c23..72aa72ed0 100644 --- a/variants/arduino_mzero/variant.h +++ b/variants/arduino_mzero/variant.h @@ -26,15 +26,37 @@ #define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 /*---------------------------------------------------------------------------- - * Definitions + * Clock Configuration *----------------------------------------------------------------------------*/ -/** Frequency of the board main oscillator */ -#define VARIANT_MAINOSC (32768ul) - -/** Master clock frequency */ +/** Master clock frequency (also Fcpu frequency) */ #define VARIANT_MCK (48000000ul) +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +//#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ @@ -118,6 +140,7 @@ static const uint8_t DAC0 = PIN_DAC0; /* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ #define REFA_PIN (15ul) +#define REFB_PIN (27ul) /* * Serial interfaces diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 7e9b9f6ce..115b7af6f 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -26,15 +26,37 @@ #define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 /*---------------------------------------------------------------------------- - * Definitions + * Clock Configuration *----------------------------------------------------------------------------*/ -/** Frequency of the board main oscillator */ -#define VARIANT_MAINOSC (32768ul) - -/** Master clock frequency */ +/** Master clock frequency (also Fcpu frequency) */ #define VARIANT_MCK (48000000ul) +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +//#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ @@ -118,6 +140,7 @@ static const uint8_t DAC0 = PIN_DAC0; /* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ #define REFA_PIN (42ul) +#define REFB_PIN (17ul) // Other pins #define PIN_ATN (38ul) From 52f9b5041baa307e609b8c8188b7dd8f6f6ba127 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 21 Apr 2017 17:45:40 +0000 Subject: [PATCH 088/124] Changed peripheral assignments for D11C. Auto switch from SerialUSB to Serial1 when CDC not enabled. --- boards.txt | 8 +-- variants/Generic_D11C14A/README.md | 42 +++++++----- variants/Generic_D11C14A/variant.cpp | 7 -- variants/Generic_D11C14A/variant.h | 98 +++++++++++++++++----------- variants/MT_D11/README.md | 20 ++++-- variants/MT_D11/variant.h | 16 ++++- variants/MT_D21E/README.md | 23 +++---- variants/MT_D21E/variant.h | 6 ++ variants/MT_D21E_revB/README.md | 22 ++++--- variants/MT_D21E_revB/variant.h | 7 +- 10 files changed, 153 insertions(+), 96 deletions(-) diff --git a/boards.txt b/boards.txt index 0b99f5efe..4464f5201 100644 --- a/boards.txt +++ b/boards.txt @@ -431,6 +431,10 @@ d11c14a.menu.serial.one_uart=ONE_UART_ONE_WIRE_NO_SPI d11c14a.menu.serial.one_uart.build.serialcom_uart=ONE_UART d11c14a.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE d11c14a.menu.serial.one_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.two_uart=TWO_UART_NO_WIRE_NO_SPI +d11c14a.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11c14a.menu.serial.two_uart.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.two_uart.build.serialcom_spi=NO_SPI d11c14a.menu.serial.one_uart_no_wire_one_spi=ONE_UART_NO_WIRE_ONE_SPI d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_uart=ONE_UART d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE @@ -439,10 +443,6 @@ d11c14a.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI d11c14a.menu.serial.no_uart.build.serialcom_uart=NO_UART d11c14a.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE d11c14a.menu.serial.no_uart.build.serialcom_spi=ONE_SPI -d11c14a.menu.serial.two_uart=TWO_UART_NO_WIRE_NO_SPI -d11c14a.menu.serial.two_uart.build.serialcom_uart=TWO_UART -d11c14a.menu.serial.two_uart.build.serialcom_wire=NO_WIRE -d11c14a.menu.serial.two_uart.build.serialcom_spi=NO_SPI d11c14a.menu.usb.cdc=CDC_ONLY d11c14a.menu.usb.cdc.build.usbcom=CDC_ONLY d11c14a.menu.usb.cdc.build.pid=0x0557 diff --git a/variants/Generic_D11C14A/README.md b/variants/Generic_D11C14A/README.md index 96cd0ec76..7d80b01e3 100644 --- a/variants/Generic_D11C14A/README.md +++ b/variants/Generic_D11C14A/README.md @@ -4,21 +4,26 @@ ====================================== ATsamD11C14A ===================================== Other COM PWM Analog INT Arduino* Arduino* INT Analog PWM COM Other ========================================================================================= - ------------------- - RX2* TCC01 * * 5 | A5 A4 | 4 * * TCC00 TX2* REF - TX1 / MOSI TCC02 * 8 | A8 A2 | 2 * * DAC - RX1 / SCK TCC03 * 9 | A9 Vdd | - SDA TC10 * NMI 14 | A14 Gnd | - SCL TC11 * * 15 | A15 A25 | 25 USB/DP + 1------------------- + SCK*/RX2 TCC01 * * 5 | A5 A4 | 4 * * TCC00 MOSI*/TX2 REF + MOSI* TCC02 * 8 | A8 A2 | 2 * * DAC + SCK* TCC03 * 9 | A9 Vdd | + SDA/MISO* TC10 * NMI 14 | A14 Gnd | + SCL/SS* TC11 * * 15 | A15 A25 | 25 USB/DP BOOT 28 | A28/RST A24 | 24 USB/DM -SWDCLK MISO 30 | A30 A31 | 31 * SS SWDIO +SWDCLK TX1/MISO* 30 | A30 A31 | 31 * RX1/SS* SWDIO ------------------- -* Some pins can be used for more than one function. The same port pin number printed on - the board is also used in Arduino (without the 'A') for all of the supported functions - (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). -* When using ONE_UART_NO_WIRE_ONE_SPI, Serial1() refers to TX2/RX2 instead of TX1/RX1. -* Tone available on TC2. TC2 is not routed to pins with the D11C14A. +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the board is also used in Arduino (but without the 'A') for all + of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). When + using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top + left pin (A2). PIN_MAP_COMPACT uses less RAM. +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +* When using NO_UART_ONE_WIRE_ONE_SPI, use SPI on pins 4, 5, 14, and 15. + When using ONE_UART_NO_WIRE_ONE_SPI, use SPI on pins 8, 9, 30, and 31. +* Tone available on TC2. TC2 is not routed to pins in the D11C14A. +* Leave pin A30 floating (or use external pullup) during reset. * DO NOT connect voltages higher than 3.3V! ``` @@ -80,13 +85,16 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip 11 | PA31 | SS / SWD IO | EIC/EXTINT[3] SERCOM1/PAD[1] !SERCOM1/PAD[3] !TC2/WO[1] !TCC0/WO[3] SWD IO ==================================================================================================================================== -* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') - for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the board is also used in Arduino (but without the 'A') for all + of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). When + using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top + left pin (A2). PIN_MAP_COMPACT uses less RAM. * NOT A PIN means the Arduino pin number is not mapped to a physical pin. * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). -* The tone library uses TC2. TC2 is not routed to pins with the D11C14A (14-pin). -* Pins 8 and 9 are by default connected to the 32.768KHz crystal. -* When using ONE_UART_NO_WIRE_ONE_SPI, Serial1() refers to TX2/RX2 instead of TX1/RX1. +* The tone library uses TC2. TC2 is not routed to pins in the D11C14A (14-pin). +* When using ONE_UART_NO_WIRE_ONE_SPI, Serial1 refers to TX2/RX2 instead of TX1/RX1. +* Leave pin A30 floating (or use external pullup) during reset. * SERCOM2 does not exist on the D11C14A. diff --git a/variants/Generic_D11C14A/variant.cpp b/variants/Generic_D11C14A/variant.cpp index 878482282..08805e484 100644 --- a/variants/Generic_D11C14A/variant.cpp +++ b/variants/Generic_D11C14A/variant.cpp @@ -92,18 +92,11 @@ SERCOM sercom1( SERCOM1 ) ; #if defined(ONE_UART) || defined(TWO_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; -#if defined (ONE_SPI) -void SERCOM0_Handler() -{ - Serial1.IrqHandler(); -} -#else void SERCOM1_Handler() { Serial1.IrqHandler(); } #endif -#endif #if defined(TWO_UART) Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; diff --git a/variants/Generic_D11C14A/variant.h b/variants/Generic_D11C14A/variant.h index f92c1d9e6..1948e7e83 100644 --- a/variants/Generic_D11C14A/variant.h +++ b/variants/Generic_D11C14A/variant.h @@ -194,32 +194,18 @@ static const uint8_t ATN = PIN_ATN; * Serial interfaces */ // Serial1 -#if defined(ONE_UART) && defined (ONE_SPI) - #if defined PIN_MAP_STANDARD - #define PIN_SERIAL1_RX (5ul) - #define PIN_SERIAL1_TX (4ul) - #elif defined PIN_MAP_COMPACT - #define PIN_SERIAL1_RX (2ul) - #define PIN_SERIAL1_TX (1ul) - #endif - - #define PAD_SERIAL1_TX (UART_TX_PAD_2) - #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) - #define SERCOM_INSTANCE_SERIAL1 &sercom0 -#else - #if defined PIN_MAP_STANDARD - #define PIN_SERIAL1_RX (9ul) - #define PIN_SERIAL1_TX (8ul) - #elif defined PIN_MAP_COMPACT - #define PIN_SERIAL1_RX (4ul) - #define PIN_SERIAL1_TX (3ul) - #endif - - #define PAD_SERIAL1_TX (UART_TX_PAD_2) - #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) - #define SERCOM_INSTANCE_SERIAL1 &sercom1 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL1_RX (31ul) +#define PIN_SERIAL1_TX (30ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL1_RX (11ul) +#define PIN_SERIAL1_TX (10ul) #endif +#define PAD_SERIAL1_TX (UART_TX_PAD_0) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_1) +#define SERCOM_INSTANCE_SERIAL1 &sercom1 + // Serial2 #if defined PIN_MAP_STANDARD #define PIN_SERIAL2_RX (5ul) @@ -237,23 +223,47 @@ static const uint8_t ATN = PIN_ATN; /* * SPI Interfaces */ +#if defined(ONE_SPI) #define SPI_INTERFACES_COUNT 1 - -#if defined PIN_MAP_STANDARD -#define PIN_SPI_MISO (30u) -#define PIN_SPI_MOSI (8u) -#define PIN_SPI_SCK (9u) -#define PIN_SPI_SS (31u) -#elif defined PIN_MAP_COMPACT -#define PIN_SPI_MISO (10u) -#define PIN_SPI_MOSI (3u) -#define PIN_SPI_SCK (4u) -#define PIN_SPI_SS (11u) +#else +#define SPI_INTERFACES_COUNT 0 #endif -#define PERIPH_SPI sercom1 -#define PAD_SPI_TX SPI_PAD_2_SCK_3 -#define PAD_SPI_RX SERCOM_RX_PAD_0 +#if defined(ONE_WIRE) && defined (ONE_SPI) + #if defined PIN_MAP_STANDARD + #define PIN_SPI_MISO (30u) + #define PIN_SPI_MOSI (8u) + #define PIN_SPI_SCK (9u) + #define PIN_SPI_SS (31u) + #elif defined PIN_MAP_COMPACT + #define PIN_SPI_MISO (10u) + #define PIN_SPI_MOSI (3u) + #define PIN_SPI_SCK (4u) + #define PIN_SPI_SS (11u) + #endif + + #define PERIPH_SPI sercom1 + #define PAD_SPI_TX SPI_PAD_2_SCK_3 + #define PAD_SPI_RX SERCOM_RX_PAD_0 + +// ONE_UART and ONE_SPI +#else + #if defined PIN_MAP_STANDARD + #define PIN_SPI_MISO (14u) + #define PIN_SPI_MOSI (4u) + #define PIN_SPI_SCK (5u) + #define PIN_SPI_SS (15u) + #elif defined PIN_MAP_COMPACT + #define PIN_SPI_MISO (5u) + #define PIN_SPI_MOSI (1u) + #define PIN_SPI_SCK (2u) + #define PIN_SPI_SS (5u) + #endif + + #define PERIPH_SPI sercom0 + #define PAD_SPI_TX SPI_PAD_2_SCK_3 + #define PAD_SPI_RX SERCOM_RX_PAD_0 +#endif static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. static const uint8_t MOSI = PIN_SPI_MOSI ; @@ -264,7 +274,11 @@ static const uint8_t SCK = PIN_SPI_SCK ; /* * Wire Interfaces */ +#if defined(ONE_WIRE) #define WIRE_INTERFACES_COUNT 1 +#else +#define WIRE_INTERFACES_COUNT 0 +#endif #if defined PIN_MAP_STANDARD #define PIN_WIRE_SDA (14u) @@ -345,11 +359,17 @@ extern Uart Serial2; #define SERIAL_PORT_HARDWARE Serial1 #define SERIAL_PORT_HARDWARE_OPEN Serial1 -// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// The MT-D11 does not have the EDBG support chip, which provides a USB-UART bridge // accessible using Serial (the Arduino serial monitor is normally connected to this). // So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. // Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. // Remember to use while(!Serial); to wait for a connection before Serial printing. + +// When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define Serial SerialUSB +#else +#define Serial Serial1 +#endif #endif /* _VARIANT_ARDUINO_ZERO_ */ diff --git a/variants/MT_D11/README.md b/variants/MT_D11/README.md index 7d157dc24..8d8705b0f 100644 --- a/variants/MT_D11/README.md +++ b/variants/MT_D11/README.md @@ -17,9 +17,13 @@ REF * | A3 | | Vcc | BTN SS * * | A15 RST | BOOT ------------------- -* Some pins can be used for more than one function. The same port pin number printed on - the board is also used in Arduino (without the 'A') for all of the supported functions - (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the board is also used in Arduino (but without the 'A') for all + of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). When + using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top + left pin (A2). PIN_MAP_COMPACT uses less RAM. +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +* Leave pin A30 floating (or use external pullup) during reset. * Tone available on TC2. DO NOT connect voltages higher than 3.3V! ``` @@ -86,12 +90,16 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 16 | A31 | PA31 | RX1 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO ============================================================================================================================================ -* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') - for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the board is also used in Arduino (but without the 'A') for all + of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). When + using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top + left pin (A2). PIN_MAP_COMPACT uses less RAM. * The following Arduino pin numbers are not mapped to a physical pin: 0, 1, 8, 9, 12, 13, 18, 19, 20, 21, 24, 25, 26, 28, and 29. * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). -* The tone library uses TC2. +* Leave pin A30 floating (or use external pullup) during reset. * Pins 8 and 9 are by default connected to the 32.768KHz crystal. +* The tone library uses TC2. diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index 199258135..defe780fa 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -257,7 +257,11 @@ static const uint8_t ATN = PIN_ATN; /* * SPI Interfaces */ +#if defined(ONE_SPI) #define SPI_INTERFACES_COUNT 1 +#else +#define SPI_INTERFACES_COUNT 0 +#endif #if defined PIN_MAP_STANDARD #define PIN_SPI_MISO (14u) @@ -284,7 +288,11 @@ static const uint8_t SCK = PIN_SPI_SCK ; /* * Wire Interfaces */ +#if defined(ONE_WIRE) #define WIRE_INTERFACES_COUNT 1 +#else +#define WIRE_INTERFACES_COUNT 0 +#endif #if defined PIN_MAP_STANDARD #define PIN_WIRE_SDA (22u) @@ -367,11 +375,17 @@ extern Uart Serial2; #define SERIAL_PORT_HARDWARE Serial1 #define SERIAL_PORT_HARDWARE_OPEN Serial1 -// The MT-D21E does not have the EDBG support chip, which provides a USB-UART bridge +// The MT-D11 does not have the EDBG support chip, which provides a USB-UART bridge // accessible using Serial (the Arduino serial monitor is normally connected to this). // So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. // Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. // Remember to use while(!Serial); to wait for a connection before Serial printing. + +// When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define Serial SerialUSB +#else +#define Serial Serial1 +#endif #endif /* _VARIANT_ARDUINO_ZERO_ */ diff --git a/variants/MT_D21E/README.md b/variants/MT_D21E/README.md index 4763044e8..0beaac421 100644 --- a/variants/MT_D21E/README.md +++ b/variants/MT_D21E/README.md @@ -27,10 +27,12 @@ USB D+ TC51 | A25+ | | Vin | | Gnd | USB | Gnd | ------------------- -Some pins can be used for more than one function. The same port pin number printed on -the board is also used in Arduino (without the 'A') for all of the supported functions -(ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). -DO NOT connect voltages higher than 3.3V! +* Most pins can be used for more than one function. The port pin number printed + on the board is also used in Arduino (but without the 'A') for all of the supported + functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +* Leave pin A30 floating (or use external pullup) during reset. +* Tone available on TC5. DO NOT connect voltages higher than 3.3V! ``` # Pins descriptions for the MattairTech MT-D21E @@ -72,15 +74,14 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi -- | RST | ---- | | Reset, BOOT (double tap bootloader entry) ============================================================================================================================================ -* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') - for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). - +* Most pins can be used for more than one function. The port pin number printed + on the board is also used in Arduino (but without the 'A') for all of the supported + functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). * The following Arduino pin numbers are not mapped to a physical pin: 12, 13, 20, 21, 26, and 29. - -* Pins 24 and 25 are by default in use by USB (USB_NEGATIVE and USB_POSITIVE). TC5(D21) is available on these pins otherwise. - The tone library uses TC5. - +* Pins 24 and 25 are by default in use by USB (USB_NEGATIVE and USB_POSITIVE). +* TC5(D21) is available on these pins otherwise. The tone library uses TC5. * A0 and A1 are by default connected to the 32.768KHz crystal. +* Leave pin A30 floating (or use external pullup) during reset. diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index 1fabacc24..c99e633b8 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -309,6 +309,12 @@ extern Uart Serial2; // So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. // Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. // Remember to use while(!Serial); to wait for a connection before Serial printing. + +// When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) #define Serial SerialUSB +#else +#define Serial Serial1 +#endif #endif /* _VARIANT_ARDUINO_ZERO_ */ diff --git a/variants/MT_D21E_revB/README.md b/variants/MT_D21E_revB/README.md index eff1831c0..0ad81229d 100644 --- a/variants/MT_D21E_revB/README.md +++ b/variants/MT_D21E_revB/README.md @@ -28,9 +28,12 @@ USB D+ (D/L)(+), CAN RX (C) TC51 25 | A25 | | Vin | L21 installed. 5V i Chip Variant: ------------------- D=D21, L=L21, C=C21 -* Most pins can be used for more than one function. The same port pin number printed on - the board is also used in Arduino (without the 'A') for all of the supported functions - (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* Most pins can be used for more than one function. The port pin number printed + on the board is also used in Arduino (but without the 'A') for all of the supported + functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +* Leave pin A30 floating (or use external pullup) during reset. +* Tone available on TC5. DO NOT connect voltages higher than 3.3V! + This alternate function is enabled by default (+M functions enabled only when a memory device is installed). Thus, the associated header pin cannot be used. Solder jumpers @@ -83,15 +86,14 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi -- | RST | ---- | | Reset, BOOT (double tap bootloader entry) ============================================================================================================================================ -* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') - for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). - +* Most pins can be used for more than one function. The port pin number printed + on the board is also used in Arduino (but without the 'A') for all of the supported + functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). * The following Arduino pin numbers are not mapped to a physical pin: 12, 13, 20, 21, 26, and 29. - -* Pins 24 and 25 are by default in use by USB (USB_NEGATIVE and USB_POSITIVE). TC5(D21) is available on these pins otherwise. - The tone library uses TC5. - +* Pins 24 and 25 are by default in use by USB (USB_NEGATIVE and USB_POSITIVE). +* TC5(D21) is available on these pins otherwise. The tone library uses TC5. * A0 and A1 are by default connected to the 32.768KHz crystal. +* Leave pin A30 floating (or use external pullup) during reset. diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h index 88a595aae..07046a4c5 100644 --- a/variants/MT_D21E_revB/variant.h +++ b/variants/MT_D21E_revB/variant.h @@ -338,7 +338,12 @@ extern Uart Serial2; #if (SAMC) #define Serial Serial1 #else - #define Serial SerialUSB + // When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. + #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) + #define Serial SerialUSB + #else + #define Serial Serial1 + #endif #endif #endif /* _VARIANT_ARDUINO_ZERO_ */ From 914f38accd8912536ba24ccd4aa2a4f5222746ae Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 22 Apr 2017 04:28:12 +0000 Subject: [PATCH 089/124] Updated documentation --- README.md | 674 +++++++++++++++++----------- bootloaders/zero/binaries/README.md | 3 - variants/Generic_D11C14A/README.md | 51 +++ variants/MT_D11/README.md | 55 +++ variants/MT_D21E/README.md | 55 +++ variants/MT_D21E_revB/README.md | 55 +++ variants/MT_D21E_revB/variant.h | 2 +- 7 files changed, 637 insertions(+), 258 deletions(-) diff --git a/README.md b/README.md index 4cf2f1db7..b7e87798f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ # MattairTech Arduino SAM M0+ Core +This documentation is currently under construction. + This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support for SAM M0+ boards including the MattairTech MT-D21E and the MT-D11 -(see https://www.mattairtech.com/). It primarily adds support for new devices as well -as a more flexible pin configuration / mapping system. It also adds some size -optimizations (~7.5KB for blink sketch with CDC+HID+UART, ~2.5KB without USB or UART). +(see https://www.mattairtech.com/). It adds support for new devices like the L21, C21, and +D11. It also adds new clock sources, like a high speed crystal or internal oscillator. This core is intended to be installed using Boards Manager (see below). To update from a previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update. +**Differences from Arduino in Versioning** +The MattairTech version number does not correspond to either the IDE version or to the +upstream ArduinoCore-samd version. See the CHANGELOG for details on which upstream +commits have been merged in to the MattairTech core. + -## What's New Beta (1.6.8-beta) +## What's New Beta (1.6.8-beta). See Beta Builds section for installation instructions. 1.6.8-beta-b0: * Added L21 and C21 support. Improved D11D and D11C support. @@ -26,12 +32,13 @@ previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then cl * New Tools->Bootloader Size menu allows selection of bootloader size * New Tools->USB Config menu simplifies USB configuration compared to previous core * Updated variant.cpp table format for future CCL and GCLK use. See VARIANT_COMPLIANCE_CHANGELOG. +* Updated bootloader. * Updated bossac upload tool (fixed support for SAML and SAMC) * New CMSIS-Atmel package (this is different than from Arduino) -* Merged in all changes from upstream through SAMD CORE 1.6.13 (2017.03.31) +* Merged in all changes from upstream through SAMD CORE 1.6.14 (April 2017) -## What's New Release (1.6.6) +## What's New Release (1.6.6). NOTE: This is out of date, use the beta for now. * 1.6.6-mt3: * Fixes compilation with CDC_UART and CDC_ONLY settings @@ -48,7 +55,9 @@ previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then cl * Merged in changes from upstream SAMD CORE 1.6.2 2015.11.03 (see CHANGELOG for details) -## Summary +## Specifications + +TODO: Update for L21 and C21 Feature | MT-D21E | MT-D11 ------------------------|---------------------------------------------------------------------------------------|------------------------------------------------------ @@ -70,173 +79,328 @@ Operating Voltage | 3.3V (Do not connect voltages higher than 3.3V!) | 3.3V ( DC Current per I/O Pin | 7 mA | 7 mA -## Special Notes -* **Boards Manager must be opened twice to see some updates** +## Board Variants -* **Errors when compiling, uploading, or burning the bootloader** - * Be sure to install the Arduino samd core before installing the MattairTech sam m0+ core. If you have problems upgrading - the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. - Use Arduino core 1.6.2 or above. +Pin configuration and peripheral assignment information is now in the README.md for each board variant. +README.md also now includes technical information on the new PinDescription table format. -* **Tools->Communications menu** - * Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration - must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an - option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the - USB device configuration (needed for Windows). This may become automatic in a future release. +* [MattairTech MT-D21E Rev B (SAMx21Exxx)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/MT_D21E_revB/README.md) - * Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. - * Different combinations of USB devices will result in different COM port assingments in Windows. +* [MattairTech MT-D21E Rev A (SAMD21ExxA)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/MT_D21E/README.md) -* **Incude platform specific libraries** - * You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. +* [MattairTech MT-D11 (SAMD11D14AM)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/MT_D11/README.md) -* **Differences from Arduino in versioning** - * The MattairTech ArduinoCore-samd version currently tracks the IDE version. In some cases, it may indicate the - minimum IDE version. This is the case for both 1.6.5-mtX and 1.6.6-mtX (which corresponds to SAMD CORE 1.6.2). - 1.6.6-mt1 corresponds to Arduino SAMD CORE 1.6.2 plus some pull requests. +* [MattairTech Generic D11C14A](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/Generic_D11C14A/README.md) +* MattairTech x21J based board (coming June) -### Additional Differences Between MattairTech and Arduino Cores -* TODO +* MattairTech Generic D11D14AS (coming soon) +* MattairTech Generic D11D14AM (coming soon) -## Pin Configurations +* MattairTech Generic x21E (coming soon) -Most pins have multiple configurations available (even analog pins). For example, pin A10 on the MT-D21E can be an analog -input, a PWM output, Digital I/O, or the TX pin of 'Serial1'. These always reference the pin number printed on the board -but without the 'A' (with the usable pins starting at 2). DO NOT connect voltages higher than 3.3V! +* MattairTech Generic x21G (coming soon) +* MattairTech Generic x21J (coming soon) -# MattairTech MT-D21E (rev B) (ATSAMx21Exxx) +* [Arduino Zero (arduino.cc)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/arduino_zero/README.md) -``` -========================== MattairTech MT-D21E rev B (ATSAMx21Exxx) ===================== -Other COM PWM Analog INT Arduino* Arduino* INT PWM COM Other -========================================================================================= - ------------------- -XI32(+) | A0 RST | BOOT(+) -XO32(+) | A1 Gnd | -DAC * 2 | A2 Vbat | -REFA * 3 | A3 A31 | 31 * IO/B(+) -REFB * * 4 | A4 A30 | 30 * CLK(+) -DAC1(L) * * 5 | A5 NC | -LED(+) TCC10 * 6 | A6 A28 (D/C)| 28 * -VM TCC11 * 7 | A7 A27 | 27 * A/CS(+M) - TCC00 * NMI 8 | A8 A23 | 23 * TC41/TC01~ SS - TCC01 * * 9 | A9 A22 | 22 * TC40/TC00~ MISO(+M) - TX1 TCC02 * 10 | A10 A19 | 19 * SCK(+M) - RX1 TCC03 * 11 | A11 A18 | 18 * MOSI(+M) - TX2 TC30/TC40~ * 14 | A14 A17 | 17 * TCC21 SCL(+) - RX2 TC31/TC41~ 15 | A15 A16 | 16 * TCC20 SDA(+) - | NC NC | - M=Memory device installed | NC NC | ! Vcc is 3.3V by default. - | Vbus 3.3V| DO NOT exceed 3.6V on Vcc or -USB D- (D/L)(+), CAN TX (C) TC50 24 | A24 _____ Vcc | any IO pin with the D21 or -USB D+ (D/L)(+), CAN RX (C) TC51 25 | A25 | | Vin | L21 installed. 5V is allowed - | Gnd | USB | Gnd | ONLY with the C21 installed. - Chip Variant: ------------------- - D=D21, L=L21, C=C21 - -* Most pins can be used for more than one function. The same port pin number printed on - the board is also used in Arduino (without the 'A') for all of the supported functions - (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). - -+ This alternate function is enabled by default (+M functions enabled only when a memory - device is installed). Thus, the associated header pin cannot be used. Solder jumpers - can be used to enable or disable the alternate onboard function. - -~ When two timers are shown, the second is for L21/C21. TC5 is TC1 on the L21/C21. - -Silkscreen Legend: - Top: A circled pin means analog function and '*' means alternate function (see + above) - Bottom: A circled pin means analog function -``` +* [Arduino M0 (arduino.org)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/arduino_mzero/README.md) -### SAMD11 (MT-D11) -``` -=========================== MattairTech MT-D11 (ATsamd11D14AM) ========================== -Other INT PWM Digital Analog Digital PWM INT Other -========================================================================================= - ------------------- -DAC 2 2(ADC0) | A2 | USB | Gnd | -REF 3 3(ADC1) | A3 | | Vcc | - 4(INT4) 4(TCC00) 4 4(ADC2) | A4 ----- A31 | 31 31(TC21) 31(INT3) RX/SWDIO - 5(INT5) 5(TCC01) 5 5(ADC3) | A5 A30 | 30 30(TC20) TX/SWDCLK - 6(TCC02) 6 6(ADC4) | A6 A27 | 27 27(INT7) - 7(TCC03) 7 7(ADC5) | A7 A23 | 23 SCL -MOSI 10(INT2) 10 10(ADC8) | A10 A22 | 22 22(INT6) SDA -SCK 11 11(ADC9) | A11 A17 | 17 17(TC11) -MISO 14(INTNMI) 14 14(ADC6) | A14 A16 | 16 16(TC10) 16(INT0) LED -BTN/SS 15(INT1) 15 15(ADC7) | A15 RST | Reset - ------------------- -``` +## Tools Menu Additions + +Depending on the board variant, different menu options will appear in the Tools menu. + + +### Microcontroller Menu + +This menu will appear with boards that have multiple microcontroller options. + + +### Clock Source Menu + +There are up to four clock source choices, depending on board variant and microcontroller. They are: + +* 32KHZ_CRYSTAL (default) +* HIGH_SPEED_CRYSTAL +* INTERNAL_OSCILLATOR +* INTERNAL_USB_CALIBRATED_OSCILLATOR + +See Clock Source section for more information. + + +### Bootloader Size Menu + +With the D21, L21, and C21, the bootloader size can be configured as: + +* 8KB_BOOTLOADER (default) +* 16KB_BOOTLOADER +* NO_BOOTLOADER + +With the D11, the bootloader size can be configured as: + +* 4KB_BOOTLOADER (default) +* NO_BOOTLOADER + +Choose NO_BOOTLOADER if not using a bootloader (an external programmer will be used for sketch upload). + + +### Serial Config Menu + +This menu is used to select different combinations of serial peripherals. This is useful especially for +the D11, which has a reduced pin count and number of SERCOMs. It can also be used to reduce FLASH and +SRAM usage by selecting fewer UART peripherals, which are instantiated in the core, rather than only +when including a library (like SPI and WIRE). Most board variants support two UART as an option. + + +### USB Config Menu + +This menu will appear with all microcontrollers except the C21, which does not have USB. The options are: + +* CDC_ONLY (default) +* CDC_HID +* WITH_CDC +* HID_ONLY +* WITHOUT_CDC +* USB_DISABLED + +Choose an option that best matches your code and library usage. Each option results in a different USB PID. +Choose an option with CDC if you want auto-reset to function, or the serial monitor over USB. If CDC is +not enabled, Serial will refer to Serial1 instead of SerialUSB. These options can be used to optimize FLASH +and SRAM usage by allowing CDC to be disabled (or USB completely disabled). + + +## Clock Source +TODO +There are up to four clock source choices, depending on board variant and microcontroller. They are: + +* 32KHZ_CRYSTAL (default) +* HIGH_SPEED_CRYSTAL +* INTERNAL_OSCILLATOR +* INTERNAL_USB_CALIBRATED_OSCILLATOR + + * If CLOCKCONFIG_32768HZ_CRYSTAL or + * CLOCKCONFIG_HS_CRYSTAL is defined, then the PLL will be used. If + * CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must + * also be defined with the crystal frequency in Hertz. CLOCKCONFIG_INTERNAL + * uses the DFLL in open-loop mode, except with the C21 which lacks a DFLL, so + * the internal 48MHz RC oscillator is used instead. CLOCKCONFIG_INTERNAL_USB + * can be defined for the D21, D11, or L21. It will also use the DFLL in + * open-loop mode, except when connected to a USB port with data lines (and + * not suspended), where it will calibrate against the USB SOF signal. + +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL)) +#error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 4000000UL and 32000000UL" +#endif + +#if defined(PLL_FAST_STARTUP) +#if (HS_CRYSTAL_FREQUENCY_HERTZ < 1000000UL) +#error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be at least 1000000UL when PLL_FAST_STARTUP is defined" +#else +#define HS_CRYSTAL_DIVISOR 1000000UL +#endif +#else +#define HS_CRYSTAL_DIVISOR 32000UL +#endif + +#define HS_CRYSTAL_DIVIDER (HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVISOR) +#define DPLLRATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) + +#if defined(PLL_FRACTIONAL_ENABLED) +#define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT +#define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) +#else +#define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT +#define DPLLRATIO_LDRFRAC 0 +#endif + +Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz. + +// Constants for Clock generators +#define GENERIC_CLOCK_GENERATOR_MAIN (0u) +#define GENERIC_CLOCK_GENERATOR_XOSC (1u) +#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT (D21/D11) */ +#define GENERIC_CLOCK_GENERATOR_OSC_HS (3u) + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + +* What to do with unused default internal RC oscillator: +#if (SAMD21) +/* Modify PRESCaler value of OSC8M to have 8MHz */ +/* Put OSC8M as source for Generic Clock Generator 3 */ +#elif (SAML21) +/* Note that after reset, the L21 starts with the OSC16M set to 4MHz, NOT the DFLL@48MHz as stated in some documentation. */ +/* Modify FSEL value of OSC16M to have 8MHz */ +/* Put OSC16M as source for Generic Clock Generator 3 */ +#endif + + +### External High-Speed Crystal +TODO + +### External 32.768KHz Crystal +TODO + +### Internal Oscillator with USB Calibration +TODO + +### Internal Oscillator +TODO + + + +## Analog Reference + +TODO: Analog reference selection + + * For values <= 5, the actual register value is used. + * For values > 5 (SAML and SAMC only), the SUPC_VREF_SEL register value is: (ulMode - 6). + * Values for the Supply Controller (SUPC) reference on the L21 or C21. + * Used when AR_INTREF is selected as the reference. + +typedef enum _eAnalogReference +{ +#if (SAMD) + AR_INTERNAL1V0 = 0, + AR_INTERNAL_INTVCC0 = 1, + AR_INTERNAL_INTVCC1 = 2, + AR_EXTERNAL_REFA = 3, + AR_EXTERNAL_REFB = 4, + AR_DEFAULT = 5, // On the SAMD, this also uses 1/2 gain on each input +#elif (SAML21) + AR_INTREF = 0, + AR_INTERNAL_INTVCC0 = 1, + AR_INTERNAL_INTVCC1 = 2, + AR_EXTERNAL_REFA = 3, + AR_EXTERNAL_REFB = 4, + AR_INTERNAL_INTVCC2 = 5, + AR_INTREF_1V0 = 6, + AR_INTREF_1V1 = 7, + AR_INTREF_1V2 = 8, + AR_INTREF_1V25 = 9, + AR_INTREF_2V0 = 10, + AR_INTREF_2V2 = 11, + AR_INTREF_2V4 = 12, + AR_INTREF_2V5 = 13, + AR_DEFAULT = AR_INTERNAL_INTVCC2, + AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAML is 1.0V +#elif (SAMC21) + AR_INTREF = 0, + AR_INTERNAL_INTVCC0 = 1, + AR_INTERNAL_INTVCC1 = 2, + AR_EXTERNAL_REFA = 3, + AR_EXTERNAL_DAC = 4, + AR_INTERNAL_INTVCC2 = 5, + AR_INTREF_1V024 = 6, + AR_INTREF_2V048 = 7, + AR_INTREF_4V096 = 8, + AR_DEFAULT = AR_INTERNAL_INTVCC2, + AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAMC is 1.024V +#else + #error "wiring_analog.c: Unsupported chip" +#endif + AR_INTERNAL = AR_INTERNAL_INTVCC0, + AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0, // 2.23V only when Vcc = 3.3V + AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1, // 1.65V only when Vcc = 3.3V + AR_EXTERNAL = AR_EXTERNAL_REFA, +} eAnalogReference ; + + + +## Random TODO Notes + +* TONE: TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14 as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. +* D21: Enables wakeup capability on pin in case being used during sleep (WAKEUP always enabled on SAML and SAMC) +* All pins (digital and analog) setup in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) +* INEN enabled for both input and output (but not analog) +* pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would + interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. +* Pull resistors enabled only if pin attributes allow and only if pin is not configured as output. +* Pull direction (pullup or pulldown) is now set with pinMode only (defaults to pullup if pinMode never called). + + + +## Chip Specific Notes + +### SAMD21 + +* When USB is disabled, pullups will be enabled on PA24 and PA24 to avoid excessive current consumption (<1mA) due to floating pins. + Note that it is not necessary to enable pull resistors on any other pins that are floating. + Errata: Disable pull resistors on PA24 and PA25 manually before switching to a peripheral. + + +### SAML21 + +* There are two DACs, DAC0 and DAC1. Both are supported. Because changing the configuration of one DAC requires disabling both, + there will be about a 40us period when the second DAC is disabled. Most of this time is due to an errata that requires a delay of + at least 30us when turning off the DAC while refresh is on. The L21 DACs have a refresh setting which must be enabled in this core. +* The analog reference has additional options on the L21 and C21. See Analog Reference below. +* On the L21, SERCOM5 is in a low power domain. The Fm+ and HS modes of I2C (wire) are not supported. +* The SAML and SAMC have double-buffered TCs, which are supported in the core. +* The CHANGE and RISING interrupt modes on pin A31 do not seem to work properly on the L21. +* The L21 has two performance levels that affect power consumption. During powerup, the L21 starts at the lowest performance level (PL0). + The startup code changes to the highest performance level (PL2) in order to support 48MHz and USB (among other things). +* Two Flash Wait States are inserted for the L21 and C21 (the D21/D11 use one wait state). + + +### SAMC21 + +* There are two SAR ADCs. Both are supported. The PinDescription table determines the peripheral instance and pin mapping. +* The analog reference has additional options on the L21 and C21. See Analog Reference below. +* The SAML and SAMC have double-buffered TCs, which are supported in the core. +* Two Flash Wait States are inserted for the L21 and C21 (the D21/D11 use one wait state). +* The C21 requires internal pull resistors to be activated on floating pins to minimize power consumption (not needed on D21/D11 or L21). +* The C21 uses the minimum sampling time so that rail-to-rail and offset compensation works. Offset compensation adds 3 ADC clock cycles, + so the total is 4 clock cycles. The D21, D11, and L21 use the maximum sampling time. + + +### SAMD11 + +* The D11D has three SERCOM. The D11C has two sercom (no sercom2). +* When USB is disabled, pullups will be enabled on PA24 and PA24 to avoid excessive current consumption (<1mA) due to floating pins. + Note that it is not necessary to enable pull resistors on any other pins that are floating. + Errata: Disable pull resistors on PA24 and PA25 manually before switching to a peripheral. + +#### Reducing SRAM/FLASH Usage + +TODO + + +### Differences Between MattairTech and Arduino Cores + +* TODO +* Table summarizing which core files are modified and by how much +* Changes due to adding/changing features vs porting to new chip -#### All pins operate at 3.3 volts. DO NOT connect voltages higher than 3.3V! - -### Pin Capabilities - -* **Digital: All pins can be used for general purpose I/O** - * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. - * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). - * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). - * Use the pinMode(), digitalWrite(), and digitalRead() functions. -* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** - * These are available using the analogRead() function. - * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). - * Each pin provides 10 bits of resolution (1024 values) by default. - * 12-bit resolution supported by using the analogReadResolution() function. - * Each pin measures from ground to 3.3 volts. - * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. -* **DAC: One analog output is available on pin 2.** - * Provides a 10-bit voltage output with the analogWrite() function. -* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** - * Available using the analogWrite() function. - * Each pin provides 8 bits of resolution (256 values) by default. - * 12-bit resolution supported by using the analogWriteResolution() function. -* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** - * Available using the attachInterrupt() function. -* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** - * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). - * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). -* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** - * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). - * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). - * SPI communication using the SPI library. - * Note that the SPI library will set SS as an output. - * On the MT-D11, the button must be configured as reset (default) when using SPI. -* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** - * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). - * MT-D11: Pin 22 (SDA) and pin 23 (SCL). - * TWI communication using the Wire library. -* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** - * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** - * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. - * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. -* **AREF: One pin can be configured as an AREF analog input.** - * The upper end of the analog measurement range can be changed using the analogReference() function. -* **Reset: Bring this line LOW to reset the microcontroller.** - -### MT-D21E and MT-D11 Board Configuration Notes - -* The 32.768KHz crystal is used by the Arduino core, so it MUST be connected via the solder jumpers. -* The sketch in some cases can run without the crystal attached, but the clock will be very inaccurate. -* The 16MHz crystal is not used. It should be disconnected via the solder jumpers. -* The I2C (TWI) pullup resistors should be enabled via the solder jumpers. -* The LED should be enabled via the solder jumper. -* Button A and the debouncing capacitor should be connected via the solder jumpers. -* Button B (MT-D21E only) is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. -* A reference voltage can be connected to AREF. In this case, the capacitors should be enabled via the solder jumpers. -* On the MT-D11, BTN is shared with SPI SS, so the button must be configured as reset (default) when using SPI. ## Serial Monitor -To print to the Serial Monitor over USB, use 'Serial'. Serial points to SerialUSB (Serial1 and Serial2 are UARTs). +To print to the Serial Monitor over USB, use 'Serial'. Serial refers to SerialUSB (Serial1 and Serial2 are UARTs). Unlike most Arduino boards (ie. Uno), SAM M0+ boards do not automatically reset when the serial monitor is opened. To see what your sketch outputs to the serial monitor from the beginning, the sketch must wait for the SerialUSB port to open first. Add the following to setup(): @@ -250,9 +414,13 @@ You can also reset the board manually with the Reset button if you wish to resta the Reset button will reset the SAM M0+ chip, which in turn will reset USB communication. This interruption means that if the serial monitor is open, it will be necessary to close and re-open it to restart communication. +When USB CDC is not enabled, Serial will instead refer to Serial1, which is the first UART. + ## Code Size and RAM Usage (1.6.5-mt2) +TODO: Update this. Maybe just for D11 and move to D11 Chip Specific Notes. + Sketch and Configuration | MT-D21E (Flash + RAM) | MT-D11 (Flash + RAM) ----------------------------|-----------------------|----------------------- Blink (CDC + HID + UART) | 7564 + 1524 | 7452 + 1424 @@ -303,16 +471,17 @@ There are currently four USB composite device combinations that include CDC as w supported combination has a unique USB VID:PID pair, and these are listed in the .inf file. Once the first device is installed (the CDC only device), future installations *might* be automatic, otherwise, you may direct the installer to the same .inf file. The drivers are signed and support both 32 and 64 bit versions of Windows XP(SP3), -Vista, 7, 8, and 10. +Vista, 7, 8, and 10. Note that the Windows 10 generic CDC drivers work as well. 1. If you do not already have the SAM-BA bootloader installed, see below. 2. Download https://www.mattairtech.com/software/MattairTech_CDC_Driver_Signed.zip and unzip into any folder. -3. Plug in the board while holding down button A to enter the bootloader. The LED should light. + Note that the Windows 10 generic CDC drivers work as well. +3. Plug in the board. The LED should fade when the bootloader is running (or blink if the test sketch is running). 4. Windows will detect the board. Point the installer to the folder from above to install the bootloader driver. 5. If you don't intend on using Arduino, you can skip the rest of this list. See Using Bossac Standalone below. 6. If you do not already have the test firmware installed (comes preinstalled), see Using Bossac Standalone below. -7. Press the reset button to run the test firmware (blink sketch). +7. Press the reset button to run the test firmware (if needed). The LED will blink. 8. Windows will detect the board. Point the installer to the above folder to install the sketch driver (if needed). 9. Continue with SAM M0+ Core Installation below. @@ -329,7 +498,7 @@ Vista, 7, 8, and 10. #### OS X -OS X support currently in beta (see below), the following instructions are still for 1.6.6-mtX. +OS X support currently in beta (see below), the following instructions are only for 1.6.6-mtX and below. 1. Only the 256 KB chip variants work with the OS X version of the upload tool, bossac. 2. First, you will need to open boards.txt and change mattairtech_mt_d21e_bl8k.upload.tool to equal arduino:bossac. 3. Open platform.txt and change tools.bossac.path to equal{runtime.tools.bossac-1.6.1-arduino.path}. @@ -343,26 +512,25 @@ OS X support currently in beta (see below), the following instructions are still ### SAM M0+ Core Installation * To update from a previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update. -* Boards Manager may require opening twice (with possibly a delay in between) to see some updates. -1. The MattairTech SAM M0+ Core requires Arduino 1.6.7 (1.6.5-mtX required IDE 1.6.5). +1. The MattairTech SAM M0+ Core requires Arduino 1.6.7 or above (including 1.8.x). 2. In the Arduino IDE, click File->Preferences. 3. Click the button next to Additional Boards Manager URLs. 4. Add https://www.mattairtech.com/software/arduino/package_MattairTech_index.json. 5. Save preferences, then open the Boards Manager. 6. Install the Arduino SAM M0+ Boards package. Use version 1.6.2 or higher. -7. Install the MattairTech SAM M0+ Boards package (1.6.7). +7. Install the MattairTech SAM M0+ Boards package. 8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E (or MT-D11). -9. Select the processor with the now visible Tools->Processor menu. +9. Select the MCU with the now visible Tools->Microcontroller menu (if present). 10. If you do not already have the bootloader or blink sketch installed, see SAM-BA USB CDC Bootloader below. 11. Plug in the board. The blink sketch should be running. -12. Click Tools->Port and choose the COM port. +12. Click Tools->Port and choose the COM port. Note that the board indicated may not match the chosen board. 13. You can now upload your own sketch. ### Uploading the First Sketch -1. In the Arduino IDE 1.6.7 (or above), open File->Examples->01.Basics->Blink. +1. In the Arduino IDE (1.6.7 or above), open File->Examples->01.Basics->Blink. 2. Change the three instances of '13' to 'LED_BUILTIN'. 3. Be sure the correct options are selected in the Tools menu (see AVR Core Installation above). 4. With the board plugged in, select the correct port from Tools->Port. @@ -372,13 +540,12 @@ OS X support currently in beta (see below), the following instructions are still ## SAM-BA USB CDC Bootloader (Arduino compatible) -The SAM-BA bootloader has both a CDC USB interface, and a UART interface (TX: pin 10, RX: pin 11, 8N1). -It is compatible with the Arduino IDE (Zero compatible), or it can be used with the Bossac tool standalone. Under -Arduino, auto-reset is supported (automatically runs the bootloader while the sketch is running) as well as -automatic return from reset. The SAM-BA bootloader described here adds to the Arduino version, which in -turn is based on the bootloader from Atmel. The Arduino version added several features, including three -new commands (Arduino Extended Capabilities) that increase upload speed. The bootloader normally requires -8 KB FLASH, however, a 4 KB version can be used for the D11 chips. +The SAM-BA bootloader has both a CDC USB interface, and a UART interface. It is compatible with the Arduino IDE, or +it can be used with the Bossac tool standalone. With Arduino, auto-reset is supported (automatically runs the +bootloader while the sketch is running) as well as automatic return from reset. The SAM-BA bootloader described +here adds to the Arduino version, which in turn is based on the bootloader from Atmel. The Arduino version added +several features, including three new commands (Arduino Extended Capabilities) that increase upload speed. The +bootloader normally requires 8 KB FLASH, however, a 4 KB version can be used for the D11 chips. Bossac is a command line utility for uploading firmware to SAM-BA bootloaders. It runs on Windows. Linux, and OS X. It is used by Arduino to upload firmware to SAM and SAM M0+ boards. The version Bossac described here adds to the @@ -402,7 +569,7 @@ The bootloader can be started by: * If the application (sketch) area is blank, the bootloader will run. Otherwise, it jumps to application and starts execution from there. The LED will light during bootloader execution. -Note that the 4KB bootloader does not support the Arduino Extended Capabilities or BOOT_DOUBLE_TAP. +Note that the 4KB bootloader does not support the Arduino Extended Capabilities. However, BOOT_DOUBLE_TAP does fit into the SAMD11 4KB bootloader. When the Arduino IDE initiates the bootloader, the following procedure is used: @@ -412,6 +579,8 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: 3. The board is reset. The bootloader (which always runs first) detects the blank flah row, so bootloader operation resumes. 4. Opening and closing the port at a baud rate other than 1200bps will not erase or reset the SAM M0+. +**See [bootloaders/zero/README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/README.md) for more technical information on the bootloader.** + ### Bootloader Firmware Installation @@ -421,8 +590,8 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: 2. Plug in the SAM M0+ board. The bootloader must be running to (press reset twice within 500ms). 3. Plug an Atmel ICE into USB, then connect it to the powered SAM M0+ board. A green LED should light on the Atmel ICE. 4. Click Tools->Programmer->Atmel ICE. -5. Click Tools->Board->MattairTech MT-D21E (or MT-D11). -6. Click Tools->Processor and select your chip. +5. Click Tools->Board->MattairTech MT-D21E (or whichever board you are using). +6. Click Tools->Microcontroller and select your MCU (if menu present). 7. Click Tools->Burn Bootloader. Ignore any messages about not supporting shutdown or reset. 8. Continue with driver installation above. @@ -431,7 +600,7 @@ A running sketch may interfere with the bootloader installation process. Be sure #### Bootloader Installation Using Another Tool (ie: Atmel Studio, openocd) 1. Download the bootloader from https://www.mattairtech.com/software/arduino/SAM-BA-bootloaders-zero-mattairtech.zip. -2. Unzip to any directory. Be sure that a bootloader is available for your particular chip. +2. Unzip to any directory. Be sure that a bootloader is available for your particular MCU. 3. Follow the procedures for your upload tool to upload the firmware. * Perform a chip erase first. Be sure no BOOTPROT bits are set. * Install the binary file to 0x00000000 of the FLASH. @@ -440,8 +609,38 @@ A running sketch may interfere with the bootloader installation process. Be sure 4. Continue with driver installation above. +### Bootloader Binaries + +The bootloaders/zero/binaries directory contains all of the SAM-BAm0+ +bootloaders built by the build_all_bootloaders.sh script. + +#### MattairTech Boards +MattairTech boards are all configured with only one interface: +SAM_BA_USBCDC_ONLY (except C21, which uses SAM_BA_UART_ONLY). +CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_INTERNAL_USB +(CLOCKCONFIG_INTERNAL for the C21). Only the main LED is defined. +BOOT_LOAD_PIN is not defined, but BOOT_DOUBLE_TAP_ENABLED is. + +#### Arduino/Genuino Boards +Arduino/Genuino boards are all configured with both interfaces. +CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_32768HZ_CRYSTAL. +All LEDs that are installed for each board are defined (and some +have LED_POLARITY_LOW_ON set). BOOT_LOAD_PIN is not defined, but +BOOT_DOUBLE_TAP_ENABLED is. + +#### Generic Boards +The generic boards are all configured to minimize external hardware +requirements. Only one interface is enabled: SAM_BA_USBCDC_ONLY +(except C21, which uses SAM_BA_UART_ONLY). CLOCKCONFIG_CLOCK_SOURCE +is set to CLOCKCONFIG_INTERNAL_USB (CLOCKCONFIG_INTERNAL for the C21), +so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not +defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin. + + ### Using Bossac Standalone +TODO: Update https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip with new chips (L21 and C21). + When using Bossac standalone, you will need to ensure that your application starts at 0x00002000 for 8 KB bootloaders, and 0x00001000 for 4 KB bootloaders. This is because the bootloader resides at 0x00000000. This can be accomplished by passing the following flag to the linker (typically LDFLAGS in your makefile; adjust for your bootloader size): @@ -450,19 +649,19 @@ by passing the following flag to the linker (typically LDFLAGS in your makefile; Wl,sectionstart=.text=0x2000 ``` -You may also use a linker script. See the MattairTech SAM M0+ package for examples. +You can also use a linker script. See the MattairTech SAM M0+ package for examples. Be sure to generate and use a binary file. Many makefiles are set up to generate an elf, hex, and bin already. Download Bossac from: -* https://www.mattairtech.com/software/arduino/bossac-1.6.1-arduino-mattairtech-1-mingw32.tar.bz2 (Windows 32 bit and 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.6.1-arduino-mattairtech-1-x86_64-linux-gnu.tar.bz2 (Linux 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.6.1-arduino-mattairtech-1-i686-linux-gnu.tar.bz2 (Linux 32 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.6.1-arduino-mattairtech-1-x86_64-apple-darwin.tar.bz2 (OS X 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) Linux 64 bit users can also download Bossa (GUI) and bossash (shell) from: -* https://www.mattairtech.com/software/arduino/Bossa-1.6.1-arduino-mattairtech-1-x86_64-linux-gnu.tar.bz2 (Linux 64 bit) +* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) As an example, bossac will be used to upload the test firmware (blink sketch): @@ -481,6 +680,9 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R ## New PinDescription Table +Technical information on the new PinDescription table format is now in the README.md +that accompanies each board variant. See board variants above. + ### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the @@ -509,87 +711,23 @@ pin 28 = Port A28). This works well when there is only one port (or if the PORTB are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added for pins that are used for other purposes or for pins that do not exist (especially the D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp -from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin -designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then -using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be -used, leaving the other pin for some number above 31. +from the MT-D11 variant. + +### See Board Variants above for more technical information on the PinDescription table. ### See WVariant.h in cores/arduino for the definitions used in the table. -#### Port: -This is the port (ie: PORTA). - -#### Pin: -This is the pin (bit) within the port. Valid values are 0-31. - -#### PinType: -This indicates what peripheral function the pin can be attached to. In most cases, -this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute -field. It can also be set to a specific peripheral. In this case, any attempt to -configure the pin (using pinPeripheral or pinMode) as anything else will fail (and -pinPeripheral will return -1). This can be used to prevent accidental re-configuration -of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin -is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See -WVariant.h for valid entries. These entries are also used as a parameter to -pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function -now calls pinPeripheral() with the desired mode. Note that this field is not used to -select between the two peripherals possible with each of the SERCOM and TIMER functions. -PeripheralAttribute is now used for this. - -#### PeripheralAttribute: -This is an 8-bit bitfield used for various peripheral configuration. It is primarily -used to select between the two peripherals possible with each of the SERCOM and TIMER -functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. -This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the -MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. -Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the -pin drive strength. In the future, other attributes (like input buffer configuration) -may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also -selected here. See WVariant.h for valid entries. - -#### PinAttribute -This is a 32-bit bitfield used to list all of the valid peripheral functions that a -pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain -attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL -includes all of the GPIO functions, while PIN_ATTR_TIMER includes both -PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). -PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for -limiting a pin to only input related functions or output functions. This allows a pin -to have a more flexible configuration, while restricting the direction (ie: to avoid -contention). See WVariant.h for valid entries. - -#### TCChannel -This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available -on multiple pins. In general, only one pin should be configured in the pinDescription -table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column -to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the -D21). See WVariant.h for valid entries. - -#### ADCChannelNumber -This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, -which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. - -#### ExtInt -This is the interrupt (if any) assigned to the pin. Some interrupt numbers are -available on multiple pins. In general, only one pin should be configured in the -pinDescription table per interrupt number. Thus, for example, if an interrupt was -needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid -entries. - -#### GCLKCCL -This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support -the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and -C21, and the GCLK outputs (inputs). - - -## Possible Future Additions - -* SAML21 and C21 support is currently under development + + +## Possible Future Additions/Changes + * Timer library is currently under development (like TimerOne, plus input capture, plus ??) * OS X support currently in beta testing +* Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) * USB Host mode CDC ACM (partially complete; BSD-like license?) * Features for lower power consumption (library?) +* Reliability and security enhancements * Enhanced SD card library * Optional use of single on-board LED as USB activity LED * MSC (Mass Storage) USB Device Class @@ -598,7 +736,7 @@ C21, and the GCLK outputs (inputs). * High-speed port pin access (IOBUS) * Libraries for some hardware I plan on using: * TFT LCD (CFAF128128B-0145T) - * Motor controller (LV8711T) + * Motor controller * IR decoder * I2S DAC/AMP and I2S MEMS microphone * Battery management IC @@ -616,6 +754,34 @@ C21, and the GCLK outputs (inputs). The Changelog has moved to a separate file named CHANGELOG. The most recent changes are still in the 'What's New' section above. +## Troubleshooting + +TODO: Update + +* **On Linux, disable modem manager** + +* **Do not perform a manual auto-reset (using a terminal program to change baud to 1200)** + +* **Boards Manager must be opened twice to see some updates** + +* **Errors when compiling, uploading, or burning the bootloader** +* Be sure to install the Arduino samd core before installing the MattairTech sam m0+ core. If you have problems upgrading +the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. +Use Arduino core 1.6.2 or above. + +* **Tools->Communications menu** +* Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration +must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an +option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the +USB device configuration (needed for Windows). This may become automatic in a future release. + +* Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. +* Different combinations of USB devices will result in different COM port assingments in Windows. + +* **Incude platform specific libraries** +* You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. + + ## Bugs or Issues If you find a bug you can submit an issue here on github: @@ -630,7 +796,7 @@ Before posting a new issue, please check if the same problem has been already re Contributions are always welcome. The preferred way to receive code cotribution is by submitting a Pull Request on github. -## Beta builds +## Beta Builds Periodically, a beta is released for testing. @@ -649,7 +815,7 @@ where ${VERSION} and ${BUILD_NUMBER} match the beta name as shown in the CHANGEL In this case, the IDE will not notify the user of updates. -## License and credits +## License and Credits This core has been developed by Arduino LLC in collaboration with Atmel. This fork developed by Justin Mattair of MattairTech LLC. diff --git a/bootloaders/zero/binaries/README.md b/bootloaders/zero/binaries/README.md index 799d3f858..4ce8a0850 100644 --- a/bootloaders/zero/binaries/README.md +++ b/bootloaders/zero/binaries/README.md @@ -4,9 +4,6 @@ This directory contains the SAM-BA m0+ bootloaders built by the build_all_bootloaders.sh script from the 'MattairTech SAM M0+ Boards' Arduino core, which is available at https://github.com/mattairtech/ArduinoCore-samd. -Note that the link above might not correspond to these binaries. -I've released the binaries before the core. These binaries are from -core version 1.6.8-beta-b0. ## MattairTech Boards MattairTech boards are all configured with only one interface: diff --git a/variants/Generic_D11C14A/README.md b/variants/Generic_D11C14A/README.md index 7d80b01e3..db03ae0ba 100644 --- a/variants/Generic_D11C14A/README.md +++ b/variants/Generic_D11C14A/README.md @@ -98,6 +98,57 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip * SERCOM2 does not exist on the D11C14A. +# Board Configuration Notes + +TODO: Update this for Generic D11C14A + +* Either the 32.768KHz crystal or the 16MHz crystal can be used. +* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. + +* **Digital: All pins can be used for general purpose I/O** + * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + * Use the pinMode(), digitalWrite(), and digitalRead() functions. +* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** + * These are available using the analogRead() function. + * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * Each pin measures from ground to 3.3 volts. + * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. +* **DAC: One analog output is available on pin 2.** + * Provides a 10-bit voltage output with the analogWrite() function. +* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** + * Available using the analogWrite() function. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. +* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** + * Available using the attachInterrupt() function. +* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** + * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). + * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). +* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** + * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). + * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). + * SPI communication using the SPI library. + * Note that the SPI library will set SS as an output. + * On the MT-D11, the button must be configured as reset (default) when using SPI. +* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** + * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). + * MT-D11: Pin 22 (SDA) and pin 23 (SCL). + * TWI communication using the Wire library. +* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** + * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. +* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** + * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. +* **AREF: One pin can be configured as an AREF analog input.** + * The upper end of the analog measurement range can be changed using the analogReference() function. +* **Reset: Bring this line LOW to reset the microcontroller.** + + + # PinDescription table format ## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. diff --git a/variants/MT_D11/README.md b/variants/MT_D11/README.md index 8d8705b0f..3897cdc77 100644 --- a/variants/MT_D11/README.md +++ b/variants/MT_D11/README.md @@ -102,6 +102,61 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * The tone library uses TC2. +# Board Configuration Notes + +TODO: Update this + +* Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. +* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. +* The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. +* BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. +* A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. +* The I2C (TWI) pullup resistors are enabled by default. +* The LED is enabled by default. + +* **Digital: All pins can be used for general purpose I/O** + * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + * Use the pinMode(), digitalWrite(), and digitalRead() functions. +* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** + * These are available using the analogRead() function. + * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * Each pin measures from ground to 3.3 volts. + * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. +* **DAC: One analog output is available on pin 2.** + * Provides a 10-bit voltage output with the analogWrite() function. +* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** + * Available using the analogWrite() function. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. +* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** + * Available using the attachInterrupt() function. +* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** + * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). + * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). +* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** + * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). + * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). + * SPI communication using the SPI library. + * Note that the SPI library will set SS as an output. + * On the MT-D11, the button must be configured as reset (default) when using SPI. +* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** + * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). + * MT-D11: Pin 22 (SDA) and pin 23 (SCL). + * TWI communication using the Wire library. +* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** + * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. +* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** + * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. +* **AREF: One pin can be configured as an AREF analog input.** + * The upper end of the analog measurement range can be changed using the analogReference() function. +* **Reset: Bring this line LOW to reset the microcontroller.** + + # PinDescription table format diff --git a/variants/MT_D21E/README.md b/variants/MT_D21E/README.md index 0beaac421..fd8ce3360 100644 --- a/variants/MT_D21E/README.md +++ b/variants/MT_D21E/README.md @@ -84,6 +84,61 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * Leave pin A30 floating (or use external pullup) during reset. +# Board Configuration Notes + +TODO: Update this + +* Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. +* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. +* The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. +* BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. +* A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. +* The I2C (TWI) pullup resistors are enabled by default. +* The LED is enabled by default. + +* **Digital: All pins can be used for general purpose I/O** + * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + * Use the pinMode(), digitalWrite(), and digitalRead() functions. +* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** + * These are available using the analogRead() function. + * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * Each pin measures from ground to 3.3 volts. + * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. +* **DAC: One analog output is available on pin 2.** + * Provides a 10-bit voltage output with the analogWrite() function. +* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** + * Available using the analogWrite() function. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. +* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** + * Available using the attachInterrupt() function. +* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** + * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). + * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). +* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** + * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). + * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). + * SPI communication using the SPI library. + * Note that the SPI library will set SS as an output. + * On the MT-D11, the button must be configured as reset (default) when using SPI. +* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** + * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). + * MT-D11: Pin 22 (SDA) and pin 23 (SCL). + * TWI communication using the Wire library. +* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** + * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. +* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** + * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. +* **AREF: One pin can be configured as an AREF analog input.** + * The upper end of the analog measurement range can be changed using the analogReference() function. +* **Reset: Bring this line LOW to reset the microcontroller.** + + # PinDescription table format diff --git a/variants/MT_D21E_revB/README.md b/variants/MT_D21E_revB/README.md index 0ad81229d..4d2936006 100644 --- a/variants/MT_D21E_revB/README.md +++ b/variants/MT_D21E_revB/README.md @@ -96,6 +96,61 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * Leave pin A30 floating (or use external pullup) during reset. +# Board Configuration Notes + +TODO: Update this + +* Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. +* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. +* The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. +* BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. +* A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. +* The I2C (TWI) pullup resistors are enabled by default. +* The LED is enabled by default. + +* **Digital: All pins can be used for general purpose I/O** + * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + * Use the pinMode(), digitalWrite(), and digitalRead() functions. +* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** + * These are available using the analogRead() function. + * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * Each pin measures from ground to 3.3 volts. + * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. +* **DAC: One analog output is available on pin 2.** + * Provides a 10-bit voltage output with the analogWrite() function. +* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** + * Available using the analogWrite() function. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. +* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** + * Available using the attachInterrupt() function. +* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** + * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). + * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). +* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** + * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). + * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). + * SPI communication using the SPI library. + * Note that the SPI library will set SS as an output. + * On the MT-D11, the button must be configured as reset (default) when using SPI. +* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** + * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). + * MT-D11: Pin 22 (SDA) and pin 23 (SCL). + * TWI communication using the Wire library. +* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** + * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. +* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** + * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. +* **AREF: One pin can be configured as an AREF analog input.** + * The upper end of the analog measurement range can be changed using the analogReference() function. +* **Reset: Bring this line LOW to reset the microcontroller.** + + # PinDescription table format diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h index 07046a4c5..b383815a7 100644 --- a/variants/MT_D21E_revB/variant.h +++ b/variants/MT_D21E_revB/variant.h @@ -141,7 +141,7 @@ extern "C" */ #define JUMPER_A (27u) #define BUTTON_B (31u) -#define BUTTON_BUILTIN BUTTON_A +#define BUTTON_BUILTIN BUTTON_B /* From 170dc00d98fbe8d334386b4469313a9a0b0da1cc Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 24 Apr 2017 09:45:54 +0000 Subject: [PATCH 090/124] Fixed auto-reset not working with some versions of Windows, other fixups --- cores/arduino/USB/USBCore.cpp | 12 +----------- cores/arduino/USB/USBCore.h | 2 +- cores/arduino/USB/samd21_host.h | 2 ++ cores/arduino/startup.c | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index c1d95a9f0..6eb5bb10d 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -635,10 +635,6 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) uint32_t written = 0; uint32_t length = 0; - // if len is a multiple of EPX_SIZE an ZLP needs to be sent - // to indicate end of transfer - bool sendZlp = (len % EPX_SIZE) == 0; - if (!_usbConfiguration) return -1; if (len > 16384) @@ -652,7 +648,7 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) #endif // Flash area - while (len != 0 || sendZlp) + while (len != 0) { if (usbd.epBank1IsReady(ep)) { // previous transfer is still not complete @@ -697,12 +693,6 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) written += length; len -= length; - - if (len == 0 && sendZlp) { - // empty transfer sent - sendZlp = false; - } - data = (char *)data + length; } return written; diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 5f928533e..f40013e34 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -262,7 +262,7 @@ typedef struct _Pragma("pack()") #define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \ - { 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } + { 18, 1, 0x110, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } /* Table 9-8. Standard Device Descriptor * bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0, * idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */ diff --git a/cores/arduino/USB/samd21_host.h b/cores/arduino/USB/samd21_host.h index 23101d19a..18cb5ee7c 100644 --- a/cores/arduino/USB/samd21_host.h +++ b/cores/arduino/USB/samd21_host.h @@ -25,9 +25,11 @@ extern "C" { extern __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EPT_NUM]; +#ifndef USB_HOST_PINTFLAG_TRCPT_Pos #define USB_HOST_PINTFLAG_TRCPT_Pos 0 /**< \brief (USB_HOST_PINTFLAG) Transfer Complete 0/1 Interrupt Flag */ #define USB_HOST_PINTFLAG_TRCPT_Msk (0x3u << USB_HOST_PINTFLAG_TRCPT_Pos) #define USB_HOST_PINTFLAG_TRCPT(value) ((USB_HOST_PINTFLAG_TRCPT_Msk & ((value) << USB_HOST_PINTFLAG_TRCPT_Pos))) +#endif #define USB_EP_DIR_IN 0x80 // USB_SETUP_DEVICE_TO_HOST #define USB_EP_DIR_OUT 0x00 // USB_SETUP_HOST_TO_DEVICE diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index 701f50607..63e4d80e4 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -172,7 +172,7 @@ void SystemInit( void ) */ #if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL)) - #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 4000000UL and 32000000UL" + #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 400000UL and 32000000UL" #endif #if defined(PLL_FAST_STARTUP) From 0aefab982d2142c09dbcd12592aae7448feb170a Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 24 Apr 2017 09:47:28 +0000 Subject: [PATCH 091/124] Updated documentation --- README.md | 387 +++++++++++++---------------- bootloaders/zero/README.md | 80 +++--- variants/Generic_D11C14A/README.md | 104 ++++---- variants/MT_D11/README.md | 109 ++++---- variants/MT_D21E/README.md | 102 ++++---- variants/MT_D21E_revB/README.md | 110 ++++---- variants/arduino_mzero/README.md | 16 +- variants/arduino_zero/README.md | 16 +- 8 files changed, 434 insertions(+), 490 deletions(-) diff --git a/README.md b/README.md index b7e87798f..cbc11a224 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # MattairTech Arduino SAM M0+ Core -This documentation is currently under construction. - This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support for SAM M0+ boards including the MattairTech MT-D21E and the MT-D11 (see https://www.mattairtech.com/). It adds support for new devices like the L21, C21, and @@ -10,15 +8,19 @@ D11. It also adds new clock sources, like a high speed crystal or internal oscil This core is intended to be installed using Boards Manager (see below). To update from a previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update. -**Differences from Arduino in Versioning** -The MattairTech version number does not correspond to either the IDE version or to the -upstream ArduinoCore-samd version. See the CHANGELOG for details on which upstream -commits have been merged in to the MattairTech core. +**Differences from Arduino in Versioning** The MattairTech version number does not +correspond to either the IDE version or to the upstream ArduinoCore-samd version. See the +CHANGELOG for details on which upstream commits have been merged in to the MattairTech core. + +## What's New Beta (1.6.8-beta) +**See Beta Builds section for installation instructions.** -## What's New Beta (1.6.8-beta). See Beta Builds section for installation instructions. +**1.6.8-beta-b1:** +* Fixed auto-reset not working on some versions of Windows +* Documentation updates -1.6.8-beta-b0: +**1.6.8-beta-b0:** * Added L21 and C21 support. Improved D11D and D11C support. * Use Tools->Microcontroller menu to select mcu. * Both the core and bootloader have added support for: @@ -38,7 +40,8 @@ commits have been merged in to the MattairTech core. * Merged in all changes from upstream through SAMD CORE 1.6.14 (April 2017) -## What's New Release (1.6.6). NOTE: This is out of date, use the beta for now. +## What's New Release (1.6.6) +**This is out of date, use the beta for now.** * 1.6.6-mt3: * Fixes compilation with CDC_UART and CDC_ONLY settings @@ -55,28 +58,27 @@ commits have been merged in to the MattairTech core. * Merged in changes from upstream SAMD CORE 1.6.2 2015.11.03 (see CHANGELOG for details) -## Specifications - -TODO: Update for L21 and C21 +## Features Summary -Feature | MT-D21E | MT-D11 -------------------------|---------------------------------------------------------------------------------------|------------------------------------------------------ -Microcontroller | ATSAMD21ExxA, 32-Bit ARM Cortex M0+ | ATSAMD11D14AM, 32-Bit ARM Cortex M0+ -Clock Speed | 48 MHz | 48 MHz -Flash Memory | 256 KB (D21E18A) / 128 KB (D21E17A) / 64 KB (D21E16A) / 32 KB (D21E15A) | 16 KB (4KB used by USB SAM-BA bootloader) -SRAM | 32 KB (D21E18A) / 16 KB (D21E17A) / 8 KB (D21E16A) / 4 KB (D21E15A) | 4 KB -EEPROM | None (emulation may be available in the future) | None (emulation may be available in the future) -Digital Pins | 22 | 17 -Analog Input Pins | 10, 12-bit ADC channels | 10, 12-bit ADC channels -Analog Output Pins | 1, 10-bit DAC | 1, 10-bit DAC -PWM Output Pins | 12 | 8 -External Interrupts | 15 (1 NMI) | 9 (1 NMI) -USB | Device and Host (CDC and HID) | Device and Host (CDC and HID) -UART (Serial) | 2 | 1 -SPI | 1 | 1 -I2C (TWI) | 1 | 1 -Operating Voltage | 3.3V (Do not connect voltages higher than 3.3V!) | 3.3V (Do not connect voltages higher than 3.3V!) -DC Current per I/O Pin | 7 mA | 7 mA +Feature | 21J (64 pin) | 21G (48 pin) | 21E (32 pin) | D11 (24, 20, or 14 pin) +----------------|---------------------------------------|---------------------------------------|---------------------------------------|--------------------------------------- +Board Variants | New board coming June, Generic 21J | Arduino Zero, Arduino M0, Generic 21G | MT-D21E, Generic 21E | MT-D11, Generic D11D14AM, Generic D11D14AS, Generic D11C14A +Processor | 48 MHz 32-bit ARM Cortex M0+ | 48 MHz 32-bit ARM Cortex M0+ | 48 MHz 32-bit ARM Cortex M0+ | 48 MHz 32-bit ARM Cortex M0+ +Flash Memory | Up to 256KB (L21/C21 have RWW) | Up to 256KB (L21/C21 have RWW) | Up to 256KB (L21/C21 have RWW) | 16 KB (4KB used by bootloader) +SRAM | Up to 32KB (plus <=8KB LPSRAM on L21) | Up to 32KB (plus <=8KB LPSRAM on L21) | Up to 32KB (plus <=8KB LPSRAM on L21) | 4 KB +Digital Pins | 52 (51 for L21) | 38 (37 for L21) | 26 (25 for L21) | 24-pin: 21, 20-pin: 17, 14-pin: 11 +Analog Inputs | 20 channels, 12-bit | 14 channels, 12-bit | 10 channels, 12-bit | 24-pin: 10, 20-pin: 8, 14-pin: 5 (12-bit) +Analog Outputs | One 10-bit (two 12-bit on L21) | One 10-bit (two 12-bit on L21) | One 10-bit (two 12-bit on L21) | One 10-bit +PWM Outputs | 18 | 14 | 14 | 8 (6 for 14-pin) +Interrupts | 16 | 16 | 16 | 8 (7 for 14-pin) +USB | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device +SERCOM | 6 | 6 | 4 | 3 (2 for 14-pin) +UART (Serial) | Up to 3 | Up to 3 | Up to 2 | Up to 2 +SPI | Up to 3 | Up to 2 | 1 | 1 +I2C (WIRE) | Up to 3 | Up to 2 | 1 | 1 +I2S | Present on the D21 only | Present on the D21 only | Present on the D21 only | Not present +Voltage | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V +I/O Pin Current | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | 7 mA @@ -176,7 +178,6 @@ and SRAM usage by allowing CDC to be disabled (or USB completely disabled). ## Clock Source -TODO There are up to four clock source choices, depending on board variant and microcontroller. They are: * 32KHZ_CRYSTAL (default) @@ -184,163 +185,98 @@ There are up to four clock source choices, depending on board variant and microc * INTERNAL_OSCILLATOR * INTERNAL_USB_CALIBRATED_OSCILLATOR - * If CLOCKCONFIG_32768HZ_CRYSTAL or - * CLOCKCONFIG_HS_CRYSTAL is defined, then the PLL will be used. If - * CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must - * also be defined with the crystal frequency in Hertz. CLOCKCONFIG_INTERNAL - * uses the DFLL in open-loop mode, except with the C21 which lacks a DFLL, so - * the internal 48MHz RC oscillator is used instead. CLOCKCONFIG_INTERNAL_USB - * can be defined for the D21, D11, or L21. It will also use the DFLL in - * open-loop mode, except when connected to a USB port with data lines (and - * not suspended), where it will calibrate against the USB SOF signal. - -/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ - * must also be defined with the external crystal frequency in Hertz. - */ -#if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL)) -#error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 4000000UL and 32000000UL" -#endif - -#if defined(PLL_FAST_STARTUP) -#if (HS_CRYSTAL_FREQUENCY_HERTZ < 1000000UL) -#error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be at least 1000000UL when PLL_FAST_STARTUP is defined" -#else -#define HS_CRYSTAL_DIVISOR 1000000UL -#endif -#else -#define HS_CRYSTAL_DIVISOR 32000UL -#endif - -#define HS_CRYSTAL_DIVIDER (HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVISOR) -#define DPLLRATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) - -#if defined(PLL_FRACTIONAL_ENABLED) -#define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT -#define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) -#else -#define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT -#define DPLLRATIO_LDRFRAC 0 -#endif - -Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz. - -// Constants for Clock generators -#define GENERIC_CLOCK_GENERATOR_MAIN (0u) -#define GENERIC_CLOCK_GENERATOR_XOSC (1u) -#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT (D21/D11) */ -#define GENERIC_CLOCK_GENERATOR_OSC_HS (3u) - -/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL - * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in - * a more accurate 48MHz output frequency at the expense of increased jitter. - */ - -/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal - * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being - * multiplied by the PLL. This will result in a faster lock time for the PLL, - * however, it will also result in a less accurate PLL output frequency if the - * crystal is not divisible (without remainder) by 1MHz. In this case, define - * PLL_FRACTIONAL_ENABLED as well. - */ - -/* The fine calibration value for DFLL open-loop mode is defined here. - * The coarse calibration value is loaded from NVM OTP (factory calibration values). - */ -#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) - -* What to do with unused default internal RC oscillator: -#if (SAMD21) -/* Modify PRESCaler value of OSC8M to have 8MHz */ -/* Put OSC8M as source for Generic Clock Generator 3 */ -#elif (SAML21) -/* Note that after reset, the L21 starts with the OSC16M set to 4MHz, NOT the DFLL@48MHz as stated in some documentation. */ -/* Modify FSEL value of OSC16M to have 8MHz */ -/* Put OSC16M as source for Generic Clock Generator 3 */ -#endif +### External 32.768KHz Crystal +The PLL will be used with the 32.768KHz crystal. PLL_FRACTIONAL_ENABLED can be defined, +which will result in a more accurate 48MHz output frequency at the expense of increased +jitter. ### External High-Speed Crystal -TODO -### External 32.768KHz Crystal -TODO +HS_CRYSTAL_FREQUENCY_HERTZ must be defined with the external crystal frequency in Hertz. +The crystal frequency must be between 400000Hz and 32000000Hz. The PLL will be used. +PLL_FRACTIONAL_ENABLED can be defined, which will result in a more accurate 48MHz output +frequency at the expense of increased jitter. If PLL_FAST_STARTUP is defined, the crystal +will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being multiplied +by the PLL. This will result in a faster lock time for the PLL, however, it will also +result in a less accurate PLL output frequency if the crystal is not divisible (without +remainder) by 1MHz. In this case, define PLL_FRACTIONAL_ENABLED as well. By default, +PLL_FAST_STARTUP is disabled. PLL_FAST_STARTUP is also useful for USB host mode +applications. See datasheet USB electrical characteristics. The crystal frequency must +be at least 1000000Hz when PLL_FAST_STARTUP is defined. + +### Internal Oscillator + +The DFLL will be used in open-loop mode, except with the C21 which lacks a DFLL, so the +internal 48MHz RC oscillator is used instead. NVM_SW_CALIB_DFLL48M_FINE_VAL is the fine +calibration value for DFLL open-loop mode. The coarse calibration value is loaded from +NVM OTP (factory calibration values). ### Internal Oscillator with USB Calibration -TODO -### Internal Oscillator -TODO +This is available for the D21, D11, or L21. It will also use the DFLL in open-loop mode, +except when connected to a USB port with data lines (and not suspended), then it +will calibrate against the USB SOF signal. NVM_SW_CALIB_DFLL48M_FINE_VAL is the fine +calibration value for DFLL open-loop mode. The coarse calibration value is loaded from +NVM OTP (factory calibration values). +### Clock Generators +0. MAIN (mcu) +1. XOSC (high speed crystal) +2. OSCULP32K (initialized at reset for WDT on D21 and D11) +3. OSC_HS (the reset default internal RC oscillator is put here at 8MHz, except with C21) -## Analog Reference -TODO: Analog reference selection - - * For values <= 5, the actual register value is used. - * For values > 5 (SAML and SAMC only), the SUPC_VREF_SEL register value is: (ulMode - 6). - * Values for the Supply Controller (SUPC) reference on the L21 or C21. - * Used when AR_INTREF is selected as the reference. - -typedef enum _eAnalogReference -{ -#if (SAMD) - AR_INTERNAL1V0 = 0, - AR_INTERNAL_INTVCC0 = 1, - AR_INTERNAL_INTVCC1 = 2, - AR_EXTERNAL_REFA = 3, - AR_EXTERNAL_REFB = 4, - AR_DEFAULT = 5, // On the SAMD, this also uses 1/2 gain on each input -#elif (SAML21) - AR_INTREF = 0, - AR_INTERNAL_INTVCC0 = 1, - AR_INTERNAL_INTVCC1 = 2, - AR_EXTERNAL_REFA = 3, - AR_EXTERNAL_REFB = 4, - AR_INTERNAL_INTVCC2 = 5, - AR_INTREF_1V0 = 6, - AR_INTREF_1V1 = 7, - AR_INTREF_1V2 = 8, - AR_INTREF_1V25 = 9, - AR_INTREF_2V0 = 10, - AR_INTREF_2V2 = 11, - AR_INTREF_2V4 = 12, - AR_INTREF_2V5 = 13, - AR_DEFAULT = AR_INTERNAL_INTVCC2, - AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAML is 1.0V -#elif (SAMC21) - AR_INTREF = 0, - AR_INTERNAL_INTVCC0 = 1, - AR_INTERNAL_INTVCC1 = 2, - AR_EXTERNAL_REFA = 3, - AR_EXTERNAL_DAC = 4, - AR_INTERNAL_INTVCC2 = 5, - AR_INTREF_1V024 = 6, - AR_INTREF_2V048 = 7, - AR_INTREF_4V096 = 8, - AR_DEFAULT = AR_INTERNAL_INTVCC2, - AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAMC is 1.024V -#else - #error "wiring_analog.c: Unsupported chip" -#endif - AR_INTERNAL = AR_INTERNAL_INTVCC0, - AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0, // 2.23V only when Vcc = 3.3V - AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1, // 1.65V only when Vcc = 3.3V - AR_EXTERNAL = AR_EXTERNAL_REFA, -} eAnalogReference ; - - - -## Random TODO Notes -* TONE: TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14 as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. -* D21: Enables wakeup capability on pin in case being used during sleep (WAKEUP always enabled on SAML and SAMC) -* All pins (digital and analog) setup in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) -* INEN enabled for both input and output (but not analog) -* pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would - interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. -* Pull resistors enabled only if pin attributes allow and only if pin is not configured as output. -* Pull direction (pullup or pulldown) is now set with pinMode only (defaults to pullup if pinMode never called). +## Analog Reference + +TODO: more info + +* D21 / D11 + * AR_INTERNAL1V0 + * AR_INTERNAL_INTVCC0 + * AR_INTERNAL_INTVCC1 + * AR_EXTERNAL_REFA + * AR_EXTERNAL_REFB + * AR_DEFAULT (this also uses 1/2 gain on each input) + +* L21 + * AR_INTREF + * AR_INTERNAL_INTVCC0 + * AR_INTERNAL_INTVCC1 + * AR_EXTERNAL_REFA + * AR_EXTERNAL_REFB + * AR_INTERNAL_INTVCC2 + * AR_INTREF_1V0 + * AR_INTREF_1V1 + * AR_INTREF_1V2 + * AR_INTREF_1V25 + * AR_INTREF_2V0 + * AR_INTREF_2V2 + * AR_INTREF_2V4 + * AR_INTREF_2V5 + * AR_DEFAULT = AR_INTERNAL_INTVCC2 + * AR_INTERNAL1V0 = AR_INTREF (Default INTREF for SAML is 1.0V) + +* C21 + * AR_INTREF + * AR_INTERNAL_INTVCC0 + * AR_INTERNAL_INTVCC1 + * AR_EXTERNAL_REFA + * AR_EXTERNAL_DAC + * AR_INTERNAL_INTVCC2 + * AR_INTREF_1V024 + * AR_INTREF_2V048 + * AR_INTREF_4V096 + * AR_DEFAULT = AR_INTERNAL_INTVCC2 + * AR_INTERNAL1V0 = AR_INTREF (Default INTREF for SAMC is 1.024V) + +* Common + * AR_INTERNAL = AR_INTERNAL_INTVCC0 + * AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0 (2.23V only when Vcc = 3.3V) + * AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1 (1.65V only when Vcc = 3.3V) + * AR_EXTERNAL = AR_EXTERNAL_REFA @@ -358,7 +294,7 @@ typedef enum _eAnalogReference * There are two DACs, DAC0 and DAC1. Both are supported. Because changing the configuration of one DAC requires disabling both, there will be about a 40us period when the second DAC is disabled. Most of this time is due to an errata that requires a delay of at least 30us when turning off the DAC while refresh is on. The L21 DACs have a refresh setting which must be enabled in this core. -* The analog reference has additional options on the L21 and C21. See Analog Reference below. +* The analog reference has additional options on the L21 and C21. See Analog Reference section. * On the L21, SERCOM5 is in a low power domain. The Fm+ and HS modes of I2C (wire) are not supported. * The SAML and SAMC have double-buffered TCs, which are supported in the core. * The CHANGE and RISING interrupt modes on pin A31 do not seem to work properly on the L21. @@ -370,7 +306,7 @@ typedef enum _eAnalogReference ### SAMC21 * There are two SAR ADCs. Both are supported. The PinDescription table determines the peripheral instance and pin mapping. -* The analog reference has additional options on the L21 and C21. See Analog Reference below. +* The analog reference has additional options on the L21 and C21. See Analog Reference section. * The SAML and SAMC have double-buffered TCs, which are supported in the core. * Two Flash Wait States are inserted for the L21 and C21 (the D21/D11 use one wait state). * The C21 requires internal pull resistors to be activated on floating pins to minimize power consumption (not needed on D21/D11 or L21). @@ -385,7 +321,7 @@ typedef enum _eAnalogReference Note that it is not necessary to enable pull resistors on any other pins that are floating. Errata: Disable pull resistors on PA24 and PA25 manually before switching to a peripheral. -#### Reducing SRAM/FLASH Usage +#### Reducing SRAM/FLASH Usage on the D11 TODO @@ -397,6 +333,17 @@ TODO * Changes due to adding/changing features vs porting to new chip +## Random Notes (TODO) + +* TONE: TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14 as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. +* D21: Enables wakeup capability on pin in case being used during sleep (WAKEUP always enabled on SAML and SAMC) +* All pins (digital and analog) setup in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) +* INEN enabled for both input and output (but not analog) +* pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would +interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. +* Pull resistors enabled only if pin attributes allow and only if pin is not configured as output. +* Pull direction (pullup or pulldown) is now set with pinMode only (defaults to pullup if pinMode never called). + ## Serial Monitor @@ -524,9 +471,11 @@ OS X support currently in beta (see below), the following instructions are only 9. Select the MCU with the now visible Tools->Microcontroller menu (if present). 10. If you do not already have the bootloader or blink sketch installed, see SAM-BA USB CDC Bootloader below. 11. Plug in the board. The blink sketch should be running. -12. Click Tools->Port and choose the COM port. Note that the board indicated may not match the chosen board. +12. Click Tools->Port and choose the COM port. Note that the board indicated may not match the chosen board* 13. You can now upload your own sketch. +*Currently, with MattairTech boards, USB PIDs are shared across boards (but they are different based on Tools->USB Config).* +*This will result in Tools->Port showing "MattairTech MT-D21E (rev B)" for all MattairTech boards.* ### Uploading the First Sketch @@ -538,6 +487,25 @@ OS X support currently in beta (see below), the following instructions are only 6. Once the bootloader exits, the blink sketch should be running. +## Beta Builds + +Periodically, a beta is released for testing. + +The beta builds are available through Boards Manager. If you want to install them: + 1. Open the **Preferences** of the Arduino IDE. + 2. Add this URL `https://www.mattairtech.com/software/arduino/beta/package_MattairTech_index.json` in the **Additional Boards Manager URLs** field, and click OK. + 3. Open the **Boards Manager** (menu Tools->Board->Board Manager...) + 4. Install **MattairTech SAM M0+ Boards - Beta build** + 5. Select one of the boards under **MattairTech SAM M0+ Beta Build XX** in Tools->Board menu + 6. Compile/Upload as usual + +The Arduino IDE will notify the user if an update to the beta is available, which can then be installed automatically. +Alternatively, if a particular beta is needed, replace the url in step 2 with: + `https://www.mattairtech.com/software/arduino/beta/package_MattairTech_sam_m0p-${VERSION}-beta-b${BUILD_NUMBER}_index.json` +where ${VERSION} and ${BUILD_NUMBER} match the beta name as shown in the CHANGELOG (ie: package_MattairTech_sam_m0p-1.6.7-beta-b0_index.json). +In this case, the IDE will not notify the user of updates. + + ## SAM-BA USB CDC Bootloader (Arduino compatible) The SAM-BA bootloader has both a CDC USB interface, and a UART interface. It is compatible with the Arduino IDE, or @@ -713,9 +681,9 @@ for pins that are used for other purposes or for pins that do not exist (especia D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp from the MT-D11 variant. -### See Board Variants above for more technical information on the PinDescription table. +**See Board Variants above for more technical information on the PinDescription table.** -### See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** @@ -724,6 +692,7 @@ from the MT-D11 variant. * Timer library is currently under development (like TimerOne, plus input capture, plus ??) * OS X support currently in beta testing * Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) +* Drivers for MT-D21E optional memory devices (SRAM, FLASH, EEPROM) * USB Host mode CDC ACM (partially complete; BSD-like license?) * Features for lower power consumption (library?) @@ -756,30 +725,33 @@ The Changelog has moved to a separate file named CHANGELOG. The most recent chan ## Troubleshooting -TODO: Update +* **Tools->Port shows wrong board** + * Currently, with MattairTech boards, USB PIDs are shared across boards (but they are different based on Tools->USB Config). + This will result in Tools->Port showing "MattairTech MT-D21E (rev B)" for all MattairTech boards. -* **On Linux, disable modem manager** +* **Tools->USB Config menu** + * Currently, the Tools->USB Config menu (was Tools->Communications) must be used to select the communications configuration. + This configuration must match the included libraries. For example, when including the HID and Keyboard libraries, you must + select an option that includes HID (all options except CDC_ONLY or USB_DISABLED). This menu is currently needed to select + the USB PID that matches the USB device configuration (needed for some versions of Windows). It is also used to control + if CDC support is compiled (CDC is always enabled in the stock Arduino core). Auto reset requires CDC to be enabled. -* **Do not perform a manual auto-reset (using a terminal program to change baud to 1200)** + * Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. + * Different combinations of USB devices will result in different COM port assingments in Windows. -* **Boards Manager must be opened twice to see some updates** +* **Incude platform specific libraries** + * You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. * **Errors when compiling, uploading, or burning the bootloader** -* Be sure to install the Arduino samd core before installing the MattairTech sam m0+ core. If you have problems upgrading -the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. -Use Arduino core 1.6.2 or above. + * Be sure to install the Arduino samd core before installing the MattairTech sam m0+ core. If you have problems upgrading + the IDE to 1.6.6, you may need to uninstall both the Arduino and MattairTech cores, then re-install in the proper order. + Use Arduino core 1.6.2 or above. -* **Tools->Communications menu** -* Currently, the Tools->Communications menu must be used to select the communications configuration. This configuration -must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an -option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the -USB device configuration (needed for Windows). This may become automatic in a future release. +* **On Linux, disable modem manager (Ubuntu)** -* Be sure that the Tools->Communications menu matches the sketch and libraries you are compiling. -* Different combinations of USB devices will result in different COM port assingments in Windows. +* Do not perform a manual auto-reset (using a terminal program to change baud to 1200) -* **Incude platform specific libraries** -* You may need to manually include platform specific libraries such as SPI.h, Wire.h, and HID.h. +* Boards Manager must be opened twice to see some updates (only applies to some old IDE versions) ## Bugs or Issues @@ -796,25 +768,6 @@ Before posting a new issue, please check if the same problem has been already re Contributions are always welcome. The preferred way to receive code cotribution is by submitting a Pull Request on github. -## Beta Builds - -Periodically, a beta is released for testing. - -The beta builds are available through Boards Manager. If you want to install them: - 1. Open the **Preferences** of the Arduino IDE. - 2. Add this URL `https://www.mattairtech.com/software/arduino/beta/package_MattairTech_index.json` in the **Additional Boards Manager URLs** field, and click OK. - 3. Open the **Boards Manager** (menu Tools->Board->Board Manager...) - 4. Install **MattairTech SAM M0+ Boards - Beta build** - 5. Select one of the boards under **MattairTech SAM M0+ Beta Build XX** in Tools->Board menu - 6. Compile/Upload as usual - -The Arduino IDE will notify the user if an update to the beta is available, which can then be installed automatically. -Alternatively, if a particular beta is needed, replace the url in step 2 with: - `https://www.mattairtech.com/software/arduino/beta/package_MattairTech_sam_m0p-${VERSION}-beta-b${BUILD_NUMBER}_index.json` -where ${VERSION} and ${BUILD_NUMBER} match the beta name as shown in the CHANGELOG (ie: package_MattairTech_sam_m0p-1.6.7-beta-b0_index.json). -In this case, the IDE will not notify the user of updates. - - ## License and Credits This core has been developed by Arduino LLC in collaboration with Atmel. diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index 9e3357368..c4f57a7ef 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -1,6 +1,6 @@ # Arduino Zero Bootloader -## 1- Prerequisites +## Prerequisites for Building The project build is based on Makefile system. Makefile is present at project root and try to handle multi-platform cases. @@ -40,30 +40,30 @@ Make is usually available by default. Make is available through XCode package. -## 2- Makefile Configuration +## Makefile Configuration The section between 'Begin Configuration' and 'End Configuration' in the Makefile should be edited. Set BOARD_ID and MCU to a chip listed in the comments. -# Boards definitions: -# MT_D21E_rev_A, MT_D21E_rev_B, MT_D11, MT_D21J -# arduino_zero, arduino_mkrzero, arduino_mkr1000, genuino_mkr1000, genuino_zero -# Generic_x21E, Generic_x21G, Generic_x21J, Generic_D11D14AM, Generic_D11D14AS, Generic_D11C14A +### Boards definitions: +* MT_D21E_rev_A, MT_D21E_rev_B, MT_D11, MT_D21J +* arduino_zero, arduino_mkrzero, arduino_mkr1000, genuino_mkr1000, genuino_zero +* Generic_x21E, Generic_x21G, Generic_x21J, Generic_D11D14AM, Generic_D11D14AS, Generic_D11C14A -# MCU definitions: -# SAMD21J: SAMD21J18A, SAMD21J17A, SAMD21J16A, SAMD21J15A -# SAMD21G: SAMD21G18A, SAMD21G17A, SAMD21G16A, SAMD21G15A -# SAMD21E: SAMD21E18A, SAMD21E17A, SAMD21E16A, SAMD21E15A -# SAML21J: SAML21J18B, SAML21J17B, SAML21J16B -# SAML21G: SAML21G18B, SAML21G17B, SAML21G16B -# SAML21E: SAML21E18B, SAML21E17B, SAML21E16B, SAML21E15B -# SAMC21J: SAMC21J18A, SAMC21J17A, SAMC21J16A, SAMC21J15A -# SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A -# SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A -# SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS +### MCU definitions: +* SAMD21J: SAMD21J18A, SAMD21J17A, SAMD21J16A, SAMD21J15A +* SAMD21G: SAMD21G18A, SAMD21G17A, SAMD21G16A, SAMD21G15A +* SAMD21E: SAMD21E18A, SAMD21E17A, SAMD21E16A, SAMD21E15A +* SAML21J: SAML21J18B, SAML21J17B, SAML21J16B +* SAML21G: SAML21G18B, SAML21G17B, SAML21G16B +* SAML21E: SAML21E18B, SAML21E17B, SAML21E16B, SAML21E15B +* SAMC21J: SAMC21J18A, SAMC21J17A, SAMC21J16A, SAMC21J15A +* SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A +* SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A +* SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS -## 3- Behaviour / Board Configuration +## Board Configuration Configuration for each board is available in the board_definitions directory. Each board has a file named board_definitions_BOARD_NAME.h, where BOARD_NAME is @@ -181,7 +181,7 @@ so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin. -## Boot condition test sequence +## Boot Condition Test Sequence First, the start location of the sketch is fetched and checked. If it is empty (0xFFFFFFFF), then bootloader execution is resumed. Note that when Arduino auto-reset (into bootloader) is initiated, the first flash @@ -198,7 +198,27 @@ should not be defined. USB_VENDOR_STRINGS_ENABLED also should not be defined in most cases, as well as BOOT_LOAD_PIN. -## 4- Details +## Building + +If not specified the makefile builds for **MT_D21E_rev_B**: + +``` +make +``` + +if you want to make a custom bootloader for a derivative board you must supply all the +necessary information in a `board_definitions_xxx.h` file, and add the corresponding case in +`board_definitions.h`. For example for the **Generic_x21J** board with a **SAMD21J18A** MCU, +we use `board_definitions_Generic_x21J.h` and it is build with the following command: + +``` +BOARD_ID=Generic_x21J MCU=SAMD21J18A make clean all +``` + +which will produce a binary named sam_ba_Generic_x21J_SAMD21J18A.bin + + +## Technical Details **Pinmap** @@ -228,23 +248,3 @@ of the system stack. The applet in this case is a very simple word copy function 1KB is reserved for the applet, and there are two 64 byte data buffers placed after it. The applet has its own stack at the top of RAM, but the word copy applet uses little/none of this. The bossac tool is responsible for loading the applet. See Devices.h from the Bossa source. - - -## 5- How to build - -If not specified the makefile builds for **MT_D21E_rev_B**: - -``` -make -``` - -if you want to make a custom bootloader for a derivative board you must supply all the -necessary information in a `board_definitions_xxx.h` file, and add the corresponding case in -`board_definitions.h`. For example for the **Generic_x21J** board with a **SAMD21J18A** MCU, -we use `board_definitions_Generic_x21J.h` and it is build with the following command: - -``` -BOARD_ID=Generic_x21J MCU=SAMD21J18A make clean all -``` - -which will produce a binary named sam_ba_Generic_x21J_SAMD21J18A.bin diff --git a/variants/Generic_D11C14A/README.md b/variants/Generic_D11C14A/README.md index db03ae0ba..1c099a321 100644 --- a/variants/Generic_D11C14A/README.md +++ b/variants/Generic_D11C14A/README.md @@ -28,8 +28,10 @@ SWDCLK TX1/MISO* 30 | A30 A31 | 31 * RX1/SS ``` -# Pins descriptions for Generic ATsamD11C14A -## PIN_MAP_STANDARD +## Pins descriptions for Generic ATsamD11C14A + +### PIN_MAP_STANDARD +``` ==================================================================================================================================== Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) --------|-------|-----------------------|------------------------------------------------------------------------------------------- @@ -66,8 +68,11 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip 30 | PA30 | MISO / SWD CLK | !EIC/EXTINT[2] SERCOM1/PAD[0] !SERCOM1/PAD[2] !TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot 31 | PA31 | SS / SWD IO | EIC/EXTINT[3] SERCOM1/PAD[1] !SERCOM1/PAD[3] !TC2/WO[1] !TCC0/WO[3] SWD IO ==================================================================================================================================== +``` + -## PIN_MAP_COMPACT +### PIN_MAP_COMPACT +``` ==================================================================================================================================== Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) --------|-------|-----------------------|------------------------------------------------------------------------------------------- @@ -96,68 +101,57 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip * When using ONE_UART_NO_WIRE_ONE_SPI, Serial1 refers to TX2/RX2 instead of TX1/RX1. * Leave pin A30 floating (or use external pullup) during reset. * SERCOM2 does not exist on the D11C14A. +``` -# Board Configuration Notes - -TODO: Update this for Generic D11C14A +## Board Configuration Notes -* Either the 32.768KHz crystal or the 16MHz crystal can be used. -* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. +* **Crystals** + * Either a 32.768KHz crystal or a high speed crystal can be used. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. -* **Digital: All pins can be used for general purpose I/O** - * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. - * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin, enabled by default). * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). - * Use the pinMode(), digitalWrite(), and digitalRead() functions. -* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** - * These are available using the analogRead() function. - * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + +* **Analog Inputs** + * 5 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. * Each pin provides 10 bits of resolution (1024 values) by default. * 12-bit resolution supported by using the analogReadResolution() function. - * Each pin measures from ground to 3.3 volts. - * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. -* **DAC: One analog output is available on pin 2.** + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REF. + +* **DAC** + * One analog output is available on pin 2. * Provides a 10-bit voltage output with the analogWrite() function. -* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** - * Available using the analogWrite() function. + +* **PWM** + * 6 pins can be configured as PWM outputs. * Each pin provides 8 bits of resolution (256 values) by default. * 12-bit resolution supported by using the analogWriteResolution() function. -* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** - * Available using the attachInterrupt() function. -* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** - * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). - * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). -* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** - * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). - * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). - * SPI communication using the SPI library. - * Note that the SPI library will set SS as an output. - * On the MT-D11, the button must be configured as reset (default) when using SPI. -* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** - * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). - * MT-D11: Pin 22 (SDA) and pin 23 (SCL). - * TWI communication using the Wire library. -* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** - * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** - * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. - * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. -* **AREF: One pin can be configured as an AREF analog input.** - * The upper end of the analog measurement range can be changed using the analogReference() function. -* **Reset: Bring this line LOW to reset the microcontroller.** - - - -# PinDescription table format - -## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. + +* **External Interrupts** + * 7 pins can be configured with external interrupts. + +* **SERCOM** + * 2 SERCOM are available. + * Up to 2 UART instances + * 1 SPI instance + * 1 WIRE (I2C) instance + + + +## PinDescription table format + +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the table the old way, losing any new features introduced by the new column. Additionally, new definitions have been added for L21 and C21 support. -## Each pin can have multiple functions. +### Each pin can have multiple functions. The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures which functions can @@ -168,7 +162,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for that function. Most of the contents of pinMode() are now in pinPeripheral(). -## Pin Mapping +### Pin Mapping There are different ways that pins can be mapped. Typically, there is no relation between the arduino pin number used, and the actual port pin designator. Thus, the pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, @@ -184,15 +178,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be used, leaving the other pin for some number above 31. -## See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** -### Port: +### Port This is the port (ie: PORTA). -### Pin: +### Pin This is the pin (bit) within the port. Valid values are 0-31. -### PinType: +### PinType This indicates what peripheral function the pin can be attached to. In most cases, this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. It can also be set to a specific peripheral. In this case, any attempt to diff --git a/variants/MT_D11/README.md b/variants/MT_D11/README.md index 3897cdc77..72b088338 100644 --- a/variants/MT_D11/README.md +++ b/variants/MT_D11/README.md @@ -28,8 +28,10 @@ BTN SS * * | A15 RST | ``` -# Pins descriptions for the MattairTech MT-D11 -## PIN_MAP_STANDARD +## Pins descriptions for the MattairTech MT-D11 + +### PIN_MAP_STANDARD +``` ============================================================================================================================================ Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) --------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- @@ -66,8 +68,10 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 30 | A30 | PA30 | TX1 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot 31 | A31 | PA31 | RX1 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO ============================================================================================================================================ +``` -## PIN_MAP_COMPACT +### PIN_MAP_COMPACT +``` ============================================================================================================================================ Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) --------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- @@ -100,73 +104,68 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * Leave pin A30 floating (or use external pullup) during reset. * Pins 8 and 9 are by default connected to the 32.768KHz crystal. * The tone library uses TC2. +``` + +## Board Configuration Notes -# Board Configuration Notes +* **Crystals** + * Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. -TODO: Update this +* **LED (LED_BUILTIN)** + * Bring the pin HIGH to turn the LED on. + * The LED is enabled (solder jumper) by default. -* Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. -* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. -* The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. -* BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. -* A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. -* The I2C (TWI) pullup resistors are enabled by default. -* The LED is enabled by default. +* **Button (BUTTON_BUILTIN)** + * Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. + * The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. + * BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. -* **Digital: All pins can be used for general purpose I/O** - * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. - * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin, enabled by default). * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). - * Use the pinMode(), digitalWrite(), and digitalRead() functions. -* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** - * These are available using the analogRead() function. - * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + +* **Analog Inputs** + * 10 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. * Each pin provides 10 bits of resolution (1024 values) by default. * 12-bit resolution supported by using the analogReadResolution() function. - * Each pin measures from ground to 3.3 volts. - * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. -* **DAC: One analog output is available on pin 2.** + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REF. In this case, the capacitor should be enabled via the solder jumper. + +* **DAC** + * One analog output is available on pin 2. * Provides a 10-bit voltage output with the analogWrite() function. -* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** - * Available using the analogWrite() function. + +* **PWM** + * 8 pins can be configured as PWM outputs. * Each pin provides 8 bits of resolution (256 values) by default. * 12-bit resolution supported by using the analogWriteResolution() function. -* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** - * Available using the attachInterrupt() function. -* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** - * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). - * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). -* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** - * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). - * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). - * SPI communication using the SPI library. - * Note that the SPI library will set SS as an output. - * On the MT-D11, the button must be configured as reset (default) when using SPI. -* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** - * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). - * MT-D11: Pin 22 (SDA) and pin 23 (SCL). - * TWI communication using the Wire library. -* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** - * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** - * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. - * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. -* **AREF: One pin can be configured as an AREF analog input.** - * The upper end of the analog measurement range can be changed using the analogReference() function. -* **Reset: Bring this line LOW to reset the microcontroller.** + +* **External Interrupts** + * 8 pins can be configured with external interrupts. + +* **SERCOM** + * 3 SERCOM are available. + * Up to 2 UART instances + * 1 SPI instance + * 1 WIRE (I2C) instance + * The WIRE pullup resistors are enabled by default. -# PinDescription table format +## PinDescription table format -## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the table the old way, losing any new features introduced by the new column. Additionally, new definitions have been added for L21 and C21 support. -## Each pin can have multiple functions. +### Each pin can have multiple functions. The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures which functions can @@ -177,7 +176,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for that function. Most of the contents of pinMode() are now in pinPeripheral(). -## Pin Mapping +### Pin Mapping There are different ways that pins can be mapped. Typically, there is no relation between the arduino pin number used, and the actual port pin designator. Thus, the pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, @@ -193,15 +192,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be used, leaving the other pin for some number above 31. -## See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** -### Port: +### Port This is the port (ie: PORTA). -### Pin: +### Pin This is the pin (bit) within the port. Valid values are 0-31. -### PinType: +### PinType This indicates what peripheral function the pin can be attached to. In most cases, this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. It can also be set to a specific peripheral. In this case, any attempt to diff --git a/variants/MT_D21E/README.md b/variants/MT_D21E/README.md index fd8ce3360..d4826bba9 100644 --- a/variants/MT_D21E/README.md +++ b/variants/MT_D21E/README.md @@ -35,7 +35,8 @@ USB D+ TC51 | A25+ | | Vin | * Tone available on TC5. DO NOT connect voltages higher than 3.3V! ``` -# Pins descriptions for the MattairTech MT-D21E +## Pins descriptions for the MattairTech MT-D21E +``` ============================================================================================================================================ Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) --------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- @@ -82,73 +83,68 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * TC5(D21) is available on these pins otherwise. The tone library uses TC5. * A0 and A1 are by default connected to the 32.768KHz crystal. * Leave pin A30 floating (or use external pullup) during reset. +``` -# Board Configuration Notes +## Board Configuration Notes -TODO: Update this +* **Crystals** + * Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. -* Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. -* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. -* The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. -* BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. -* A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. -* The I2C (TWI) pullup resistors are enabled by default. -* The LED is enabled by default. +* **LED (LED_BUILTIN)** + * Bring the pin HIGH to turn the LED on. + * The LED is enabled (solder jumper) by default. -* **Digital: All pins can be used for general purpose I/O** - * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. - * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). +* **Buttons (BUTTON_BUILTIN)** + * Button A (BTNA) is connected to pin 27 by default (BUTTON_BUILTIN). + * Button B (BTNB) is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. + * Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. + +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin, enabled by default). * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). - * Use the pinMode(), digitalWrite(), and digitalRead() functions. -* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** - * These are available using the analogRead() function. - * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + +* **Analog Inputs** + * 10 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. * Each pin provides 10 bits of resolution (1024 values) by default. * 12-bit resolution supported by using the analogReadResolution() function. - * Each pin measures from ground to 3.3 volts. - * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. -* **DAC: One analog output is available on pin 2.** + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. + +* **DAC** + * One analog output is available on pin 2. * Provides a 10-bit voltage output with the analogWrite() function. -* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** - * Available using the analogWrite() function. + +* **PWM** + * 12 pins can be configured as PWM outputs. * Each pin provides 8 bits of resolution (256 values) by default. * 12-bit resolution supported by using the analogWriteResolution() function. -* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** - * Available using the attachInterrupt() function. -* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** - * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). - * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). -* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** - * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). - * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). - * SPI communication using the SPI library. - * Note that the SPI library will set SS as an output. - * On the MT-D11, the button must be configured as reset (default) when using SPI. -* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** - * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). - * MT-D11: Pin 22 (SDA) and pin 23 (SCL). - * TWI communication using the Wire library. -* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** - * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** - * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. - * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. -* **AREF: One pin can be configured as an AREF analog input.** - * The upper end of the analog measurement range can be changed using the analogReference() function. -* **Reset: Bring this line LOW to reset the microcontroller.** + +* **External Interrupts** + * 14 pins can be configured with external interrupts. + +* **SERCOM** + * 4 SERCOM are available. + * Up to 2 UART instances + * 1 SPI instance + * 1 WIRE (I2C) instance + * The WIRE pullup resistors are enabled by default. -# PinDescription table format +## PinDescription table format -## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the table the old way, losing any new features introduced by the new column. Additionally, new definitions have been added for L21 and C21 support. -## Each pin can have multiple functions. +### Each pin can have multiple functions. The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures which functions can @@ -159,7 +155,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for that function. Most of the contents of pinMode() are now in pinPeripheral(). -## Pin Mapping +### Pin Mapping There are different ways that pins can be mapped. Typically, there is no relation between the arduino pin number used, and the actual port pin designator. Thus, the pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, @@ -175,15 +171,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be used, leaving the other pin for some number above 31. -## See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** -### Port: +### Port This is the port (ie: PORTA). -### Pin: +### Pin This is the pin (bit) within the port. Valid values are 0-31. -### PinType: +### PinType This indicates what peripheral function the pin can be attached to. In most cases, this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. It can also be set to a specific peripheral. In this case, any attempt to diff --git a/variants/MT_D21E_revB/README.md b/variants/MT_D21E_revB/README.md index 4d2936006..5f28f2e48 100644 --- a/variants/MT_D21E_revB/README.md +++ b/variants/MT_D21E_revB/README.md @@ -47,7 +47,8 @@ Silkscreen Legend: ``` -# Pins descriptions for the MattairTech MT-D21E (rev B) +## Pins descriptions for the MattairTech MT-D21E (rev B) +``` ============================================================================================================================================ Arduino | Silk | Port | Alternate Function | Comments (! means not used with this peripheral assignment) --------|-------|-------|-----------------------|------------------------------------------------------------------------------------------- @@ -94,73 +95,74 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * TC5(D21) is available on these pins otherwise. The tone library uses TC5. * A0 and A1 are by default connected to the 32.768KHz crystal. * Leave pin A30 floating (or use external pullup) during reset. +``` + +## Board Configuration Notes -# Board Configuration Notes +* **Crystals** + * Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. -TODO: Update this +* **LED (LED_BUILTIN)** + * Bring the pin HIGH to turn the LED on. + * The LED is enabled (solder jumper) by default. -* Either the 32.768KHz crystal or the 16MHz crystal can be used. Be sure to set the correct solder jumpers. -* The bootloader does not use an external crystal by default. Double-tap the reset button to enter. -* The button is connected to the Reset pin by default, but can be connected to pin 15 via the solder jumper. -* BTN pin is shared with SPI SS, so the button must be configured as reset (default) when using SPI. -* A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. -* The I2C (TWI) pullup resistors are enabled by default. -* The LED is enabled by default. +* **Button (BUTTON_BUILTIN)** + * Button (B) is connected to the Reset pin by default, but can be connected to pin 31 via the solder jumper. + * Pressing the button will bring the pin LOW. The pullup must be enabled first. + * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. + +* **Jumper** + * Jumper (A) is connected (solder jumper) to pin 27 by default. + * Since this pin is shared with the optional memory device CD pin, **leave the jumper off** when a memory device is installed. -* **Digital: All pins can be used for general purpose I/O** - * Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. - * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin). +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * When PER_ATTR_DRIVE_STRONG is set for the pin (enabled by default), each pin can source or sink a maximum of: + * **D21:** 7mA high, 10mA low + * **L21:** 5mA high, 6mA low (8 high drive pins: 10mA high, 12mA low) + * **C21:** 6mA high, 10mA low (2 high drive pins (A10, A11): 12mA high, 20mA low) * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). - * Use the pinMode(), digitalWrite(), and digitalRead() functions. -* **Analog Inputs: 10 pins can be configured as ADC analog inputs.** - * These are available using the analogRead() function. - * All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial). + +* **Analog Inputs** + * 10 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. * Each pin provides 10 bits of resolution (1024 values) by default. * 12-bit resolution supported by using the analogReadResolution() function. - * Each pin measures from ground to 3.3 volts. - * The upper end of the measurement range can be changed using the AREF pin and the analogReference() function. -* **DAC: One analog output is available on pin 2.** - * Provides a 10-bit voltage output with the analogWrite() function. -* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.** - * Available using the analogWrite() function. + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REFA or REFB. In these cases, the capacitors should be enabled via the solder jumpers. + +* **DAC** + * D21/C21: One 10-bit 350Ksps analog output is available on pin 2. + * L21: Two 12-bit 1Msps analog outputs are available on pins 2 and 5. + +* **PWM** + * 12 pins can be configured as PWM outputs. * Each pin provides 8 bits of resolution (256 values) by default. * 12-bit resolution supported by using the analogWriteResolution() function. -* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.** - * Available using the attachInterrupt() function. -* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.** - * MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX). - * MT-D11: Serial1: pin 31 (RX) and pin 30 (TX). -* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).** - * MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used). - * MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used). - * SPI communication using the SPI library. - * Note that the SPI library will set SS as an output. - * On the MT-D11, the button must be configured as reset (default) when using SPI. -* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).** - * MT-D21E: Pin 16 (SDA) and pin 17 (SCL). - * MT-D11: Pin 22 (SDA) and pin 23 (SCL). - * TWI communication using the Wire library. -* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).** - * Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin. -* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).** - * Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first. - * If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup. -* **AREF: One pin can be configured as an AREF analog input.** - * The upper end of the analog measurement range can be changed using the analogReference() function. -* **Reset: Bring this line LOW to reset the microcontroller.** + +* **External Interrupts** + * 14 pins can be configured with external interrupts. + +* **SERCOM** + * 4 SERCOM are available. + * Up to 2 UART instances + * 1 SPI instance + * 1 WIRE (I2C) instance + * The WIRE pullup resistors are enabled by default. -# PinDescription table format +## PinDescription table format -## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the table the old way, losing any new features introduced by the new column. Additionally, new definitions have been added for L21 and C21 support. -## Each pin can have multiple functions. +### Each pin can have multiple functions. The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures which functions can @@ -171,7 +173,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for that function. Most of the contents of pinMode() are now in pinPeripheral(). -## Pin Mapping +### Pin Mapping There are different ways that pins can be mapped. Typically, there is no relation between the arduino pin number used, and the actual port pin designator. Thus, the pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, @@ -187,15 +189,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be used, leaving the other pin for some number above 31. -## See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** -### Port: +### Port This is the port (ie: PORTA). -### Pin: +### Pin This is the pin (bit) within the port. Valid values are 0-31. -### PinType: +### PinType This indicates what peripheral function the pin can be attached to. In most cases, this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. It can also be set to a specific peripheral. In this case, any attempt to diff --git a/variants/arduino_mzero/README.md b/variants/arduino_mzero/README.md index fc38b0fee..bc49b6d41 100644 --- a/variants/arduino_mzero/README.md +++ b/variants/arduino_mzero/README.md @@ -86,15 +86,15 @@ -# PinDescription table format +## PinDescription table format -## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the table the old way, losing any new features introduced by the new column. Additionally, new definitions have been added for L21 and C21 support. -## Each pin can have multiple functions. +### Each pin can have multiple functions. The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures which functions can @@ -105,7 +105,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for that function. Most of the contents of pinMode() are now in pinPeripheral(). -## Pin Mapping +### Pin Mapping There are different ways that pins can be mapped. Typically, there is no relation between the arduino pin number used, and the actual port pin designator. Thus, the pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, @@ -121,15 +121,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be used, leaving the other pin for some number above 31. -## See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** -### Port: +### Port This is the port (ie: PORTA). -### Pin: +### Pin This is the pin (bit) within the port. Valid values are 0-31. -### PinType: +### PinType This indicates what peripheral function the pin can be attached to. In most cases, this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. It can also be set to a specific peripheral. In this case, any attempt to diff --git a/variants/arduino_zero/README.md b/variants/arduino_zero/README.md index 6e652727b..e623a7498 100644 --- a/variants/arduino_zero/README.md +++ b/variants/arduino_zero/README.md @@ -92,15 +92,15 @@ -# PinDescription table format +## PinDescription table format -## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. If using board variant files with the old format, the new core will still read the table the old way, losing any new features introduced by the new column. Additionally, new definitions have been added for L21 and C21 support. -## Each pin can have multiple functions. +### Each pin can have multiple functions. The PinDescription table describes how each of the pins can be used by the Arduino core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, communications, etc.), and the PinDescription table configures which functions can @@ -111,7 +111,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to verify that the pin can perform the function requested, and to configure the pin for that function. Most of the contents of pinMode() are now in pinPeripheral(). -## Pin Mapping +### Pin Mapping There are different ways that pins can be mapped. Typically, there is no relation between the arduino pin number used, and the actual port pin designator. Thus, the pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, @@ -127,15 +127,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be used, leaving the other pin for some number above 31. -## See WVariant.h in cores/arduino for the definitions used in the table. +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** -### Port: +### Port This is the port (ie: PORTA). -### Pin: +### Pin This is the pin (bit) within the port. Valid values are 0-31. -### PinType: +### PinType This indicates what peripheral function the pin can be attached to. In most cases, this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute field. It can also be set to a specific peripheral. In this case, any attempt to From 571229352c7caa4c145f68639bf39c79cfffe20d Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 18 May 2017 04:34:27 +0000 Subject: [PATCH 092/124] Added more Serial, SPI, and WIRE instances to MT-D21E (rev A and B). Documentation updates. --- CHANGELOG | 13 ++++++++ README.md | 41 +++++++++++++++++-------- boards.txt | 48 ++++++++++++++++++++++++++--- variants/MT_D21E/README.md | 46 ++++++++++++++-------------- variants/MT_D21E/variant.cpp | 37 ++++++++++++++++++----- variants/MT_D21E/variant.h | 45 ++++++++++++++++++++++++++++ variants/MT_D21E_revB/README.md | 50 +++++++++++++++---------------- variants/MT_D21E_revB/variant.cpp | 45 +++++++++++++++++++++------- variants/MT_D21E_revB/variant.h | 45 ++++++++++++++++++++++++++++ 9 files changed, 287 insertions(+), 83 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c28a8ad9e..d2637a29d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,16 @@ +1.6.8-beta-b2: +* Added more Serial, SPI, and WIRE options +* Added MicroSD card firmware loading in the bootloader +* Fixed SDU library to work with MattairTech boards +* Fixed auto-detection for Arduino Zero and M0 board variants +* Documentation updates +* Merged in changes from upstream SAMD CORE 1.6.15: + * + +1.6.8-beta-b1: +* Fixed auto-reset not working on some versions of Windows +* Documentation updates + 1.6.8-beta-b0: * Added L21 and C21 support. Improved D11D and D11C support. * Use Tools->Microcontroller menu to select mcu. diff --git a/README.md b/README.md index cbc11a224..708aac865 100644 --- a/README.md +++ b/README.md @@ -72,13 +72,14 @@ Analog Outputs | One 10-bit (two 12-bit on L21) | One 10-bit (two 12-bit on L21) PWM Outputs | 18 | 14 | 14 | 8 (6 for 14-pin) Interrupts | 16 | 16 | 16 | 8 (7 for 14-pin) USB | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device -SERCOM | 6 | 6 | 4 | 3 (2 for 14-pin) -UART (Serial) | Up to 3 | Up to 3 | Up to 2 | Up to 2 -SPI | Up to 3 | Up to 2 | 1 | 1 -I2C (WIRE) | Up to 3 | Up to 2 | 1 | 1 +SERCOM* | 6 | 6 | 4 | 3 (2 for 14-pin) +UART (Serial)* | Up to 6 | Up to 6 | Up to 4 | Up to 2 +SPI* | Up to 3 | Up to 2 | Up to 2 | Up to 1 +I2C (WIRE)* | Up to 3 | Up to 2 | Up to 2 | Up to 1 I2S | Present on the D21 only | Present on the D21 only | Present on the D21 only | Not present Voltage | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V I/O Pin Current | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | 7 mA +* Note that the maximum number of UART/SPI/I2C is the number of SERCOM. The number listed above for UART/SPI/I2C indicated how many are configurable through the Arduino IDE menu. @@ -153,10 +154,17 @@ Choose NO_BOOTLOADER if not using a bootloader (an external programmer will be u ### Serial Config Menu -This menu is used to select different combinations of serial peripherals. This is useful especially for -the D11, which has a reduced pin count and number of SERCOMs. It can also be used to reduce FLASH and -SRAM usage by selecting fewer UART peripherals, which are instantiated in the core, rather than only -when including a library (like SPI and WIRE). Most board variants support two UART as an option. +This menu is used to select different combinations of serial peripherals. It adds additional UART, SPI, +and WIRE instances. This is also useful for the D11, which has a reduced pin count and number of SERCOMs. +It can also be used to reduce FLASH and SRAM usage by selecting fewer UART peripherals, which are +instantiated in the core, rather than only when including a library (like SPI and WIRE). Note that with +options where there is more than one SPI or WIRE, the additional instances will consume a small amount +of RAM, but neither the peripheral nor the pins are configured until begin() method is called (thus, the +pins can be used for other purposes). + +Use the ASCII art rendering at the top of the README.md file of the board variant used in order to +determine the mapping of instances to pins. When USB CDC is enabled, Serial refers to SerialUSB, +otherwise it refers to Serial1 (TX1/RX1). ### USB Config Menu @@ -458,6 +466,8 @@ OS X support currently in beta (see below), the following instructions are only ### SAM M0+ Core Installation +**See Beta Builds section below to install the beta, as it uses a different json file** + * To update from a previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update. 1. The MattairTech SAM M0+ Core requires Arduino 1.6.7 or above (including 1.8.x). @@ -516,7 +526,7 @@ several features, including three new commands (Arduino Extended Capabilities) t bootloader normally requires 8 KB FLASH, however, a 4 KB version can be used for the D11 chips. Bossac is a command line utility for uploading firmware to SAM-BA bootloaders. It runs on Windows. Linux, and OS X. -It is used by Arduino to upload firmware to SAM and SAM M0+ boards. The version Bossac described here adds to the +It is used by Arduino to upload firmware to SAM and SAM M0+ boards. The version described here adds to the Arduino version (https://github.com/shumatech/BOSSA, Arduino branch), which in turn is a fork from the original Bossa (http://www.shumatech.com/web/products/bossa). It adds support for more SAM M0+ chips (D21, L21, C21, and D11). @@ -687,13 +697,15 @@ from the MT-D11 variant. -## Possible Future Additions/Changes +## Future Additions/Changes -* Timer library is currently under development (like TimerOne, plus input capture, plus ??) -* OS X support currently in beta testing -* Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) +### In-Progress +* Timer library (like TimerOne, plus input capture, plus ??) * Drivers for MT-D21E optional memory devices (SRAM, FLASH, EEPROM) +* OS X support currently in beta testing +### Possible Future +* Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) * USB Host mode CDC ACM (partially complete; BSD-like license?) * Features for lower power consumption (library?) * Reliability and security enhancements @@ -753,6 +765,9 @@ The Changelog has moved to a separate file named CHANGELOG. The most recent chan * Boards Manager must be opened twice to see some updates (only applies to some old IDE versions) +* **Boards manager might not install/uninstall the core or tools properly if the contents of the arduino15 directory has been manually modified** + * Be sure to delete all manually installed folders (not just files) + ## Bugs or Issues diff --git a/boards.txt b/boards.txt index 4464f5201..8d71bb7fc 100644 --- a/boards.txt +++ b/boards.txt @@ -151,14 +151,34 @@ mattairtech_mt_d21e_revb.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI mattairtech_mt_d21e_revb.menu.serial.one_uart.build.serialcom_uart=ONE_UART mattairtech_mt_d21e_revb.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE mattairtech_mt_d21e_revb.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.one_uart_one_wire_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +mattairtech_mt_d21e_revb.menu.serial.one_uart_one_wire_two_spi.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e_revb.menu.serial.one_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.one_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21e_revb.menu.serial.one_uart_two_wire_one_spi=ONE_UART_TWO_WIRE_ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.one_uart_two_wire_one_spi.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e_revb.menu.serial.one_uart_two_wire_one_spi.build.serialcom_wire=TWO_WIRE +mattairtech_mt_d21e_revb.menu.serial.one_uart_two_wire_one_spi.build.serialcom_spi=ONE_SPI mattairtech_mt_d21e_revb.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI mattairtech_mt_d21e_revb.menu.serial.two_uart.build.serialcom_uart=TWO_UART mattairtech_mt_d21e_revb.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE mattairtech_mt_d21e_revb.menu.serial.two_uart.build.serialcom_spi=ONE_SPI -mattairtech_mt_d21e_revb.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.three_uart_one_wire_no_spi=THREE_UART_ONE_WIRE_NO_SPI +mattairtech_mt_d21e_revb.menu.serial.three_uart_one_wire_no_spi.build.serialcom_uart=THREE_UART +mattairtech_mt_d21e_revb.menu.serial.three_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.three_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +mattairtech_mt_d21e_revb.menu.serial.three_uart_no_wire_one_spi=THREE_UART_NO_WIRE_ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.three_uart_no_wire_one_spi.build.serialcom_uart=THREE_UART +mattairtech_mt_d21e_revb.menu.serial.three_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +mattairtech_mt_d21e_revb.menu.serial.three_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.four_uart=FOUR_UART_NO_WIRE_NO_SPI +mattairtech_mt_d21e_revb.menu.serial.four_uart.build.serialcom_uart=FOUR_UART +mattairtech_mt_d21e_revb.menu.serial.four_uart.build.serialcom_wire=NO_WIRE +mattairtech_mt_d21e_revb.menu.serial.four_uart.build.serialcom_spi=NO_SPI +mattairtech_mt_d21e_revb.menu.serial.no_uart=NO_UART_ONE_WIRE_TWO_SPI mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_uart=NO_UART mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_spi=TWO_SPI mattairtech_mt_d21e_revb.menu.usb.cdc=CDC_ONLY mattairtech_mt_d21e_revb.menu.usb.cdc.build.usbcom=CDC_ONLY mattairtech_mt_d21e_revb.menu.usb.cdc.build.pid=0x0557 @@ -261,14 +281,34 @@ mattairtech_mt_d21e.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_uart=ONE_UART mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE mattairtech_mt_d21e.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.one_uart_one_wire_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +mattairtech_mt_d21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21e.menu.serial.one_uart_two_wire_one_spi=ONE_UART_TWO_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_uart=ONE_UART +mattairtech_mt_d21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_wire=TWO_WIRE +mattairtech_mt_d21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_spi=ONE_SPI mattairtech_mt_d21e.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_uart=TWO_UART mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE mattairtech_mt_d21e.menu.serial.two_uart.build.serialcom_spi=ONE_SPI -mattairtech_mt_d21e.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.three_uart_one_wire_no_spi=THREE_UART_ONE_WIRE_NO_SPI +mattairtech_mt_d21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_uart=THREE_UART +mattairtech_mt_d21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +mattairtech_mt_d21e.menu.serial.three_uart_no_wire_one_spi=THREE_UART_NO_WIRE_ONE_SPI +mattairtech_mt_d21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_uart=THREE_UART +mattairtech_mt_d21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +mattairtech_mt_d21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.four_uart=FOUR_UART_NO_WIRE_NO_SPI +mattairtech_mt_d21e.menu.serial.four_uart.build.serialcom_uart=FOUR_UART +mattairtech_mt_d21e.menu.serial.four_uart.build.serialcom_wire=NO_WIRE +mattairtech_mt_d21e.menu.serial.four_uart.build.serialcom_spi=NO_SPI +mattairtech_mt_d21e.menu.serial.no_uart=NO_UART_ONE_WIRE_TWO_SPI mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_uart=NO_UART mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_spi=TWO_SPI mattairtech_mt_d21e.menu.usb.cdc=CDC_ONLY mattairtech_mt_d21e.menu.usb.cdc.build.usbcom=CDC_ONLY mattairtech_mt_d21e.menu.usb.cdc.build.pid=0x0557 diff --git a/variants/MT_D21E/README.md b/variants/MT_D21E/README.md index d4826bba9..1ecc3be07 100644 --- a/variants/MT_D21E/README.md +++ b/variants/MT_D21E/README.md @@ -8,17 +8,17 @@ Other COM PWM Analog INT Arduino* Arduino* INT PWM CO Xin32 | A0 RST | BOOT Xout32 | A1 NC | DAC * 2 | A2 NC | -REFA * 3 | A3 A31 | 31 * TCC11 SWDIO* -REFB * * 4 | A4 A30 | 30 * TCC10 SWDCLK +REFA * 3 | A3 A31 | 31 * TCC11 RX3 SWDIO* +REFB * * 4 | A4 A30 | 30 * TCC10 TX3 SWDCLK * * 5 | A5 NC | * 6 | A6 A28 | 28 * LED VM * 7 | A7 A27 | 27 * BTNA - TCC00 * NMI 8 | A8 A23 | 23 * TC41 SS - TCC01 * * 9 | A9 A22 | 22 * TC40 MISO - TX1 TCC02 * 10 | A10 A19 | 19 * SCK - RX1 TCC03 * 11 | A11 A18 | 18 * MOSI - TX2 TC30 * 14 | A14 A17 | 17 * TCC21 SCL - RX2 TC31 15 | A15 A16 | 16 * TCC20 SDA + SDA1/MISO1 TCC00 * NMI 8 | A8 A23 | 23 * TC41 SS + SCL1/SS1 TCC01 * * 9 | A9 A22 | 22 * TC40 MISO + TX1 TCC02 * 10 | A10 A19 | 19 * SCK + RX1 TCC03 * 11 | A11 A18 | 18 * MOSI + TX2/MOSI1 TC30 * 14 | A14 A17 | 17 * TCC21 SCL/RX4 + RX2/SCK1 TC31 15 | A15 A16 | 16 * TCC20 SDA/TX4 | NC NC | | NC NC | | Vbus 3.3V| * Button B available on 31. @@ -48,30 +48,30 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 5 | A5 | PA05 | | EIC/EXTINT[5] ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] 6 | A6 | PA06 | | !EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] 7 | A7 | PA07 | Voltage Divider | !EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] -8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] -9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] +8 | A8 | PA08 | SDA1/MISO1 | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] +9 | A9 | PA09 | SCL1/SS1 | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] 10 | A10 | PA10 | TX1 | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] 11 | A11 | PA11 | RX1 | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] 12 | --- | ---- | NOT A PIN | NOT A PIN 13 | --- | ---- | NOT A PIN | NOT A PIN -14 | A14 | PA14 | Xin, TX2 | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE -15 | A15 | PA15 | Xout, RX2 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout -16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] -17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] -18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] -19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] +14 | A14 | PA14 | Xin, TX2/MOSI1 | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE +15 | A15 | PA15 | Xout, RX2/SCK1 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout +16 | A16 | PA16 | SDA/TX4 w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] +17 | A17 | PA17 | SCL/RX4 w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] +18 | A18 | PA18 | SPI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] +19 | A19 | PA19 | SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] 20 | --- | ---- | NOT A PIN | NOT A PIN 21 | --- | ---- | NOT A PIN | NOT A PIN -22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] -23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] +22 | A22 | PA22 | MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] +23 | A23 | PA23 | SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] 24 | A24- | PA24 | USB_NEGATIVE | USB/DM TC5/WO[0] 25 | A25+ | PA25 | USB_POSITIVE | USB/DP TC5/WO[1] 26 | --- | ---- | NOT A PIN | NOT A PIN 27 | A27 | PA27 | Button A | EIC/EXTINT[15] Button A 28 | A28 | PA28 | LED | EIC/EXTINT[8] LED 29 | --- | ---- | NOT A PIN | NOT A PIN -30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] TCC1/WO[0] SWD CLK -31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO +30 | A30 | PA30 | SWDCLK / TX3 | EIC/EXTINT[10] SERCOM1/PAD[2] TCC1/WO[0] SWD CLK, leave floating during boot +31 | A31 | PA31 | Button B / SWDIO / RX3| EIC/EXTINT[11] SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO -- | RST | ---- | | Reset, BOOT (double tap bootloader entry) ============================================================================================================================================ @@ -129,9 +129,9 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * **SERCOM** * 4 SERCOM are available. - * Up to 2 UART instances - * 1 SPI instance - * 1 WIRE (I2C) instance + * Up to 4 UART instances + * Up to 2 SPI instances + * Up to 2 WIRE (I2C) instances * The WIRE pullup resistors are enabled by default. diff --git a/variants/MT_D21E/variant.cpp b/variants/MT_D21E/variant.cpp index 7188cc520..d360c87bd 100644 --- a/variants/MT_D21E/variant.cpp +++ b/variants/MT_D21E/variant.cpp @@ -42,8 +42,8 @@ const PinDescription g_APinDescription[]= { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, // ADC/AIN[5] { PORTA, 6, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[6] { PORTA, 7, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] @@ -57,9 +57,14 @@ const PinDescription g_APinDescription[]= { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // TC3/WO[0], HOST_ENABLE { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN - // 16..17 SERCOM/I2C (Wire) or Digital functions + // 16..17 SERCOM/I2C (Wire) or Serial4 or Digital functions +#if defined(FOUR_UART) + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // TX4: SERCOM3/PAD[0] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // RX4: SERCOM3/PAD[1] +#else { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // SDA: SERCOM1/PAD[0] { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // SCL: SERCOM1/PAD[1] +#endif // 18..23 - SERCOM/SPI (SPI) or Digital functions (pins 20..21 do not exist) { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) @@ -80,8 +85,8 @@ const PinDescription g_APinDescription[]= { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH0, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK - { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC1_CH1, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC1_CH0, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK / TX3 + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC1_CH1, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO / RX3 } ; const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; @@ -92,7 +97,7 @@ SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; SERCOM sercom3( SERCOM3 ) ; -#if defined(ONE_UART) || defined(TWO_UART) +#if defined(ONE_UART) || defined(TWO_UART) || defined(THREE_UART) || defined(FOUR_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; void SERCOM0_Handler() @@ -101,7 +106,7 @@ void SERCOM0_Handler() } #endif -#if defined(TWO_UART) +#if defined(TWO_UART) || defined(THREE_UART) || defined(FOUR_UART) Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; void SERCOM2_Handler() @@ -109,3 +114,21 @@ void SERCOM2_Handler() Serial2.IrqHandler(); } #endif + +#if defined(THREE_UART) || defined(FOUR_UART) +Uart Serial3( SERCOM_INSTANCE_SERIAL3, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX ) ; + +void SERCOM1_Handler() +{ + Serial3.IrqHandler(); +} +#endif + +#if defined(FOUR_UART) +Uart Serial4( SERCOM_INSTANCE_SERIAL4, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX ) ; + +void SERCOM3_Handler() +{ + Serial4.IrqHandler(); +} +#endif diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index c99e633b8..740949fdd 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -200,11 +200,31 @@ static const uint8_t ATN = PIN_ATN; #define SERCOM_INSTANCE_SERIAL2 &sercom2 +// Serial3 +#define PIN_SERIAL3_RX (31ul) +#define PIN_SERIAL3_TX (30ul) +#define PAD_SERIAL3_TX (UART_TX_PAD_2) +#define PAD_SERIAL3_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL3 &sercom1 + +// Serial4 +#define PIN_SERIAL4_RX (17ul) +#define PIN_SERIAL4_TX (16ul) +#define PAD_SERIAL4_TX (UART_TX_PAD_0) +#define PAD_SERIAL4_RX (SERCOM_RX_PAD_1) + +#define SERCOM_INSTANCE_SERIAL4 &sercom3 + /* * SPI Interfaces */ +#if defined(TWO_SPI) +#define SPI_INTERFACES_COUNT 2 +#else #define SPI_INTERFACES_COUNT 1 +#endif #define PIN_SPI_MISO (22u) #define PIN_SPI_MOSI (18u) @@ -219,11 +239,28 @@ static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; +#define PIN_SPI1_MISO (8u) +#define PIN_SPI1_MOSI (14u) +#define PIN_SPI1_SCK (15u) +#define PIN_SPI1_SS (9u) +#define PERIPH_SPI1 sercom2 +#define PAD_SPI1_TX SPI_PAD_2_SCK_3 +#define PAD_SPI1_RX SERCOM_RX_PAD_0 + +static const uint8_t SS1 = PIN_SPI1_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI1 = PIN_SPI1_MOSI ; +static const uint8_t MISO1 = PIN_SPI1_MISO ; +static const uint8_t SCK1 = PIN_SPI1_SCK ; + /* * Wire Interfaces */ +#if defined(TWO_WIRE) +#define WIRE_INTERFACES_COUNT 2 +#else #define WIRE_INTERFACES_COUNT 1 +#endif #define PIN_WIRE_SDA (16u) #define PIN_WIRE_SCL (17u) @@ -233,6 +270,14 @@ static const uint8_t SCK = PIN_SPI_SCK ; static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; +#define PIN_WIRE1_SDA (8u) +#define PIN_WIRE1_SCL (9u) +#define PERIPH_WIRE1 sercom2 +#define WIRE1_IT_HANDLER SERCOM2_Handler + +static const uint8_t SDA1 = PIN_WIRE1_SDA; +static const uint8_t SCL1 = PIN_WIRE1_SCL; + /* * USB diff --git a/variants/MT_D21E_revB/README.md b/variants/MT_D21E_revB/README.md index 5f28f2e48..0484e1a51 100644 --- a/variants/MT_D21E_revB/README.md +++ b/variants/MT_D21E_revB/README.md @@ -8,17 +8,17 @@ Other COM PWM Analog INT Arduino* Arduino* INT PWM CO XI32(+) | A0 RST | BOOT(+) XO32(+) | A1 Gnd | DAC * 2 | A2 Vbat | -REFA * 3 | A3 A31 | 31 * IO/B(+) -REFB * * 4 | A4 A30 | 30 * CLK(+) +REFA * 3 | A3 A31 | 31 * RX3 IO/B(+) +REFB * * 4 | A4 A30 | 30 * TX3 CLK(+) DAC1(L) * * 5 | A5 NC | -LED(+) TCC10 * 6 | A6 A28 (D/C)| 28 * -VM TCC11 * 7 | A7 A27 | 27 * A/CS(+M) - TCC00 * NMI 8 | A8 A23 | 23 * TC41/TC01~ SS - TCC01 * * 9 | A9 A22 | 22 * TC40/TC00~ MISO(+M) - TX1 TCC02 * 10 | A10 A19 | 19 * SCK(+M) - RX1 TCC03 * 11 | A11 A18 | 18 * MOSI(+M) - TX2 TC30/TC40~ * 14 | A14 A17 | 17 * TCC21 SCL(+) - RX2 TC31/TC41~ 15 | A15 A16 | 16 * TCC20 SDA(+) +LED(+) TCC10 * 6 | A6 A28 (D/C)| 28 * +VM TCC11 * 7 | A7 A27 | 27 * A/CS(+M) + SDA1/MISO1 TCC00 * NMI 8 | A8 A23 | 23 * TC41/TC01~ SS + SCL1/SS1 TCC01 * * 9 | A9 A22 | 22 * TC40/TC00~ MISO(+M) + TX1 TCC02 * 10 | A10 A19 | 19 * SCK(+M) + RX1 TCC03 * 11 | A11 A18 | 18 * MOSI(+M) + TX2/MOSI1 TC30/TC40~ * 14 | A14 A17 | 17 * TCC21 SCL/RX4(+) + RX2/SCK1 TC31/TC41~ 15 | A15 A16 | 16 * TCC20 SDA/TX4(+) | NC NC | M=Memory device installed | NC NC | ! Vcc is 3.3V by default. | Vbus 3.3V| DO NOT exceed 3.6V on Vcc or @@ -60,30 +60,30 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 5 | A5 | PA05 | DAC1(L21) | EIC/EXTINT[5] ADC/AIN[5] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[1] !TCC0/WO[1] DAC1(L21) 6 | A6 | PA06 | LED | !EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] !SERCOM0/PAD[2] !TCC1/WO[0] LED 7 | A7 | PA07 | Voltage Measurement | !EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] !SERCOM0/PAD[3] !TCC1/WO[1] -8 | A8 | PA08 | | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] !SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] -9 | A9 | PA09 | | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] !SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] +8 | A8 | PA08 | SDA1/MISO1 | EIC/NMI ADC/AIN[16] PTC/X[0] !SERCOM0/PAD[0] SERCOM2/PAD[0] TCC0/WO[0] !TCC1/WO[2] +9 | A9 | PA09 | SCL1/SS1 | EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] !SERCOM0/PAD[1] SERCOM2/PAD[1] TCC0/WO[1] !TCC1/WO[3] 10 | A10 | PA10 | TX1 | !EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] SERCOM0/PAD[2] !SERCOM2/PAD[2] !TCC1/WO[0] TCC0/WO[2] 11 | A11 | PA11 | RX1 | !EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] SERCOM0/PAD[3] !SERCOM2/PAD[3] !TCC1/WO[1] TCC0/WO[3] 12 | --- | ---- | NOT A PIN | NOT A PIN 13 | --- | ---- | NOT A PIN | NOT A PIN -14 | A14 | PA14 | Xin, TX2 | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE -15 | A15 | PA15 | Xout, RX2 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout -16 | A16 | PA16 | I2C/SDA w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] !SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] -17 | A17 | PA17 | I2C/SCL w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] !SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] -18 | A18 | PA18 | SPI MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] -19 | A19 | PA19 | SPI SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] +14 | A14 | PA14 | Xin, TX2/MOSI1 | EIC/EXTINT[14] SERCOM2/PAD[2] TC3/WO[0] !TCC0/WO[4] Xin, HOST_ENABLE +15 | A15 | PA15 | Xout, RX2/SCK1 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout +16 | A16 | PA16 | SDA/TX4 w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] +17 | A17 | PA17 | SCL/RX4 w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] +18 | A18 | PA18 | SPI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] +19 | A19 | PA19 | SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] 20 | --- | ---- | NOT A PIN | NOT A PIN 21 | --- | ---- | NOT A PIN | NOT A PIN -22 | A22 | PA22 | SPI MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] -23 | A23 | PA23 | SPI SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] +22 | A22 | PA22 | MISO | EIC/EXTINT[6] PTC/X[10] SERCOM3/PAD[0] TC4/WO[0] !TCC0/WO[4] +23 | A23 | PA23 | SS | EIC/EXTINT[7] PTC/X[11] SERCOM3/PAD[1] TC4/WO[1] !TCC0/WO[5] 24 | A24- | PA24 | USB_NEGATIVE | USB/DM TC5/WO[0] 25 | A25+ | PA25 | USB_POSITIVE | USB/DP TC5/WO[1] 26 | --- | ---- | NOT A PIN | NOT A PIN 27 | A27 | PA27 | A/CS | EIC/EXTINT[15] A/CS (Jumper A / memory device chip select) 28 | A28 | PA28 | | EIC/EXTINT[8] 29 | --- | ---- | NOT A PIN | NOT A PIN -30 | A30 | PA30 | SWD CLK | EIC/EXTINT[10] !SERCOM1/PAD[2] TCC1/WO[0] SWD CLK, leave floating during boot -31 | A31 | PA31 | Button B / SWD IO | EIC/EXTINT[11] !SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO +30 | A30 | PA30 | SWDCLK / TX3 | EIC/EXTINT[10] SERCOM1/PAD[2] TCC1/WO[0] SWD CLK, leave floating during boot +31 | A31 | PA31 | Button B / SWDIO / RX3| EIC/EXTINT[11] SERCOM1/PAD[3] TCC1/WO[1] Button B SWD IO -- | RST | ---- | | Reset, BOOT (double tap bootloader entry) ============================================================================================================================================ @@ -147,9 +147,9 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * **SERCOM** * 4 SERCOM are available. - * Up to 2 UART instances - * 1 SPI instance - * 1 WIRE (I2C) instance + * Up to 4 UART instances + * Up to 2 SPI instances + * Up to 2 WIRE (I2C) instances * The WIRE pullup resistors are enabled by default. diff --git a/variants/MT_D21E_revB/variant.cpp b/variants/MT_D21E_revB/variant.cpp index c0212735f..fbccb2739 100644 --- a/variants/MT_D21E_revB/variant.cpp +++ b/variants/MT_D21E_revB/variant.cpp @@ -47,16 +47,16 @@ const PinDescription g_APinDescription[]= { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[6], LED #if (SAMD) { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] #elif (SAML) { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] #elif (SAMC) { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel10, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel11, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel10, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel11, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] #endif // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions @@ -84,9 +84,14 @@ const PinDescription g_APinDescription[]= { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN #endif - // 16..17 SERCOM/I2C (Wire) or Digital functions + // 16..17 SERCOM/I2C (Wire) or Serial4 or Digital functions +#if defined(FOUR_UART) + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // TX4: SERCOM3/PAD[0] + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // RX4: SERCOM3/PAD[1] +#else { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // SDA: SERCOM1/PAD[0] { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // SCL: SERCOM1/PAD[1] +#endif // 18..23 - SERCOM/SPI (SPI) or Digital functions (pins 20..21 do not exist) { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) @@ -121,8 +126,8 @@ const PinDescription g_APinDescription[]= { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK - { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG), (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK / TX3 + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO / RX3 } ; #if (SAMD) @@ -141,7 +146,7 @@ SERCOM sercom4( SERCOM4 ) ; SERCOM sercom5( SERCOM5 ) ; #endif -#if defined(ONE_UART) || defined(TWO_UART) +#if defined(ONE_UART) || defined(TWO_UART) || defined(THREE_UART) || defined(FOUR_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; void SERCOM0_Handler() @@ -150,7 +155,7 @@ void SERCOM0_Handler() } #endif -#if defined(TWO_UART) +#if defined(TWO_UART) || defined(THREE_UART) || defined(FOUR_UART) Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; void SERCOM2_Handler() @@ -158,3 +163,21 @@ void SERCOM2_Handler() Serial2.IrqHandler(); } #endif + +#if defined(THREE_UART) || defined(FOUR_UART) +Uart Serial3( SERCOM_INSTANCE_SERIAL3, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX ) ; + +void SERCOM1_Handler() +{ + Serial3.IrqHandler(); +} +#endif + +#if defined(FOUR_UART) +Uart Serial4( SERCOM_INSTANCE_SERIAL4, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX ) ; + +void SERCOM3_Handler() +{ + Serial4.IrqHandler(); +} +#endif diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h index b383815a7..ced2e0281 100644 --- a/variants/MT_D21E_revB/variant.h +++ b/variants/MT_D21E_revB/variant.h @@ -214,11 +214,31 @@ static const uint8_t ATN = PIN_ATN; #define SERCOM_INSTANCE_SERIAL2 &sercom2 +// Serial3 +#define PIN_SERIAL3_RX (31ul) +#define PIN_SERIAL3_TX (30ul) +#define PAD_SERIAL3_TX (UART_TX_PAD_2) +#define PAD_SERIAL3_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL3 &sercom1 + +// Serial4 +#define PIN_SERIAL4_RX (17ul) +#define PIN_SERIAL4_TX (16ul) +#define PAD_SERIAL4_TX (UART_TX_PAD_0) +#define PAD_SERIAL4_RX (SERCOM_RX_PAD_1) + +#define SERCOM_INSTANCE_SERIAL4 &sercom3 + /* * SPI Interfaces */ +#if defined(TWO_SPI) +#define SPI_INTERFACES_COUNT 2 +#else #define SPI_INTERFACES_COUNT 1 +#endif #define PIN_SPI_MISO (22u) #define PIN_SPI_MOSI (18u) @@ -233,11 +253,28 @@ static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; +#define PIN_SPI1_MISO (8u) +#define PIN_SPI1_MOSI (14u) +#define PIN_SPI1_SCK (15u) +#define PIN_SPI1_SS (9u) +#define PERIPH_SPI1 sercom2 +#define PAD_SPI1_TX SPI_PAD_2_SCK_3 +#define PAD_SPI1_RX SERCOM_RX_PAD_0 + +static const uint8_t SS1 = PIN_SPI1_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI1 = PIN_SPI1_MOSI ; +static const uint8_t MISO1 = PIN_SPI1_MISO ; +static const uint8_t SCK1 = PIN_SPI1_SCK ; + /* * Wire Interfaces */ +#if defined(TWO_WIRE) +#define WIRE_INTERFACES_COUNT 2 +#else #define WIRE_INTERFACES_COUNT 1 +#endif #define PIN_WIRE_SDA (16u) #define PIN_WIRE_SCL (17u) @@ -247,6 +284,14 @@ static const uint8_t SCK = PIN_SPI_SCK ; static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; +#define PIN_WIRE1_SDA (8u) +#define PIN_WIRE1_SCL (9u) +#define PERIPH_WIRE1 sercom2 +#define WIRE1_IT_HANDLER SERCOM2_Handler + +static const uint8_t SDA1 = PIN_WIRE1_SDA; +static const uint8_t SCL1 = PIN_WIRE1_SCL; + /* * USB From 0cca97cddf0eaf524f96d056c43474dc87e711be Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Mon, 22 May 2017 06:24:55 +0000 Subject: [PATCH 093/124] Fixed bootloader compilation on Windows. Documentation updates. --- CHANGELOG | 3 ++- README.md | 7 ++++--- bootloaders/zero/Makefile | 8 ++++++-- bootloaders/zero/README.md | 32 +++++++++++++++++++------------- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d2637a29d..56ff3407f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,9 @@ -1.6.8-beta-b2: +1.6.8-beta-b2 (in-progress): * Added more Serial, SPI, and WIRE options * Added MicroSD card firmware loading in the bootloader * Fixed SDU library to work with MattairTech boards * Fixed auto-detection for Arduino Zero and M0 board variants +* Fixed bootloader compilation on Windows * Documentation updates * Merged in changes from upstream SAMD CORE 1.6.15: * diff --git a/README.md b/README.md index 708aac865..8eff5976b 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,8 @@ Analog Outputs | One 10-bit (two 12-bit on L21) | One 10-bit (two 12-bit on L21) PWM Outputs | 18 | 14 | 14 | 8 (6 for 14-pin) Interrupts | 16 | 16 | 16 | 8 (7 for 14-pin) USB | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device -SERCOM* | 6 | 6 | 4 | 3 (2 for 14-pin) -UART (Serial)* | Up to 6 | Up to 6 | Up to 4 | Up to 2 +SERCOM* | 6 | 6 | 4 (6 for L21) | 3 (2 for 14-pin) +UART (Serial)* | Up to 6 | Up to 6 | Up to 4 (up to 5 for L21) | Up to 2 SPI* | Up to 3 | Up to 2 | Up to 2 | Up to 1 I2C (WIRE)* | Up to 3 | Up to 2 | Up to 2 | Up to 1 I2S | Present on the D21 only | Present on the D21 only | Present on the D21 only | Not present @@ -306,6 +306,7 @@ TODO: more info * On the L21, SERCOM5 is in a low power domain. The Fm+ and HS modes of I2C (wire) are not supported. * The SAML and SAMC have double-buffered TCs, which are supported in the core. * The CHANGE and RISING interrupt modes on pin A31 do not seem to work properly on the L21. +* When using pin A31 as UART RX, in Arduino, pinMode(31, INPUT_PULLUP) must be called before SerialX.begin(). * The L21 has two performance levels that affect power consumption. During powerup, the L21 starts at the lowest performance level (PL0). The startup code changes to the highest performance level (PL2) in order to support 48MHz and USB (among other things). * Two Flash Wait States are inserted for the L21 and C21 (the D21/D11 use one wait state). @@ -475,7 +476,7 @@ OS X support currently in beta (see below), the following instructions are only 3. Click the button next to Additional Boards Manager URLs. 4. Add https://www.mattairtech.com/software/arduino/package_MattairTech_index.json. 5. Save preferences, then open the Boards Manager. -6. Install the Arduino SAM M0+ Boards package. Use version 1.6.2 or higher. +6. Install the Arduino SAMD Boards package. Use version 1.6.2 or higher. 7. Install the MattairTech SAM M0+ Boards package. 8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E (or MT-D11). 9. Select the MCU with the now visible Tools->Microcontroller menu (if present). diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index df7075a92..daafb888a 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -74,10 +74,12 @@ ifeq ($(OS),Windows_NT) ifeq ($(TERM),xterm) T=$(shell cygpath -u $(LOCALAPPDATA)) MODULE_PATH?=$(T)/Arduino15/packages/$(CORE_VENDOR) + MODULE_PATH_ARDUINO?=$(T)/Arduino15/packages/arduino RM=rm SEP=/ else MODULE_PATH?=$(LOCALAPPDATA)/Arduino15/packages/$(CORE_VENDOR) + MODULE_PATH_ARDUINO?=$(LOCALAPPDATA)/Arduino15/packages/arduino RM=rm SEP=\\ endif @@ -86,18 +88,20 @@ else ifeq ($(UNAME_S),Linux) MODULE_PATH?=$(HOME)/.arduino15/packages/$(CORE_VENDOR) + MODULE_PATH_ARDUINO?=$(HOME)/.arduino15/packages/arduino RM=rm SEP=/ endif ifeq ($(UNAME_S),Darwin) MODULE_PATH?=$(HOME)/Library/Arduino15/packages/$(CORE_VENDOR)/ + MODULE_PATH_ARDUINO?=$(HOME)/Library/Arduino15/packages/arduino/ RM=rm SEP=/ endif endif -ARM_GCC_PATH?=$(MODULE_PATH)/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi- +ARM_GCC_PATH?=$(MODULE_PATH_ARDUINO)/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi- BUILD_PATH=build # ----------------------------------------------------------------------------- @@ -122,7 +126,7 @@ BIN=$(NAME).bin HEX=$(NAME).hex -INCLUDES=-I"$(MODULE_PATH)/tools/CMSIS/4.5.0/CMSIS/Include/" -I"$(MODULE_PATH)/tools/CMSIS-Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/" +INCLUDES=-I"$(MODULE_PATH_ARDUINO)/tools/CMSIS/4.5.0/CMSIS/Include/" -I"$(MODULE_PATH)/tools/CMSIS-Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/" # ----------------------------------------------------------------------------- # Linker options diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index c4f57a7ef..20185491a 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -1,17 +1,14 @@ # Arduino Zero Bootloader -## Prerequisites for Building - -The project build is based on Makefile system. -Makefile is present at project root and try to handle multi-platform cases. +This bootloader is based on the Arduino Zero bootloader which is a part of the Arduino SAMD core. +It provides a USB-CDC and/or TTL serial communications interface to a host running the bossac +command-line firmware programming utility (or Bossa with a GUI). This version adds support for +the L21 and C21 microcontrollers. It also adds support for four different clock sources (2 external +crystals and two internal oscillator options). There are additional boards added, and binaries for +most board/chip combinations are pre-built. Additionally, MicroSD firmware loading is supported. -Multi-plaform GCC is provided by ARM here: https://launchpad.net/gcc-arm-embedded/+download -Atmel Studio contains both make and ARM GCC toolchain. You don't need to install them in this specific use case. - -For all builds and platforms you will need to have the Arduino IDE installed and the board support -package for "Arduino SAMD Boards (32-bits ARM Cortex-M0+)". You can install the latter -from the former's "Boards Manager" UI. +## Prerequisites for Using This version of the bootloader requires bossac (1.7.0-mattairtech-1) from the package "MattairTech SAM M0+ Boards" or download bossac directly: @@ -19,18 +16,27 @@ from the package "MattairTech SAM M0+ Boards" or download bossac directly: * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) +Note that the SAM-BA tools from Atmel will not work, and the version of bossac from the Arduino +SAMD Core currently does not support the L21, C21, or D11 (but it does support the D21). + + +## Prerequisites for Building + +For all builds and platforms you will need to have the Arduino IDE installed as well as the packages +for both Arduino SAMD Boards and for MattairTech SAM M0+ Boards, which provides the needed dependencies +(CMSIS, CMSIS-Atmel, and the compiler toolchain: arm-none-eabi-gcc), which can be installed using the +Arduino IDE Boards Manager. This project uses a Makefile, which is present in the root (zero) directory. +However, you will need a make program: ### Windows * Native command line Make binary can be obtained here: http://gnuwin32.sourceforge.net/packages/make.htm +Be sure that no other version of make is in your PATH (ie: MinGW). * Cygwin/MSys/MSys2/Babun/etc... It is available natively in all distributions. -* Atmel Studio -An Atmel Studio **7** Makefile-based project is present at project root, just open samd21_sam_ba.atsln file in AS7. - ### Linux Make is usually available by default. From 41e9022f7756c1184582ad20eec791df4e05e3dd Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Wed, 21 Jun 2017 09:12:25 +0000 Subject: [PATCH 094/124] Added SD Card support to bootloader. New binaries. --- bootloaders/zero/Makefile | 25 +- bootloaders/zero/README.md | 676 ++++++++-- bootloaders/zero/SDCard/00readme.txt | 46 + bootloaders/zero/SDCard/diskio.h | 92 ++ bootloaders/zero/SDCard/integer.h | 33 + bootloaders/zero/SDCard/mmcbbp.c | 277 +++++ bootloaders/zero/SDCard/pff.c | 1108 +++++++++++++++++ bootloaders/zero/SDCard/pff.h | 159 +++ bootloaders/zero/SDCard/pffconf.h | 97 ++ bootloaders/zero/SDCard/sdBootloader.c | 111 ++ bootloaders/zero/SDCard/sdBootloader.h | 45 + bootloaders/zero/binaries/README.md | 63 +- .../sam_ba_Generic_D11C14A_SAMD11C14A.bin | Bin 3896 -> 3872 bytes .../sam_ba_Generic_D11D14AM_SAMD11D14AM.bin | Bin 3896 -> 3872 bytes .../sam_ba_Generic_D11D14AS_SAMD11D14AS.bin | Bin 3896 -> 3872 bytes .../sam_ba_Generic_x21E_SAMC21E15A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21E_SAMC21E16A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21E_SAMC21E17A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21E_SAMC21E18A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21E_SAMD21E15A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21E_SAMD21E16A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21E_SAMD21E17A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21E_SAMD21E18A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21E_SAML21E15B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21E_SAML21E16B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21E_SAML21E17B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21E_SAML21E18B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21G_SAMC21G15A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21G_SAMC21G16A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21G_SAMC21G17A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21G_SAMC21G18A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21G_SAMD21G15A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21G_SAMD21G16A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21G_SAMD21G17A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21G_SAMD21G18A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21G_SAML21G16B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21G_SAML21G17B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21G_SAML21G18B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21J_SAMC21J15A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21J_SAMC21J16A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21J_SAMC21J17A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21J_SAMC21J18A.bin | Bin 3816 -> 3720 bytes .../sam_ba_Generic_x21J_SAMD21J15A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21J_SAMD21J16A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21J_SAMD21J17A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21J_SAMD21J18A.bin | Bin 5196 -> 5028 bytes .../sam_ba_Generic_x21J_SAML21J16B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21J_SAML21J17B.bin | Bin 5140 -> 4964 bytes .../sam_ba_Generic_x21J_SAML21J18B.bin | Bin 5140 -> 4964 bytes .../binaries/sam_ba_MT_D11_SAMD11D14AM.bin | Bin 4072 -> 4036 bytes .../sam_ba_MT_D21E_rev_A_SAMD21E17A.bin | Bin 5372 -> 5204 bytes .../sam_ba_MT_D21E_rev_A_SAMD21E18A.bin | Bin 5372 -> 5204 bytes .../sam_ba_MT_D21E_rev_B_SAMC21E18A.bin | Bin 3984 -> 3888 bytes .../sam_ba_MT_D21E_rev_B_SAMD21E17A.bin | Bin 5368 -> 5196 bytes .../sam_ba_MT_D21E_rev_B_SAMD21E18A.bin | Bin 5368 -> 5196 bytes .../sam_ba_MT_D21E_rev_B_SAML21E18B.bin | Bin 5312 -> 5132 bytes .../binaries/sam_ba_arduino_m0_SAMD21G18A.bin | Bin 5468 -> 5196 bytes .../sam_ba_arduino_m0_pro_SAMD21G18A.bin | Bin 6604 -> 6304 bytes .../sam_ba_arduino_mkr1000_SAMD21G18A.bin | Bin 6484 -> 6192 bytes .../sam_ba_arduino_mkrzero_SAMD21G18A.bin | Bin 6488 -> 6296 bytes .../sam_ba_arduino_zero_SAMD21G18A.bin | Bin 6584 -> 6288 bytes .../sam_ba_genuino_mkr1000_SAMD21G18A.bin | Bin 6484 -> 6288 bytes .../sam_ba_genuino_zero_SAMD21G18A.bin | Bin 6584 -> 6288 bytes ...m_ba_sdcard_Generic_D11C14A_SAMD11C14A.bin | Bin 0 -> 4044 bytes ...ba_sdcard_Generic_D11D14AM_SAMD11D14AM.bin | Bin 0 -> 4044 bytes ...ba_sdcard_Generic_D11D14AS_SAMD11D14AS.bin | Bin 0 -> 4044 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E15A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E16A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E17A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E18A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E15B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E16B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E17B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E18B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G16A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G17A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G15A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G16A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G17A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G18A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAML21G16B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21G_SAML21G17B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21G_SAML21G18B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J16A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J17A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin | Bin 0 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J16A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J17A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAML21J16B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21J_SAML21J17B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_Generic_x21J_SAML21J18B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_MT_D11_SAMD11D14AM.bin | Bin 0 -> 4044 bytes ...sam_ba_sdcard_MT_D21E_rev_A_SAMD21E17A.bin | Bin 0 -> 8128 bytes ...sam_ba_sdcard_MT_D21E_rev_A_SAMD21E18A.bin | Bin 0 -> 8128 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAMC21E18A.bin | Bin 0 -> 6820 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin | Bin 0 -> 8116 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin | Bin 0 -> 8116 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAML21E18B.bin | Bin 0 -> 8056 bytes .../sam_ba_sdcard_arduino_m0_SAMD21G18A.bin | Bin 0 -> 8120 bytes ...am_ba_sdcard_arduino_m0_pro_SAMD21G18A.bin | Bin 0 -> 8124 bytes ...m_ba_sdcard_arduino_mkr1000_SAMD21G18A.bin | Bin 0 -> 8048 bytes ...m_ba_sdcard_arduino_mkrzero_SAMD21G18A.bin | Bin 0 -> 8112 bytes .../sam_ba_sdcard_arduino_zero_SAMD21G18A.bin | Bin 0 -> 8108 bytes ...m_ba_sdcard_genuino_mkr1000_SAMD21G18A.bin | Bin 0 -> 8108 bytes .../sam_ba_sdcard_genuino_zero_SAMD21G18A.bin | Bin 0 -> 8108 bytes bootloaders/zero/board_definitions.h | 70 +- .../board_definitions_Generic_D11C14A.h | 177 ++- .../board_definitions_Generic_D11D14AM.h | 177 ++- .../board_definitions_Generic_D11D14AS.h | 177 ++- .../board_definitions_Generic_x21E.h | 179 ++- .../board_definitions_Generic_x21G.h | 179 ++- .../board_definitions_Generic_x21J.h | 179 ++- .../board_definitions_MT_D11.h | 161 ++- .../board_definitions_MT_D21E_rev_A.h | 159 ++- .../board_definitions_MT_D21E_rev_B.h | 159 ++- .../board_definitions_arduino_m0.h | 172 ++- .../board_definitions_arduino_m0_pro.h | 176 ++- .../board_definitions_arduino_mkr1000.h | 159 ++- .../board_definitions_arduino_mkrzero.h | 167 ++- .../board_definitions_arduino_zero.h | 176 ++- .../board_definitions_genuino_mkr1000.h | 164 ++- .../board_definitions_genuino_zero.h | 176 ++- bootloaders/zero/board_driver_led.c | 14 +- bootloaders/zero/board_driver_led.h | 14 +- bootloaders/zero/board_driver_serial.c | 2 + bootloaders/zero/board_driver_serial.h | 13 +- bootloaders/zero/board_driver_usb.c | 30 +- bootloaders/zero/board_driver_usb.h | 1 + bootloaders/zero/board_init.c | 24 +- bootloaders/zero/build_all_bootloaders.sh | 193 ++- .../bootloader_sam_m0p_128KB.ld | 6 +- .../linker_scripts/bootloader_sam_m0p_16KB.ld | 6 +- .../bootloader_sam_m0p_256KB.ld | 6 +- .../linker_scripts/bootloader_sam_m0p_32KB.ld | 6 +- .../linker_scripts/bootloader_sam_m0p_64KB.ld | 6 +- bootloaders/zero/main.c | 198 ++- bootloaders/zero/sam_ba_monitor.c | 99 +- bootloaders/zero/sam_ba_monitor.h | 1 + bootloaders/zero/sam_ba_serial.c | 52 +- bootloaders/zero/sam_ba_serial.h | 1 + bootloaders/zero/samd21_sam_ba.atsln | 22 - bootloaders/zero/samd21_sam_ba.cproj | 218 ---- bootloaders/zero/util.c | 193 +++ bootloaders/zero/util.h | 47 + 153 files changed, 5709 insertions(+), 982 deletions(-) create mode 100644 bootloaders/zero/SDCard/00readme.txt create mode 100644 bootloaders/zero/SDCard/diskio.h create mode 100644 bootloaders/zero/SDCard/integer.h create mode 100644 bootloaders/zero/SDCard/mmcbbp.c create mode 100644 bootloaders/zero/SDCard/pff.c create mode 100644 bootloaders/zero/SDCard/pff.h create mode 100644 bootloaders/zero/SDCard/pffconf.h create mode 100644 bootloaders/zero/SDCard/sdBootloader.c create mode 100644 bootloaders/zero/SDCard/sdBootloader.h create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11C14A_SAMD11C14A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11D14AM_SAMD11D14AM.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11D14AS_SAMD11D14AS.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E15A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E16A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E15B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E16B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E17B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E18B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G16A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G15A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G16A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G16B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G17B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G18B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J16A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J16A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J16B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J17B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J18B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D11_SAMD11D14AM.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_A_SAMD21E17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_A_SAMD21E18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMC21E18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAML21E18B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_arduino_m0_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_arduino_m0_pro_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_arduino_mkr1000_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_arduino_mkrzero_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_arduino_zero_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_genuino_mkr1000_SAMD21G18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_genuino_zero_SAMD21G18A.bin delete mode 100644 bootloaders/zero/samd21_sam_ba.atsln delete mode 100644 bootloaders/zero/samd21_sam_ba.cproj create mode 100644 bootloaders/zero/util.c create mode 100644 bootloaders/zero/util.h diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index daafb888a..7633233b7 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -18,6 +18,11 @@ # Begin Config ############################### +# ----------------------------------------------------------------------------- +# SD Card support. This can also be set in the relevant board_definitions file. +# SDCARD_DISABLED, SDCARD_ENABLED +SDCARD?=SDCARD_DISABLED + # ----------------------------------------------------------------------------- # Boards definitions: # MT_D21E_rev_A, MT_D21E_rev_B, MT_D11 @@ -44,7 +49,11 @@ MCU?=SAMD21E18A # End Config ############################### +ifeq ($(findstring ENABLED,$(SDCARD)),ENABLED) +NAME=sam_ba_sdcard_$(BOARD_ID)_$(MCU) +else NAME=sam_ba_$(BOARD_ID)_$(MCU) +endif ifeq ($(findstring 18,$(MCU)),18) FLASHSIZE=256KB @@ -113,7 +122,8 @@ SIZE=$(ARM_GCC_PATH)size # ----------------------------------------------------------------------------- # Compiler options -CFLAGS_EXTRA=-D__$(MCU)__ -DBOARD_ID_$(BOARD_ID) +# eliminate PARANOIA define to save a tiny amount of code (~40B) +CFLAGS_EXTRA=-D$(SDCARD) -D__$(MCU)__ -DBOARD_ID_$(BOARD_ID) -DPARANOIA CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_PATH)/%.lst) ifdef DEBUG CFLAGS+=-g3 -O1 -DDEBUG=1 @@ -141,6 +151,10 @@ SOURCES= \ board_driver_serial.c \ board_init.c \ board_startup.c \ + util.c \ + SDCard/sdBootloader.c \ + SDCard/mmcbbp.c \ + SDCard/pff.c \ main.c \ sam_ba_monitor.c \ sam_ba_serial.c @@ -152,6 +166,10 @@ SOURCES= \ board_driver_usb.c \ board_init.c \ board_startup.c \ + util.c \ + SDCard/sdBootloader.c \ + SDCard/mmcbbp.c \ + SDCard/pff.c \ main.c \ sam_ba_usb.c \ sam_ba_cdc.c \ @@ -200,6 +218,7 @@ $(BUILD_PATH): @echo ---------------------------------------------------------- @echo Creating build folder -mkdir $(BUILD_PATH) + -mkdir $(BUILD_PATH)/SDCard print_info: @echo ---------------------------------------------------------- @@ -227,14 +246,18 @@ clean: $(AS_CLEAN) @echo Cleaning project -$(RM) $(BIN) -$(RM) $(HEX) + -$(RM) $(BUILD_PATH)/SDCard/*.* -$(RM) $(BUILD_PATH)/*.* + -rmdir $(BUILD_PATH)/SDCard -rmdir $(BUILD_PATH) mostly_clean: $(AS_CLEAN) @echo ---------------------------------------------------------- @echo Cleaning project except bin -$(RM) $(HEX) + -$(RM) $(BUILD_PATH)/SDCard/*.* -$(RM) $(BUILD_PATH)/*.* + -rmdir $(BUILD_PATH)/SDCard -rmdir $(BUILD_PATH) .phony: print_info $(BUILD_PATH) diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index 20185491a..ebd303fcb 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -1,26 +1,314 @@ # Arduino Zero Bootloader -This bootloader is based on the Arduino Zero bootloader which is a part of the Arduino SAMD core. -It provides a USB-CDC and/or TTL serial communications interface to a host running the bossac -command-line firmware programming utility (or Bossa with a GUI). This version adds support for -the L21 and C21 microcontrollers. It also adds support for four different clock sources (2 external -crystals and two internal oscillator options). There are additional boards added, and binaries for -most board/chip combinations are pre-built. Additionally, MicroSD firmware loading is supported. +This bootloader is based on the Arduino Zero bootloader which is a part of the Arduino SAMD core. It +provides a USB-CDC and/or TTL serial communications interface to a host running the bossac command +line firmware programming utility (or the Arduino IDE) running on Windows, Linux, or OS X. Optionally, +SD Card firmware loading is supported, using SDSC or SDHC cards with a FAT16 or FAT32 filesystem. +This version adds support for the D11, L21, and C21 microcontrollers. It also adds support for four +different clock sources (two external crystals and two internal oscillator options). There are +additional board definitions added, and binaries for most board/chip combinations are pre-built. + +## Features + +* SAM-BA USB CDC and UART interfaces with optional terminal mode +* SD Card interface (both USB CDC and SD Card support fits in 8KB) +* Four different clock sources (two external crystals and two internal oscillator options) +* Arduino IDE auto-reset and double-tap reset button support +* Arduino extended commands for faster firmware loading +* Supports the D21, L21, C21, and D11 SAM M0+ chips +* Bossac command line utility for Windows, Linux, and OS X + + +## SD Card Support + +When SDCARD_ENABLED is defined, SD card bootloader support is compiled in. Support for +the other interfaces (USB CDC and/or UART) can be compiled in as well. External pins +can be defined to control the run-time behavior. If the SD bootloader is configured to +run, it always runs before the other intarfaces. If the SD bootloader does not find +the appropriate binary file on the SD card (or if the SD card does not exist), then +the other interface(s), if configured, will activate. + +The SD bootloader supports MMCv3, SDv1 (SDSC), and SDv2 (SDSC and SDHC) cards with +FAT16 and FAT32 filesystem support. The filesystem is mounted read only, with no directory +support, so the files must be placed in the root directory. Only 8.3 format filenames are +supported (no long filenames, LFN). After reset, the SPI bus operates at 250KHz. After +successful sd card initialization, the speed is increased to 6MHz. While the sd bootloader +is running, the LED, if configured, will PWM fade quickly (~4Hz). + +1. The bootloader can be run by Arduino IDE auto-reset, double-tap reset, and/or external + pin state. It will run automatically if the first four bytes of FLASH is erased. + SDCARD_ENABLED must be defined to compile in SD card bootloader support. +2. If SDCARD_USE_PIN1 or SDCARD_USE_PIN2 defined, read the pin(s) to determine if the sd + bootloader should run (either pin enabled), and which file to load (UPDATE.BIN when + PIN1 is enabled, UPDATE2.BIN if PIN2 is enabled). If neither pin is enabled, the + enabled SAM-BA interface, if configured, will run. If a SAM-BA interface is not + enabled, the LED will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. If the + pins are not defined, then the SD bootloader will always run. The LED, if configured, + will PWM fade quickly while the SD bootloader is running. +3. The SD bootloader initializes the SD card. If successful, it mounts the FAT16 or FAT32 + volume, if present. It then looks for the appropriate file (UPDATE.BIN or UPDATE2.BIN) + in the root directory. If there is no SD card, no FAT16/FAT32 volume, or no file, the + SD bootloader will exit, and the enabled SAM-BA interface, if configured, will run. If + a SAM-BA interface is not enabled, the LED will blink with status code + LED_STATUS_FILE_NOT_FOUND. +4. If SDCARD_VERIFICATION_DISABLED is not defined, the SD bootloader compares the update + file on the SD card with the already installed firmware. If they already match, then + the bootloader will jump to the firmware, unless SDCARD_AUTORUN_DISABLED is defined, + in which case the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + If the update file differs from the installed firmware, it continues to step 5. +5. The application section of the FLASH is erased. The selected update file is written + to the FLASH. If the file exceeds the size of the FLASH, the LED will blink with + status code LED_STATUS_FILE_TOO_LARGE. +6. If SDCARD_VERIFICATION_DISABLED is not defined, the SD bootloader verifies the FLASH + by re-reading the update file. If the files differ, the application section of the + FLASH is erased (so it will never be executed; the bootloader will still run) and the + LED will blink with LED_STATUS_VERIFICATION_FAILURE. If verification is successful, + the bootloader will jump to the firmware, unless SDCARD_AUTORUN_DISABLED is defined, + in which case the LED will blink with status code LED_STATUS_SUCCESS. + + +### SD Card External Pins + +If SDCARD_USE_PIN1 is defined, then the SD Card bootloader will run depending +on the state of an external pin and the value of SDCARD_PIN1_POLARITY. The +SPI peripheral and SPI pins will only be setup if the SD card bootloader runs. + +Pin1 | Action +----------------|--------------------- +Inactive | Skip SD bootloader +Active | Run SD bootloader + +If SDCARD_USE_PIN1 and SDCARD_USE_PIN2 are defined, then the SD Card bootloader +will run depending on the state of two external pins and the values of +SDCARD_PIN1_POLARITY and SDCARD_PIN1_POLARITY. The SPI peripheral and pins +will only be setup if the SD card bootloader runs. Note that if SDCARD_USE_PIN2 +is defined, then SDCARD_USE_PIN1 must also be defined. + +Pin1 | Pin2 | Action +----------------|---------------|----------------------------------- +Inactive | Inactive | Skip SD bootloader +Active | Inactive | Run SD bootloader w/ UPDATE.BIN +Inactive | Active | Run SD bootloader w/ UPDATE2.BIN +Active | Active | Skip SD bootloader + +SDCARD_PIN1_POLARITY and SDCARD_PIN2_POLARITY can be set to PIN_POLARITY_ACTIVE_LOW +or PIN_POLARITY_ACTIVE_HIGH. If polarity is undefined, PIN_POLARITY_ACTIVE_HIGH +is used. + +If neither SDCARD_USE_PIN1 or SDCARD_USE_PIN2 are defined, then the SD Card +bootloader will always run. + + +## Status LED + +When the bootloader is running, and if both BOARD_LED_PIN and BOARD_LED_FADE_ENABLED are +defined, the LED will PWM fade in an "M-wave" pattern. When the SD bootloader is running, +the fading will be twice as fast (~4Hz) as the SAM-BA interface (USB CDC or UART at ~2Hz). +If BOARD_LED_FADE_ENABLED is not defined, the LED will simply turn on. + +**Status codes** + +Status Code | Blink Period | Description +--------------------------------|---------------|--------------------------------------- +LED_STATUS_SUCCESS | 1Hz | FLASH write success. +LED_STATUS_FILE_ALREADY_MATCHES | 2Hz | File already the same. +LED_STATUS_FILE_NOT_FOUND | 4Hz | SD Card or update file not present. +LED_STATUS_NO_SAM_BA_INTERFACE | 8Hz | No SAM-BA interface is available (nothing to do). +LED_STATUS_FILE_TOO_LARGE | 16Hz | Update file exceeds size of application FLASH. Application FLASH erased. +LED_STATUS_VERIFICATION_FAILURE | 32Hz | Application FLASH verification failure. Application FLASH erased. + + +## SAM-BA monitor commands + +The SAM-BA interface, which is used with both USB CDC and UART, +can operate in either binary (default) or terminal mode. If +TERMINAL_MODE_ENABLED is defined, additional terminal handling code +(add prompt, add \n\r to EOL, format numbers, etc.) will be compiled +in. To switch to terminal mode, type 'T#' (you should then see a +prompt). Then, type 'V#' to show version information. + +Command | Action | Argument(s) | Example +--------|-----------------------|-----------------------|------------------------ +N | Set Normal Mode | No argument | N# +T | Set Terminal Mode | No argument | T# +O | Write a byte | Address, Value# | O200001,CA# +o | Read a byte | Address,# | o200001,# +H | Write a half word | Address, Value# | H200002,CAFE# +h | Read a half word | Address,# | h200002,# +W | Write a word | Address, Value# | W200000,CAFEDECA# +w | Read a word | Address,# | w200000,# +S | Send a file | Address,# | S200000,# +R | Receive a file | Address, NbOfBytes# | R200000, 1234# +G | Go | Address# | G200200# +V | Display version | No argument | V# + +For more information on SAM-BA, see (especially pages 10 and 11): +http://www.atmel.com/Images/Atmel-42438-SAM-BA-Overview-and-Customization-Process_ApplicationNote_AT09423.pdf + + +## Bootloader Binaries + +The bootloaders/zero/binaries directory contains the SAM-BA m0+ +bootloaders built by the build_all_bootloaders.sh script from +the 'MattairTech SAM M0+ Boards' Arduino core, which is available +at https://github.com/mattairtech/ArduinoCore-samd. Each board +and chip combination has two bootloaders available: + +* SAM-BA interface only + * USB CDC only for all MattairTech boards + * Both USB CDC and UART for most Arduino boards + * The Generic board variants minimize external pin usage + * Only the SAM-BA interface pins are used (no crystal, LED, etc.) + * Filename is: sam_ba_$(BOARD_ID)_$(MCU) + +* SAM-BA interface and SD Card interface + * USB CDC only for all Arduino and most MattairTech boards + * No SAM-BA interface for the D11 chips + * All board variants define SDCARD_USE_PIN1 (except D11) + * The Generic board variants use the LED + * SDCARD_AUTORUN_DISABLED is defined + * Filename is: sam_ba_sdcard_$(BOARD_ID)_$(MCU) + + +### MattairTech Boards + +MattairTech boards are all configured with only one interface: +SAM_BA_USBCDC_ONLY (except C21, which uses SAM_BA_UART_ONLY). +CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_INTERNAL_USB +(CLOCKCONFIG_INTERNAL for the C21). Only the main LED is defined. +BOOT_LOAD_PIN is not defined, but BOOT_DOUBLE_TAP_ENABLED is. +When the SD Card interface is enabled, SDCARD_AUTORUN_DISABLED and +SDCARD_USE_PIN1 are defined. + +### MattairTech/Generic D11 Boards + +All boards are configured with only the USB CDC interface, except +when SDCARD_ENABLED is defined, then only the SD Card interface is +enabled. ARDUINO_EXTENDED_CAPABILITIES is set to 0 (disabled). +TERMINAL_MODE_ENABLED is not defined. As of 1.6.8-beta-b2, +USB_VENDOR_STRINGS_ENABLED is now defined. BOOT_LOAD_PIN is not +defined, but BOOT_DOUBLE_TAP_ENABLED is. When the SD Card interface is +enabled, SDCARD_AUTORUN_DISABLED is defined (but not SDCARD_USE_PIN1). + +### Arduino/Genuino Boards + +Most Arduino/Genuino boards are configured with both interfaces, +except when SDCARD_ENABLED is defined, then only USB CDC is enabled. +CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_32768HZ_CRYSTAL. +All LEDs that are installed for each board are defined (and some +have LED_POLARITY_LOW_ON set). BOOT_LOAD_PIN is not defined, but +BOOT_DOUBLE_TAP_ENABLED is. When the SD Card interface is enabled, +SDCARD_AUTORUN_DISABLED and SDCARD_USE_PIN1 are defined. + +### Generic Boards +The generic boards are all configured to minimize external hardware +requirements. Only one interface is enabled: SAM_BA_USBCDC_ONLY +(except C21, which uses SAM_BA_UART_ONLY). CLOCKCONFIG_CLOCK_SOURCE +is set to CLOCKCONFIG_INTERNAL_USB (CLOCKCONFIG_INTERNAL for the C21), +so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not +defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin. +When the SD Card interface is enabled, SDCARD_AUTORUN_DISABLED and +SDCARD_USE_PIN1 are defined. + + +## Installation + +### Driver Installation + +The bootloader requires a USB CDC driver to be installed when using the SAM-BA USB CDC interface. +This driver is the same as the one used by the MattairTech SAM M0+ Core. + +**See the MattairTech SAM M0+ Core [README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/README.md) "Driver Installation" for installation instructions.** + + +### Bootloader Firmware Installation + +#### Bootloader Installation Using the Arduino IDE -## Prerequisites for Using +1. If you do not already have the MattairTech SAM M0+ core installed, see SAM M0+ Core Installation above. +2. Plug in the SAM M0+ board. The bootloader must be running to (press reset twice within 500ms). +3. Plug an Atmel ICE into USB, then connect it to the powered SAM M0+ board. A green LED should light on the Atmel ICE. +4. Click Tools->Programmer->Atmel ICE. +5. Click Tools->Board->MattairTech MT-D21E (or whichever board you are using). +6. Click Tools->Microcontroller and select your MCU (if menu present). +7. Click Tools->Burn Bootloader. Ignore any messages about not supporting shutdown or reset. +8. Continue with driver installation above. + +A running sketch *may* interfere with the bootloader installation process. Be sure you are running the existing bootloader or using a blank chip. + +#### Bootloader Installation Using Another Tool (ie: Atmel Studio, openocd) + +1. Download the bootloader from https://www.mattairtech.com/software/arduino/SAM-BA-bootloaders-zero-mattairtech.zip. +2. Unzip to any directory. Be sure that a bootloader is available for your particular MCU. +3. Follow the procedures for your upload tool to upload the firmware. + * Perform a chip erase first. Be sure no BOOTPROT bits are set. + * Install the binary file to 0x00000000 of the FLASH. + * You can optionally set the BOOTPROT bits to 8KB (or 4KB for the MT-D11). The Arduino installation method does not set these. + * You can optionally set the EEPROM bits or anything else. The Arduino installation method uses factory defaults. +4. Continue with driver installation above. + + +### Bossac Utility Installation + +This version of the bootloader requires bossac (1.7.0-mattairtech-1) from the package "MattairTech SAM M0+ Boards". +If using the Arduino IDE to upload firmware, then download the core. + +**See the MattairTech SAM M0+ Core [README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/README.md) "Driver Installation" for installation instructions.).** + +If using Bossac standalone, download bossac directly at: -This version of the bootloader requires bossac (1.7.0-mattairtech-1) -from the package "MattairTech SAM M0+ Boards" or download bossac directly: * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) + Note that the SAM-BA tools from Atmel will not work, and the version of bossac from the Arduino SAMD Core currently does not support the L21, C21, or D11 (but it does support the D21). +#### Using Bossac Standalone + +TODO: Update https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip with new chips (L21 and C21). + +When using Bossac standalone, you will need to ensure that your application starts at 0x00002000 for 8 KB bootloaders, +and 0x00001000 for 4 KB bootloaders. This is because the bootloader resides at 0x00000000. This can be accomplished +by passing the following flag to the linker (typically LDFLAGS in your makefile; adjust for your bootloader size): + +``` +Wl,sectionstart=.text=0x2000 +``` -## Prerequisites for Building +You can also use a linker script. See the MattairTech SAM M0+ package for examples. +Be sure to generate and use a binary file. Many makefiles are set up to generate an elf, hex, and bin already. + +Download Bossac from: + +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) + +Linux 64 bit users can also download Bossa (GUI) and bossash (shell) from: + +* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) + +As an example, bossac will be used to upload the test firmware (blink sketch): + +1. Download firmware from https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip and unzip. +2. If you have not already installed the bootloader driver, see Driver Installation above. +3. Be sure there is a binary that matches your chip. On the command line (change the binary to match yours): + +``` +bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R +``` +4. On Linux --port might be /dev/ttyACM0. If the device is not found, remove the --port argument for auto-detection. +5. See http://manpages.ubuntu.com/manpages/vivid/man1/bossac.1.html for details. +6. The board should reset automatically and the sketch should be running. + + +## Building Bootloader + +### Prerequisites for Building For all builds and platforms you will need to have the Arduino IDE installed as well as the packages for both Arduino SAMD Boards and for MattairTech SAM M0+ Boards, which provides the needed dependencies @@ -28,7 +316,7 @@ for both Arduino SAMD Boards and for MattairTech SAM M0+ Boards, which provides Arduino IDE Boards Manager. This project uses a Makefile, which is present in the root (zero) directory. However, you will need a make program: -### Windows +#### Windows * Native command line Make binary can be obtained here: http://gnuwin32.sourceforge.net/packages/make.htm @@ -37,26 +325,35 @@ Be sure that no other version of make is in your PATH (ie: MinGW). * Cygwin/MSys/MSys2/Babun/etc... It is available natively in all distributions. -### Linux +#### Linux Make is usually available by default. -### OS X +#### OS X Make is available through XCode package. -## Makefile Configuration +### Makefile Configuration The section between 'Begin Configuration' and 'End Configuration' in the Makefile should be edited. -Set BOARD_ID and MCU to a chip listed in the comments. +Set SDCARD, BOARD_ID, and MCU to one of the values listed in the comments. + +#### SD Card support + + * SDCARD_DISABLED, SDCARD_ENABLED + +This can also be set in the relevant board_definitions file. It is present in the makefile to +allow the build_all_bootloaders.sh script to select SD Card support. + +#### Boards definitions: -### Boards definitions: * MT_D21E_rev_A, MT_D21E_rev_B, MT_D11, MT_D21J * arduino_zero, arduino_mkrzero, arduino_mkr1000, genuino_mkr1000, genuino_zero * Generic_x21E, Generic_x21G, Generic_x21J, Generic_D11D14AM, Generic_D11D14AS, Generic_D11C14A -### MCU definitions: +#### MCU definitions: + * SAMD21J: SAMD21J18A, SAMD21J17A, SAMD21J16A, SAMD21J15A * SAMD21G: SAMD21G18A, SAMD21G17A, SAMD21G16A, SAMD21G15A * SAMD21E: SAMD21E18A, SAMD21E17A, SAMD21E16A, SAMD21E15A @@ -69,23 +366,164 @@ Set BOARD_ID and MCU to a chip listed in the comments. * SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS -## Board Configuration +### Board Configuration Configuration for each board is available in the board_definitions directory. Each board has a file named board_definitions_BOARD_NAME.h, where BOARD_NAME is listed above in the makefile configuration. The following options are available: +#### Sizes of Options + +Compilation Option | Size (Bytes) +----------------------------------------|-------------------------- +*Core* | ~1200* +SAM_BA_CDC | 1148* +SAM_BA_UART | 1108* +*SAM-BA Monitor* | 1200* +SDCARD_ENABLED | 2788* +SDCARD_VERIFICATION_DISABLED | 284 +USB_VENDOR_STRINGS_ENABLED | 228 +TERMINAL_MODE_ENABLED | 228 +BOARD_LED_FADE_ENABLED | 160 +SAM_BA_INTERFACE_USE_PIN | 100 +BOOT_DOUBLE_TAP_ENABLED | 96 +BOOT_LOAD_PIN | 84 +SDCARD_USE_PIN1 & SDCARD_USE_PIN2 | 92 +SDCARD_USE_PIN1 | 60 +ARDUINO_EXTENDED_CAPABILITIES (X/Y/Z) | 904* + *X (Chip Erase) & Y (Write FLASH)* | 120* + *Z (CRC Verification)* | 248* + *crc16Table* | 512* + + *SAM_BA_CDC and SAM_BA_UART automatically pull in SAM-BA Monitor* + *ARDUINO_EXTENDED_CAPABILITIES and SDCARD_ENABLED include X and Y functions* + *ARDUINO_EXTENDED_CAPABILITIES and SAM_BA_UART include crc16Table* + *ARDUINO_EXTENDED_CAPABILITIES includes Z function* + +#### Example Compiled Binary Size + +Precompiled Bootloader | Size (Bytes) +----------------------------------------|-------------------------- +Default 8KB with CDC only | 5196 +8KB with CDC and SDCARD | 8052 +Default 4KB with CDC only | 4036 +4KB with SDCARD only | 4044 + + +### TERMINAL_MODE_ENABLED + +The SAM-BA interface, which is used with both USB CDC and UART (TTL +serial), can operate in either binary (default) or terminal mode. If +TERMINAL_MODE_ENABLED is defined, additional terminal handling code +(add prompt, add \n\r to EOL, number formatting, etc.) will be compiled +in. To switch to terminal mode, type 'T#' (you should then see a prompt). +Then, type 'V#' to show version information. See SAM-BA monitor commands. +Size: ~228B. Enabled by default. Disable with 4KB bootloader. + +### SDCARD_ENABLED + +If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. +See "SD Card Bootloader" section. This define can also be set from the +makefile (so it can be used with the build_all_bootloaders.sh script). +Size: ~2788B. Disabled by default. Available with 4KB bootloader. + +#### SDCARD_SPI_SERCOM_INSTANCE +#### SDCARD_SPI_PAD_SETTINGS +#### SDCARD_SPI_PAD0 +#### SDCARD_SPI_PAD1 +#### SDCARD_SPI_PAD2 +#### SDCARD_SPI_PAD3 + +If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. +When setting SDCARD_SPI_PADx defines, consult the appropriate header file +from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- +Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ +.h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. +When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and +associated pins are only initialized if either pin is active. + +### SDCARD_SPI_CS_PORT +### SDCARD_SPI_CS_PIN + +If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN +must also be defined. PORT can be 0 (Port A) or 1 (Port B). + +### SDCARD_USE_PIN1 +#### SDCARD_PIN1_POLARITY +#### SDCARD_PIN1_PORT +#### SDCARD_PIN1_PIN +#### SDCARD_PIN1_CONFIG + +### SDCARD_USE_PIN2 +#### SDCARD_PIN2_POLARITY +#### SDCARD_PIN2_PORT +#### SDCARD_PIN2_PIN +#### SDCARD_PIN2_CONFIG + +If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can +optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must +also be defined. See "SD Card External Pins" section for more information. PORT +can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or +PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. +Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + +### SDCARD_VERIFICATION_DISABLED + +If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH +after programming will not occur, nor will the initial check to see if the +FLASH contents are already the same as the file. +Size: ~284B. By default, this is not defined, so verification will be enabled. + +### SDCARD_AUTORUN_DISABLED + +If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not +automatically run the firmware that was just installed. Instead, the LED will +blink with status code LED_STATUS_SUCCESS. This option also applies when the +binary file on the SD card already matches the installed firmware. In this +case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. +By default, SDCARD_AUTORUN_DISABLED is defined. + ### SAM_BA_INTERFACE -Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or -SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. -The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. + +Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or +SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except +when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 +lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, +SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + +### SAM_BA_INTERFACE_USE_PIN +#### SAM_BA_INTERFACE_PIN_POLARITY +#### SAM_BA_INTERFACE_PIN_PORT +#### SAM_BA_INTERFACE_PIN_PIN +#### SAM_BA_INTERFACE_PIN_CONFIG + +If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which +SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one +interface is used, then the pin acts as an enable. In both cases, the value of +SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of +PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and +PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are +enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, +or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the +device is not selected/enabled. If no interface is selected by the pin, the LED +will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. +Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. ### ARDUINO_EXTENDED_CAPABILITIES + If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands will become available which will speed up programming when using the Arduino IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. +Size: ~904B. This is defined and set to 1 by default (except with 4KB). + +Arduino Extended Capabilities: + +* X: Erase the flash memory starting from ADDR to the end of flash. +* Y: Write the content of a buffer in SRAM into flash memory. +* Z: Calculate the CRC for a given area of memory. ### CLOCKCONFIG_CLOCK_SOURCE + The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, or CLOCKCONFIG_INTERNAL_USB. If CLOCKCONFIG_32768HZ_CRYSTAL or @@ -99,15 +537,18 @@ open-loop mode, except when connected to a USB port with data lines (and not suspended), where it will calibrate against the USB SOF signal. ### HS_CRYSTAL_FREQUENCY_HERTZ + If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must also be defined with the external crystal frequency in Hertz. ### PLL_FRACTIONAL_ENABLED + If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in a more accurate 48MHz output frequency at the expense of increased jitter. ### PLL_FAST_STARTUP + If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being multiplied by the PLL. This will result in a faster lock time for the PLL, @@ -118,93 +559,96 @@ also useful for USB host mode applications. See datasheet USB electrical characteristics. ### VARIANT_MCK + Master clock frequency (also Fcpu frequency), set to 48000000ul only for now. ### NVM_SW_CALIB_DFLL48M_FINE_VAL + The fine calibration value for DFLL open-loop mode is defined here. The coarse calibration value is loaded from NVM OTP (factory calibration values). ### USB_VENDOR_STRINGS_ENABLED -If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and -STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. - -### STRING_MANUFACTURER -Manufacturer Name +#### STRING_MANUFACTURER +#### STRING_PRODUCT -### STRING_PRODUCT -Product Name - -### USB_VID_HIGH -High byte of USB VID - -### USB_VID_LOW -Low byte of USB VID +If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and +STRING_PRODUCT will be sent to the host. +Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). -### USB_PID_HIGH -High byte of USB PID +#### USB_VID_HIGH +#### USB_VID_LOW +#### USB_PID_HIGH +#### USB_PID_LOW -### USB_PID_LOW -Low byte of USB PID +If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. ### BOOT_USART_SERCOM_INSTANCE -This must be a single digit representing the SERCOM number - -### BOOT_USART_PAD_SETTINGS -UART_RX_PAD3_TX_PAD2 - -### BOOT_USART_PADx -where x is 0, 1, 2, or 3. Consult CMSIS defines to determine what -goes here (ie:PINMUX_PA10C_SERCOM0_PAD2). Use PINMUX_UNUSED if not used. +#### BOOT_USART_PAD_SETTINGS +#### BOOT_USART_PAD3 +#### BOOT_USART_PAD2 +#### BOOT_USART_PAD1 +#### BOOT_USART_PAD0 + +BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. +See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting +BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: +~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ +CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED +if not used. By default, this interface is not enabled (except with the C21). ### BOOT_DOUBLE_TAP_ENABLED -If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by -quickly tapping two times on the reset button. -### BOOT_LOAD_PIN -If BOOT_LOAD_PIN is defined (ie: PIN_PA27), the bootloader is started -if the selected pin is tied LOW during startup. An internal pullup -resistor will be enabled. There will be a 10ms delay before testin the -pin to allow time for debouncing capacitors to charge (button use). +If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly +tapping two times on the reset button (within 1/2 second). +Size: ~96B. Enabled by default. -### BOARD_LED_PORT, BOARD_LEDRX_PORT, BOARD_LEDTX_PORT -### BOARD_LED_PIN, BOARD_LEDRX_PIN, BOARD_LEDTX_PIN -If the PORT is defined, then the LED on the associated pin is enabled. +### BOOT_LOAD_PIN_ENABLED +#### BOOT_LOAD_PIN +#### BOOT_LOAD_PIN_PORT +#### BOOT_LOAD_PIN_POLARITY +#### BOOT_LOAD_PIN_CONFIG -### BOARD_LED_POLARITY -This can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. +If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected +pin is active after reset. There is a 10ms delay before testing the pin to +allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 +(Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or +PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. +Size: ~84B. Disabled by default. ### BOARD_LED_FADE_ENABLED -If BOARD_LED_FADE_ENABLED is defined, then the main LED produces -a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. +If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an +"M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader +is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). +Size: ~160B. Enabled by default. -## Generic Boards -The generic boards are all configured to minimize external hardware -requirements. Only one interface is enabled: SAM_BA_USBCDC_ONLY -(except C21, which uses SAM_BA_UART_ONLY). CLOCKCONFIG_CLOCK_SOURCE -is set to CLOCKCONFIG_INTERNAL_USB (CLOCKCONFIG_INTERNAL for the C21), -so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not -defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin. +### BOARD_LED_PORT +#### BOARD_LED_PIN +#### BOARD_LED_POLARITY +### BOARD_LEDRX_PORT +#### BOARD_LEDRX_PIN +#### BOARD_LEDRX_POLARITY -## Boot Condition Test Sequence -First, the start location of the sketch is fetched and checked. If it -is empty (0xFFFFFFFF), then bootloader execution is resumed. Note that -when Arduino auto-reset (into bootloader) is initiated, the first flash -row is erased, so the bootloader will always run after reset until a -new sketch is transferred. Next, it checks for the double-tap reset -condition. Then, it checks the boot pin state (after a 10ms delay to -allow debounce capacitor charging). If no bootloader entry condition -is present, it jumps to the application and starts execution from there. +### BOARD_LEDTX_PORT +#### BOARD_LEDTX_PIN +#### BOARD_LEDTX_POLARITY + +If the LED PORT is defined, then the LED on the associated pin is enabled. +Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. +By default, only BOARD_LED is enabled. -## Building a 4KB bootloader -Only one interface should be selected. ARDUINO_EXTENDED_CAPABILITIES -should not be defined. USB_VENDOR_STRINGS_ENABLED also should not be -defined in most cases, as well as BOOT_LOAD_PIN. +### Building a 4KB bootloader +Only one interface (USB CDC, UART, or SD Card) should be selected. +ARDUINO_EXTENDED_CAPABILITIES should be set to 0. All external pins +should be undefined, as well as TERMINAL_MODE_ENABLED. As of +1.6.8-beta-b2, USB_VENDOR_STRINGS_ENABLED can now be defined. +BOOT_DOUBLE_TAP_ENABLED can be defined. -## Building + +### Building If not specified the makefile builds for **MT_D21E_rev_B**: @@ -212,20 +656,46 @@ If not specified the makefile builds for **MT_D21E_rev_B**: make ``` -if you want to make a custom bootloader for a derivative board you must supply all the +If you want to make a custom bootloader for a derivative board you must supply all the necessary information in a `board_definitions_xxx.h` file, and add the corresponding case in -`board_definitions.h`. For example for the **Generic_x21J** board with a **SAMD21J18A** MCU, -we use `board_definitions_Generic_x21J.h` and it is build with the following command: +`board_definitions.h`. For example, for the **Generic_x21J** board with a **SAMD21J18A** MCU, +use `board_definitions_Generic_x21J.h` and build with the following command: ``` -BOARD_ID=Generic_x21J MCU=SAMD21J18A make clean all +BOARD_ID=Generic_x21J MCU=SAMD21J18A SDCARD=SDCARD_ENABLED make clean all ``` -which will produce a binary named sam_ba_Generic_x21J_SAMD21J18A.bin +which will produce a binary named sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin + + +## Possible Future Additions/Changes + +* IP Protection / Security options (control/eliminate direct register access, applet loading/executing, and reading/checksumming of flash contents) +* Variable bootloader sizes for each chip ## Technical Details +**Arduino IDE Auto-Reset** + +When the Arduino IDE initiates the bootloader, the following procedure is used: + +1. The IDE opens and closes the USB serial port at a baud rate of 1200bps. This triggers a “soft erase†procedure. +2. The first row of application section flash memory is erased by the MCU. If it is interrupted for any reason, the erase procedure will likely fail. +3. The board is reset. The bootloader (which always runs first) detects the blank flah row, so bootloader operation resumes. +4. Opening and closing the port at a baud rate other than 1200bps will not erase or reset the SAM M0+. + +**Boot Condition Test Sequence** + +First, the start location of the sketch is fetched and checked. If it +is empty (0xFFFFFFFF), then bootloader execution is resumed. Note that +when Arduino auto-reset (into bootloader) is initiated, the first flash +row is erased, so the bootloader will always run after reset until a +new sketch is transferred. Next, it checks for the double-tap reset +condition. Then, it checks the boot pin state (after a 10ms delay to +allow debounce capacitor charging). If no bootloader entry condition +is present, it jumps to the application and starts execution from there. + **Pinmap** The following pins are used by the program : @@ -254,3 +724,37 @@ of the system stack. The applet in this case is a very simple word copy function 1KB is reserved for the applet, and there are two 64 byte data buffers placed after it. The applet has its own stack at the top of RAM, but the word copy applet uses little/none of this. The bossac tool is responsible for loading the applet. See Devices.h from the Bossa source. + + +## License + +Copyright (c) 2015 Arduino LLC. All right reserved. +Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. +Copyright (c) 2017 MattairTech 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 + +### Petit FatFS + +Petit FatFs module is an open source software to implement FAT file system to +small embedded systems. This is a free software and is opened for education, +research and commercial developments under license policy of following trems. + +Copyright (C) 2014, ChaN, all right reserved. + +* The Petit FatFs module is a free software and there is NO WARRANTY. +* No restriction on use. You can use, modify and redistribute it for + personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY. +* Redistributions of source code must retain the above copyright notice. diff --git a/bootloaders/zero/SDCard/00readme.txt b/bootloaders/zero/SDCard/00readme.txt new file mode 100644 index 000000000..974a17bca --- /dev/null +++ b/bootloaders/zero/SDCard/00readme.txt @@ -0,0 +1,46 @@ +Petit FatFs Module Source Files R0.03 (C)ChaN, 2014 + + +FILES + + pff.h Common include file for Petit FatFs and application module. + pff.c Petit FatFs module. + diskio.h Common include file for Petit FatFs and disk I/O module. + diskio.c Skeleton of low level disk I/O module. + integer.h Alternative type definitions for integer variables. + + Low level disk I/O module is not included in this archive because the Petit + FatFs module is only a generic file system layer and not depend on any + specific storage device. You have to provide a low level disk I/O module that + written to control your storage device. + + + +AGREEMENTS + + Petit FatFs module is an open source software to implement FAT file system to + small embedded systems. This is a free software and is opened for education, + research and commercial developments under license policy of following trems. + + Copyright (C) 2014, ChaN, all right reserved. + + * The Petit FatFs module is a free software and there is NO WARRANTY. + * No restriction on use. You can use, modify and redistribute it for + personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY. + * Redistributions of source code must retain the above copyright notice. + + + +REVISION HISTORY + + Jun 15, 2009 R0.01a First release (Branched from FatFs R0.07b) + + Dec 14, 2009 R0.02 Added multiple code page support. + Added write funciton. + Changed stream read mode interface. + Dec 07,'2010 R0.02a Added some configuration options. + Fixed fails to open objects with DBCS character. + + Jun 10, 2014 R0.03 Separated out configuration options to pffconf.h. + Added _USE_LCC option. + Added _FS_FAT16 option. diff --git a/bootloaders/zero/SDCard/diskio.h b/bootloaders/zero/SDCard/diskio.h new file mode 100644 index 000000000..2505d506d --- /dev/null +++ b/bootloaders/zero/SDCard/diskio.h @@ -0,0 +1,92 @@ +/*----------------------------------------------------------------------- +/ PFF - Low level disk interface modlue include file (C)ChaN, 2014 +/-----------------------------------------------------------------------*/ + +#ifndef _DISKIO_DEFINED +#define _DISKIO_DEFINED + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "integer.h" + + +/* Status of Disk Functions */ +typedef BYTE DSTATUS; + + +/* Results of Disk Functions */ +typedef enum { + RES_OK = 0, /* 0: Function succeeded */ + RES_ERROR, /* 1: Disk error */ + RES_NOTRDY, /* 2: Not ready */ + RES_PARERR /* 3: Invalid parameter */ +} DRESULT; + + +/* SERCOM SPI available pad settings */ +enum spi_pad_settings { + SPI_RX_PAD0_TX_PAD2_SCK_PAD3 = SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(1), + SPI_RX_PAD0_TX_PAD3_SCK_PAD1 = SERCOM_SPI_CTRLA_DIPO(0) | SERCOM_SPI_CTRLA_DOPO(2), + SPI_RX_PAD1_TX_PAD2_SCK_PAD3 = SERCOM_SPI_CTRLA_DIPO(1) | SERCOM_SPI_CTRLA_DOPO(1), + SPI_RX_PAD1_TX_PAD0_SCK_PAD3 = SERCOM_SPI_CTRLA_DIPO(1) | SERCOM_SPI_CTRLA_DOPO(3), + SPI_RX_PAD2_TX_PAD0_SCK_PAD1 = SERCOM_SPI_CTRLA_DIPO(2) | SERCOM_SPI_CTRLA_DOPO(0), + SPI_RX_PAD2_TX_PAD3_SCK_PAD1 = SERCOM_SPI_CTRLA_DIPO(2) | SERCOM_SPI_CTRLA_DOPO(2), + SPI_RX_PAD2_TX_PAD0_SCK_PAD3 = SERCOM_SPI_CTRLA_DIPO(2) | SERCOM_SPI_CTRLA_DOPO(3), + SPI_RX_PAD3_TX_PAD0_SCK_PAD1 = SERCOM_SPI_CTRLA_DIPO(3) | SERCOM_SPI_CTRLA_DOPO(0), +}; + + +/*---------------------------------------*/ +/* Prototypes for disk control functions */ + +DSTATUS disk_initialize (void); +DRESULT disk_readp (BYTE* buff, DWORD sector, UINT offser, UINT count); +DRESULT disk_writep (const BYTE* buff, DWORD sc); + +#define DUMMY_BYTE 0xFF + +#define STA_NOINIT 0x01 /* Drive not initialized */ +#define STA_NODISK 0x02 /* No medium in the drive */ + +/* Card type flags (CardType) */ +#define CT_MMC 0x01 /* MMC ver 3 */ +#define CT_SD1 0x02 /* SD ver 1 */ +#define CT_SD2 0x04 /* SD ver 2 */ +#define CT_SDC (CT_SD1|CT_SD2) /* SD */ +#define CT_BLOCK 0x08 /* Block addressing */ + +/* Definitions for MMC/SDC command */ +#define CMD0 (0x40+0) /* GO_IDLE_STATE */ +#define CMD1 (0x40+1) /* SEND_OP_COND (MMC) */ +#define ACMD41 (0xC0+41) /* SEND_OP_COND (SDC) */ +#define CMD8 (0x40+8) /* SEND_IF_COND */ +#define CMD16 (0x40+16) /* SET_BLOCKLEN */ +#define CMD17 (0x40+17) /* READ_SINGLE_BLOCK */ +#define CMD24 (0x40+24) /* WRITE_BLOCK */ +#define CMD55 (0x40+55) /* APP_CMD */ +#define CMD58 (0x40+58) /* READ_OCR */ + +#define SERCOM_MODE_USART_EXT_CLK_Val 0x0ul +#define SERCOM_MODE_USART_INT_CLK_Val 0x1ul +#define SERCOM_MODE_SPI_SLAVE_Val 0x2ul +#define SERCOM_MODE_SPI_MASTER_Val 0x3ul +#define SERCOM_MODE_I2C_SLAVE_Val 0x4ul +#define SERCOM_MODE_I2C_MASTER_Val 0x5ul + +#define SERCOM_DORD_MSB_FIRST_Val 0x0ul +#define SERCOM_DORD_LSB_FIRST_Val 0x1ul + +#define SERCOM_CHAR_SIZE_8_BITS_Val 0x0ul +#define SERCOM_CHAR_SIZE_9_BITS_Val 0x1ul + +#define SDCARD_SPI_BUAD_SLOW 250000ul +#define SDCARD_SPI_BUAD_FAST 6000000ul + +#ifdef __cplusplus +} +#endif + +#endif /* _DISKIO_DEFINED */ diff --git a/bootloaders/zero/SDCard/integer.h b/bootloaders/zero/SDCard/integer.h new file mode 100644 index 000000000..074a46bd5 --- /dev/null +++ b/bootloaders/zero/SDCard/integer.h @@ -0,0 +1,33 @@ +/*-------------------------------------------*/ +/* Integer type definitions for FatFs module */ +/*-------------------------------------------*/ + +#ifndef _FF_INTEGER +#define _FF_INTEGER + +#ifdef _WIN32 /* FatFs development platform */ + +#include +#include + +#else /* Embedded platform */ + +/* This type MUST be 8 bit */ +typedef unsigned char BYTE; + +/* These types MUST be 16 bit */ +typedef short SHORT; +typedef unsigned short WORD; +typedef unsigned short WCHAR; + +/* These types MUST be 16 bit or 32 bit */ +typedef int INT; +typedef unsigned int UINT; + +/* These types MUST be 32 bit */ +typedef long LONG; +typedef unsigned long DWORD; + +#endif + +#endif diff --git a/bootloaders/zero/SDCard/mmcbbp.c b/bootloaders/zero/SDCard/mmcbbp.c new file mode 100644 index 000000000..90c17fccf --- /dev/null +++ b/bootloaders/zero/SDCard/mmcbbp.c @@ -0,0 +1,277 @@ +/*-----------------------------------------------------------------------/ +/ PFF - Generic low level disk control module (C)ChaN, 2014 +/------------------------------------------------------------------------/ +/ +/ Copyright (C) 2014, ChaN, all right reserved. +/ Copyright (c) 2017 MattairTech LLC. All right reserved. +/ +/ * This software is a free software and there is NO WARRANTY. +/ * No restriction on use. You can use, modify and redistribute it for +/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. +/ * Redistributions of source code must retain the above copyright notice. +/-----------------------------------------------------------------------*/ + +#include +#include "pff.h" +#include "../board_definitions.h" +#include "diskio.h" +#include "../util.h" + + +/*-------------------------------------------------------------------------- + + Module Private Functions + +---------------------------------------------------------------------------*/ + +static +BYTE CardType; + +/* Set sd card baud rate */ +void setBaud (uint32_t baud) +{ + SDCARD_SPI_MODULE->SPI.CTRLA.bit.ENABLE = 0; + while(SDCARD_SPI_MODULE->SPI.SYNCBUSY.bit.ENABLE); + + //Synchronous arithmetic + SDCARD_SPI_MODULE->SPI.BAUD.reg = ((VARIANT_MCK / (2 * baud)) - 1); + + + SDCARD_SPI_MODULE->SPI.CTRLA.bit.ENABLE = 1; + while(SDCARD_SPI_MODULE->SPI.SYNCBUSY.bit.ENABLE); +} + +/* Initialize SPI port */ +inline void init_spi (void) +{ + // Attach pins to peripheral through peripheral multiplexer + pinMux(SDCARD_SPI_PAD0); + pinMux(SDCARD_SPI_PAD1); + pinMux(SDCARD_SPI_PAD2); + pinMux(SDCARD_SPI_PAD3); + + // Configure chip select pin + pinConfig(SDCARD_SPI_CS_PORT, SDCARD_SPI_CS_PIN, OUTPUT_HIGH); + + // +#if (SAMD21 || SAMD11) + PM->APBCMASK.reg |= SDCARD_SPI_BUS_CLOCK_INDEX; +#elif (SAML21) + MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 ; + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM5; // On the SAML, SERCOM5 is on the low power bridge +#elif (SAMC21) + #if (SAMC21E) + MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 ; + #elif (SAMC21G) || (SAMC21J) + MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 | MCLK_APBCMASK_SERCOM5 ; + #endif +#else + #error "mmcbbp.c: Unsupported microcontroller" +#endif + + // Reset +#if defined(PARANOIA) + SDCARD_SPI_MODULE->SPI.CTRLA.bit.SWRST = 1; + while(SDCARD_SPI_MODULE->SPI.CTRLA.bit.SWRST || SDCARD_SPI_MODULE->SPI.SYNCBUSY.bit.SWRST); +#endif + + // Setting clock +#if (SAMD21 || SAMD11) + GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( SDCARD_SPI_PER_CLOCK_INDEX ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); + waitForSync(); +#elif (SAML21 || SAMC21) + GCLK->PCHCTRL[SDCARD_SPI_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + waitForSync(); +#else + #error "mmcbbp.c: Unsupported microcontroller" +#endif + + SDCARD_SPI_MODULE->SPI.CTRLA.reg = SERCOM_SPI_CTRLA_MODE(SERCOM_MODE_SPI_MASTER_Val) | + ( 0 << SERCOM_SPI_CTRLA_CPHA_Pos ) | + ( 0 << SERCOM_SPI_CTRLA_CPOL_Pos ) | + SDCARD_SPI_PAD_SETTINGS | + SERCOM_DORD_MSB_FIRST_Val << SERCOM_SPI_CTRLA_DORD_Pos; + + SDCARD_SPI_MODULE->SPI.CTRLB.reg = SERCOM_SPI_CTRLB_CHSIZE(SERCOM_CHAR_SIZE_8_BITS_Val) | + SERCOM_SPI_CTRLB_RXEN; //Active the SPI receiver. + + setBaud (SDCARD_SPI_BUAD_SLOW); // also enables SPI peripheral +} + +/* Select MMC */ +void deselect (void) +{ + pinConfig(SDCARD_SPI_CS_PORT, SDCARD_SPI_CS_PIN, OUTPUT_HIGH); +} + +/* Deselect MMC */ +inline void select (void) +{ + pinConfig(SDCARD_SPI_CS_PORT, SDCARD_SPI_CS_PIN, OUTPUT_LOW); +} + +/* Send a byte to the MMC or send a 0xFF to the MMC and get the received byte */ +BYTE xfer_spi (BYTE data) +{ + SDCARD_SPI_MODULE->SPI.DATA.bit.DATA = data; // Writing data into Data register + + while( SDCARD_SPI_MODULE->SPI.INTFLAG.bit.RXC == 0 ) + { + // Waiting Complete Reception + } + + return SDCARD_SPI_MODULE->SPI.DATA.bit.DATA; // Reading data +} + + +/*-----------------------------------------------------------------------*/ +/* Send a command packet to MMC */ +/*-----------------------------------------------------------------------*/ + +static +BYTE send_cmd ( + BYTE cmd, /* 1st byte (Start + Index) */ + DWORD arg /* Argument (32 bits) */ +) +{ + BYTE n, res; + + + if (cmd & 0x80) { /* ACMD is the command sequense of CMD55-CMD */ + cmd &= 0x7F; + res = send_cmd(CMD55, 0); + if (res > 1) return res; + } + + /* Select the card */ + select(); + + /* Send a command packet */ + xfer_spi(cmd); /* Start + Command index */ + xfer_spi((BYTE)(arg >> 24)); /* Argument[31..24] */ + xfer_spi((BYTE)(arg >> 16)); /* Argument[23..16] */ + xfer_spi((BYTE)(arg >> 8)); /* Argument[15..8] */ + xfer_spi((BYTE)arg); /* Argument[7..0] */ + n = 0x01; /* Dummy CRC + Stop */ + if (cmd == CMD0) n = 0x95; /* Valid CRC for CMD0(0) */ + if (cmd == CMD8) n = 0x87; /* Valid CRC for CMD8(0x1AA) */ + xfer_spi(n); + + /* Receive a command response */ + n = 10; /* Wait for a valid response in timeout of 10 attempts */ + do { + res = xfer_spi(DUMMY_BYTE); + } while ((res & 0x80) && --n); + + return res; /* Return with the response value */ +} + + + + +/*-------------------------------------------------------------------------- + + Public Functions + +---------------------------------------------------------------------------*/ + +/*-----------------------------------------------------------------------*/ +/* Initialize Disk Drive */ +/*-----------------------------------------------------------------------*/ + +DSTATUS disk_initialize (void) +{ + BYTE n, cmd, ty, ocr[4]; + UINT tmr; + + deselect(); + init_spi(); /* Initialize ports to control MMC */ + for (n = 100; n; n--) delayUs(1000); /* 1ms delay */ + for (n = 10; n; n--) xfer_spi(DUMMY_BYTE); /* 80 Dummy clocks with CS=H */ + + ty = 0; + if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */ + if (send_cmd(CMD8, 0x1AA) == 1) { /* SDv2 */ + for (n = 0; n < 4; n++) ocr[n] = xfer_spi(DUMMY_BYTE); /* Get trailing return value of R7 resp */ + if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */ + for (tmr = 10000; tmr && send_cmd(ACMD41, 1UL << 30); tmr--) delayUs(100); /* Wait for leaving idle state (ACMD41 with HCS bit) */ + if (tmr && send_cmd(CMD58, 0) == 0) { /* Check CCS bit in the OCR */ + for (n = 0; n < 4; n++) ocr[n] = xfer_spi(DUMMY_BYTE); + ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; /* SDv2 (HC or SC) */ + } + } + } else { /* SDv1 or MMCv3 */ + if (send_cmd(ACMD41, 0) <= 1) { + ty = CT_SD1; cmd = ACMD41; /* SDv1 */ + } else { + ty = CT_MMC; cmd = CMD1; /* MMCv3 */ + } + for (tmr = 10000; tmr && send_cmd(cmd, 0); tmr--) delayUs(100); /* Wait for leaving idle state */ + if (!tmr || send_cmd(CMD16, 512) != 0) /* Set R/W block length to 512 */ + ty = 0; + } + } + CardType = ty; + deselect(); + + if (ty) { /* OK */ + setBaud (SDCARD_SPI_BUAD_FAST); /* Set fast clock */ + } + + return ty ? 0 : STA_NOINIT; +} + + + +/*-----------------------------------------------------------------------*/ +/* Read partial sector */ +/*-----------------------------------------------------------------------*/ + +DRESULT disk_readp ( + BYTE *buff, /* Pointer to the read buffer (NULL:Read bytes are forwarded to the stream) */ + DWORD sector, /* Sector number (LBA) */ + UINT offset, /* Byte offset to read from (0..511) */ + UINT count /* Number of bytes to read (ofs + cnt mus be <= 512) */ +) +{ + DRESULT res; + BYTE rc; + UINT bc; + + + if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */ + + res = RES_ERROR; + if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */ + + bc = 40000; + do { /* Wait for data packet */ + rc = xfer_spi(DUMMY_BYTE); + } while (rc == 0xFF && --bc); + + if (rc == 0xFE) { /* A data packet arrived */ + bc = 514 - offset - count; + + /* Skip leading bytes */ + if (offset) { + do xfer_spi(DUMMY_BYTE); while (--offset); + } + + /* Receive a part of the sector */ + do { + *buff++ = xfer_spi(DUMMY_BYTE); + } while (--count); + + /* Skip trailing bytes and CRC */ + do xfer_spi(DUMMY_BYTE); while (--bc); + + res = RES_OK; + } + } + + deselect(); + + return res; +} + + diff --git a/bootloaders/zero/SDCard/pff.c b/bootloaders/zero/SDCard/pff.c new file mode 100644 index 000000000..f8f6329c7 --- /dev/null +++ b/bootloaders/zero/SDCard/pff.c @@ -0,0 +1,1108 @@ +/*----------------------------------------------------------------------------/ +/ Petit FatFs - FAT file system module R0.03 (C)ChaN, 2014 +/-----------------------------------------------------------------------------/ +/ Petit FatFs module is a generic FAT file system module for small embedded +/ systems. This is a free software that opened for education, research and +/ commercial developments under license policy of following trems. +/ +/ Copyright (C) 2014, ChaN, all right reserved. +/ +/ * The Petit FatFs module is a free software and there is NO WARRANTY. +/ * No restriction on use. You can use, modify and redistribute it for +/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. +/ * Redistributions of source code must retain the above copyright notice. +/ +/-----------------------------------------------------------------------------/ +/ Jun 15,'09 R0.01a First release. +/ +/ Dec 14,'09 R0.02 Added multiple code page support. +/ Added write funciton. +/ Changed stream read mode interface. +/ Dec 07,'10 R0.02a Added some configuration options. +/ Fixed fails to open objects with DBCS character. + +/ Jun 10,'14 R0.03 Separated out configuration options to pffconf.h. +/ Added _USE_LCC option. +/ Added _FS_FAT16 option. +/----------------------------------------------------------------------------*/ + +#include "pff.h" /* Petit FatFs configurations and declarations */ +#include "diskio.h" /* Declarations of low level disk I/O functions */ + + + +/*-------------------------------------------------------------------------- + + Module Private Definitions + +---------------------------------------------------------------------------*/ + + +#if _PFATFS != 4004 /* Revision ID */ +#error Wrong include file (pff.h). +#endif + +#if _FS_FAT32 +#if !_FS_FAT16 && !_FS_FAT12 +#define _FS_32ONLY 1 +#else +#define _FS_32ONLY 0 +#endif +#else +#if !_FS_FAT16 && !_FS_FAT12 +#error Wrong _FS_FATxx setting. +#endif +#define _FS_32ONLY 0 +#endif + +#define ABORT(err) {fs->flag = 0; return err;} + + + +/*--------------------------------------------------------*/ +/* DBCS code ranges and SBCS extend char conversion table */ +/*--------------------------------------------------------*/ + +#if _CODE_PAGE == 932 /* Japanese Shift-JIS */ +#define _DF1S 0x81 /* DBC 1st byte range 1 start */ +#define _DF1E 0x9F /* DBC 1st byte range 1 end */ +#define _DF2S 0xE0 /* DBC 1st byte range 2 start */ +#define _DF2E 0xFC /* DBC 1st byte range 2 end */ +#define _DS1S 0x40 /* DBC 2nd byte range 1 start */ +#define _DS1E 0x7E /* DBC 2nd byte range 1 end */ +#define _DS2S 0x80 /* DBC 2nd byte range 2 start */ +#define _DS2E 0xFC /* DBC 2nd byte range 2 end */ + +#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ +#define _DF1S 0x81 +#define _DF1E 0xFE +#define _DS1S 0x40 +#define _DS1E 0x7E +#define _DS2S 0x80 +#define _DS2E 0xFE + +#elif _CODE_PAGE == 949 /* Korean */ +#define _DF1S 0x81 +#define _DF1E 0xFE +#define _DS1S 0x41 +#define _DS1E 0x5A +#define _DS2S 0x61 +#define _DS2E 0x7A +#define _DS3S 0x81 +#define _DS3E 0xFE + +#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ +#define _DF1S 0x81 +#define _DF1E 0xFE +#define _DS1S 0x40 +#define _DS1E 0x7E +#define _DS2S 0xA1 +#define _DS2E 0xFE + +#elif _CODE_PAGE == 437 /* U.S. (OEM) */ +#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ + 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0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,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} + +#elif _CODE_PAGE == 866 /* Russian (OEM) */ +#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ + 0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} + +#elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */ +#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA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F6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF} + +#elif _CODE_PAGE == 1257 /* Baltic (Windows) */ +#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \ + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF} + +#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */ +#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \ + 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \ + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F} + +#else +#error Unknown code page. + +#endif + + + +/* Character code support macros */ + +#define IsUpper(c) (((c)>='A')&&((c)<='Z')) +#define IsLower(c) (((c)>='a')&&((c)<='z')) + +#ifndef _EXCVT /* DBCS configuration */ + +#ifdef _DF2S /* Two 1st byte areas */ +#define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E)) +#else /* One 1st byte area */ +#define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) +#endif + +#ifdef _DS3S /* Three 2nd byte areas */ +#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E)) +#else /* Two 2nd byte areas */ +#define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E)) +#endif + +#else /* SBCS configuration */ + +#define IsDBCS1(c) 0 +#define IsDBCS2(c) 0 + +#endif /* _EXCVT */ + + +/* FatFs refers the members in the FAT structures with byte offset instead +/ of structure member because there are incompatibility of the packing option +/ between various compilers. */ + +#define BS_jmpBoot 0 +#define BS_OEMName 3 +#define BPB_BytsPerSec 11 +#define BPB_SecPerClus 13 +#define BPB_RsvdSecCnt 14 +#define BPB_NumFATs 16 +#define BPB_RootEntCnt 17 +#define BPB_TotSec16 19 +#define BPB_Media 21 +#define BPB_FATSz16 22 +#define BPB_SecPerTrk 24 +#define BPB_NumHeads 26 +#define BPB_HiddSec 28 +#define BPB_TotSec32 32 +#define BS_55AA 510 + +#define BS_DrvNum 36 +#define BS_BootSig 38 +#define BS_VolID 39 +#define BS_VolLab 43 +#define BS_FilSysType 54 + +#define BPB_FATSz32 36 +#define BPB_ExtFlags 40 +#define BPB_FSVer 42 +#define BPB_RootClus 44 +#define BPB_FSInfo 48 +#define BPB_BkBootSec 50 +#define BS_DrvNum32 64 +#define BS_BootSig32 66 +#define BS_VolID32 67 +#define BS_VolLab32 71 +#define BS_FilSysType32 82 + +#define MBR_Table 446 + +#define DIR_Name 0 +#define DIR_Attr 11 +#define DIR_NTres 12 +#define DIR_CrtTime 14 +#define DIR_CrtDate 16 +#define DIR_FstClusHI 20 +#define DIR_WrtTime 22 +#define DIR_WrtDate 24 +#define DIR_FstClusLO 26 +#define DIR_FileSize 28 + + + +/*-------------------------------------------------------------------------- + + Private Functions + +---------------------------------------------------------------------------*/ + + +static +FATFS *FatFs; /* Pointer to the file system object (logical drive) */ + + +/* Fill memory */ +static +void mem_set (void* dst, int val, int cnt) { + char *d = (char*)dst; + while (cnt--) *d++ = (char)val; +} + +/* Compare memory to memory */ +static +int mem_cmp (const void* dst, const void* src, int cnt) { + const char *d = (const char *)dst, *s = (const char *)src; + int r = 0; + while (cnt-- && (r = *d++ - *s++) == 0) ; + return r; +} + + + +/*-----------------------------------------------------------------------*/ +/* FAT access - Read value of a FAT entry */ +/*-----------------------------------------------------------------------*/ + +static +CLUST get_fat ( /* 1:IO error, Else:Cluster status */ + CLUST clst /* Cluster# to get the link information */ +) +{ + BYTE buf[4]; + FATFS *fs = FatFs; + + if (clst < 2 || clst >= fs->n_fatent) /* Range check */ + return 1; + + switch (fs->fs_type) { +#if _FS_FAT12 + case FS_FAT12 : { + UINT wc, bc, ofs; + + bc = (UINT)clst; bc += bc / 2; + ofs = bc % 512; bc /= 512; + if (ofs != 511) { + if (disk_readp(buf, fs->fatbase + bc, ofs, 2)) break; + } else { + if (disk_readp(buf, fs->fatbase + bc, 511, 1)) break; + if (disk_readp(buf+1, fs->fatbase + bc + 1, 0, 1)) break; + } + wc = LD_WORD(buf); + return (clst & 1) ? (wc >> 4) : (wc & 0xFFF); + } +#endif +#if _FS_FAT16 + case FS_FAT16 : + if (disk_readp(buf, fs->fatbase + clst / 256, ((UINT)clst % 256) * 2, 2)) break; + return LD_WORD(buf); +#endif +#if _FS_FAT32 + case FS_FAT32 : + if (disk_readp(buf, fs->fatbase + clst / 128, ((UINT)clst % 128) * 4, 4)) break; + return LD_DWORD(buf) & 0x0FFFFFFF; +#endif + } + + return 1; /* An error occured at the disk I/O layer */ +} + + + + +/*-----------------------------------------------------------------------*/ +/* Get sector# from cluster# / Get cluster field from directory entry */ +/*-----------------------------------------------------------------------*/ + +static +DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */ + CLUST clst /* Cluster# to be converted */ +) +{ + FATFS *fs = FatFs; + + + clst -= 2; + if (clst >= (fs->n_fatent - 2)) return 0; /* Invalid cluster# */ + return (DWORD)clst * fs->csize + fs->database; +} + + +static +CLUST get_clust ( + BYTE* dir /* Pointer to directory entry */ +) +{ + FATFS *fs = FatFs; + CLUST clst = 0; + + + if (_FS_32ONLY || (_FS_FAT32 && fs->fs_type == FS_FAT32)) { + clst = LD_WORD(dir+DIR_FstClusHI); + clst <<= 16; + } + clst |= LD_WORD(dir+DIR_FstClusLO); + + return clst; +} + + +/*-----------------------------------------------------------------------*/ +/* Directory handling - Rewind directory index */ +/*-----------------------------------------------------------------------*/ + +static +FRESULT dir_rewind ( + DIR *dj /* Pointer to directory object */ +) +{ + CLUST clst; + FATFS *fs = FatFs; + + + dj->index = 0; + clst = dj->sclust; + if (clst == 1 || clst >= fs->n_fatent) /* Check start cluster range */ + return FR_DISK_ERR; + if (_FS_FAT32 && !clst && (_FS_32ONLY || fs->fs_type == FS_FAT32)) /* Replace cluster# 0 with root cluster# if in FAT32 */ + clst = (CLUST)fs->dirbase; + dj->clust = clst; /* Current cluster */ + dj->sect = (_FS_32ONLY || clst) ? clust2sect(clst) : fs->dirbase; /* Current sector */ + + return FR_OK; /* Seek succeeded */ +} + + + + +/*-----------------------------------------------------------------------*/ +/* Directory handling - Move directory index next */ +/*-----------------------------------------------------------------------*/ + +static +FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table */ + DIR *dj /* Pointer to directory object */ +) +{ + CLUST clst; + WORD i; + FATFS *fs = FatFs; + + + i = dj->index + 1; + if (!i || !dj->sect) /* Report EOT when index has reached 65535 */ + return FR_NO_FILE; + + if (!(i % 16)) { /* Sector changed? */ + dj->sect++; /* Next sector */ + + if (dj->clust == 0) { /* Static table */ + if (i >= fs->n_rootdir) /* Report EOT when end of table */ + return FR_NO_FILE; + } + else { /* Dynamic table */ + if (((i / 16) & (fs->csize - 1)) == 0) { /* Cluster changed? */ + clst = get_fat(dj->clust); /* Get next cluster */ + if (clst <= 1) return FR_DISK_ERR; + if (clst >= fs->n_fatent) /* When it reached end of dynamic table */ + return FR_NO_FILE; /* Report EOT */ + dj->clust = clst; /* Initialize data for new cluster */ + dj->sect = clust2sect(clst); + } + } + } + + dj->index = i; + + return FR_OK; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Directory handling - Find an object in the directory */ +/*-----------------------------------------------------------------------*/ + +static +FRESULT dir_find ( + DIR *dj, /* Pointer to the directory object linked to the file name */ + BYTE *dir /* 32-byte working buffer */ +) +{ + FRESULT res; + BYTE c; + + + res = dir_rewind(dj); /* Rewind directory object */ + if (res != FR_OK) return res; + + do { + res = disk_readp(dir, dj->sect, (dj->index % 16) * 32, 32) /* Read an entry */ + ? FR_DISK_ERR : FR_OK; + if (res != FR_OK) break; + c = dir[DIR_Name]; /* First character */ + if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */ + if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */ + break; + res = dir_next(dj); /* Next entry */ + } while (res == FR_OK); + + return res; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Read an object from the directory */ +/*-----------------------------------------------------------------------*/ +#if _USE_DIR +static +FRESULT dir_read ( + DIR *dj, /* Pointer to the directory object to store read object name */ + BYTE *dir /* 32-byte working buffer */ +) +{ + FRESULT res; + BYTE a, c; + + + res = FR_NO_FILE; + while (dj->sect) { + res = disk_readp(dir, dj->sect, (dj->index % 16) * 32, 32) /* Read an entry */ + ? FR_DISK_ERR : FR_OK; + if (res != FR_OK) break; + c = dir[DIR_Name]; + if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */ + a = dir[DIR_Attr] & AM_MASK; + if (c != 0xE5 && c != '.' && !(a & AM_VOL)) /* Is it a valid entry? */ + break; + res = dir_next(dj); /* Next entry */ + if (res != FR_OK) break; + } + + if (res != FR_OK) dj->sect = 0; + + return res; +} +#endif + + + +/*-----------------------------------------------------------------------*/ +/* Pick a segment and create the object name in directory form */ +/*-----------------------------------------------------------------------*/ + + +static +FRESULT create_name ( + DIR *dj, /* Pointer to the directory object */ + const char **path /* Pointer to pointer to the segment in the path string */ +) +{ + BYTE c, ni, si, i, *sfn; + const char *p; +#if _USE_LCC +#ifdef _EXCVT + static const BYTE cvt[] = _EXCVT; +#endif +#endif + + /* Create file name in directory form */ + sfn = dj->fn; + mem_set(sfn, ' ', 11); + si = i = 0; ni = 8; + p = *path; + for (;;) { + c = p[si++]; + if (c <= ' ' || c == '/') break; /* Break on end of segment */ + if (c == '.' || i >= ni) { + if (ni != 8 || c != '.') break; + i = 8; ni = 11; + continue; + } +#if _USE_LCC +#ifdef _EXCVT + if (c >= 0x80) /* To upper extended char (SBCS) */ + c = cvt[c - 0x80]; +#endif + if (IsDBCS1(c) && i < ni - 1) { /* DBC 1st byte? */ + BYTE d = p[si++]; /* Get 2nd byte */ + sfn[i++] = c; + sfn[i++] = d; + } else +#endif + { /* Single byte code */ + if (_USE_LCC && IsLower(c)) c -= 0x20; /* toupper */ + sfn[i++] = c; + } + } + *path = &p[si]; /* Rerurn pointer to the next segment */ + + sfn[11] = (c <= ' ') ? 1 : 0; /* Set last segment flag if end of path */ + + return FR_OK; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Get file information from directory entry */ +/*-----------------------------------------------------------------------*/ +#if _USE_DIR +static +void get_fileinfo ( /* No return code */ + DIR *dj, /* Pointer to the directory object */ + BYTE *dir, /* 32-byte working buffer */ + FILINFO *fno /* Pointer to store the file information */ +) +{ + BYTE i, c; + char *p; + + + p = fno->fname; + if (dj->sect) { + for (i = 0; i < 8; i++) { /* Copy file name body */ + c = dir[i]; + if (c == ' ') break; + if (c == 0x05) c = 0xE5; + *p++ = c; + } + if (dir[8] != ' ') { /* Copy file name extension */ + *p++ = '.'; + for (i = 8; i < 11; i++) { + c = dir[i]; + if (c == ' ') break; + *p++ = c; + } + } + fno->fattrib = dir[DIR_Attr]; /* Attribute */ + fno->fsize = LD_DWORD(dir+DIR_FileSize); /* Size */ + fno->fdate = LD_WORD(dir+DIR_WrtDate); /* Date */ + fno->ftime = LD_WORD(dir+DIR_WrtTime); /* Time */ + } + *p = 0; +} +#endif /* _USE_DIR */ + + + +/*-----------------------------------------------------------------------*/ +/* Follow a file path */ +/*-----------------------------------------------------------------------*/ + +static +FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */ + DIR *dj, /* Directory object to return last directory and found object */ + BYTE *dir, /* 32-byte working buffer */ + const char *path /* Full-path string to find a file or directory */ +) +{ + FRESULT res; + + + while (*path == ' ') path++; /* Strip leading spaces */ + if (*path == '/') path++; /* Strip heading separator if exist */ + dj->sclust = 0; /* Set start directory (always root dir) */ + + if ((BYTE)*path < ' ') { /* Null path means the root directory */ + res = dir_rewind(dj); + dir[0] = 0; + + } else { /* Follow path */ + for (;;) { + res = create_name(dj, &path); /* Get a segment */ + if (res != FR_OK) break; + res = dir_find(dj, dir); /* Find it */ + if (res != FR_OK) break; /* Could not find the object */ + if (dj->fn[11]) break; /* Last segment match. Function completed. */ + if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow path because it is a file */ + res = FR_NO_FILE; break; + } + dj->sclust = get_clust(dir); /* Follow next */ + } + } + + return res; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Check a sector if it is an FAT boot record */ +/*-----------------------------------------------------------------------*/ + +static +BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */ + BYTE *buf, /* Working buffer */ + DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */ +) +{ + if (disk_readp(buf, sect, 510, 2)) /* Read the boot record */ + return 3; + if (LD_WORD(buf) != 0xAA55) /* Check record signature */ + return 2; + + if (!_FS_32ONLY && !disk_readp(buf, sect, BS_FilSysType, 2) && LD_WORD(buf) == 0x4146) /* Check FAT12/16 */ + return 0; + if (_FS_FAT32 && !disk_readp(buf, sect, BS_FilSysType32, 2) && LD_WORD(buf) == 0x4146) /* Check FAT32 */ + return 0; + return 1; +} + + + + +/*-------------------------------------------------------------------------- + + Public Functions + +--------------------------------------------------------------------------*/ + + + +/*-----------------------------------------------------------------------*/ +/* Mount/Unmount a Locical Drive */ +/*-----------------------------------------------------------------------*/ + +FRESULT pf_mount ( + FATFS *fs /* Pointer to new file system object */ +) +{ + BYTE fmt, buf[36]; + DWORD bsect, fsize, tsect, mclst; + + + FatFs = 0; + + if (disk_initialize() & STA_NOINIT) /* Check if the drive is ready or not */ + return FR_NOT_READY; + + /* Search FAT partition on the drive */ + bsect = 0; + fmt = check_fs(buf, bsect); /* Check sector 0 as an SFD format */ + if (fmt == 1) { /* Not an FAT boot record, it may be FDISK format */ + /* Check a partition listed in top of the partition table */ + if (disk_readp(buf, bsect, MBR_Table, 16)) { /* 1st partition entry */ + fmt = 3; + } else { + if (buf[4]) { /* Is the partition existing? */ + bsect = LD_DWORD(&buf[8]); /* Partition offset in LBA */ + fmt = check_fs(buf, bsect); /* Check the partition */ + } + } + } + if (fmt == 3) return FR_DISK_ERR; + if (fmt) return FR_NO_FILESYSTEM; /* No valid FAT patition is found */ + + /* Initialize the file system object */ + if (disk_readp(buf, bsect, 13, sizeof (buf))) return FR_DISK_ERR; + + fsize = LD_WORD(buf+BPB_FATSz16-13); /* Number of sectors per FAT */ + if (!fsize) fsize = LD_DWORD(buf+BPB_FATSz32-13); + + fsize *= buf[BPB_NumFATs-13]; /* Number of sectors in FAT area */ + fs->fatbase = bsect + LD_WORD(buf+BPB_RsvdSecCnt-13); /* FAT start sector (lba) */ + fs->csize = buf[BPB_SecPerClus-13]; /* Number of sectors per cluster */ + fs->n_rootdir = LD_WORD(buf+BPB_RootEntCnt-13); /* Nmuber of root directory entries */ + tsect = LD_WORD(buf+BPB_TotSec16-13); /* Number of sectors on the file system */ + if (!tsect) tsect = LD_DWORD(buf+BPB_TotSec32-13); + mclst = (tsect /* Last cluster# + 1 */ + - LD_WORD(buf+BPB_RsvdSecCnt-13) - fsize - fs->n_rootdir / 16 + ) / fs->csize + 2; + fs->n_fatent = (CLUST)mclst; + + fmt = 0; /* Determine the FAT sub type */ + if (_FS_FAT12 && mclst < 0xFF7) + fmt = FS_FAT12; + if (_FS_FAT16 && mclst >= 0xFF8 && mclst < 0xFFF7) + fmt = FS_FAT16; + if (_FS_FAT32 && mclst >= 0xFFF7) + fmt = FS_FAT32; + if (!fmt) return FR_NO_FILESYSTEM; + fs->fs_type = fmt; + + if (_FS_32ONLY || (_FS_FAT32 && fmt == FS_FAT32)) + fs->dirbase = LD_DWORD(buf+(BPB_RootClus-13)); /* Root directory start cluster */ + else + fs->dirbase = fs->fatbase + fsize; /* Root directory start sector (lba) */ + fs->database = fs->fatbase + fsize + fs->n_rootdir / 16; /* Data start sector (lba) */ + + fs->flag = 0; + FatFs = fs; + + return FR_OK; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Open or Create a File */ +/*-----------------------------------------------------------------------*/ + +FRESULT pf_open ( + const char *path /* Pointer to the file name */ +) +{ + FRESULT res; + DIR dj; + BYTE sp[12], dir[32]; + FATFS *fs = FatFs; + + + if (!fs) return FR_NOT_ENABLED; /* Check file system */ + + fs->flag = 0; + dj.fn = sp; + res = follow_path(&dj, dir, path); /* Follow the file path */ + if (res != FR_OK) return res; /* Follow failed */ + if (!dir[0] || (dir[DIR_Attr] & AM_DIR)) /* It is a directory */ + return FR_NO_FILE; + + fs->org_clust = get_clust(dir); /* File start cluster */ + fs->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */ + fs->fptr = 0; /* File pointer */ + fs->flag = FA_OPENED; + + return FR_OK; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Read File */ +/*-----------------------------------------------------------------------*/ +#if _USE_READ + +FRESULT pf_read ( + void* buff, /* Pointer to the read buffer (NULL:Forward data to the stream)*/ + UINT btr, /* Number of bytes to read */ + UINT* br /* Pointer to number of bytes read */ +) +{ + DRESULT dr; + CLUST clst; + DWORD sect, remain; + UINT rcnt; + BYTE cs, *rbuff = buff; + FATFS *fs = FatFs; + + + *br = 0; + if (!fs) return FR_NOT_ENABLED; /* Check file system */ + if (!(fs->flag & FA_OPENED)) /* Check if opened */ + return FR_NOT_OPENED; + + remain = fs->fsize - fs->fptr; + if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */ + + while (btr) { /* Repeat until all data transferred */ + if ((fs->fptr % 512) == 0) { /* On the sector boundary? */ + cs = (BYTE)(fs->fptr / 512 & (fs->csize - 1)); /* Sector offset in the cluster */ + if (!cs) { /* On the cluster boundary? */ + if (fs->fptr == 0) /* On the top of the file? */ + clst = fs->org_clust; + else + clst = get_fat(fs->curr_clust); + if (clst <= 1) ABORT(FR_DISK_ERR); + fs->curr_clust = clst; /* Update current cluster */ + } + sect = clust2sect(fs->curr_clust); /* Get current sector */ + if (!sect) ABORT(FR_DISK_ERR); + fs->dsect = sect + cs; + } + rcnt = 512 - (UINT)fs->fptr % 512; /* Get partial sector data from sector buffer */ + if (rcnt > btr) rcnt = btr; + dr = disk_readp(!buff ? 0 : rbuff, fs->dsect, (UINT)fs->fptr % 512, rcnt); + if (dr) ABORT(FR_DISK_ERR); + fs->fptr += rcnt; rbuff += rcnt; /* Update pointers and counters */ + btr -= rcnt; *br += rcnt; + } + + return FR_OK; +} +#endif + + + +/*-----------------------------------------------------------------------*/ +/* Write File */ +/*-----------------------------------------------------------------------*/ +#if _USE_WRITE + +FRESULT pf_write ( + const void* buff, /* Pointer to the data to be written */ + UINT btw, /* Number of bytes to write (0:Finalize the current write operation) */ + UINT* bw /* Pointer to number of bytes written */ +) +{ + CLUST clst; + DWORD sect, remain; + const BYTE *p = buff; + BYTE cs; + UINT wcnt; + FATFS *fs = FatFs; + + + *bw = 0; + if (!fs) return FR_NOT_ENABLED; /* Check file system */ + if (!(fs->flag & FA_OPENED)) /* Check if opened */ + return FR_NOT_OPENED; + + if (!btw) { /* Finalize request */ + if ((fs->flag & FA__WIP) && disk_writep(0, 0)) ABORT(FR_DISK_ERR); + fs->flag &= ~FA__WIP; + return FR_OK; + } else { /* Write data request */ + if (!(fs->flag & FA__WIP)) /* Round-down fptr to the sector boundary */ + fs->fptr &= 0xFFFFFE00; + } + remain = fs->fsize - fs->fptr; + if (btw > remain) btw = (UINT)remain; /* Truncate btw by remaining bytes */ + + while (btw) { /* Repeat until all data transferred */ + if ((UINT)fs->fptr % 512 == 0) { /* On the sector boundary? */ + cs = (BYTE)(fs->fptr / 512 & (fs->csize - 1)); /* Sector offset in the cluster */ + if (!cs) { /* On the cluster boundary? */ + if (fs->fptr == 0) /* On the top of the file? */ + clst = fs->org_clust; + else + clst = get_fat(fs->curr_clust); + if (clst <= 1) ABORT(FR_DISK_ERR); + fs->curr_clust = clst; /* Update current cluster */ + } + sect = clust2sect(fs->curr_clust); /* Get current sector */ + if (!sect) ABORT(FR_DISK_ERR); + fs->dsect = sect + cs; + if (disk_writep(0, fs->dsect)) ABORT(FR_DISK_ERR); /* Initiate a sector write operation */ + fs->flag |= FA__WIP; + } + wcnt = 512 - (UINT)fs->fptr % 512; /* Number of bytes to write to the sector */ + if (wcnt > btw) wcnt = btw; + if (disk_writep(p, wcnt)) ABORT(FR_DISK_ERR); /* Send data to the sector */ + fs->fptr += wcnt; p += wcnt; /* Update pointers and counters */ + btw -= wcnt; *bw += wcnt; + if ((UINT)fs->fptr % 512 == 0) { + if (disk_writep(0, 0)) ABORT(FR_DISK_ERR); /* Finalize the currtent secter write operation */ + fs->flag &= ~FA__WIP; + } + } + + return FR_OK; +} +#endif + + + +/*-----------------------------------------------------------------------*/ +/* Seek File R/W Pointer */ +/*-----------------------------------------------------------------------*/ +#if _USE_LSEEK + +FRESULT pf_lseek ( + DWORD ofs /* File pointer from top of file */ +) +{ + CLUST clst; + DWORD bcs, sect, ifptr; + FATFS *fs = FatFs; + + + if (!fs) return FR_NOT_ENABLED; /* Check file system */ + if (!(fs->flag & FA_OPENED)) /* Check if opened */ + return FR_NOT_OPENED; + + if (ofs > fs->fsize) ofs = fs->fsize; /* Clip offset with the file size */ + ifptr = fs->fptr; + fs->fptr = 0; + if (ofs > 0) { + bcs = (DWORD)fs->csize * 512; /* Cluster size (byte) */ + if (ifptr > 0 && + (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */ + fs->fptr = (ifptr - 1) & ~(bcs - 1); /* start from the current cluster */ + ofs -= fs->fptr; + clst = fs->curr_clust; + } else { /* When seek to back cluster, */ + clst = fs->org_clust; /* start from the first cluster */ + fs->curr_clust = clst; + } + while (ofs > bcs) { /* Cluster following loop */ + clst = get_fat(clst); /* Follow cluster chain */ + if (clst <= 1 || clst >= fs->n_fatent) ABORT(FR_DISK_ERR); + fs->curr_clust = clst; + fs->fptr += bcs; + ofs -= bcs; + } + fs->fptr += ofs; + sect = clust2sect(clst); /* Current sector */ + if (!sect) ABORT(FR_DISK_ERR); + fs->dsect = sect + (fs->fptr / 512 & (fs->csize - 1)); + } + + return FR_OK; +} +#endif + + + +/*-----------------------------------------------------------------------*/ +/* Create a Directroy Object */ +/*-----------------------------------------------------------------------*/ +#if _USE_DIR + +FRESULT pf_opendir ( + DIR *dj, /* Pointer to directory object to create */ + const char *path /* Pointer to the directory path */ +) +{ + FRESULT res; + BYTE sp[12], dir[32]; + FATFS *fs = FatFs; + + + if (!fs) { /* Check file system */ + res = FR_NOT_ENABLED; + } else { + dj->fn = sp; + res = follow_path(dj, dir, path); /* Follow the path to the directory */ + if (res == FR_OK) { /* Follow completed */ + if (dir[0]) { /* It is not the root dir */ + if (dir[DIR_Attr] & AM_DIR) /* The object is a directory */ + dj->sclust = get_clust(dir); + else /* The object is not a directory */ + res = FR_NO_FILE; + } + if (res == FR_OK) + res = dir_rewind(dj); /* Rewind dir */ + } + } + + return res; +} + + + + +/*-----------------------------------------------------------------------*/ +/* Read Directory Entry in Sequense */ +/*-----------------------------------------------------------------------*/ + +FRESULT pf_readdir ( + DIR *dj, /* Pointer to the open directory object */ + FILINFO *fno /* Pointer to file information to return */ +) +{ + FRESULT res; + BYTE sp[12], dir[32]; + FATFS *fs = FatFs; + + + if (!fs) { /* Check file system */ + res = FR_NOT_ENABLED; + } else { + dj->fn = sp; + if (!fno) { + res = dir_rewind(dj); + } else { + res = dir_read(dj, dir); /* Get current directory item */ + if (res == FR_NO_FILE) res = FR_OK; + if (res == FR_OK) { /* A valid entry is found */ + get_fileinfo(dj, dir, fno); /* Get the object information */ + res = dir_next(dj); /* Increment read index for next */ + if (res == FR_NO_FILE) res = FR_OK; + } + } + } + + return res; +} + +#endif /* _USE_DIR */ + diff --git a/bootloaders/zero/SDCard/pff.h b/bootloaders/zero/SDCard/pff.h new file mode 100644 index 000000000..76157d085 --- /dev/null +++ b/bootloaders/zero/SDCard/pff.h @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------/ +/ Petit FatFs - FAT file system module include file R0.03 (C)ChaN, 2014 +/----------------------------------------------------------------------------/ +/ Petit FatFs module is an open source software to implement FAT file system to +/ small embedded systems. This is a free software and is opened for education, +/ research and commercial developments under license policy of following trems. +/ +/ Copyright (C) 2014, ChaN, all right reserved. +/ +/ * The Petit FatFs module is a free software and there is NO WARRANTY. +/ * No restriction on use. You can use, modify and redistribute it for +/ personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY. +/ * Redistributions of source code must retain the above copyright notice. +/ +/----------------------------------------------------------------------------*/ + +#ifndef _PFATFS +#define _PFATFS 4004 /* Revision ID */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "integer.h" +#include "pffconf.h" + +#if _PFATFS != _PFFCONF +#error Wrong configuration file (pffconf.h). +#endif + +#if _FS_FAT32 +#define CLUST DWORD +#else +#define CLUST WORD +#endif + + +/* File system object structure */ + +typedef struct { + BYTE fs_type; /* FAT sub type */ + BYTE flag; /* File status flags */ + BYTE csize; /* Number of sectors per cluster */ + BYTE pad1; + WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */ + CLUST n_fatent; /* Number of FAT entries (= number of clusters + 2) */ + DWORD fatbase; /* FAT start sector */ + DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */ + DWORD database; /* Data start sector */ + DWORD fptr; /* File R/W pointer */ + DWORD fsize; /* File size */ + CLUST org_clust; /* File start cluster */ + CLUST curr_clust; /* File current cluster */ + DWORD dsect; /* File current data sector */ +} FATFS; + + + +/* Directory object structure */ + +typedef struct { + WORD index; /* Current read/write index number */ + BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */ + CLUST sclust; /* Table start cluster (0:Static table) */ + CLUST clust; /* Current cluster */ + DWORD sect; /* Current sector */ +} DIR; + + + +/* File status structure */ + +typedef struct { + DWORD fsize; /* File size */ + WORD fdate; /* Last modified date */ + WORD ftime; /* Last modified time */ + BYTE fattrib; /* Attribute */ + char fname[13]; /* File name */ +} FILINFO; + + + +/* File function return code (FRESULT) */ + +typedef enum { + FR_OK = 0, /* 0 */ + FR_DISK_ERR, /* 1 */ + FR_NOT_READY, /* 2 */ + FR_NO_FILE, /* 3 */ + FR_NOT_OPENED, /* 4 */ + FR_NOT_ENABLED, /* 5 */ + FR_NO_FILESYSTEM /* 6 */ +} FRESULT; + + + +/*--------------------------------------------------------------*/ +/* Petit FatFs module application interface */ + +FRESULT pf_mount (FATFS* fs); /* Mount/Unmount a logical drive */ +FRESULT pf_open (const char* path); /* Open a file */ +FRESULT pf_read (void* buff, UINT btr, UINT* br); /* Read data from the open file */ +FRESULT pf_write (const void* buff, UINT btw, UINT* bw); /* Write data to the open file */ +FRESULT pf_lseek (DWORD ofs); /* Move file pointer of the open file */ +FRESULT pf_opendir (DIR* dj, const char* path); /* Open a directory */ +FRESULT pf_readdir (DIR* dj, FILINFO* fno); /* Read a directory item from the open directory */ + + + +/*--------------------------------------------------------------*/ +/* Flags and offset address */ + +/* File status flag (FATFS.flag) */ + +#define FA_OPENED 0x01 +#define FA_WPRT 0x02 +#define FA__WIP 0x40 + + +/* FAT sub type (FATFS.fs_type) */ + +#define FS_FAT12 1 +#define FS_FAT16 2 +#define FS_FAT32 3 + + +/* File attribute bits for directory entry */ + +#define AM_RDO 0x01 /* Read only */ +#define AM_HID 0x02 /* Hidden */ +#define AM_SYS 0x04 /* System */ +#define AM_VOL 0x08 /* Volume label */ +#define AM_LFN 0x0F /* LFN entry */ +#define AM_DIR 0x10 /* Directory */ +#define AM_ARC 0x20 /* Archive */ +#define AM_MASK 0x3F /* Mask of defined bits */ + + +/*--------------------------------*/ +/* Multi-byte word access macros */ + +#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */ +#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr)) +#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr)) +#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val) +#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val) +#else /* Use byte-by-byte access to the FAT structure */ +#define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr)) +#define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr)) +#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8) +#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _PFATFS */ diff --git a/bootloaders/zero/SDCard/pffconf.h b/bootloaders/zero/SDCard/pffconf.h new file mode 100644 index 000000000..a5038506a --- /dev/null +++ b/bootloaders/zero/SDCard/pffconf.h @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------/ +/ Petit FatFs - Configuration file R0.03 (C)ChaN, 2014 +/---------------------------------------------------------------------------*/ + +#ifndef _PFFCONF +#define _PFFCONF 4004 /* Revision ID */ + +#include "../board_definitions.h" + +/*---------------------------------------------------------------------------/ +/ Function Configurations +/---------------------------------------------------------------------------*/ + +#define _USE_READ 1 /* Enable pf_read() function */ +#define _USE_DIR 0 /* Enable pf_opendir() and pf_readdir() function */ + +#if defined(SDCARD_VERIFICATION_DISABLED) +#define _USE_LSEEK 0 /* Enable pf_lseek() function */ +#else +#define _USE_LSEEK 1 /* Enable pf_lseek() function */ +#endif + +#define _USE_WRITE 0 /* Enable pf_write() function */ + +#define _FS_FAT12 0 /* Enable FAT12 */ +#define _FS_FAT16 1 /* Enable FAT16 */ +#define _FS_FAT32 1 /* Enable FAT32 */ + + +/*---------------------------------------------------------------------------/ +/ Locale and Namespace Configurations +/---------------------------------------------------------------------------*/ + +#define _USE_LCC 0 /* Allow lower case characters for path name */ + +#define _CODE_PAGE 437 +/* The _CODE_PAGE specifies the code page to be used on the target system. +/ SBCS code pages with _USE_LCC == 1 requiers a 128 byte of case conversion +/ table. This might occupy RAM on some platforms, e.g. avr-gcc. +/ When _USE_LCC == 0, _CODE_PAGE has no effect. +/ +/ 932 - Japanese Shift_JIS (DBCS, OEM, Windows) +/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows) +/ 949 - Korean (DBCS, OEM, Windows) +/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows) +/ 1250 - Central Europe (Windows) +/ 1251 - Cyrillic (Windows) +/ 1252 - Latin 1 (Windows) +/ 1253 - Greek (Windows) +/ 1254 - Turkish (Windows) +/ 1255 - Hebrew (Windows) +/ 1256 - Arabic (Windows) +/ 1257 - Baltic (Windows) +/ 1258 - Vietnam (OEM, Windows) +/ 437 - U.S. (OEM) +/ 720 - Arabic (OEM) +/ 737 - Greek (OEM) +/ 775 - Baltic (OEM) +/ 850 - Multilingual Latin 1 (OEM) +/ 858 - Multilingual Latin 1 + Euro (OEM) +/ 852 - Latin 2 (OEM) +/ 855 - Cyrillic (OEM) +/ 866 - Russian (OEM) +/ 857 - Turkish (OEM) +/ 862 - Hebrew (OEM) +/ 874 - Thai (OEM, Windows) +*/ + + +/*---------------------------------------------------------------------------/ +/ System Configurations +/---------------------------------------------------------------------------*/ + +#define _WORD_ACCESS 0 +/* The _WORD_ACCESS option is an only platform dependent option. It defines +/ which access method is used to the word data on the FAT volume. +/ +/ 0: Byte-by-byte access. Always compatible with all platforms. +/ 1: Word access. Do not choose this unless under both the following conditions. +/ +/ * Address misaligned memory access is always allowed for ALL instructions. +/ * Byte order on the memory is little-endian. +/ +/ If it is the case, _WORD_ACCESS can also be set to 1 to improve performance and +/ reduce code size. Following table shows an example of some processor types. +/ +/ ARM7TDMI 0 ColdFire 0 V850E 0 +/ Cortex-M3 0 Z80 0/1 V850ES 0/1 +/ Cortex-M0 0 RX600(LE) 0/1 TLCS-870 0/1 +/ AVR 0/1 RX600(BE) 0 TLCS-900 0/1 +/ AVR32 0 RL78 0 R32C 0 +/ PIC18 0/1 SH-2 0 M16C 0/1 +/ PIC24 0 H8S 0 MSP430 0 +/ PIC32 0 H8/300H 0 x86 0/1 +*/ + +#endif /* _PFFCONF */ diff --git a/bootloaders/zero/SDCard/sdBootloader.c b/bootloaders/zero/SDCard/sdBootloader.c new file mode 100644 index 000000000..d7a30f971 --- /dev/null +++ b/bootloaders/zero/SDCard/sdBootloader.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2017 MattairTech LLC. All right reserved. + * Copyright (C) 2014, ChaN, 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 + */ + +#include "sdBootloader.h" + +FATFS Fatfs; /* Petit-FatFs work area */ +BYTE Buff[FLASH_PAGE_SIZE]; /* Page data buffer */ + +char updateBin[] = "UPDATE.BIN"; +char update2Bin[] = "UPDATE2.BIN"; + +uint8_t sdBootloader (uint8_t mode) +{ + DWORD fa = APP_START; /* Flash address */ + UINT br; /* Bytes read */ + char * fileName; + + if (mode == SD_BOOTLOADER_MODE_UPDATE) { + fileName = updateBin; + } else { + fileName = update2Bin; + } + + if (pf_mount(&Fatfs) == FR_OK) { /* Initialize file system */ + if (pf_open(fileName) == FR_OK) { /* Open application file */ +#if !defined(SDCARD_VERIFICATION_DISABLED) + // Check if installed binary already matches file + if (flashVerify()) { + #if defined(SDCARD_AUTORUN_DISABLED) + LED_status(LED_STATUS_FILE_ALREADY_MATCHES); + #else + systemReset(); // software reset, then execute flash + #endif + } + pf_lseek(0); +#endif + + flashErase(fa); // erase entire FLASH beyond bootloader + + do { + memset(Buff, 0xFF, FLASH_PAGE_SIZE); /* Clear buffer */ + pf_read(Buff, FLASH_PAGE_SIZE, &br); /* Load a page data */ + if (br) { + if (fa >= FLASH_SIZE) { + flashErase(APP_START); // erase entire FLASH beyond bootloader + LED_status(LED_STATUS_FILE_TOO_LARGE); + } else { + flashWrite(br, (uint32_t *)Buff, (uint32_t *)fa); + } + } + fa += FLASH_PAGE_SIZE; + } while (br); + +#if !defined(SDCARD_VERIFICATION_DISABLED) + // Verification + if (!flashVerify()) { + flashErase(APP_START); // erase entire FLASH beyond bootloader + LED_status(LED_STATUS_VERIFICATION_FAILURE); + } +#endif + +#if defined(SDCARD_AUTORUN_DISABLED) + LED_status(LED_STATUS_SUCCESS); +#else + systemReset(); // software reset, then execute flash +#endif + } + } + + return(SD_BOOTLOADER_FILE_NOT_FOUND); +} + +bool flashVerify (void) +{ + DWORD fa = APP_START; + UINT br; + + pf_lseek(0); + + do { + pf_read(Buff, FLASH_PAGE_SIZE, &br); /* Load a page data */ + + if (br) { + for (uint8_t i=0; i +#include +#include "pff.h" +#include "../board_definitions.h" +#include "../board_driver_led.h" +#include "../util.h" + +#define SD_BOOTLOADER_MODE_NO_UPDATE 0 +#define SD_BOOTLOADER_MODE_UPDATE 1 +#define SD_BOOTLOADER_MODE_UPDATE2 2 + +#define SD_BOOTLOADER_NOT_CALLED 0 +#define SD_BOOTLOADER_SUCCESS 1 +#define SD_BOOTLOADER_FILE_ALREADY_MATCHES 2 +#define SD_BOOTLOADER_FILE_NOT_FOUND 3 +#define SD_BOOTLOADER_FILE_TOO_LARGE 4 +#define SD_BOOTLOADER_VERIFICATION_FAILURE 5 + +uint8_t sdBootloader (uint8_t mode); +bool flashVerify (void); + +#endif diff --git a/bootloaders/zero/binaries/README.md b/bootloaders/zero/binaries/README.md index 4ce8a0850..51c3b23a5 100644 --- a/bootloaders/zero/binaries/README.md +++ b/bootloaders/zero/binaries/README.md @@ -1,37 +1,73 @@ # Arduino Zero Bootloader Binaries -This directory contains the SAM-BA m0+ bootloaders built by the -build_all_bootloaders.sh script from the 'MattairTech SAM M0+ -Boards' Arduino core, which is available at -https://github.com/mattairtech/ArduinoCore-samd. +The bootloaders/zero/binaries directory contains the SAM-BA m0+ +bootloaders built by the build_all_bootloaders.sh script from +the 'MattairTech SAM M0+ Boards' Arduino core, which is available +at https://github.com/mattairtech/ArduinoCore-samd. Each board +and chip combination has two bootloaders available: + +* SAM-BA interface only + * USB CDC only for all MattairTech boards + * Both USB CDC and UART for most Arduino boards + * The Generic board variants minimize external pin usage + * Only the SAM-BA interface pins are used (no crystal, LED, etc.) + * Filename is: sam_ba_$(BOARD_ID)_$(MCU) + +* SAM-BA interface and SD Card interface + * USB CDC only for all Arduino and most MattairTech boards + * No SAM-BA interface for the D11 chips + * All board variants define SDCARD_USE_PIN1 (except D11) + * The Generic board variants use the LED + * SDCARD_AUTORUN_DISABLED is defined + * Filename is: sam_ba_sdcard_$(BOARD_ID)_$(MCU) + ## MattairTech Boards + MattairTech boards are all configured with only one interface: SAM_BA_USBCDC_ONLY (except C21, which uses SAM_BA_UART_ONLY). CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_INTERNAL_USB (CLOCKCONFIG_INTERNAL for the C21). Only the main LED is defined. BOOT_LOAD_PIN is not defined, but BOOT_DOUBLE_TAP_ENABLED is. +When the SD Card interface is enabled, SDCARD_AUTORUN_DISABLED and +SDCARD_USE_PIN1 are defined. + +## MattairTech/Generic D11 Boards + +All boards are configured with only the USB CDC interface, except +when SDCARD_ENABLED is defined, then only the SD Card interface is +enabled. ARDUINO_EXTENDED_CAPABILITIES is set to 0 (disabled). +TERMINAL_MODE_ENABLED is not defined. As of 1.6.8-beta-b2, +USB_VENDOR_STRINGS_ENABLED is now defined. BOOT_LOAD_PIN is not +defined, but BOOT_DOUBLE_TAP_ENABLED is. When the SD Card interface is +enabled, SDCARD_AUTORUN_DISABLED is defined (but not SDCARD_USE_PIN1). ## Arduino/Genuino Boards -Arduino/Genuino boards are all configured with both interfaces. + +Most Arduino/Genuino boards are configured with both interfaces, +except when SDCARD_ENABLED is defined, then only USB CDC is enabled. CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_32768HZ_CRYSTAL. All LEDs that are installed for each board are defined (and some have LED_POLARITY_LOW_ON set). BOOT_LOAD_PIN is not defined, but -BOOT_DOUBLE_TAP_ENABLED is. +BOOT_DOUBLE_TAP_ENABLED is. When the SD Card interface is enabled, +SDCARD_AUTORUN_DISABLED and SDCARD_USE_PIN1 are defined. ## Generic Boards + The generic boards are all configured to minimize external hardware requirements. Only one interface is enabled: SAM_BA_USBCDC_ONLY (except C21, which uses SAM_BA_UART_ONLY). CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_INTERNAL_USB (CLOCKCONFIG_INTERNAL for the C21), so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin. +When the SD Card interface is enabled, SDCARD_AUTORUN_DISABLED and +SDCARD_USE_PIN1 are defined. ## License +Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. -Copyright (c) 2017 MattairTech 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 @@ -46,3 +82,16 @@ 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 + +### Petit FatFS + +Petit FatFs module is an open source software to implement FAT file system to +small embedded systems. This is a free software and is opened for education, +research and commercial developments under license policy of following trems. + +Copyright (C) 2014, ChaN, all right reserved. + +* The Petit FatFs module is a free software and there is NO WARRANTY. +* No restriction on use. You can use, modify and redistribute it for + personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY. +* Redistributions of source code must retain the above copyright notice. diff --git a/bootloaders/zero/binaries/sam_ba_Generic_D11C14A_SAMD11C14A.bin b/bootloaders/zero/binaries/sam_ba_Generic_D11C14A_SAMD11C14A.bin index 5f14510d5ed9cb3bc1093560e2401ebf38a68a17..84805bd14a68f561aa727019f6f97321da339d69 100755 GIT binary patch delta 2694 zcmYjTeQaCR6+idcv0t1tPHaeD?3d(yM3BTV;<#12WFXfriS3sU+74P0y1k}UyD3q5 z313b{vC|cBKai3-b~H5lG4Vp#vhg8B8_XeJZ|9j# zn&qF*J?Gqe?z#7TT)$rTLS4n08-y`Cz%b$w`$U!h1^^gE=6|1KINm>Tdwr=2AXvgT zCJqHk->3k%9|iYKJU2`Xy^L&4Rc2*H5HAl(F<12R0a&{BjTnO^;~OC%Dt&2K@~#L9 z5q(Kl)Td1)^Uk$D*Cy&k552354QC>dFA<(C7sK^UkgpXd$!@o^8S*wMO-R&ZtBTe< zS(8jjuCPz@CGDac_wZ@^27D*W#Zyt=nC~RfH!)?BxKTMf*8z42JAeZR)PN(5E|)_X z?t&c+Y8v#N%uez*{UmeVJHAfj&+i5~q=CWn0>3=_xPGVYt<)8I*|GYe)`^B#2y1w( zwAe?bZdbHV?W1+LAtPGjR|Z+h8?Ehm>)!P5T0oIb;#rRfvUU>4r2H-D|d(l3|Gl!uVM zwCqZhDL(aS3nB2`E0vz;SQ4u^6)#nw=V@?3=E%cV#ZWIaN1B(%Dy zby^-;o-)^OW#x+2X$50BdsFvKJXon|5R*~Y*{PT>-LYVh!!RLYdPJPud1 zbpWI()hYS#7H?hlD0a!t`?P5)@Mk;S3N)gVl27v|A@EfW-CTNT1(trgvbG47cz<7l zu^qF>s*bH=4>^Swolt3j@um%Rc&K9tHVaF~R@m9fRJKGZ>5^5mK-UFcq-NnBq?NPQ zb(doZ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QKxiQ`6K(O%6i*IlYh7ORK|a_ce~U)ZzuI{Z~qhgV*xDrte~E+6P6JpjVA*7;nAJh zUsY6;gv{UAK|S*o-6PpkpyN4dyHon&vU_N#{Byg3!)LMZWBb7@5`%?hgc4r1AIKsh zP+;^mLMYXf3#s*bE#H`8KteA==Z@HQT1@vPyYWAm;a+5n_`>j}Uvz)C=_z)gpNCZN@a}M)0 z(7moM0=kD+d2eP&oWp`sIx)v<3$N-zMek}iMc=zbbBKRBU1bW!?tn-3{7`l>@9}w7r59H5+M`#&k;T$EiirRh@Jl+Fy8;b#s%kDqv*T9;Fgy~6O3lWb^ zxl~6s($*o*$n#8a#Zh)R9W>qa`x~f<#%mig$XY1f5k05iqnY9xxvDS4N$|0Jva?Cw*Y5^3aO+fwm?c5u>sqvG~S83~MXQmzO5 zwChBcRs5ut+{qnC|8x8`IYwB`fhVdpKP5ubFPM6@gNEX(Hjl}#WMj}Q6Oi#W&QLa} zt(WewUdlyav61G^9qqu)t;!(#Lm878!A)2>+BulUNPTUMki#n?$^m#Xa4W04Am{sXF)d7 zIJ2r~uao@NzMMqDq#LvY?fWX45xYzBSbJn1%%Ihm?GE62iLHo;M$q-S&Lc+$2}?F*s(Ro!A>-<(3XC(&{>x*KK!7HP%Lm8AQ_Rls9}C$>ZfU zIV48ZE_^OJv_S*1Z~F9o=r)&g+LmjlWJ8Ubz-oQ6((2F5yo z0k~!EwuBD!m!SJIU<~jU;P-&{0ihxijWlik;l5vQz=pqOAx6dxHO#$r7*P~LDRbey zRR{(Mp4qj2gdPDr2RH#ZdzF3yG%z1M0rx_ix`XF$=9?RvmZQd|)?1odleeKeQS*(B Mm1_|hzpdH)U!RPFG5`Po diff --git a/bootloaders/zero/binaries/sam_ba_Generic_D11D14AM_SAMD11D14AM.bin b/bootloaders/zero/binaries/sam_ba_Generic_D11D14AM_SAMD11D14AM.bin index 56a2ca87de126728226dee307d117c3a22a44e12..6d68b1169453155c44d175eab49003daddd6f6f8 100755 GIT binary patch delta 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Z;P2JW;vkgvaB{57z+aPRzb_G`@NGbxzl-W~2V zUy0^?To}5NlJ67Pq7URxgGXouW#K#}vx?er6g=JobCab2$L02)@M~aAQ^NElu!V@n zrd+Bc8)+MmXY^Snxauf7k_nn_`u$DRWb(?UEV5VL+8kApAFujk29GAipsIVRQ3PsmsnT0B#O;*QkhsW4r z&HwT4J?*;i6kxVgT8l(cIVtZF_Mc$YpWS}4OCm`wwk;hW>;Nat*Q;)ykdeSBC*(%J zPrHxjSjA7;$gSLg%s(eykz<6_9C)JI3ezGq{i5lYJ83AsTJxCvQZ5F~G6@-9=M3k9 z+D7RX>xFy-78@Dv%+XHV(xwctKa??v5!{TGqg_K8Jkg>cJEgP`o}k$^U!+JYVVO4N zP(DQ7X2Qzz`H1>l?zz051UbAaq8xxH1Glltb8?|SAJf9**^GZ8K~A%WxAEjq)r(@) zi&JY#_6Ess?aNCfOnN{&*s-sw8MV75kF`hU!3>svAd5xB}B z5Gwb9=zZgU*=^5<&CPNxAA@5CJBYmrR&MFUBCT$Kc|CTQRA=1@F@s22UGkhq6%l+kG6^##UkkomI-sK>*kLYt z)4OAh#@2-^3*Jsjb>{{zZx6)`$Nc19r`Bjt+RFiMr?mpy^5uZ?fF!_ef;XWPpMtRt zU;u8JyDgyu{UzxB3>XKz1^7MSeL$#$L?c6+f4Jw@o3P=pTa1x$O&xPr14a~uP}*F4 zR}F#zf@gNUAEAc;&j5}CPG6><01YfekHNjruI}LZ>-m;s^GcL#Zo47b*4&D2MJ?AR NtJfkjep`3)gEIgC diff --git a/bootloaders/zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin b/bootloaders/zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin index ecfa9537fb3903fc9899663ec9c5f4618cc33ad9..d6952faefd3f19ac983ce8bc9d8a0da05a7d2465 100755 GIT binary patch delta 2694 zcmYjTdu&_P8UN0;W8XMw9yX*m_Dymh5hO8;IBwN08OXImV*BPn+d)f0x7(CzCnYL3 z;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h^FWjNoRh9P1j&;E5Im*(s%k@C41S{X9il3Cpx8 zhw~xw786#U%SY5_bI<1eB*@{_5#=B}8MuvAo|Oyz`Ir_a&t&`)337%#vYjV~t6mhV zUYuTAvNuY8YkyuMVbTNI!H)e^&8Xcid91xM4`$Hn3w9@PeR3SQU~$;K8@R{vB55G3 z@|^vsL|Ht+@miZmUP~a4c1Cn6PD62jR;V1XpO9)Skv!NLBOVZbI@2LFSl^Hth`==t zfl#>*MDObl$ZmT+Vs4RZ`4}8C*g@>guySiB7HM@O%XJ8q5y@98 z>+?vAsNMEm(jAsW?#xXRw=<4c3KH1_3=PasMIsxnD4wfiYPlH3~L@GXW@{yH2yNt$vL7_p_YtaCT`b1jq)tBByUkx7^_`Fil>@&O$c!47lD zo8K90G`1~VRq%FFsyjD$WqT-QIOZq+I=xnd(q0a5JFOMqmM;gC2P6S*6TAVP_!NwF z00VH#+-(UR=r2L{XTUh%O~CH~?*T$3BpMmo{KLJ!-i!@@-C~T4>*|=h8!)0Mgwp2X zyK4{(5InOR{0Kb^cp7j5aOMjA7-(Q2dK~VBc6BGu-^jNln^&P^bKA;f+samS8)~^e NS-lpK@!Pt4{tL6MgEs&G diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E15A.bin index 7659bd9eaacee315b3448de3c5414fe0e0ee5601..e021e90491f0f8045e571a2c12ba9e7ddb033432 100755 GIT binary patch delta 2035 zcmZ8i3v64}8UD|;<5wQGlQ!7bx2b)dLgL%0ezcG_Fu8V#?R(;k4n~^D05iWbyLYc&SG(U45{(2c0@G&adq2Tt?w-G9@9 zrdj^Z`TukN*ZKeRpZkvuM>e#rxFL9&06dR4K_i~l0 zsyg|gJZoS1vt4%Nyb2NdAE_Bg!cK7DC_r-6j_y2=w3?oO@K>(%EV;dS zbkVApQcLp?;?6Bq8&wnunxUN`*XM&6nVn9hTopS_IWCRaWPXA_q}f+KCQ&1LrK)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7W0Zap$2SmT3ycyQ<-UZnQF>zwY!fmi zij*-mo1#)$qV*nUW;p6hJ2P&4u8r4al&FZ3HH_Mf;Z;ZOM`v6Z}?zuS@`#r!jt{T4%g4o!pk4=v@26f{=y|FX{g zm+t-AP@jnB)P^WX7|9`k*F4^I0A_%%SO8K;A95V|HPUItXlnt!k6ww?K_%F!1ls}| Wp{>2EJ@A`&oocEZMDMML@%s;)M2&<1 diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E17A.bin index 9e9d49d29f2db19194ac3f33ef31b27406f41bbe..6473527f026e713b6a5678609e98f9a1d88dd8f8 100755 GIT binary patch delta 2035 zcmZ8i4{RIN8UNnd@xT1@C2g?J*VI0zkoY>)e_BWz*j&5B_Pr#dgV82|=~9OF0vo;2 zvRO!#vvrIzC^R)_X;n6m){Q?xDnY3LDOyk~t<@O#q9K{?k1nDj)7T_e9XL%K-@Z!= zns&P1d*AoH@8A2r_wN3&;mC%T+BYD0ngG0jI6)@)zp89vN#^NQl??`~|1|BTp{N zJULgYs=E~k?S5=>JnO9e*{Qg4yh&j&`9VJ3^aDiyKQn<1V-UG)$TvB!6kROa=p&eGmAPiOxKc zI?|om!>&(!(S#={=8r>bXfpXsTGZyI{rO`_PV}Vbrv*)$bx?sh=*bk(o5Fk35I&qD zC6ZXd@!s>>sS-oi9qIM|l?C@3B5i|T^x}DCbqs*5vtIPF$XFF(zGNQ&Fnv>j| z+tXHXc+&BGAe~g5lAuE6iDfUfOM=!)19^~Fbf_51&|NK&AXGw2P&u?zTU~L8IF)hDl5V@sQJW&DHtN%~ zjQe?1^fdwW7C+_=G{0pwoQYx+;wXK-IBW|PrjWvVKxL*h0O7FuA$?qW@{FK;F!g)6sC6MRY z)2W8}Un>`dHncxJehd$A>%zBWr+$*Yqy!kxM#qC}D$}s=P1&v&PSGHSwrO=Ei|iB) zA=fxjHTEF)f)ZwJOi(MvewovQjD#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_0eU4;2b5r^5^M`> WfVTFo_P}rAb*iau5WTk`#_vCd!i~fL diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E18A.bin index e3dc35a0e5318d17be724dd4644d892705977cf3..c3422322068a96ceb47e4d7f4a5b20df5c37b98f 100755 GIT binary patch delta 2038 zcmZ8i4{RId6@TB^@xM5U9k;LgMRG$8JlSz~tH`w(mcU(Nq-a5{v{qx_i-u&nKe~vDOkK9Ae0!G` zH0^Z1?|bik?|bik?|tv?9~+KrXkIBm=rjR%9&v(9dV}i$;00v9dR|8Q4a?*=+nwtG zLZ(!md{A<#%>aHBcqUI2Squp;oe+naHRMeXE5nT7*i47VUFngrCYgl2syBbZZvEJm z%Q9Eak*aA<8N$0Cn;g&DSN?359XYQ;ME-|r29mH795@P)T(zS+4c!O39E7=ZOAGY{R0)}(ogvrfgBY2ePNiHGJ54z*joD;=f2h6PMV+-bw8mL?p~87MamG}BE&WI{UhchrT*ui=-&B=M`=9*L9>W5D*Inve``%Oc;(2y0OmeRt;^3S--EkBJA_k-jw4VTGa@Us7bKr+#u zCt_Q=U47W`sXvx*C58NPXbDdypG^zu>~tW1EXfJ3^xQPBsxvmqGaEgbBAPq0Hw}@) zDN-hhWemPB+y7NMI6A^O%BPkzOxulgEtWb4JBFf+#5a~dp9V?LL|GiT30>cmB;|7F3uzxMDWlAvF=|WoeP`Qfn>?a)KQt>k zIj5_&U~{G8`#?OY*hOA}>Jv*IY8834g$DB=Eo)HKm!Pv&CLySX7omD+ab;oc-uxSM za6{6(aNB-zz#e+p4jvu!-(w}r5_TgTC8$2I=$LVoEP_Mu3R4-!4C%CL9JR>2VxfLj z%{ZS!MZX)Mr}znXpy?f>;YVkB(S85$DVFS5QPT-c%*wROh4{$r^@i?FA%L1snS ze-<*5Py0FbG>`|mGNY5ax4pvx~V6L1+?h#yRLi!BS zUBdMpZ`SXl#5Rhli`ModtbZYC&O!L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2ZSd&~ASzsn+S0r0Ur3>< z!Q07H)+PJo27bSM2Xker@}LR@fs>HH{yDcf>E|JCoaeUX5Z7*R7+?o9NH zAEq|Oe7VMi@6g*di&ytK{xPS}c8t2ne^uI}KBnUl(LfyhCf&tr*+ZpO36VSbceyQ@ zYk4_3B0j>vpDOriT|&*(CPRm=;VR&@Chp-n#bD}EQk?SetBcB&eLeCx& zN^bvnj$wrw|6aSWl=_euGKy?Pj56&!_Y-^6$s`=z(pl9i6r1>lt^lbkCM#}VlDbNJ^#ddQMyg-O%owSk#P&_ZI07TZM!GMeY^2^e0^5X4 zi6Ui8&8Dc7mT0}lnHi2c)6R?=ziZ=l86_&BWDTP>qqwbTwJJ-S-0u%sqwlBeG>lHz z=r_5I%He_tb_cNEpc>fX_U>bO2_6uUP<6$adry@@u5iir&@&{19g)QU{b^rxI)n bY=E}*uJ%Azu;Vv4F@FC64!e%% diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E15A.bin index 78ace994fc14c20b902eb5bc1bd2eaed73e9b02d..df0b2ffecefc095577690daca5bb160c2863f267 100755 GIT binary patch delta 2633 zcmX|D4Qx}_6~6cRH_o3O2Wme*!uv^x6Nlo&Fd$hs$EL*gO9E?I0SC56)@nCw0x!_c zRAqJxltAeqd7uT>vLRM&tm+1#ZdaV2Q#5h=`vjv@dobd#2@zXInuIDNt1|3`1OYbY=_6O+~>3vu(r%Hvjs&#a1CDJ3m z5jl_%Ig!y1MU){wT8-Lkr6f8mKTZX)OWsEX4O$J=a)#RE`g0KrcfN}RUkoV>!!r5N z7oaXpe?{)neH$N^U)B9E@m0-NK(_{Tlz5$7GZwDKIv}PQ`SYm;G08=VdzB>^m7=5u za-%qnf4|Sn+k-;)`wZRH(N!!U+C2dXF>iV zUp}*bJ6{$l7isCS{+<1!{SW%{qw-~atr`9Ja|))-%2|CpA?Njq9Qb@3an$*#$>Jn5 zjg z4OPv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fl nC*aHjc^zbPbw}I5_V4VkY-ntH0%9HJz~!wL1!E-f*2ez=QssXs diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E18A.bin index c8c94e899ecbd9979d270867188b5076f857f4b0..52b86be3ce2297e2e8b4dc98888816c170c45aa1 100755 GIT binary patch delta 2633 zcmX|D4R90372ZAlTK3FvG9yZ6=tzt>@WfAF#SB@#lcw&)*x z##7?ABlI*ZY#2QH6MIvE-4Po-j1jA<>cPXXTrJPTLc*F7M3%eO$A>JzYnxDZ(G(X# z*`_Hr!imu&%6@-}6){K0EkQbVES@nd}s==dbY!780C=-lIsCwPmWj?r;FR|!7o*t%YNUm3SQNWVz$!*V%QDy&tlqhl+P z9{G*PfsDwBjD85B4EfP&)Lttk(P8;*SiTa5dHeKF!FVPc?{1E=t_1EWxN0 zB{gt2iqppL_nCQnQ0RVt69yl?_%)OMDl7KHdq$8acfF=F$)7xc>g3?b-D>WN>Jn*^ z6ox8>s9z#`@MNz;yxBV>^n{V7{zyG}fP%xc@ds*3LfQZ3ZQ?eN|IYK9t)ks8^y-AO zF#jT7KC^y1Ulu7BY3Z^4o&BTz5Bl??@@0Lk8U6Tk3fN}ltUjKQ^Lj-Nd_Imi>ipDX zaT1coN`L|Cp6CXmA+@SwJkco|rIOB)>6k`dFkI=E0cIFDyZWLcKJBd*|8c5(w86OBDK@Q+F z_7xxoEj3z-s9Bn(uE#pGLdvHWbS>y^B)DaM`VP>?WNIU|osWR?NBlS~NEU@BoOmpN zGxbu1B1rQ?YVML+FF7K1vg@9CKowpO&Jj~m4{>y;x#Pv&cO0UlE)tcRH;?fpREed^ zXbHCTBL0|U;%T69VZKV#^LmDk$z?{GY@0&aOH_+pGIHC1{mjSy0 zKLaEIF99gH3I=d2LMJ$oJVIBj2%ZaKFMvD^cpESP^F4sl0WU71;P(Z3Yoq zQ>ISsm`hVS2C=&WhBQw?g6d0ez=FeX9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rwei33;eV+B diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E15B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E15B.bin index b9d9be6f879b1826a70ca52edc23413c2aad42ae..5e7cf2d348e21c814ef221f325b46160ef087406 100755 GIT binary patch delta 2555 zcmX|D4{Q_H8GrBm-*I9)4sbqS!M+P2SRsMc*d1|vNw%&G@`p~Btkqt+4vq#o z7Zo`zlqRJcBo{_VTefOLgH>HAt=qvCH3+oAx~_IarL2tUB51QMs$|r5&f?(PcP2E- z&)<9B_r33Zf1f>EeY2`;-iiDtjR+kD95)WSeH93yS73AZ?^Rf*1~)FVNeKCi%)v(m z8}cCZ2r#w}9^d70{W5XEvHBCD_4D1T!9?U0QsY(%7j`r{|E;`zUvZZre3}x+e z0Wr)m63T9zdzQauViFZmRvt}cEb~`caT(_$?IrH;U<74Mfe{B4URHxL_i!)aPNzjc z83R9n?NOhBi5Aa3=S?Izdzg`#gfUPWvqu@Zt(zHe1YU?T$|B0?TdTRo#y2A)3Y!s) z%*cz5&?wAGeP~#Dkcv{b3(7C3h)H+8Lb*47dl~}LY-4*}u&4`y8ASHR}954six}|zT)~G6xxd{}YF3wFCrlGEWy}td_9cqN~TEvlvebOREteAEDChDZ7WmA1tRP9ZdHkXOZS-wx$_fOD8{0Vfp9fyuR=n`;xeybFr&Gj^NAXSE;=4)z&>IddO<-kT>>vWMBk5OM|v!!JSuji2=fAVoN@4NQOIBf zr*Wt(UyR^xMiiH^A~~C?YN=|iA-HZ?dgd$=*i2=-vUv&IxFn3zyku875-3_)A(g4T zv@E8VYK26{J!JnE)_#qDCAvsVNu7jl)N+3+biYH3bi6~VeQcbwQ8s(I*&eOyM%<`m zDK`JTv*n_ZGqQ~QYvN}|l8sIgRfBUJBl{9a_%aRE%J$Bo><4r6)5XdA9I42P!urIn zeWusqf7OCqDpKDw6sOX^59()4q3oM;)-hM=S>Duq&BRMuuHm+y4G=B25~w~46;NY2 zWn#zASlPv_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N1 ziqKF8(M67|TdtNPizWPN2NNxUW@m(A9`Y{+HYBY)2S<3aanoW+%E*>g{(6+g%|~#$`0wH%1d&W zYa}Nl?|-JyuP}WIm^nig!3P5dae$Hng<^&7b1+w^FBWqR1^BvHVmKG4A$11ji<3zq z+^8TC22cPsLN9?O(sII9UTG^Y^KL<98>=>YtIEBoQJ;&N0L@S#xo8_IFD+A+KFUHU rSC5bj5COC;%YKmicbquf(e|BVRgF!}&w;Pq5O_yplrctPwyEjA9g|mh diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E16B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E16B.bin index be29c99f72c215175e8870fe9ad11c1ab25b9905..7db3b3d8c9c2368555f4dbc557efbefcf03f9a05 100755 GIT binary patch delta 2555 zcmX|D4{Q_H8GrBm-*FN<4sbqSiG3GB$kE}%utEZ>u{+}Ul5AZWglqRJcBo{_VTiR+vgH>HAt=qvCH3+oAx~_IarL2tUB51QMs$|r5&f?(PcP2E- z&)<9B_r33Zf1f>EeY2`$z5@A98WB1QIBpztdCL((FT>{U-)pc=4sNKhNeKB0%)v(m z8*(G`2r#w{9^dJ9t+TV{^ui%vWP16uF;%hLfXcS_lJ~XU6NJXgIdF5AB*rYpOu3V?Oyr=S*pZOu;gECTC*2m6{Jq-cr@~cX_ z;eI@<95?)=aA=<9bhrzmuz%wJ~ty$()^7 zTAw&PYgCo++ywGd7w4w)(@NXsfxyrMV8{rNlM!}l>Hu}Kv{b~7NAXSE;=M`#*b@pajbmkT>(w1?RE5GwT#hF*XM8b9la9|=*cJu-2Yk!9UxH546EX%(7+BW_f( z6q^6u*)q|{8CgdDHSw_{iN;b9RfBUJBYWdW_$md}%Jj~m%!hOH(}l_V0;$M~Li)t6 zd8XImd(DEJDpKD!6sFR*7wTtCqRd-!)-h*tA8%^DX5u9++i=^*`iYiZ0aTxba;UMK zG_m7ntn6ae!J^EY^C6^cF?0B5%2VclJNj?e_E(dEvs(7pZDqUVA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%v@{E`~YS+C=uZsrm+M4?9KP zklN|dNay+9u#K!DOf)uK2lE8~YW#^J5uM%#iZguIles{qk9ky5jK>ZO(WQuomOA+F z)j_NdTek}O?Bk_<(BCgK(N4m%N z_gnrkW9K(Q)KlcmRFmhF1UcfpA>^hc8_5=qrdCC0VkO@u#)d@kmEZu~E+BVH(#_{Y zJc;ZEU*{*V3*z*V4Fv!2E&578_4}fTreRZ}CM5>`le~m#ny{~7*OxQZ(24LV+))8t zR|Z%ghsPO!3y=U*1C%zigDe7U1Z0{O7Iwq92f!*4e3aIG9pnM9bpZ|nehv@-M*-9u zvfKgkJor2dV>MuV!=}zJ;joub$m+LFGVveHRP)uD$V*ero@b;gKA#j2wD#}T@qjkz zih1G6?wrS)wCulUycv#grro+0b=*p4x!=TY&MNa}xzQ&&uf;xLIa2fTUcB|uBuBKD zrw9#o5MAWRy5(v)vRKTYb~4doXm&;@;vxTHU_;Wzb8v(w8#gT$r%Y^F<*!FsKFg(^ zDj;qQe}@DHv^y#_C90`4WJ{G7Yhm63bM=&k?5o09AEZ<3-6}~Rwi1(oQ`sSXRC$SE zxkhp_^8RNE{R-2kfSEHCeBL@?5CHTUB0;8ubR$1Zai|F`#XzytGVN`X~z_ sgC3z0Km^dXEc-$3-*Mt_N85LfRW&v>KL@@JW8fW)NyZq7+2*GI0zc(fnE(I) diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E17B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E17B.bin index 147e0fa9601ab703867550fc3835fa80593973a2..15732be6225dc1bf50081833d04cbebe9ceb579e 100755 GIT binary patch delta 2555 zcmX|D4{Q_H8GrBm-*FN<4sbqS!M+P2HAt=qvCH3+oAx~_IarL2tUB51QMs$|r5&f?(PcOf*& z&)<9B_r33Zf1f>6bF;c^?tbJuX+-EK;J9(X<*h^ry#kxNf3LziJ+N_^O+v^w&m4GE zupu`>j{sx)!0}yfN5S`$JUWDtPt&x+L%^<7?!kP@nXVFX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-Zi6p|JlfbuV4mP#jXzN&qSO08afa`DG8f47F^@`$@z`!Ax)kxyQV0LN zI*8S7?N&jbeY~`9`lLrI9pg`dR&BQumGIR}t;Ym@W?&;rJ_)QTH$v<64&VjB-M(%5 z1zu~j0vCg|71Mh?Y6-qQzGw?L9!@oQa-3aq};-e>2G=VNgO#Gnj+XC z&vh+vq!q?07{`}dAfGPwi6sV>gJ8)8%Ly1i)gN8rch*N5p%E(uk5I)rSra+P<_p$% zOd}$XDybsarxN}-v#r5Rd_>9To+Td%FTXIdq#1Gv;ZUVe6*iGZ)*vVmsgqljSJw@J3HF-`+kR#q3LT*a3l5F8RkXh@V?2@cTh0&=$`-F!~O zlgMuHb$$Z7AWk3IK=2RWqOSy0zb}qx8a5?rQexmg$xEoF3Hus$eK}JNod}=89Tm`Z zWq|c@c$@(^0SQ1gKxs1@$YQ`oK&Dw?VK0IVXxM`_*HK^_2G7vLb^=Kuk46hOTp z%N-!kgU_=tRs*&-Z0h_H4toiOEPl%*6aUdnHD8^HyfoG9c}A+@3rHbBYyWN;4``Fl zm=~_>&Uw5^%l>=Do8bs&+O2C*$E|df`;F}8tTJzw8-1elnr##2BQ-DY#akauazuN1 ziqKF8(M67|TdtNPizWPN2NNxUW@m(A9`Y{+HYBY)2S<3aanoW+%E*>g{(6+g%|~#$`0wH%1d&W zYa}Nl?|-JyuP}WIm^nig!3P5dae$Hng<^&7b1+w^FBWqR1^BvHVmKG4A$11ji<3zq z+^8TC22cPsLN9?O(sII9UTG^Y^KL<98>=>YtIB<-QJ;&N0L@S#xo8_IFD+A+KFUHU rSC5bj5COC;%YKmicbquf(e|BVRgF!}&w;Pq5O_yplrctPwyEjAgf>^& diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E18B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E18B.bin index 135a0b9a7cb431c4b9e433b4284c54dd5f35dbb0..22675b86e6ae1991c24edb251a0750f765f0b242 100755 GIT binary patch delta 2555 zc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`3ONS)lQB&VE# z$bFD=WmP4tnkK#w<@_k+3paW4rJ}~Qkxj%5_Nz#Qa4bRv8Tw^u^f zl>yer;c*(^0we%60Hw|BAd3JMfK0Q(!X6m+0$4?YkJ7rYgWM0cZomP+&jAA92!MJ+ zmODY71D|JMtOjgr+}QOc9QGm#S^d^2CjO(@8onkId1_ed#f?l2kF#$w@T87t;8hYRCY)oRbFCv zQX@GTdG9lYeue3iz|3i?5Iz_%hy#=qC=@GnpM|+XeUWG|=HqK(vGHu2hSV9AFHRJg43t<~ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMC21G15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMC21G15A.bin index 3b9a1d55e918dec0e6c7f716e2a7c4d53a79a066..e55d9a2f13ff25e0cda5d8c878dc64e697815ab1 100755 GIT binary patch delta 2038 zcmZ8i4QyN06+ZVp$A9^;owUJzer@gN6cWEqb?g?>1SZ!mvHfnG(ZOhw!1Pjvb^{xI zqh+&@I%n$`Wl(5p(9)`GAgvoeLMmaY22!-3R$8ku@Qa3Ix*xrWicDjZTy@|yKYlwe zEohqM@7{CnJ%9I{d+z(kh9etVRy+_oO#og%oFEgv;CcXf5t%Q3FC+abKk?O#u5|z* zYgLOgm1NZKsV-}x(7dWPIy zJi2HzN~xte2y^F_7U~Nq60$-&L$1#UF)|08Ot~u#nsQzmwJXB7a7cHod`Mzu?8<_c zne8`=sD+NW)23OS9(O`#pxivrLN|+%arw~SQ5GVA+@Aq+HRz4ak?YlF&JeezN!4_6v(13Dbm1A==!E4DMwVd zA+b$shHp_@jEK4+Yt}BBx2Ww(8#{c}dBlvom~Nxf>Im~^%-T|Y-`RHBt_-W)56wz0 z&gE_`+TH2+K9EkT4oOg<`oxl#+9W~q&|m@NWgV)<5_HzeBm~v)B2*78t}LwGn}34= zO^~!M-1Z+GaD-lVfY$)y_dJ#Y%h!!?PDAy9Mdyrjnirj-Pn^s+XGo__=P0iTDo_2I zmT^6gg8n9ep3+C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wo1Ik`Tufj6MRE0D+2TbJk; zKS*tg`Erd3-{H4v7O(Ah{9{g`?HF~D|EjcCeO$*QqJcR0O}dNMvWH8n5+ZlPM?Nc@f}Xu3 zl-%*r9K#AV{=If%DfJ;SWE9zk7-iaz7-iOtgpscyMhQ>hyyvm~C9(-I%F!s@4aiB< zT}GZmt{|t8?92Euy-+SsV0#Z5ZNt79`D(J`@JHzFDTq76&Kc8O@JoeNZQL@MQWWU0nm?+J$O@&-#=z~YDNH35e* z<#?#)$ZoRvlkAL_SHD=~BHn|Cm%RM$JJ;pGr55^xM@qL~wM(oSFJ?Y+Z^1>q=)&!V z?^|jq+2yv*x5s5_@tKQ_+)wOLCzEh=YiCufP;BBGy8@&d1qJ!`0BE%XMOZWH% z-Ksgcon=X>Hf~KDo2xN`Gh?KF65BTs;|Pot8|l7;vXOe@2y7EF zC5n_WHJhSRTB7wHXJ$C+Ogl4f{H~4HWt6Chk~NIljN-PU)v7Fg%KhG;HTqu4PQ&Pg zjeecms2u*cKJBTG+2SKYdExqEJ(bh{58I>$u(boBi1E_BgD>3|ubmkp{!am3M(0BK z%$>#dJkpN+03uFY9IrCP$_szWFNv+>?fl)A6e;GPvFx`P>T_rs%ztPpSEQgZlK+== z?!R>J*M@eBcu#GJf`pMA0{G11O9x;E_=*J}h3r6%BfmyEt>|qn!1r-hB6Uy+b}GTP bz(#0m?`jWpg#y3ntMi%a262I{i1GUmx~YzZ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMC21G17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMC21G17A.bin index 4b30a89d37d1390133799103dc580b47f9622cac..318b0ecd9013c32656668cdbba5e8e6944bf5341 100755 GIT binary patch delta 2038 zcmZ8i4{RIN8UNnd@xT1D<2KmmYiplVNPL~@*eRq5Y_45m`(B(;#%PnkbSXo7fsNj1 z*({{a**c&Mx-~UuX;uD7l<`MMB`noIiWbyLYc&SGXh^2}ql>7>G&adq2Tl{mx9`$| zrk(E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m%V%d`vUf#T2A3{w#v6O-$TuVs9BLk)pt<%Lcy2mw!TDv z9K4-OWnHpQZr~5fcQ99`Di5kq5I6}5?4NU+lYSoJ#(8dA4sq@FhVkX91Kcd{<6 zf%nTcoCm78u)#Q-poEc!@XU=_?KrE*L-DN1^L8nu^{Z?3=H$A>dftEruR$J9@6JTO z_+e^e%$I9S_zt~Yvv_r%;~#ShZO5pK{FkLY>JvI15e>w_Z_-`7mOWBhl@Pg;f1BHq zxt3R=BjRHW{HcPU)+N+jZ8CJ|8mHz%r+9l4%TKJt0tB=qbd zq2%_D=NML~@$a<@OQ{cuA*0Av#3<8##3-|FB#e9=F-mv}=e>ySFOZFhQI1CGu18Lw z?h^6>av3>=WM9RP>7{ac0^7UMXe;*3$i2yqLm#8JCn4?(J7=Vy&vn!8O5|TD?Nz_3 zchR-Hk;A%AoRg92f-e)0VSdf$q@!B?Y%WmA5vi2h;iVdHy(bv9%j+#|0gE55)dU>M zl;h!^!@J0)PqQ;#Uj1^Bi+B$nS@QC`ZeN#&mRjhO9x2^|)h@ASyqNjOJp~u_q6@bc zzHh0eWS84I-x-&w#b+)yazC+0olL^fEuB@ZLa~W&=n9Z(lv601iw?fKix6v6EZyxF zbgSm%c9tcj+PF1sY_j6^C8?{lS3fY)Z>0JS%#4xxNo?Ojj3Y2oY^3`l%0}vqBd|@# zlqgch)NG1MX^GZ*oSEUMGwsZ{@w+x&mryk# z+<)mls15BB@t)cc1qmZL1n`;1mkz)T@HGoS3fYbvLw<#HTG88DfbZk1MCyPN>{Nnn bfep~s-qjxH3I%@MSLZX;4dMb@5aahBrRR>t diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMC21G18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMC21G18A.bin index 035639731b9521829032d7e6ee9cdc6c67cfc64e..b83420741d828b58bf61f13a880c3f951239ca5d 100755 GIT binary patch delta 2038 zcmZ8i4{RId6@TB^@xM5UFKL5)zP9!`g~ZpXj-5i9z~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UIgDlfhaiX2F(BB#?3kOUqPSiAZ#SI6);!|d=feDqkq8LrOcdF+U>O?9HfnO*{L!@hDT*_7b zk8Ic(TLzK&iQ#kN%kOHna^Onf;`S@sFS0A_;$?a{HpU-s*&*zxAAueHzstr=>;!*d zd>~rKF2$kQ%BHo|Y`U){J>7RH;pINrH5hh}_JYq;_-!Sw3luyKc7Zk`Q;9dXNzBhT z@v+F?W`09mT*{RFps)U`*AIoi&%TiiVRowvuhG}zE^hJ^d3m9ud zZx)xf^L>ND(b3-ho;+Pq+NM_NKc+`C7hlDtbY?b&a*jT8OU|Wdccc6x`jcBS8FU%>to%PBn0R{56Z2dKFpH7l~H`W^~jDEKnn)|cpy zgSV5ZtV{OE4g7xj4(7^KPM?No{gq}Sl zl-&OD9K#AV{=If#DfJ;SWE9zo7-iaz7-iOtgpsc!MhQ>hyce*23E7Ak~F39M*l}oQzZ#e3^g@^J_jQ9o6z@bAd{ZNTu8kFV%SKJ;AVDUTX(aL#C!12l9%6g`?@@^)IuNkNa+@=c8N9P#mq!_Y-^6$s`=z(pl9i6r1>lt^lbkCM#}VlDbNJ^#ddQMylVy%owSk#P%)3I07TZM!GMeY^2^e0^5X4 zi6Ui8&8Dc7mT0}lnHi2c)6R?=ziZ=l86_&BWDTP>qqwbTwJJ-WbiY4njlQ3<(=a+= zqu=BU^fUL0n)9V*LICe0GmU diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G15A.bin index 4de2eaa371208d5f0af84416260b23769f369adc..62551791434ced85b3ad94d7aab417c07048c346 100755 GIT binary patch delta 2641 zcmX|D4Qx}_6~6cRH+FvPI8gif5#CQiejJJu!+>PnUTjJnza+4hm5{*p$Xe}&P2dIE znX1gD&=M#eBoDN}S~kS0jaA(s)a^9f#A=#$;1FzADD$uocO(Ug<*xSgVO!|xMwD4J&4p2> zVVaF_QcnV9zCX=Mn4@F15FI@lOIv0x&x_3G%E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g3a(8#co!^TY2xPjqO^r6sr=(G!)Lg)va1SXQ^=TJA4Bi2#B~U3=>Han7D)og@)Vu=UlAbni&CS7xqM&-Iyj?m( zVG6-JDZOQ8<3^~dS$&HZYYSH`NY#lT8vd_B2f!0;>tahQ+0qiof;1Zm}pB JBZ;>*{})E=f$RVP diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G17A.bin index 07a72aa5f180c7725600f47eb4d0b1b92ad494a0..347bbb707443dcb7844be925e6b977e2919f9a4b 100755 GIT binary patch delta 2641 zcmX|D3v5%@89wLw8Ruokf!f!Xa32YII20#=5t4Piu_>{AlfYV5f&<$nYqb+Lffs0J zsxrHUmOyDCxu6BsvLRM&tm+1#Zda3*XA#Ie; z|2gM>o&Rxu`%=wss!L`bMeK1SLW6+A#zBXt93gZBHedg}0qc8%k1Q;Z5n}a2aqwwx zf#^i&DLB|Lc;u(f`e}AYbo3BLtfpxP4#9D`vH%Nlds2{C?rI+&v<0qiLYXB~To7gI zr`RwjMG`3UgDFm?{+3Y4*{vRmg}$ zGjbs_awD?{K@=eotwC*-asnMv9-{)-qwJ*uCOw97B~5Me{5g+>+uuV%QxvHT!!o(i z=OHege_81?JcymEt4hcOWq_aQPPVA?^n7;l{OUfwo-<(6*2K3)KezRS2ibAhJI0O4H zbH%ggw{k_{Vu_X?>EGEu+JC=4H>zARR$9?dzM!DmtdcRt;!4h_D*i9V5l5Yyn#@l^ z(pVWVKs}%LzoTPS87{pjWU@^WB-$)1he?dIz;p zZ)#d5nXsZ7cdEFfM5rPK^6(e(1G>1=@;L%dvQFq%b!hKx)vqscisZ#>!{3K z;2xuIOlI_Yf}xdQ$Owog158C~H+8eLRKi71!~Fa}MfAtk8!lgy zO=Mz2sFWKN_Xn8h*oZrJP^1`JV0?s*Ms=GjQJYzM(ds5<>4-m$(?z^LfCR;lQ@Cjw zV$f5gr-+&>)6}(SyWU8-Q(}VNl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$@)Ae*9^6BVrL^ow+4R5)nfAjhw^ZEF% z8bdM!%$YOdxtNF4zo6lluW1Cs?aAzDUTTz=_Tynue`a!9YnoyhjTnJyhKPfD;*Pm8h6VM z`h$pVRG_`}7g?ZvyL#%7=S<(i21Yg?8Q&JLsV~;Q6!+rP4%)iQ(9>VnAt+*gc1ysd z9ukkl-E;|Mlk#{y>S^(X)Gb3gIldDO2gI&hx)#!0kgY?xzUBHQPE@UG|dkR_8?}_%e_98D30QKJS$3!#l zMlSm6D#v#Oj4FP;LdiA^?8r6-^3(-V)rZ7K{zq!hynd+*J+|rO}!cMG`0#Y^SB60W8i00H_eqE&n`(=X(9bKwKt|qUyt@#_ekJx%lO5-L?E5p z7&`bd&H`RrVl^c{I%R!5V)#o*!qm7ny%|3TH!??Ib2AAwZoM|~Bz7W%p|%pct{kx{ zg+B)nK13Q(gV5WIM_GbcgV3Ax942<-_%MP)EVQGpqwgj34I_Sx$Rhd?ClJi5nsy3h zH^ywlu@P}!9qI2FxJ556;nu{>bER1aS6=nUK~Bu^8OMsK zpE#n05{uT_DpQ$ZY&pHBI!Mf@x1nwvbJ3mEgxI3i>?*%OwZ#jmLn7JSm@TQlB>(mq z$y<<@Khf#enLdNe9AJupAHu=g2)zV4#X8-;MqQ`AL`m3}k!#AM_AN`75MUUrUZ!BD z2^hivekYYT?R?6LHMQ&CqJ`SxRf|%00!HKiD%gjfL|Z3cQN>r32k(LMHPvf^)fJV{ zWXp$UL<=6Be7F}X?kd+)%WMFf5N(Jq#If7*BFfg<&W^pizVk$NQ*+Bh80)b|&TevO Kgn%MCoBs<(2!gEu diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G16B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G16B.bin index b5c2a91ea0d64e187a25c751f0ed2ebb5f8c79bc..77de884064128c459978deba023dee1d701f362f 100755 GIT binary patch delta 2555 zcmX|D4{Q_H8GrBm-*FN<4sbqSiG3GB$kE}%utEZ>u{+}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Qe}@DHv^y#_C90`4WJ{G7Yhm63bM=&k?5o09AEZ<3-6}~Rwi1(oQ`sSXRC$SE zxkhp_^8RNE{R-2kfSEHCeBL@?5CHTUB0x8ubR$1Zai|F`#XzytGVN`X~z_ sgC3z0Km^dXEc-$3-*Mt_N85LfRW&v>KL@@JW8fW)NyZq7+2*GI0zubTp8x;= diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G17B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G17B.bin index df8965e6780f51d09392c3e1c162346cd622da2f..c745da26f39e267fa70d2079f804b2637341762e 100755 GIT binary patch delta 2555 zcmX|D4{Q_H8GrBm-*FN<4sbqS!M+P2_~@`>SRsMc*d1|vNw%&G@`p~Btkqt+4vq#o z7Zo`zlqRJcBo{_VTefOLgH>HAt=qvCH3+oAx~_IarL2tUB51QMs$|r5&f?(PcOf*& z&)<9B_r33Zf1f>6bF;c^?tbJuX+-EK;J9(X<*h^ry#kxNf3LziJ+N_^O+v^w&m4GE zupu`>j{sx)!0}yfN5S`$JUWDtPt&x+L%^<7?!kP@nXVFX)krrV=VBwBC|5em#Zk^a z>lY&&Bca^J*=PA{CMH=KW95-#)-rdM6_;^d(pKV%3`9}Z+QjQyb)O*?%;urW8XYa~ele?)0BR&VF{LrRR_ujQ|39+4rv{9xH2^%8Q&Zgegd`L02}1L@N9 z8h?laBl`Mn%_$09DEF5cexHL=Vn&_6$01GwZ)~PSbR-xF^Wj~xa?QBh3U&0M$NxbM znl_{k&lpuDIy;X1)WzAU;uO@?r`NZSx|>$*&oekEiKi( ztM+}C0^!T3!ejG{F*l}idV#>u17OGqkkc`CY32ZRv%Flyjz{rL-0Zzc|IiZ&FHK@@ zacrslW9tn%7`8{)&)8y1Kc#B|vcPvdr{ZB(T}4L{-xgxN%7YXL!l3a>PGxX@yj# z^3t-nUaA!mop6)=Us(Gz{*~AwF)eivx{+l9Ch z$ui&k_s&#^M$X7G@~?@H9Zofri>L;i;~3eSM8cOD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L?wJRUE?)_p9R>+l1~C_%8k%+y&ZT#aJO%p zdV$y4ZNSAqP5IPbuUdj{k3ZH7j)&9r-W(}Is`MOx=zpa4E-AOLbLv~(eG*3whbIYk z%CntI9BF~E3dV`0X2_?TePW4&)12kfV;1w!a7i%U5**w9P zh-*aTRi#t}`&Gg}r?=I6h@U9=+_U5-k>wXgmo$TJArh_-DkEmnz#0W5B6VtulAJOI zBKJeil~v`iYLfWFl=GvsKhogMmx}7wMmG~P*smcGl2;gQp#R!jUh7I0L|q+;k93dk z@3;J8+Rkr;s3*yr=|=A<339~y!pK8OHj*tIO|Od5#7e$RjP=RlE1`b6O+cRJl!woW zdXw4p{*F&z7sTnK8wmd4TlAHn>i0!aP5q{1by^JmCv^!`H)4PNt}mynpcCO!xT74p zt`x970gp2P7a$3!0w`@}2U!Hz2*@-mEbM}DH-J?n_$aOWI>-ZH>jWGG{2U+vjsmDR zWVs#WdGL7_#%jR!`b`~Q!eK9=ur*+vU=lx?uHvgQk(Z>Kyw6CLd_E~4XzkyvV?k}o z75BlF-7$wZY1w~I`!XEiOuKb1>bRB8vVe)*oK@<}@}N(2K8tT!?5o6BAEMLiJt|2bu@aMj)7fEtOnHf6 zxkhp_^8RNE{R-2kfSEH?A$%}kkN_wtP$*XDJ_mD!`XbR_%*WToV&l044XHCKUz|(| z;YJ0CFn|K65qb$M(dHBOvI=`ysc#D^-B`KNS6Nnp8uSL#2xx)|F`#XztfW*~`X~z_ sgB~F_APQ(*mVF@i?>KR|z4bfCDjOP`o&#TpG5C(gBx8)kY;)s(0fs17-~a#s diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G18B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G18B.bin index 25a0fb8f1b36933ea25887a14774d093ad803a72..fe167d8d36ebf718025cbdef4c6f53deecc74c2b 100755 GIT binary patch delta 2555 zcmX|D4{Q_H8GrBm-*FN<4sbqS!M+Q@_~>wASRsMc*d1|vNw%&G@`p~Btkqt+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yzM8(+H5Upq5I{GR~4g3g8T znLCT^d88ft0Ysdyk# z{D0}*s}1cI@t)cc1qmZL1n`;1mkz)T@FfdC3fX}iM}CQPS<%~CfbZk1MCzat>{5bl bfsN4C-rXMP4t4&jzs_f>8^Q&)BF67O#c7Ue diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J16A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J16A.bin index 00ff72d10a7e86eea31fd97f381e8d5d5f532d21..5046e0f611665896771719edecc80213f2dd98d0 100755 GIT binary patch delta 2038 zcmZ8i4{RIN8UNnd@xT1D<2KmmYh#~NNPL~@*eRq5Os-vG`(BdK!Dy4fbSXo7fsNj1 z*({{a**ZoU6q*{ev??1&>&71;l`vNWDOyk~t<@O#q9K{?k1nFZ)7T_e9XQP&-@Z!= zns&P1d*Aoo_wRk*`|kd+>By#*)eZ=rCIBxWPLOF&U?Tv$h|Cwy%SgX!nf~f#=LUeF zxvEY-C^^*@03R;6r%x1E6bTQV5=WUe=t+$#qm1C#LPsZEsj-P>nS?y5CwIYa{m_-o zFjv-*tZ7aeLc1TEp3K-+|7@2XS&u?Q{(EW~60j2-I0}$hv!gpVB&??A@BEc3JVS2J zA6>HQh2-)Agt&9dm3jq5f@WxE$o2UkMrNloNmtoUla5OhHkqH|4{7$*4@uOBUa6?* z`9Z@#Ep)`4HjHX<$^l*eQu9y?-6Djiq(gs4SqT3Eo*O0cpYL`{q;wbqwvXIAwe`>^ zdE7h&ZGNYJp8vQ~otqyt4edfhR)kti2_2=MaF<(u941WhaDgLqH$M3$Q_5)&~)ONl%USf`g6w;oZw0=%<`%_XQMo`(UVD{HHG)4AbdDU zN+iC5!RO}(zeop1#~4TX!APMf~COn^&lKYs6Mddm~#{@fh>9T4ZwaC0;p*~ej zJD*2EUlTxI;Un%q^IJy4nJ5+^hO5sPMlFH-3{sd6s1{2@5DqIJ(8t9m&+zK|!yk-D zEGh&h6QP;(pD2hvXUw6d7Zu@2XY?v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LCzEh=YiCufP;BBGy8@&d1qJ!`0BE%XMOZWH% z-Ksgcon=X>Hf~KDo2xN`Gh?KF65BTs;|Pot8|l7;vXOe@2y7EF zC5n_WHJhSRTB7wHXJ$C+Ogl4f{H~4HWt6Chk~NIljN-PU)v7Fg%KhG;HTqu4PQ&Pg zjeecms2u*cKJBTG+2SKYdExqEJ(bh{58I>$u(boBi1E_BgD>3|ubmkp{!am3M(0BK z%$>#dJkpN+03uFY9IrCP$_szWFNv+>?fl)A6e;GPvFx`P>T_rs%ztPpSEQgZlK+== z?!R>J*M@eBcu#GJf`pMA0{G11O9x;E_=*J}h3r6%BfmyEt>|qn!1r-hB6Uy+b}GTP bz(#0m?`jWpg*N`Cug+(x8^i^+BF67OyBm&+ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J17A.bin index ce93d82eceffd72a15a85ca5cacd64e84e05d6dc..799e0ecbdbba1fecdd5c9b468b63811f1defce95 100755 GIT binary patch delta 2038 zcmZ8i4{RIN8UNnd@xT1D<2KmmYiplVNPL~@*eRq5Y_45m`(B(;#%PnkbSXo7fsNj1 z*({{a**c&Mx-~UuX;uD7l<`MMB`noIiWbyLYc&SGXh^2}ql>7>G&adq2Tl{mx9`$| zrk(Eh-uHd)`}e-@y}N&GIJ}{y_6-Q0A^^`Kj+04GU_Aglhs>AHOGv+Fnf&@j=Q@C( zDOD%$mz-(~fDZ-k$>T*9MZ!ZT#9?L)dQ!v6Fe5m&(BW}cYGkZgCLxdN$)C4dKXPR= z%$0Q{tC~}W(5^=&$20cYpY5_E>rsfv|4>as0(O7{M*$M6b`0l+gw>4v{l9X>r^&5_ zBTH7jm|UKR5O;QYvA&2ZK{K_}DmlxIa z+<;-=t}qaH$}lQ36AtL~mzoD#=w=~2AszfX>O%N=_|-6p|9Y2OBBeu^uzl#pi7f{| zE#TrwX!AS$bNnZZmD#xg)6q_JWJRbmDPdFT=iH^%p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O5|TD?Nz_3 zchR-Hk;A%AoRg92f-e)0VSdf$q@!B?Y%WmA5vi2h;iVdHy(bv9%j+#|0gE55)dU>M zl;h!^!@J0)PqQ;#Uj1^Bi+B$nS@QC`ZeN#&mRjhO9x2^|)h@ASyqNjOJp~u_q6@bc zzHh0eWS84I-x-&w#b+)yazC+0olL^fEuB@ZLa~W&=n9Z(lv601iw?fKix6v6EZyxF zbgSm%c9tcj+PF1sY_j6^C8?{lS3fY)Z>0JS%#4xxNo?Ojj3Y2oY^3`l%0}vqBd|@# zlqgch)NG1MX^GZ*oSEUMGwsZ{@w+x&mryk# z+<)mls15BB@t)cc1qmZL1n`;1mkz)T@HGoS3fYbvLw<#HTG88DfbZk1MCyPN>{Nnn cfep~s-qjxH3T^mxU!BiXH;4;tL5$yj0H#@v%K!iX diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J18A.bin index 73f3741c5cf5ada3653244e59555f7266905a13b..4ebbc22797ebc6703b279bae151daf784169b8d2 100755 GIT binary patch delta 2038 zcmZ8i4{RId6@TB^@xM5UFKL5)zP9!`g~ZpXj-5i9z~tH`w(mhx1j4=lB5(- zJ%+@#tQ)>fZ8jq6rmR`LWZtH>D{bt^HP=xy@m0Qyf@-6F zP0P5SLq)$Apttw|cd+RVv*BzEix5ZYbHx!`urQ4j<^w9Tr9p^9)c5EU(o<&z?cJgG zhGiBLgA>W{bmmVKB)|F&-7ap%QBeOlbTJoYZuaBUKNtQ$gG|VqQP3|eMxs!9c=5t; z0uSdX&C&C@AmgMmGpmo7Z)R=zugE*~w{T}8E2hK`ewQVMcvL+lyhRBMGSW@dH;1u` z3vm^Ugc@fd29P8mX zX&OeZak6UcMecbe!djW2R*VBOr-v8`I}C<~B=(bR+fgoTQ_boIbJ6&&+@MF;)7c=i zqwGIR8M#gW5%uG#?>3*p>{vHt|G6jEOAh)aBTpTnAo`ikoG%#nq9YPXXa`Y|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2mjW!nl71fI#(8dE332VthVhlE6Rk{(cd>4* zfe*+woCm78u*o=_poEc!@XU=_?KrE*L-DN1^JXce4XEq&=H!ONM&5u1uRFZzs+sQ zT+7SRQSlK5{#3zF>k?|NHW@m69ajObHE|y&$Ipr{M}+L}n-f*Zj$CgkANjO!3VQdF zP;$qI^9(E0`1jh4rPPnakTGN%VwC9sVw71A5=Op)7$rQ7^Pb1{MWhok%F!s@jmSyV zT}GZmt{|t8>?`;&y-+SsVtX$dZNt79`Es)3@Q3K_DTq76&ROZ%`5xL+iTn$ted-tW zZn~Z~a@g>Zb1G6@@MQurEUf#KbX3cq%m*qtB9(GGvRvb>_XNXsd84H*VDZECnt(%@ zc0Aa7WH;ITady_rt6wT|5%0l6%U*uZo$K1qJ!`0Cd3*QOZWN( z-Ksgcon=X>Hf~KDo2xOBGh?KF3fngj;|Pot8|l7;vXOe@2yBxw zC5n_WHJhSRTB7wHXJ#boOgl4f{H~AJWt6Chk~NIljN-PU)tW4Q(*5p`HTrJKPQ&Pg zjeecms2u*cKI5s6+2W%@dGY#EJ(bh{58IRmu(boBi1E_BjW6Bjubmkp{!aj2LFYpF z%$>#dJkpN+03uFaoTxIz%8P%>FN>|@t^7Tf6e;GPw(PeU>T_rs%zt1hSEQgZlK+== z{=anZ)rNM9cu#GJf`pMA0{G11O9x;E_>u)6h3r6%Bfmtttmthm!1r-hB6Uy+b}7NO bz$R#G?`{uthdO`NU*|K`4dDV?5##qCeCUr% diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMD21J15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMD21J15A.bin index d124f85e75c7779371bbb682551e86e791b124b2..7612033472c38cdc952a927976c674e3d370e245 100755 GIT binary patch delta 2633 zcmX|D4Qx}_6~6cRH+FvPI8gif5#CQiejJJu!+>Pn9Geo`FA1z=B{;A>vR1oc6L^7k zrYf^rXbCMHBoDN}S~kS0jaA(s)a^;Gd6YzBUV+_1BYO{N?w44ge@hAEO)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dB1d?!-8$wCuH{^Dz`|_EDDq`^&?g3;jUBP=tA240-gI}=MfB&#h!M^~ zeBMRYJ~%D=<_q|v933x!W~YUG9_lXz*QXr33zo1nal?E;+QJl-|8bDvGu+y-T;jo& zkX@j`T2-zq)Qqhr8!LQR4|+4`+A$m1TY<4DWK6H~Xk=5=PAmdWXGTnM^&{C2&Pdjx zy!ok0zsmF_VCEPFkKPar-T|m3P$^dF{x#?-_4!iFyb9luo-v4#^~qT*A>61S z5e85IEkcLE6Kif~i_6*KBHu<-R8mpmtML0#y(t?t02<+hWTVGW@gqfQYM}|CZGdJ# n2jI*Dc^za^ReS59w(lIMsBdU|5@Ma^;N@)=1!E-f)`tHA&MJQ& diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMD21J17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMD21J17A.bin index 8913cb3d8f9215492b55cad6baf1a3c014f727e8..54ddb29c33f40c1464886b1e57e33c0ddcc7fbf5 100755 GIT binary patch delta 2633 zcmX|D3v5%@89wLw8Ruokf!f!Xa32YA;!vCz1|;k1*p%45NnkB2!GZ0Pwb}`rzzei9 zRhdnpCA74VT+jk**$}HXR&|3=w<}fDRM52uy4n#)8FbS{FtQa@GGokM9DMg*NE_wz zf6n<|=YO2vzUcl7n#phk=3PU|6l-R4D7)&&Og5aW#)0i`0+|p zBg*LbB*wuioh|5m(HT$h7C#-M<9ej0l-ksNq?CYd*i*M$dkKT)0yOt??ZKR@c3>ucS&`LG)W4> z6~ojokv(|4&mms#8y0%QNMnDj9^XfSF>U>!nvziVzj>Ru73jb7{3fet_X~YG;WX^O z%$MIkznL$Kl#8_V$iR+)v4ML7`7!yTzSfL>@&yIeX639to{;l;MGky1fjH{y^i**Q zlEzAaLFxfr0UaDs`vJkmJU_L&^xG| zdQ(-isiYaXo$2z<3bBq6lAaxZ2U#Q>Mf=xb-!Hyv_25K$S0I-$buUOZ?YIfd*HM+T z#5qo1pUP_W1VbypkRA|A1(}-kZt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Wipde|F;OQWk0z-h z*ryS`o_wsqO?*VH=k5g`2|xH?WI^|8kq{152$f+gX=KcTx+86JqgtF28g}l3nyXpm zkTp(xA&UDT=hoYa$zn75tZw1jWmbG#Wo|Ew6LM^CGU}u@4M$H(PA~o@Dt_ z*!4JhBh}Y~Hu#Qz z0<$2eDYBm6A6_uN8PNQtAfjt1i`T&K;C}Kns%gT$hMjjNpMy?BepFo!T~`cP7lYR^ zfC~@@Q~}gBV?h=GN&#xKUV+4J8211eRf0`z-S2~Z1$-lb9|2N;LBKfx^}3>50C^H( zw!&Bo*wRpT{0=PkGz#VVbI0h|Ym-%c)#A<{Ni};Ol`HvGB#)pq|H>T+=#wtd3m5tE z8C<4k{xj)aP|iT?aJF~T{B z&O6E42d8D61S z5e85IEkcLE6KU;aODfosV(&&&Tv}P`t@M?mMpHIw0yM)3$wrT%l1GZw)FKl?+W@VA nF2I=w@;bdy8<9p5=n+1S+lB*Z$*fy>)03dTs{txf+0yM}+@ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAML21J16B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAML21J16B.bin index 05dc815cad30ff0d68523ca7d642e1d67860399a..2ce7f1413133bbc89ff9c073752768a6150e157f 100755 GIT binary patch delta 2559 zcmX|D4{Q_H8GrBm-*FN<4sbqSiG3GB$kE}%utEZxu{+}Ul5AZWgO3R| z5xg)FPm? zfj@}t5wC%X6z)Fji6=OFh>@AN(O(?3M;N)Sn>pz4ABr%_BC6E8MstphZ$d^CG9wz9 zkp~^6QHYiL(6I6l6`}6rm0wU{lWu&ua)avfp3Y-_=6i?_%1C8dA3Hnt3^=6ouPN<@ zZ{lI)gyDxR_nf^3yv@L)#Ovf^Q|=?V5gv1(ken36K7R+PX|+c>qz+>A>uYaMh;v7J zyZXRw%#H3GjZ;7$RoabJ+c^HP65;!`>{ZPpGNg|mDjA|)MDEDVuEiqXJ;Zk+oqIv! z4^yB--@m0fMWGvI{xZw&b#O|=sMB{l#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K*o(!t>xTk(qD(|7pZL?-GJ;54+lyv$=Y6D@G+Eu^a5$GdvYN#=!j`Cq z;H@6<65I*6k`af6pM>o(Gr15jPH?2J_AY}+e`{|I@SN;VCoo>!GquZOlwYg880KMX zGuhXw=^dy!#7RPSYKKQBpBH+e0wC z0Xwb4kRl#hZWmszg;_)XSNh z`j%&}%#%Z*NrE|LwsVOmEil%=IKI>j^(3B=LnP?xU11+~CQR3+vZLHWLfjuOSJFR}g8S|Jqz$ z>q_KDTpjU`43F>cv;Je+A#8-KC&`#()^p$|-_k|H%{iZ~9N(%fZc?nfFVqg8v zFQ==Z6X6TFy&Sr(6tF%HkJA7bAOWZXsBPu|SqRt&NH;4i?1FJOfK?^KL~k zu0FE|Z+$eu6aD2$Lc=+TF7jmE@@YA|SR|a{m}n6+J0lhfP=6_~A!!$Q2;s@bjf+Jo zGh15m>k(GSaA_y=i5tVeB#{B__6l9GW^xVLQt8Edm^Z^*J830*D={_(>C}3+MmC0R z#4O@eX2=*-Uy{9iMzYfK{%0!vD$^%{nbTAOa&*8T4p2*=QmoQ_4(2NLg;KUD4_}vx zOy}Y>l+L7na?&M)8xb%7 diff --git a/bootloaders/zero/binaries/sam_ba_MT_D11_SAMD11D14AM.bin b/bootloaders/zero/binaries/sam_ba_MT_D11_SAMD11D14AM.bin index 8c0affe612fbcd5457eafa86d72503867ac2536d..c79712f9077c989dbc47622c3c867463869af6e2 100755 GIT binary patch delta 2824 zcmYjTYj7LY6~1>@kCo(Dvem?TtnJmV+gMg8mIcJM3n^)VwM3%1n@N;|B{ptu4jkO}n? zzRM~0%Dtope4|2U`{hA~_lnisFZW|uBc?9cEf)e(pV~K#BE?I-&I~^_qKQ){jp7Ak zixeOkVZ3~tI*YvG)PPsIGB7Ump{Xd)e>A2>D41&MB&sutZyCRq(b6xMUD87!UtD&k zTv9;ZcI5DpSB`vsM48n(tt^8MU#2YJu|}*a-m4X?-n0yAhC-Yv55f(vDQJgzK&S)l zP-aB7CU=th$nBPJ*&+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!~!6@t5{zm&mrpNDDMjjo=n)IVWeLPjf|rH6GK5$gN7MDE6v^&t^9_xu};a`P{MO zrQwGgMwT=u%7k#JMyL&&XbYDwC^u3kHz>)eWZ~vs$hk7B8fHyXZ;0XFPkF;F?v+wW z)0)V7Y6AZSBtr65M_TlEI;w-tL~+D4>EQTk?JSies|u8yRO?ZG_+pr397$T2S{K`4~n|{?F zOCp-4b%}a-(Z5KZLiMfK+qC_YSsQdB@}Vt0=(=h^RUCef04e}|fUN+f&72_10d)YS zS-W83AdHU#N&rebDy@4Qqz`=E06(A~uodtmfO%b(TR{#&%vKny0Z%loJM;-0_7n

EsJRF)kG>_M5x&O?1mN~-9?bf@f zbL8=rJ|nk2tHP7zLbr7uvu)D6r~ZYf@Wy*n4yrvnP4!R*(M1Pc`>S;6GS&OkDpih;%RFWZVp+*6xvO|WbvPtg48p&CfH~yy3uQ0s}m^s2&k*xy; zy8%iH6p9tPzX5uk_(i^z87&Ztj4#IZkhgq*Z8?9-UkLb=fWiRa^YI<!iBjf=@9?Jb7+qd*|?eG5f d-rAPdwp|cw&-Y*a+$dxChf!Uq5$~H?{|g5^UcCSS diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E18A.bin index 13c25eacc40aca4c5dbdcfb6c354bca7bb5523ec..1e0b59614595db218b44a5758017794d221b2951 100755 GIT binary patch delta 2028 zcmZ8i4Qw3M5uUeu|Ngu4<>zj1>)h?x*uG7b`ys`Np*r8Cxx0O~3xz`L&}tou^b9R* z329GA(HT-oTK?i3Rh=}nAeEMakc`nqfMnHCA~jJd+*(CC0!3>j!fMl27lrgfV&8Vw z1XOjk-+MD}=FQBTd9!92RW*8zmB z)xh+C_G+*(w z)AqinkY}EPE7Q>33Pf((H$9nmuKd-hxC%a%NWu@bT-nR5bJ;A1-~Wg!cXKzBr^^$Z zzhuQQOCW5`B8K3kGZ|0KNi(jq6And~687uP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HlsF6K~*f-`{Ps!HQf<$}7XtJs*?K3i+d=x2zEvJThFhjWom5EFE(%wv4m_)Lhr5~L#uAFk#F;RNd?*owDpTt ze!x$NDJ15%cyy{MYU370@>LO2QhQ0w-8)iUZm++u$*(E>5Gr#9@SB#v&LfDH0!?B~ z?$4vGNw1~AJR?)$kWxaE5R#G-t##Q_;~`tpmU7~AQ=~fO2#IK!0vJs>oF*K#kv2Nt z8#RUAOITclHf)Ye=t|4KU#X??;Uqr(5A$pkKc$@rML>kWJ2LJY zS;fx+=ppF&2w(~~w+%mTm$3aQ(vAI2M4Y)iErd(UYW9M$mAsk#jWI!vWxb|DMlCvx zBfGLMm`Y`yURu%s%cCy;HN5t2d5eE`LG6)bvK=c3wBY?pK@Goq8u-%8;K;Ewc o_!`cNCBEWl?{T!ZdAC7Zhrh%7lbh9wVAj_gU=&x_g=oKj132Z3ZU6uP diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E17A.bin index ec6d251d2479c74d6ceba2988530c0121d57712f..b775aa60f14de025931e49b7e6184e2b4006a5db 100755 GIT binary patch delta 2483 zcmX|C4R90372ZAlTKX0(P6o5=FAkc1S{lEtB?eX=hDSI7~t` z8C;2<1Vf+!Uzi#6#Rnm}pVuoZACLu^}=s1vc&I5xk$K5jaCca23v$gQp3 zvLF3PL&+^WLYrY_sWUI)!Qgd)1gt7+rGi7XWVLi&;#SY^8D@_e3 ztK(7_hpTk9u=5FLBFR~Tv_vQLY$e2?rOqDuKpA^5Oz)--;H9$yVpAN1QmrGSYmpuW zjmUwF$cc94qj?nL() zrhP{}d58jEn*7#E zH7%mte+o8X2aNwJa9gZ`J;?Xy__Hwoyih*7ezQ;(D;H?-yM6tABYk)J3M2AnL#-J- z{0XH8mgE6L0?RTs+LIzo4^haijsE}=XC&03WdlV~i%A#?S;kF5$b5B^F-E88exTyvxrNc~3W*>ES7sVE}RYUOV z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@J~$9^DnuMsa1p#|AIx&VL*>(4HHftJ`mE zzsld>uU_Y_2S>=^;zniT@*&jN^oMvz!M{b`9&Ha8`42;=NY7sj=keF-i=)@-Ka8-% zN!vPoj^R2ueDe31aISEOvG7;8Lcm1ix7#S*MK+QV|KBHn!`TQGli)_m`;>K|1v3R*R4Kj7*K?k8be z%tT)I>n9m97`#p)GSoSc31BD_z(j5Tbfa4@o(P@{vvF{3BCVauf#JFiM&Pnj+uUmL z7}p=Rkz7JWW79$46WsB~d?Gr%6Zj)s&tsk^)BD^?F$Pz+g=ka6trHJ$F9#u3hpkr$ zv-8Q)&gqxj8gU86)n5p~2gI z2fQFwA6ZNA8}I7g@hjthDvGEZ)+K6Fg8yOiG^%aJ-iGa8&d@NR$cJitFm@Gya=yv;YfIRr}=$-^x4YC&in*qH5A0S>2KZIu zP}&M>6<|xly6!LGw5L(X>a$K#Z_ZS6)tShjPPMq75v#ZYQb^G1udL&KP0|_jz$M&0 zkJoAF|IBzYIl`H7>si#Y%b7BtiC&*o>dA7UJ6ey$K4IBYd-Pen@qT=gC7Sb7LiXdPOT&xsytW&d>inpDGS+Ig|R-MORaG!MSa*xOnd;R3?Y3~{z&$dCNXB{ z&CliZ%c*XL%*d(V1@t=rxdd{G<#g``zFN4SV^jPnS6F6xC9Z?AfxaTWEl`z r3kW@--v`=S)75dH^LzWMnwnd7fvzLRf9ak{!th_DDo-suFgO1fpowIe diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E18A.bin index 0f8c4e8a1c4c3a11839193550e834fd3bb9dc2e3..f6b08a4d66b14f848834861d4095d6cee12b226b 100755 GIT binary patch delta 2483 zcmX|C4R90372ZAlTKX0(P6o5=FAkc1S{lEtB?eX=hDSI7~t` z8C;2<1Vf+!Uzi#6#Rnm}pVuoZACLu^}=s1vc&I5x8@59zFgP-X+)Jerox&{2RPHX-)Hjo4wl0MJ?g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@zlMS%;eR*{B)N0_~BFHlwnqOThw(dUz-SSq6mG r0zyyd_kp(7bam|S{NCQGrskHNpzFx-U%F?KF#H#(%2Nvu%+3D=87pNP diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E18B.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E18B.bin index 5e164e6d0c6cfbbc127098913e35ad398018c925..711db2ce06248d7652234ab2bc29bb329b700fc8 100755 GIT binary patch delta 2479 zcmX|D4QvzF9e?lq89O0%9D;qmfqfUi_(HK0SRsMR*o-*7B^tH2TDHi-?d%TRra> z{l35AyaSbPUr z5^?M3$l}=}u0)cxglLIQ=)F}@ON5rX`sibo-s2HkzDQNmTU6WB^me32AtQ1kBXXe; zCkioQ3d#SXwqb+3R(HX1sf@XM-$h)LgcOGHF!NJ`@@KlMEw{-nL+KN#6$DhGkd)?y zls8WNot8*kj1#?AqXYdR))5)#O@S+zop^B~LBaZjd|$t6C(E6XBitdia9wo?G)Zw| zOU9_zkt1@aw@%>t#<(7&aj&S{2?~U0+~Owe|g#!aZ1 zF@wc=cP4l?8s0YlV7`fEs(Nf-}X zawZ{czSV1t(J6Wm!u|;ksDb-)nxCqwLnwr{QomBwd^%-DK3AryeTlG=;ZpqIKVdK8 z&Z6ON-1L)g*?62e6fR^L6$v2+{+jbc9)+IZWNH zt`>0RbNDXqaNl))&lPG~p1^EfWV!T1^BrfP$r54`W2o9Y8afG8F+J%@jD#r05}BE# zB}tR%gG@p!jlx72XDhj`2!t?PTJ+${kWfOLPy!t;W~ElheCUA*q4~70!`JC2 zxN$}1-X!9g?5fzR_GMtevJlR2qD5f|wQTKIjr?|m9dc|wf$x&&7;78irhPqP(Ng{8)5i8S^hV3`&xJvi?W^sJttrC$&a zGu~V*ceK%HJ$5%q{lTe~^OAD5N#zh93`@Jm#mza)=PW~GlcqMrsfEiWlcK4JEa-q@uUc5YP=J)S z!+ulRAYc}c;0sRTU{qbO}VBGy7?|ADC0kKZ;&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Ytd|$~I&jc+Wld3qWF%>!)D&+ukR1Y-W??(s-N)cm$it{O#t=?UgtKtF z1In(V-NkQdrZZKbbp$jHC^w3nsV+E0G2yz9uOQ2H;rdJ;mqtE=nidL3sj0V>osqHs zCu3A2VIeCL;hBA4zaPVDdU(hByU(zvKaUmi)t^=mZu)f7p!}&kc!^w!^wPbRn+=<1 zXVB*6i%~}YIenwAEmS0bl8T}QR{26~j(lN#W#Yp6PZ~w);hpUPcTX63OxcfTwi=wd z-XKAOUH*tv06uCww}F#=bQSFlelavaoRmvy(8*kX6@4h1ANhTgAClCZ?IZ6;osHgP7mNDr&4s1E`>?=SB}Qn0WBE)|Zx9dF$SCKRPey7eqQ+xr zOq}pjFOA!M@~K!ky=k|}zlxP5B#Ku_@-LvL;CfDeoxB!vCT;YkVDXSZGm(oNqM7z% zGuOz>Tq84cjq~e%GO}5kr5=vF5))IffsMAb8;!Pk7D9 zR>`Ph=+}>d-i}<8RHV+hSdEj`uU*_Rt#|ZABj1*`sUm$mI!v*k<-a#A(pDH7VB9(_ zLx{cnJxM$TqDMhg45FtbcJnJ)o5BpI`{dZ=nRxVaxPK(|V9U^Yyv zql|DVR~>7X=Bn-{v2i&q1BG{y60{ESjm_+rtt%p)G}q|qykNO|xyAnP(F)>+TMyHB za@!@8?aY{!W%CNg-JupH2snngpN_63Yi4}#P%bVlRacR@w1T3AUpWSX=By`K&7-k> z7x6I6P{W~_QK;+30;7bDv%iP@9Z%MNw-)-(=SPbb;*!&|M)cdI$!zCD`W@|Cp4u~TWzTZSO4^`==cdQ863K3cY t*aX;hpS}vTrJ-ZTp7tL+S>L=p{wV0WOM+)_*fb1(OO10(%B`~P{{!?0c~$@b diff --git a/bootloaders/zero/binaries/sam_ba_arduino_m0_pro_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_arduino_m0_pro_SAMD21G18A.bin index ac858f0cab0173b5f9d81bd1bc7aa6af8d94c6be..43f456b79776b4d86c3848823f1567417b4a41c9 100755 GIT binary patch delta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ukFo_qd#RlXU(ux=GV@IYMp`U(diVfzn)l#Iafhm?AEE{BZS4o%3`U@0s z5>;!Y8_aT^t5Ig8@02fmL)KbxOL-XsEQ|5mDMT=;7#8rqUK*|7<9fV7DZ-BMArc5h z2&k?61xL&P-$x80UPYWjgvtSSVqg6Lu8Ir}*_*c5n;N~Fp|PdC#oO*}gkD1t^db5| z!0(OFbZw)u?U6!&*ARa~e2UN*p)x<%WCR%K9NK^Xf$!bd-rLuI`&*t$4XeQmlxw8T HmcIW1r?#nA diff --git a/bootloaders/zero/binaries/sam_ba_genuino_mkr1000_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_genuino_mkr1000_SAMD21G18A.bin index 774b752d9eb9d4bea5a0391eeb82d07f05f80857..c6d038c290a7f953185137bfdbdfad68e38163e1 100755 GIT binary patch delta 2743 zcmZ8j3ve6d5#Imwe%N~XA)PMH>CPdxWr%D;apFQ{Da4Y_c4?p_kwfPa!p!f`lEb_- zlvK(KobZZsFm=qUlrn{S=maxLfsO}LGA#^kkuqV%gg!0ue zg-?Z~bPh_JD!fEOY{njEm8ne8vV3YqYGuevuXR|X<1r|j_(z?g=*o5|t_U3=8(o$T zC>n$uA#tz46Av5+WU_)i$|`Ke7;>QvR@uCrJ?IP_inDvzgG60xa0ubA+_Q5Vzz9(@ z_`wVTFh|jUCq&^|=x>#Cpely-%)b`Z&;}FI`RP%s;EM}`)7ywBDq`le#rWPzX(Tf;1L5)qE2Neb6PnsP zb;ur{+B;7fA&_*(Dusabzzz`K+2NO1#V<7s2QyQa%6mESad=jSQf2XX;^WLs$bGTc zz0)K4Rz-WZ8$@07>7q;01)nU|OZ6#M1~EK#%h>eT*)e5S)l6+xqn@B2{)JJk<_uBQ zJ!W54#;HjI@H&lP%9a)A*AEW~=(k9dG5fqlidj!@GpE=byBpK+9*NW<=N6QKxec|N z0Wehk%yYF`DW9`KTcA)kSTC*O#9Vmy-%uCCr{Iw-r01vKbB9S`U#wiT3}2G#-2E}i zo&ayamJQ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%kC>Hr4UU+nzr&$8qpMu;Axfzma%aIe7^+10epZ2Koug;R$tCfOQFNHAhZBu zD~#QMj{%>RA@mbi73t~c8rEqR556vx>u4QppiC#Pwr>3&;i{U| diff --git a/bootloaders/zero/binaries/sam_ba_genuino_zero_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_genuino_zero_SAMD21G18A.bin index 1e3798080e0e6d8528c748672ba6f0fc45e68354..a3d47ea9b372b44703134924d5a2a1b4a8d52428 100755 GIT binary patch delta 2794 zcmZ8j3v64}8UD}p+i_w$&cnXGP46S6Nt{t9DUddUId*Am-z4MR)`jh+Ez?QaS`%Pc zjLz-@NXsk91uYG)F@^?|dum?FYJ8;CLN3Z$%T)9pZHtU@yb=HR5h`)}#cv?$;C z|8xFx&VT;r^@}|dU3IHj;O8v>&mf+&OnQTj0FcMYfB#-W{$l&&B`r<`fHzh<{gdD8 zaCG_s_Tb93lgIBTx2x^sF>*kCll*}B=8D?OY|MJ{lFSPyN5!}^c5(zt>nlPWO05+> zDaffDl(toPnFwsg8DrBknWAm=-8IRzLOs2##vU1uLeauM;1VKh+o8Bdm?BrWZ5>cF zi8(@I^(JpDa7Q4M6`c__&1TGk8+EYh?Yr2cF5y^=J;)v<>Lyc-82ZvPzpxd|5V3+E ztPlWe1PyRO1TKUARwV~&+O&oF=d${O=_%jLGLcSS4N^}UG>+rB<@q10H=19`rt@ub zPDs)9L(W)ANzoS6!3YLFJ8BnwF>!Eqgh*0a%AB;B-&-s1%Wjmm7wInHgK?%zRresZ}dL<)za<)Ur)yjL~M$+q;If) z;1BmWBV1+*+`?q!o*0*2m3(1ty zwRb^uFpjLV-s+5X?*ef~v56S6(!W=sbjfl+Hj8GCO+P_-ZhD|uhBkb&Xk;^VSPJ;) z(vb?3{$5#K3T7a5x(KDn8E9K75R}}ClJ`-9y8u1`trzp#DB}wb-elt+w}Igmj|SQ+ z7`-jHh0h}FdA+;=RnJ%K^Pap#whT&&UUr?~If3fs$|}!!=8e4YGr*_w7H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p z`!J^T;CFukFo_qd#RlXU(ux=GV@IYMp`U(diVfzn)l#Iafhm?AEE{BZS4o%3`U@0s z5>;!Y8_aT^t5Ig8@02fmL)KbxOL-XsEQ|5mDMVOc85Z!rUK*|7<9fV7DZ-BMArc5h z2&k?61xL&P-$x80UPYWjgvtSSVqg6Lu8Ir}*_*c5n;N~Fp|PdC#oO*}gkD1t^db5| z!0(OFbZw)u?U6!&*ARa~e2UN*p)x<%WCR%K9NK^Xf$!bd-rLuI`&*t$4XeQmlxw8T HmcIW1sT`?U diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11C14A_SAMD11C14A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11C14A_SAMD11C14A.bin new file mode 100755 index 0000000000000000000000000000000000000000..0326c5a04f5c5b5e3b6858410f6c3cc7f6d995be GIT binary patch literal 4044 zcmaJ^Yj70Tl|HxUsnKiD2s4k?&@(OYNFzWXOjv_)tJ@ZmS|S*mR3dQFl33SB&el#r zZMF>-8UsmWATdaeBTK>ssO(@KF4x54R06UUsHBowS8cbjvPckbXN5Dk2w6F#Xdz(k zo)&Uder;FX?%RFOJ?A^md-{Gca4Q*r2#zH<{=ci@AJ&)Q{5M4a-i)(}S0V1w9Wulj z&0Y@%d`x&g=^d#8;4FSa#Q^S%8`o``tKQvUQMl@D3G3a7UqS2N=pGrZ`--+2_r>P- zdNYxRi0o0JGEe6k{c4H2&p(z9CR1FvQDC%Ik4jdJr9H`@I$i0W@Hcu@K^#qclMg8u z84DX()vF#5OUD+}+tnRus4AW;RUK7CuPX<`QC^y4)Ggvznn|)Mqn@1O?NLMOfN0ZG zQHQ*RnQZkUwtB=v9%AC)DX2yDId5j?hqL87;3>&2r=k`m$HMe;cg-y7V$sM~6O+z+ z;$5F1E%0x_Yu_R@KYhj< zC)$3|)LomFrmDLBjB7(s637dT2B)&qR-7WAr;v{wM=~R^VeJ5Oy|`E=1^-O0ljhKM ze|tcv39BUfh!jq~=$`Ud*LVb0?SD5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xFXLyU%`k@%?p&ZTh21&-lmBZGYn7wRin;<9Ee}Gv5Dp+<}5Ed8>4{-#cS*!Cd_fM_(9xZPP=q zKXqGTMRLRkQ@%Vj>faMK81@YR-R(=44yzn@b5-9TKFT~l_VkCFPCxv}zFj+RnE(5b zLA+MzwjDREF7NOx|G4((^=I-goNw-J-@mJE|9z3UHPw+NzGeZYJUv3@sc7D;8!F~bFCD{%XI^O!HBkfLRA`9s`ycFC%5DGv literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin new file mode 100755 index 0000000000000000000000000000000000000000..a6ab6abaadec1da0c91cb97962fbe6e4b6878997 GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B{yYecoALedgjsm~U%iUGE}(;B^ud5w}6p+u|rAe+~d z9ny)5J5h1gkvvgfjOEG#r05IsqJ%hy?dc?&I-JR zfFFFBCmOa+TjNXi4i+p%Hw3R@(G=>x`Ft{=$>cx-@?Dfkfhgz*lKj;kE?}TX3df8W zKfnCV%sGO@mGN$-oe1))R$av=+_`|Q(bgdpAXgkQUObG~MrR;Itia4{*?yw~s5-ed8o0QEF-h`MR3_Qzu;vv({*rKaQEl^Skk87WW}={gFT$5A&+cwy-@d>hH25R1pAJ%^cNt<8B*j#7uL*7C>G?4zlwruoBE~ ztXL-M?;SAwe%2+qL{$}r=K-mi;;&ify~7%TW2 zPOrv0JygJj`in2(HpC#WNorvYJ*R5zw={uu;=^Wv52qUORf)4&ngQ=>` zc;WL3WDMc{D+4a*OaMC(?MI~9LpTS z8f>k1te6e9NN}xZl9~BJ7br(Z~h!RP6Efu4JgdH7>myI7-SX8uoQW z^<=8aFI7)^cc+>>qMn7IVBI8@w#c1>6oE_)E>;LLr8aL7ZCz{aST#!61#N#L!9La9;`)CuK_^ zo~qJkp?{BxMi0mVx(If*T-D{{Vl1J8h;rB!qQgiV#~w=7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O!HBkfLRA`9s`yc(q%Z~s6 literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..b73a20a4127e76e2b3c431c05f3e79b5b6adcdad GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-BkLy@cjZ-FKg{!7nQM)^!Y6g%ofUWs z0YCUMPc&?uw#Jw29V}RkZU|n*qAApW^Z8^#lgWVwAg7T);q&6pk4$ zet!9znR5h*E92cvI}zkpt-6X$xN`wpqpd?IK(07qym%O|jm|)bSb>?@#tVnpW(RAO z+2$hw2XM@Izz+}b1auNdH7ZT zPYG?GstVcx{)p#PwLcy+A&*_ksLJFDDJJGy{x#qt<{9+Z0$ldgY^x7TYha(onWJLG z%fE-Q%_zriws$*DB>FWwgmrF!b#wsHc#s+?JxH9)TFv0}-{YhDlepS>(zeJRD9abI zdw4KEdWY$R&0l5-P~t|E<=PNYD?Ey#>bgUQ#wzHwRez zP5kNt>^`X{?T-Z7c$imhwuS9!QGb^ep^5;&YUZfE8+Y4KBW9WdwgB=Ha*&;0ft6r> zYlUVT2pKqsVBp$VET=Q`gNRwfVhNXB7?S5zy%JoFKyVIrP=*;-^nP6&bl(5?#aO}L zaC$Y~>7fEH)L(oNw;=|3O;QVM=s8tuzoiMR6PF$B{5266hrFj{Od|!+)4G~Kx7Wq7 z2g{x+qyzIN$obq_EQ%7Y`5Mht}iAFA%r(%z|s>ugZH$m_Iq36<+#=l1QiPS7E-*p5c$&tF590rM4 zKpu7hySb`tu$bcw+2CbiF5q_Xz+Y+x7YZ?a4C34(=+~-?3kGRCC5BD{hx<~fI4N5S z@l=&Q3;lakG5FJL^IQCGo#{aDLwxYKt^9#a)_eWX7P7`Lc6e}uFcXsOAyK!=jX!JSx-NZ6jWfE}FHAJyc_0PlObj1U5nOI{$htmu4I4Y_pvsDE0 z%>ha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&=2UeeWGhgot9YuBLZi>fXy^{0L>+*+V^lRc4d@}CMH(L+sSum+ zWV4tXBiiu>Tt>8fmFVs?K;44c$xYg=O{@g9#HNrNQ1R=s4!FsL`T44j!-Z57&bmSm zrH2enlY=G$O&0y}@~VgSAO^2zqMI}sFjyHE$&QVSEFP5`4Z<4#N|oNICeJ~xOUh_0 zDdFqkzH}^9uG7$%ALMEU7iu_=WBbbG?oMJo_UI*@XDU=KYVy<6L`DA+;qrsd@>JX! zgIe9HLcR%_v_W1frHq7{{3P{uCnH{Od%F|+G9`pB zy#NuJRJ3)srHFPn+%FRn8Z|1KreHV=aN8YJtn{l+ym4FTYTu@-#%IbPnu|$ss zdh;2W@t^H5Tz>rl;1+`3`b}wBwCUC?xIWm@K57drIfH<8$D?c*z&_6I*O+{`^W!N7tdv2h?+4pQtYgj-z!r@B76c z-21m1*3NBwj*ENNnxFXLyU%`k@%?p&ZTh21&-lmBZGYn7wRin;<9Ee}Gv5Dp+<}5Ed8>4{-#cS*!Cd_fM_(9xZPP=q zKXqGTMRLRkQ@%Vj>faMK81@YR-R(=44yzn@b5-9TKFT~l_VkCFPCxv}zFj+RnE(5b zLA+MzwjDREF7NOx|G4((^=I-goNw-J-@mJE|9z3UHPw+NzGeZYJUv3@sc7D;8!F~bFCD{%XI^O!HBkfLRA`9s`ycx8%hCV< literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..0287ace262970442f47952a3fd4f235c9ea2103b GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B{yYecoALedgjsm~U%iUGE}(;B^ud5w}6p+u|rAe+~d z9ny)5J5h1gkvvgfjOEG#r05IsqJ%hy?dc?&I-JR zfFFFBCmOa+TjNXi4i+p%Hw3R@(G=>x`Ft{=$>cx-@?Dfkfhgz*lKj;kE?}TX3df8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ff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin new file mode 100755 index 0000000000000000000000000000000000000000..252623f865e90fe61fd57e02569ff662f4360215 GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb36GwcPUx8qFv%cH62J(Eoo)!pbOOjjAq4CM^mZcR@L0Bk z0t4t8M6ZyDhJXsh2MD+r9bLt&0d}vl>N*`{Hwn0Q7TlmLYh2U`Axz)u5cl)P{cgTg zpGVa>r%s)!I(2ILlM%DfjL=MgVu1heuk;uAyAAqOgd7n|39BH#RW*yqPee^cNJAfD zmJK;t6oeRKzWh-L*&;T;lTmAtt=OQj7Ll^iwm>h6Hq5fMv=;tM`zVZCH#pW2VTu{i zuApq2Ix0vhsmfNWt=Sby4{}Vj!mi-lwq|?CrSxRmIz|Q^3dgrLJ3_bUMry-@wBk@6 zU zv#nuG3OhfoM1}CC35lW5tk%MXun|Xu6&X)wmAA+)bXK6A34NX-)HAM+33|k`FzPwn$B5YD zQtW~&)TpS|{x8ylqdckd+(a8!%OlmyJe%aC0nzRN_xW>3#nv^;C$Sv zZ1&nY7o3X8lMHLPLW?S0+mk#`3a%}#?RcO>p0F49T<Tcd?vmu?uBVf;NGE zB;%!mVd95ar}AkpNU5bC?@2DQP2#DM6>0RmsspCF#O+CSB+yqZu1XBrxw47}@imI@ zcCKDr6ZX#I0khiZIbYLg?E^{22W0%SYLd#I#`f%2v-XZo4^2 zC>&kBLZ8HC&RCdS8W@wlV&~|GP~pO*4-V(Dgu2m-mp_EUo`Qu5rRmF$17^m;@`t@# z*?%>|Zci=FG>@d zDkJwBys-9#M_v(pLc`jIM`{H^Xk3eWKD%ks z>iG+8$U~g&>yCGW>Q@;ReJN`{J~X*TTN_&1+CV%aU1^uxP2(qnc!@7UF_~LY#Qd70rQvuLJ@(^h(1PKN=_DW(*5`nE_Gj`mOHt; z3EZM;k&U(O_vq{x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A7ZtV|asGbTLZA1gmv|MINI7goO_hJBC6?fKW&pZ|F5k58XpFm>&?q)}Ox zzi#;Hfj#%UU9j}sjjuVM&wJvlXsqXjzkcx19}2%-{2Tc-g|k&qgpbYp^z7A+|NiE; z*9&)4?X@5AzxQL=7lC&-K3BcQHQ$~)EjjaM*M(0$yz%0dnth9RPCw~7`s%7D9=%lj z$8zrka)y+UPrq^XnVbLo?6WU3kH@#jPZz!L{N{I7pI`pN+?1I)6Yow74u47i{dZq} zHSoFn!)d==@{;mQ?d~I6|McdSg9++wr{;eDaCgXY5S`At$e8Aj1epOkmqbtUb_^_}heP9AMM`K!Rf zvfHaiZT#LIalMsUH*Mn0#H*{mEcxv9mYv5hzi{^HagSP8tt_8id}zk@2^xJWVa#_k z^<|$w`qjSQzW-szGkq_OUOjd5qPgpr*H3JosSfW=Gc>?9!i+dR5iOcOD}UkaoQZtV z+@bnl6~z$(s38jF#F-#SGqQl@bmYLMbOI_Cgw5#~VXJvNX+wIP36$3klUmJN3C<`8 Uqd@31C^7tSRt4XDqYZ!m3&JKiga7~l literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..74a451d13dd81370730fba1546f7b8a6aa265876 GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb51?nJ6MCitOfm?007gLUbVEp{6TkopAz&w7h)Eg5t;>14DkQ`mHq;Mw?UtbkRxmXITi6D8GGZ;V6&n=RB2qTm7U)Hh#@V*kw!)ujABA!2hQ>O=Ofe(c z6_jODM+Yb+S=mapx44370gj1O+7+DJ-eM2Bl-?{`=cs@~;rO-|NAMQiC~ZW5RvgM> zd}_O+$fT@jLE{s8&%&s)7rPAP3;CU7CMMOY>+tDemHghiE!MU(_kxl|rrOI`gh}h#& z?1C%Uq^Q<`FVX^|J<0OCcpF#8Bh}12o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BXY@o`I{80Rx}P%?qxmkCLP-hw;KnUgzipPH{h@__jr_#wmI z+MqlR@HW5)0EQhhX^>6;oCDw}^cl8y9Qp^qM~nen49ZL>kwFJA0^lg%olvF$j0Ru< zlITiU)6{YAR7%F!E?BkkkVkaN9tmrfA|hz)!aQ^;rlE4oKiUcn-V9z0p5pC`IQXRr zwUx&aMO>>jB=>z6E|+h{JB&*K-N|+%86t1?j2d z@mbF05=w0QdEzW`SJ=G5Q$zKAQ2%tOegW!6bncGBk+`^vJr3IO0r(xrmVm4T>)S*T zae$+Uoh0}yC$NDsdm|*|yx!A?f4~ddT@=`{;jbKFBO6LaKCSq}0^=R!XeH^bR0B^$ zjCWN(WJnQv3f^QW>xQ~0Jvh5B+*a84f$f7AVe~KSCNj=cTDfjrW%Zf`_b->3k`e*U zzJJyIYpRzs^9xFq+?-h`84spfxX8$R&4|DR!f+psMCeX{#Q+-t_6(ILpY3s z>)Cy$^=p5-Sd}46VoW&oA1gju_wvlg7u38WhJBC6?f%!-pZ|FDk58YQKV{9>q>YHP4Ty%etMHwfzQQfw!`OUtKpH!T`>q`2K>pMF3o;cEU;#YwM z<+s<2-0;0U;(9Bqe(HpqiC0&CS^C-Qtvilge&Nj1V;{AyTv0Kr%*|Ynae7Lml3mZfJll)r>ek5iOiIvtYrj+zEW~ zoT2()6~z$(s38jF#+e{UGqQl@4CKJ33<4?^gv}WkVXJu?X+wIP36$3klUmJN2+k-7 Uqd@2sC^7tSRt?_*qYZ!m3!5Z3#sB~S literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..0df96614727aca1c71457378d33542c7c7a88019 GIT binary patch literal 8116 zcmaJmYj_k@vghOuxtkf z2GBK#ULg?;0TqZ35O6U%x{6r?>|SNnbvnpy9=LWE+@LILT+|66OyBAd_w&d7ZoX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generic_x21E_SAML21E15B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E15B.bin new file mode 100755 index 0000000000000000000000000000000000000000..4d0ef6bfd2c1e949f44c7708d1636f4e95e0ba21 GIT binary patch literal 8056 zcmaJmX?PS>w)a-`md@5$fL@BEx+_2@jgSQ}0&1livvehh0W^ewm4LqL$Y2N2sYHQ> z=omzwkPKr;P=UCBfP<0Namg6a8HcCy>LAzGVnJOd$9$OL#YY%DdEX%xm%Qqroa@z1o6z_^VQV=W=NjONV} z$}!2AKC6@}ZL{`u+XGX5EFG>jOE|x;+Z?b^d4OUCGE3XKemjSg%0K!_A|RQnD)Wpb+dCT@B-NbhNG z-;lyA4Y1C1epkbihSg$PMK3*z4eAZv)xv83T-NQas!cAn3IMgM#H3O;8=Q8OfL@_W z48{k^DgiNfG%yW%C9UbKfjC1`ctjYb8v{MZF``vfefl`?HAk!8ibfDaHh3F!JQkXT zc!_YOdE*0tlHTIwun|iri^o|Vex}sr?Wjc~iDRx(G-4ie!cOc08hLzd8*@%?m(smd zphJ?4UUI%IS#>PHoleW0b ztQ|C?b0(IWz4ky=oqcV?55NZ30 zgwm-@-`yBLGnG1RGf-9j85E1yWHQ%M@F8mmCsRS!3Nh7S_ErmV%53W4jOUBe`S-AD zEu>r^q5b1{PjabgE@z!mn?_ao_v>2Yw)wTEG%T~g5wqZqM&{fF+ zra|jD*Vthk11U#i^8Hz^qapiZJyjs3Q^=DlTY0O`zP5T@YkVtNy|!xIWFNs+uRXx5 zMBmo1G~xYr8DlyG&VIH&jYotHQ@k9^wq3;LH9y}3HUUY;gRxj%v@ZK zfF3CnMN^|ayFs6t41R!8)2W)<+(^4nHj*u%&*p|e3HTMS=2rV->(>$txnWylkXgxT zShA_ZIDSUcxi*K^YxAD!-nt=B5(w>MNY_eqa#r7|2>l3`i(`weLbJ?s# z%abc|r%zqGbK0*^@$yyoO=7dXtJgJ5&m)zQ!) z5zyZe*wctzDcsd?kjbn#r|)RU33#NlM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r_8UH{yQ$6A{P645T|KAwzOP>X+qt?d-yBMh)Bmyd!;LR2 zdTd$!i(J_ASlsS^e*MXhNB;EGnWghKOi!7dYyAA7pYGj#=kel|Z#KPbf2Q#9uOiXm zXFq@U!w*WouKJDevdEZgZG?v|{P@(Rf&cvG_g6}{2liMFdEff6`cwa#O~0#ea4fMD z%umg^cJ_;p-n;tT#m3I69Sh!Z9DZrtFI0#^Vh$AnR7J0 zM|i62*=IJtvHr~J9~P(Gl0WN?j9}99>L0)R@~iProbS#5{fg(sr(1R%+WKFwUEH4_ z-*95__xBHltozZ)+;fzE$uy=o_#gaR&FyVhy9Qss`F-;AmUF8wzeem#z3lGGpUb9K z{<`kY4c~@8dhy`y?T@Yh@%FE0o=N=E-{-uawJ&|E{@#rxYqORa7M*>0?9Dxo|KXXt zhc`#2ez@@S)6@SoZVTE3?1(%bstxKk?S#LyM~JDK&~S zgkIZ_d0SzZXVXVDXK%fjarMfM{?2y}cf9kUe_8d7^^=>vw@8lHb6V%mx|V!t-Io=A zeWho|(F@O>dTRP3rgdv;ZYw{quz99Jo=C|2?iO{`Cy#v9`TMuu8+dy3`6=t?ZC<{3 z_nnA72h?6{lJ@+FIkmfe;=i!EC`QIAzo9N_~qM4|jRJs6>u1vF$K yE7oTbP%$EG$ifJl49z+-QseYsycU?$WY|hDT0v+91Q{@5cz^}qTcow&?|%VQd?q;n literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E18B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E18B.bin new file mode 100755 index 0000000000000000000000000000000000000000..e23f135c608310881d6e7364e15acb726199576e GIT binary patch literal 8056 zcmaJmX?PS>w)a-`md@5$fL@BEx+_2@jgSQ}0&1livvehh0W^ewm4LqL$Y2N2sYHQ> z=omzwkPKr;P=UCBfP<0Namg6a8HcCy>v`lM!n#tVp!YDt z1S~xgLbNvDcm_hIkO}Z)*jQ>R(e;!MsiF8Q+y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ErseqdqqOocj;kony$>Z(s3`Kt5xZ@)M2^yu?b*3a9# zeDTKBZL_*>k&{L;Gz&1L!w=bUH>2fC78NbKEq@kQws@i*tD-o<3ucId`EfchLM;oZ z&q5Zg%Oap+KvO0Zf%XaxirFk*Os`Qclnwc+o70s0~) Az5oCK literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin new file mode 100755 index 0000000000000000000000000000000000000000..64da336d16016a3e8bc567df5245014ebd3fdb49 GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B_^ z)yfLgM`=-kuF6APj0Q!lR?$ygQD=&13#fyjfo0LUs3`?9-x6vYtaeLed41g5Jgq6R~y` zBSdTK-RnTe6gR;*DH(&NkcMFll7iMZz*i)-%`kO!S6#&|fq9-QbFFb#$i-Pi`XyC{a{*hUtwYF9t~g@6co?sZ%s_}(ftlIH3y0Yj2Wyns zmLq-#aLcxAG&xv8B021KM9{kKSY$?bRS0;^=A!Nef{xA(EZ`Ri7@nEjf<{ZAwmu__ zUD=Ur@k68Tuq6}}EFlw{l+9t}ntk7f#vt%%44XpPJgoRfpzKGL$OKOc`7aqkTUO); z-e`2^F(UJ=R3ZaF4?qB9hO>ed@ztzO&J1UAt!$=jQ8KC@XOj|QWLq`cJa#FgI+H7;n5b|0*MN(dXV7B{aQRcStv)QRfqfchj*1p9 z{~pFRqa3^0-t9P%=-2EJ*0}-J(E&u_0cxc5AaOElHG|WCkB{n4;u_~k+akNaJYU4_ z;eq_f9i|hul5&fm5;vkO*9QNi0V>iRvy1Ef1Z4?m)*9(5iDTyR{BFFN#eK+|Ew3)5 zsI&S<{Q-L&Pk6Dsxn8dj4C%GYS>ZLdI^MwKDLSuSUR`if-{L3ituU_llCrU;#n0Mr z;#U`7_enizf5hL;!@L@^Eo4uNlyq4Us`LY_W{&E+akmXMVW!1z^CK@I2iWunA$eZaE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SAMC21G16A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G16A.bin new file mode 100755 index 0000000000000000000000000000000000000000..9f09b2f67efd274841cff5501fbfd9462c247b35 GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B{yYecoALedgjsm~U%iUGE}(;B^ud5w}6p+u|rAe+~d z9ny)5J5h1gkvvgfjOEG#r05IsqJ%hy?dc?&I-JR zfFFFBCmOa+TjNXi4i+p%Hw3R@(G=>x`Ft{=$>cx-@?Dfkfhgz*lKj;kE?}TX3df8W zKfnCV%sGO@mGN$-oe1))R$av=+_`|Q(bgdpAXgkQUObG~MrR;Itia4{*?yw~s5-ed8o0QEF-h`MR3_Qzu;vv({*rKaQEl^Skk87WW}={gFT$5A&+cwy-@d>hH25R1pAJ%^cNt<8B*j#7uL*7C>G?4zlwruoBE~ ztXL-M?;SAwe%2+qL{$}r=K-mi;;&ify~7%TW2 zPOrv0JygJj`in2(HpC#WNorvYJ*R5zw={uu;=^Wv52qUORf)4&ngQ=>` zc;WL3WDMc{D+4a*OaMC(?MI~9LpTS z8f>k1te6e9NN}xZl9~BJ7br(Z~h!RP6Efu4JgdH7>myI7-SX8uoQW z^<=8aFI7)^cc+>>q3%DIT@Rypwg+dG;gE+Sc`nBrffnFL&P4N)vq{qyiRUGaciCe|3x;q-z$j*6~iVGWN1-orp%&h`E6Xz5hB7(@JlY`5NAvVrv8)g?)L_1_9H}Y<3T10dlrT79lye;RLVc1UAt50Tn6M z2D%RXUa?WuE{zt&<-!`+Q`*-ew6bG+azz3%4$^0pij*D!TkwnBoe$esKva{9K#Tb@ zFG6lY*n$q_kg(GIjv2pb4SZxtQ^Ha0D~C zoX$2jS0aFB5j6+Khp8A=NRta&~AoRvt z+Ie;phurJ-ICwqK_opyppz;F*jm9A9Nrilorb^)Zi{KF>!MMr(tvDqUH6KPMsro;(>zYxxoU03F0=Lxz*9_L{7+|QnrXa zyoQR|cJa1I6HE8Cuv_~`#uo)m%Xd^}l^t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ba_sdcard_Generic_x21G_SAMC21G17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..1c2256e96e8e3e731592b1be7fc4f87023837f2d GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-BkLy@cjZ-FKg{!7nQM)^!Y6g%ofUWs z0YCUMPc&?uw#Jw29V}RkZU|n*qAApW^Z8^#lgWVwAg7T);q&6pk4$ zet!9znR5h*E92cvI}zkpt-6X$xN`wpqpd?IK(07qym%O|jm|)bSb>?@#tVnpW(RAO z+2$hw2XM@Izz+}b1auNdH7ZT zPYG?GstVcx{)p#PwLcy+A&*_ksLJFDDJJGy{x#qt<{9+Z0$ldgY^x7TYha(onWJLG z%fE-Q%_zriws$*DB>FWwgmrF!b#wsHc#s+?JxH9)TFv0}-{YhDlepS>(zeJRD9abI zdw4KEdWY$R&0l5-P~t|E<=PNYD?Ey#>bgUQ#wzHwRez zP5kNt>^`X{?T-Z7c$imhwuS9!QGb^ep^5;&YUZfE8+Y4KBW9WdwgB=Ha*&;0ft6r> zYlUVT2pKqsVBp$VET=Q`gNRwfVhNXB7?S5zy%JoFKyVIrP=*;-^nP6&bl(5?#aO}L zaC$Y~>7fEH)L(oNw;=|3O;QVM=s8tuzoiMR6PF$B{5266hrFj{Od|!+)4G~Kx7Wq7 z2g{x+qyzIN$obq_EQ%7Y`5Mht}iAFA%r(%z|s>ugZH$m_Iq36<+#=l1QiPS7^h3g1Jk|T99ISdl9 zfIRF1c5_wPU@^xVvcb#3T)^$%fxpxYE)-(;7{s|n(63b&7Yx#PN(`L@4)>){aZzQpOFm1n6HqreV(iGtIk+|_Ys52#BGO@;h4yPC7aa2@IW~&I~ zn*);iA;q&ic-hjfm}?gOF!1YCHSY_sy1=OffrcXz`8g3fi8`9 zU^AREgl3*n(f|?tIwB0-~B+1X|3O zc@c6G!WMKWhlG{xcg*-jYv3c>YNTT{oY{brE-PY(hzw4hEy#$r;3Clp_y{92QZPMy zh_31`kIz8_qxqqloS>2n@)XN;u(p}72Zu$>odmOi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--git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..72cc008828bbcc6767ef2ad89938ad67dba2ca11 GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B_^ z)yfLgM`=-kuF6APj0Q!lR?$ygQD=&13#fyjfo0LUs3`?9- zMu^tdyVrq`DQ<#sQZfcjAq~SABn7Q+fUihun_=qeuDXg_0`ojq=33*fkc+d3$ZMAA zuuaSnSKE4Gj>u}apYG91^%fDA^~5X@huH5m_1VH!(a(0rtdYx@*C=^mO0s6EASQs ze(+_UXxKV!jW5|dSg;t~5V(p(Q>g#u^T~uJlLL*&cTpwhGffPo$<95Y`0 z{PH(5=Lis2#=DsgBEYX&brqX%=K{7yTZfRJTyeyB@i1N+nSl_o0yDFX7Y?&64%R5M zEl2zg;FfLKXmYTGL~_{eh@f@dvB-?>su1v+%|+b{1Rb3nSimn3Fg!E41&x+KZGA=< zyRswM;)h1vVM{0|SVAT?DVxK{HT%8|jX~hk7&e8nd06p}K-rHfkqMp@@?SE7wyekx zywT{+V?^d#sYC{V9)JMI3}*!^;;UJmoEgsKTG>q5qGVJ*&L$$iS zKmzr@e@UmbvV%RyMI0DRq(Fj*)@)}AarrHR{TR76*3xU_SksYuL)Z~@ESEKTl&B>? zCA592DhX0TmBe$Z+8>XakjE}%RA+L96chC={~B-+^9*`y0WN=Pw$+EFHLy?P%u&(e z<=?~DW|U($+q)en68)MT!a6s=Iy!(zJV1?<9wbg?t!8lg@9|OnNnGPRXvEdJVoc#%c~1c>RbGTy%omwUQ#yJwD?*3 zP5kNt>^`X{?T`4|d6-vYwuS6zk&-SeLY01i)yz?SH}1BfCd{<>ZGPk>57l=)C{&i_wC= z;q)53(?j`PsK59kZbuCAnxt0N&~vKJeoHf0CoVr4`!(SohrFj{Od|!+)4G~Lx7Wq7 z2g{ynqd91-U#gz;?wF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gPyQ;f zpzQYQQ5(LuM_g}Z)=isuGx6%mFH1gqy=BMo%lpqhGww0#$`$2z7ay9jZGuLhN*MFq zOnvF+kA1cGx9@-0@oe8qqgPGcv~bS4W%U!AXR5<{(+mx;jW8pQPecpn&B|YJcg{q< zXwFc5u!`ac0n`wMa^g%7q#0R2b2@ThQ#t_^3&Q4fjIh&IHP9he@sGEd*y2 Vgi#=L8k87*IIDthzR`xi{{_lJIEw%P literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..4ce924fee1030ffe2e2afcd643123c123ab919f7 GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb36GwcPUx8qFv%d~0T=eQ*KQ>SL&F2pP{BXl=F5y1cVSMm$|JqCR;LXNPdm{pM9s+vXQCnBaoq@fQn z%LW}S3POxAU)~smY+)PV$%wVkR%B3E3rX2%Tc8(38fM#CS_^)reGJB}8yf2fGewMO zS5T%+9TT9GWMwPW*6a$V1~?{CZdY(lTeCgrQhGCO9isydh2vYB9l=|4qqUI%T5%|k z^CQ|Eg(hWXGn$atIYKc{z-mD{(#+{2f`l@kZ)+xkv_dF{24}V_Zl#eYU_YFN@>~R8m zrNwe6K142-5PQ!Wc8ys}+0bbr&NDRb-PFg_1Y6$5h|zWZ*|&kO$wvJy)Qebhjj+Zf zVriQcuMpl8AwC$K-CD2+HsT1gBID_-^cLEM&T`Z{soztGdMETV0gqT3LcK@&84-J2 zid}F88x_?$@I`81j3-&17jNTgd8C?|=Mp^Jm<*(*dg}1}L~ABeNpA>aA(>1PoKHBF z&0ag_f>SYh5@8KjaB+oedxGaF!L`M;9S@es6Y}ET>jQ>-kqL1YL?H`uA`1svkbpQe z59OyzA!O_=8XiH93EYqI3#s%ur-fczIiBVamq=zgazElMkwiM=T_Pu2>_Vv&r%j?C zO?xSS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5HPeWGLf?QkEK+I}mCw82G^Y!HY2Zmvy5d##mChZe3+{?V<-(NOW;A zkLEtG`hnW&74*XV5;-S(E=t71sTMXo_C6CLFo7`Khhq`C6JQCzMu0sdONmXt5kH|(}^ z^op#<*;f|)kJuNmZb{$eKlsp_PoFxj{JHnL@3Rx_#M+!vPpA~~{)}#iV*TX5wrVWUw{7Nu|Ga@e&O`mi3ww~ z%zs_~(}TP3eY;@kyBl6}ypZ?gSCMGn{=a_k(H{!GF8hu2n#@`&Ny5wIeR}q4*MEQW z+v|nftM}NB_}=@m{0slP8=kLO<6L0NospPvv**GmAKrNJO5NVF9WzflkG{I<$;U1g z|FOc8X_zI(hsHgn3ps=XYxI%fzdB%zyI#b zuZBK%eK_N{OJ0(nt>1NI%b(u7axhN0?bN*QAL$L+52Djq7ir^y32Z^&zr^>pH8tL7 z>3-|ZGt{}w7nfgqlh~Pf&C`)HjY}^5b=AGK--bSU(-r}x@ z&yK!6<(rT9e6#(j_l_Q!Q}#fiS)L@dlfBlhc`e?JpH%eRbtU!2^&OpiPabVP`78gT z^4n|1Zus67cD|L-Fk|w~_^YeFEcxv9wjIYW??3y@#K$bFR#x0yd}!9TOqDtnH~zcX z+Op3d`)coR-~X`d*@2hFt)9MV@w|1*8z;BURz~-y>Kb58HX)XaM~fHC$zODL&Sb7= z-bj78ied;J)DQ)8VvG=^=~+Ni8nRklUht$2v#o$ Uy+G(RC^7tSRt?{Ly$yf=3tE3UQvd(} literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G16B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G16B.bin new file mode 100755 index 0000000000000000000000000000000000000000..34a3e27bd24e6112ae636d9d3e3eb947cc771cf1 GIT binary patch literal 8056 zcmaJmX?PS>w)a-A>1>?^=%q-iy8?952w4ClpjN6eOILyzKtl*v3Fxbi40aHmN)%{_ zjzRPZ$uNcl6^IK6I2dUimy7|OadJ_|Nid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zrND5XS#l>iqrN?+rXX`uvpj^ENME zym58gtnORnq>&8G0?g^~Lw4NFX!(*wMayo>pT(9fo~XyFD30)f8KO{roF0r&%K{p* ykQM8*2&fnlHe_LhO@?Nj8L4r4FkTBxYBFpk7_A_*0)h+}F+9Km@Ga8X@b|xlCMEa) literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G17B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G17B.bin new file mode 100755 index 0000000000000000000000000000000000000000..22c7b037cd09f3ab33ca8c771df52525d34a97bd GIT binary patch literal 8056 zcmaJmYj_kzwpBgPOkR@*&@t-${C|IU`~trm>WQfcSwqHhMnWEwY~YcH2L!%ofQZb#Mgihjk6sT7j?M z0x$SFKQwY9mVml7wBe1hthH#7R~MtBDKs)LHae`~10kKLr`mVeDYH|}H*?d&L3&Sf z`-T)|X@GU6^Sc_BG^`fWDthTzY|vozt`=7N=dx~ZRc&%9DFD>25|c{ZY;f990(yli zF&H1zRSAf>qk(BKC}~ZDM&b-j;Sph!ZVdDs$B0%{_37il*Bq^WD;hzJuEE=&=dsW% z#7l%L%^M#Gl=K!ahmBZ6Sv=0_@H3?@Z$~W}NgQ*Pq7loO6Lw-3(8%Ls+nBQkyOi#w z0v(cU8vm5yGhGgGMSKdoi$k)(*`7eKnK?+F>gvQRlT98Z>zM7>;&tfk-q_g3Y|<8& zg|&lb^v=Xmi`O2gsr_81v&Un5koqrFj zWFh4O3GE-pdy-4db2)NKZ5mbS->+|t-=5H_1Nzz({&=5-t**TfUnU9HV8e>WpsSJt zOoP^Qwz0!B22zg3y|!xIWFNs+uRXx5 zMBmo1G~xYr8DlyG&VIH&jYo-HQ@k9^wq3;LH|O68Td4n;gRxj%v@ZK zfF3CnMN^|ayFs6t41R!8)2W)<+(^4nHj=HN&*p|e3HTMS=2rV->(>&DZo{_5AhVLw zu)3xW)A$)p=h_@vug!a^d+UZkNg%Y3(YaQllgrZh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EhF3&3hS=|$yvd7 z2Co%zWw5t?p-5TbO@_V_xH)L@wedQ|F1Uf_>ua+)HbygBsrKf|(}XkuO}}Ws&63n&@PAK9fSui_6W6%Ryh7@~rMYn^2sx47{gr zfuKLsFPK3xGk`nqg#295)Uqb1 z{WgKXDLy;TL2uDbhU~fhH_k6qAaOwb0pgJ6Z@o|+12_)wu2u&>JP)xT0dQ7;BhaV$ z-fPg`3;o{!oCLT8@Bx4XFaU4_@LxhX2rvXN43I+B!kYU2yXM;jj4eKsG86KNcEQDC z#aK!NwOtq{w4$FVr~RY1SmRCOMdK;nQpLcpMX0wrjwoe9vHaFJ%#E_=Nbm}FTaUM} zGf(5JEYp5g-?tThA&A3HJUV$_Uk6S7BCug`RxC?)nYHe#m^VwN4)K-nXb4)R`asY&m$ zzU>Yh_^}qRtYJjAu{!DFnh%y~?tN8J~_4jNDtf7_`Rfzd{B`6igQZ0-$ z`7Q$@Fo7^aUr&PbaWX5ZWl2OU z0ICrU-&;`rtX#CRXv5kE1MBafU$vrom9}A*m8I6?KFYkfR;r-p2y;L|MTllemwH0r_L;$w_$q9)DEkJX?0-)#C_eS>3( zrC@$)&b4!2eDvPc=PovOR_$2uj^pr4>mGmPeEFYh+%t6x`Gg|!)k{xb`=7u5^~;>2 z@jb#*WzRmd`Hl5wR{yX#?UwvmcVq;Uo>%|)-IrgDf8u;^{_j^jFFxI}>(JK!dhO!= z1o?&&i@(2rFl612PUa3#`X$qt;^2SqZ#B2KUF|yi`pxf?r?(8PzWf@oGxf5&FMlqZ zUis^~J2!kA{^-SnySG2K{>R(Do_QwmPk*2De%8M9t@?X6maNTMW>|FY<*_&SJpPAg z?jGJ8nfl?v&reVP*SuZEW0UW?_o0U-70{Z=Nw literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin new file mode 100755 index 0000000000000000000000000000000000000000..1d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z}ZIG8rNh6^qK1sga#faD2-tNM_G>PnZ7Ve-*#a(a@c_y$#JPMVVPO`yj zFF-^l6>Z&ZNut9I_sfKY#*B%iC>YKH+Q#5BmuoQ$!iB?DwkP(S%fl z3d$tVm)rVkGh28F=j9ozi=KL)DMyo`CUHB1mlY+lcif_>f)8Y6=D< z68vkQn*Jsmc-UbBpVR!#8beGgOG*dp-kYn{1J-VmT5W5Edt$9V7=pV#1a}NQRfBJu z-h2jT{AW7^mtTJXxCLM+Mh6{A$(0*Ot9tf2#bU zZxYG)(_g;%!F$2)=Kn=_LG+vIZG?v@Klstv{=c67`}yF*jhiexeEWW>{XG2IvL~DV z=$K_Got)*pboAKAZ(n%k%>5nnTPpTDc0GURLl2y+e!tFLNKWBXE2)>xK6dF}pM3I_ zcXvv+urBoUQ!Dn~b@<$9CMby1dh~{NuW#*PqF~aK5FlWB;!9{r83E)?U{%a@kK7$?=MJIz=j}1P1&0P~$ y%$s@dt*zs_rpf68xtax-a`Xt9r=oeYZm66)y<{94nt7!?+(eClQ>h`s?|%RtfXglb literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J16A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J16A.bin new file mode 100755 index 0000000000000000000000000000000000000000..44f62141750e6dbc3ee68191692c231595af5b3a GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B+UK{ls1 zGpG|6ccH?JBRQhJ5X)70NYUrzL6g%y%l&1 z0zddNPc&?uw#Jt19m-pbZU|h(qA4_R^Z7(vlgWWb`t-6X$xU&IUqpd^8Pp&v(ym%O|jm$uZSb>?@#tVnp76)sT z*_I=I2XM=_Y&1DoLLxcrc0|y+p03D@o~jV=n#o1o3j`gV8CbwC5HLK`xdn}uKy7_m z7`rkfnc{~=-C;{8C|E)!HX)nC$Tj=E4UIwI(-<~|GI?0>k3iXvDv=4E6!Kp(g0`&4 z54_Rn&SOOSTgiADfF6JVNDp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$?a6;%@T~Y)^M)O({_*me zt*P?ZcV_-{_wlH8D|)x+1g)Eu@2`sd7r$>!TkD0+Bd<(7Kpk3n;?{F76YI0ixqC|{ zusL)7)Nu2Xf5tw3Zu=7tuf6M+8^0?&oc8{=We4)MK zgLtjbV>@nIUEb+g{&C&W>(As~IN#FOv42x$Gy4gXS*skeOgz&9O#f8*``#|EFh=B|k= x=FPnK*4A-d)8zDlT+ISZIeLW5Q_;LxH&o7@UNVji&AiecZlXrOsnihR_dhI`%uWCR literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..a1d9cc7ef4c3e8e661c182d3a03e7bed759448bb GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B_^ z)yfLgM`=-kuF6APj0Q!lR?$ygQD=&13#fyjfo0LUs3`?9-Q``jOq+|@5LK=oKND5lt0AG>RHpA4_U3C?=1m=0J%(cc{As1&6k=HEK zVVjsEuD12W9Ff&-Ki#93>MbHJ>xo$+4zb^B>a&HdqMz-KStFM*uTk>ClxP(nWb=Bm zgF10>3>9Y`$rJU(SgtBSioPH(LWpzNo){6KL_*v)w6;ZbitQ{ZuV(!2qxvKDR^TlN z{NT$x(Xe&e8eg(^uwXH|A#fForcnRQ=aUIdCI=dk@1jf!L_ueOkB&JiH4jCV5~M1Wtl>MAzj&IN3Zwhkdbx#EcN;$gftG6NxE1!iU&FC1oD9IR1h zTaNf0z%ARd(d1wWiR7@`5kc#^W04u%RUzOtn~S;^2s%1Duz+76V0dP73mPqf+WL$z zc4bGh#Se|T!DHD^RVI{fwCV}A`?6*&i3u zfduM*|B_B=We0nZi#RZtNPz?qt=Y~L;__Pr`!RBDtfkk;v8E&ShOi^*ST1YwC{as( zN@)93RnQLbM?9yh{qd*?dF)a~btYFxF;U<0uK^b^&!EQ^;PR(tTYXqs1N$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Ju><+jiWvx}wvw{NuW#*PqG1aK5FtWB;!9{r83E)?U{%eA!PH$?=MJIyVj}1I~&0P~# x%$s@dt*v8X)8x$le9Zz(d3uD*Q_;LxH&o7@UN(je&AiecYNAHKsnihR_dhAa%#i>9 literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..0a7b7f8efed15e6a46989d677f050eee8415e157 GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B{yYecoALedgjsm~U%iUGE}(;B^ud5w}6p+u|rAe+~d z9ny)5J5h1gkvvgfjOEG#r05IsqJ%hy?dc?&I-JR zfFFFBCmOa+TjNXi4i+p%Hw3R@(G=>x`Ft{=$>cx-@?Dfkfhgz*lKj;kE?}TX3df8W zKfnCV%sGO@mGN$-oe1))R$av=+_`|Q(bgdpAXgkQUObG~MrR;Itia4{*?yw~s5-ed8o0QEF-h`MRdEx=_@&9?fmvH(Op^ zNKt3?j|PJFTAuJ?d2^j!AsEtYm$M>kY_+_B$y0P*y}Y{Mq`o;o*jr#+?o5vm9PtY(htyK%P-HDabYU<)8GAqUy{6<7)8 zw^nGjfslc72nMc=#d10`KZuw$ES7NDg&}!f)hof(2n6R~2W6OXMeo_0HYVx3pJft*82auW!r8J5QFUIH?R+Hyb8fB_l zbp_lW3im&GUgH4oME(D~fLoC#QyR`~W{rK9vA<1SPpipmQ>0QvxhXZ-pTh0HkMC=s z(FQaO@@2eFQzHQ{H#JDdfMQmP1Wvmv^MF?qKrMjAw`OPM@pO)GIfN0^BS8m$romLz zX1wru1u}+ke{ukqcX!hFFoNd442-sc7nOH`udte*m_T;dxO8qc`D@D5rRkupagJpU zVGXv{J66mFTO_#F#>>8|%_)xuJ9ShB1rhehpJ?QQc`Ek!dRH=3;2M|S4ICxq6b<`2 zqIxpb=^y}MIQ9#TCP?fsd03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{Rx{9Y7DKz?wjE3$2O4I?EJ4RKL(|{iGS)}pNkqWU1 zPd1CWF`^xBz-2_sSBdUU1Jo_3o!q3|+QdpwOKb|c0TsV4>wud~n4hoeI9y0Y;jAn4 zPNgL#)Qp!lE$xl*mcQWGjwzoU6FGC{RpM^W9GI1B&L!JpP5syM8rju;2 z+6xeoNkv0B!-;3a}qw`Y`xE!El6@LZTJ9?=HI34}T@sp%VWj|M*Fz6VQB1 z23i16gBW;DL#1QY#rHMbb@!zC3ubdtBN*6w%+mb zqwnmNKRy2APbE24;-1nu?)V(IFJAIR{lpgAnm@l%)6sQk^8xkT*C*-=g5zi%&ij7x z2lxK%hP87WpX1`5wdN;&`0le`UVMMu;hQEb8I?WUZ}@WQueU#O^Q)B$Ut9Kq{i*VY zzDcGMPk;I52k(WxoBtQ#1u6qF1(adMnw|@NUn~R@0-=6gM1<#6)HEr0j>K`wk z*_tkoerM)ScOQ>gx1x9bCurTQ!a!y8zxaJ?T3ar39C>Bx0qW4o6StmwnOL85&fQZw zp3R%{r}~?h{4@UXbK9SIcrdU5Sdkp@!IUo#jr#Y54Te3#e|P)RrNb)6-CWi8hmSJPk3Ie2rqd5UvTxUp8|ME$ zWDu_vx^2fztIIn)%RjC?di|OF3+J1A+xPEk+kanVZq0R#! y#k`sK-r6#zbDEslpRZYfDNm1(c`BMW>xPQC(@V#&;h9(3Lrv5GI29Tq{Qd_a#?2N0 literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin new file mode 100755 index 0000000000000000000000000000000000000000..7e47350631f9c8846e3c86ae7b69f19f0b839931 GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb36GwcPUx8qFv%d~0T=eQ*KQ>SJi5itwR2;B`(1n~d;mHYyKk3pY|kRxmTi6D8GGZ;X6&V!PLQ*!`7U)HhhS|23)`FjDAA@o0hQ>O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yE@w>_1uy4BiZ044&fci#YhD z3AL8R5rtf6Ft?QlbEAyO5qJfA9dFn26VBoEbn8Lh)V2kFS%|}K+}Cpn{oF1>kOk?f zAVIvz#Mm{b7!vfn1YJR8p~ST}9QJ1rIEjnc`vr z&3<6j18b_5GxPIHl$`7UO2&h!7A`XCJ~JXPfiT>MqY%0iU@^c(fIUOyDJa*&EgAUL zDkdij{_`qXjt&)wgBpPlR=*5;IY!=;e-U-OsBJL;)zkG@sb z)N*d$8U5PdE>@-slNl2p@sAZBt$TUa6AP+e5yQSG;&%V*>(75Y_Qz+=&!4(xT+*m4 z%U{?3^x*D$-!544?uOT#FXTP>RW#PK|F0i>^oPQ)7yU+lP2p@66yam@K0SN2&NQ4{yA9rDpG<9n(*`j=s9`$;U1g z|FPUVft(>Fm;8i(gWnt=)BG%b(u7axg)??bMv_AL$M`4x-ap7a7yMv0Op$zohrJHPqi| z>U`_YGxWL57nfaolh~Pj&D)kUg&$G+>&koAd>j7cmBYKYKe6h^xnEB>KkScxpL{0$ zz=$oT2iMJBk-oq@tLwG?clSK`yBF^7*%VFvXvSa9jr;f1U6vE0?t5_k`jG{b?=9|l z`0ViOlfL!wY-nRs>OmnEOQ-m>HP<^5-$8TXiV<%;sVix17%HbJ9LC5-uQ zroQy^$G+P8+xI{0c((7Q(W|CzS~zFjvigb5Gu7d}X@&;aMwk)DC!&S(X5}xqJ7*$a zG-s$jSVeJ!0BVRrIdLWk(u^#iIUPB$DV>0d1z~eKM%ZfJM%s`bX9DH5!=zU87J@Sh V!YB|r4N43@oK?X$-)O_%{{o&+H+BF3 literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J16A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J16A.bin new file mode 100755 index 0000000000000000000000000000000000000000..0eb2912cd524f3071c447da6ef9ae63bdb8860b6 GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb36GwcPUx8qFv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q< zXwFc5u!`ac0n`wMa^g%7q#0R2b2@ThQ#t_^3&Q4fjIh&IHP9he@sGEd*y2 Vgi#=L8k87*IIDthzR`xi{{`u0IF|qb literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..36db9320918f3bc726fa177976355d961692239f GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb51?nJ6MCitOfm?007gLUbYn=S6TkopAz&w7h)Ee5xN_o7~uc=EByuj9)ms^AxGF!!YasbRm~#u6A@Dp($I&P zWrL1Z1tG?mFMl*bwy+KGWW-uzD>f*sMWk%BEzpZ1jk9d6ZG}J6J_h5~4vlq$nPNt? zD=5pRjt)>tva*G0Z*c|F0vr>mv@1Bby~Q4MDZN>?&QSq}!tre_j^Hi2QQC+AtvHm& z`P6ntkx5zJg2pFyr7Gs}SS`#znmHpiNGN4|dkYby6+$^UII~@GD@{BB`{BG@l@8$R zIp77~;)g*qQ2_yUM|kx+{Ta*AOo1GvV`$WSqrb1mzz4&mY@!>tyJ(w7&$aPmBOzw@ z*2dLI?7Sf7Nfmdln!9SLoKo7xOyELhi?CE$T0NQb2@5L|izo@8a)~^=$j61o93!At zS}2F&L*zmUvG=TESDCex^<5U?97E&YjeSgQu=Q<>7+u$&eH-|iWYq6My@(}O39C#Z zmbOaq3gJx=;)B6iZG{V9BaSdDGM=t#Z;@T-szkjL`#nXdcYHq+@QCFh)O)y}5wXXm z*acUxNl~o>U!(;_dy?h3@iwlGN2-~5F2Tc%&O~aOryiFjTCT~XG)}+$+a;Jy;gTcqB2b&^6Ato3d&P>EO)n?dfKO{N z?v)2Hdu0IvdZf`bL-)1rf-^N_@B@^_x$4#4hFyEV;hPI&jW7cViBt*D0K7*}OV9D;VC-lHSGW)ch1NB~Y=V&6CP)Gbadz zV=9*GlevtU3ldAS$EGd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jMtA_ty_T`a{vz3x6ZOrf{}Oitw@dpPsqe`QP9C z_IlB_>fQFk{`YnBGi(XQmt=oBc^Pk?lav(vy?d0t5AL$M`4xm%n7a7ysF=+goUg~98}`S)Pdc5k zKXtR|!L_rNXUsRxJpWq%yStzK-3#~kY>cLTH2tq<$NqcDPRsF;_dU37-H5_T_m*@% zd}jFdiQjy@`VCw>)} zUw(Vd$o1dbBd)iy>ZeY)nRs=@m!+S*-n#wR<$Y(K8T*)Z#qx@~OAb!oI$onsCXD`W zhQ8$U$G+P0+xI{0e75hUQ7flxTrhj>(uN5wGt}X|>4pZ_Qq73t6VZaXGYjV5ojZXq zo;_3_tfDwV05wFR+&B{iX+{>%oPiwJltDnng0MLQBWyKqC2dHLGlBBjVN$DkGr<`J VVH60R0wsnY&Z^;CV6@@ye*vvsIMDzA literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..693e2f50dc0980bf5559fd9966a75090a83a9728 GIT binary patch literal 8116 zcmaJmYj_k@vghOuxtkf z2GBK#ULg?;0ThT25O6U%x{6r?>|SNnbvnpy9=LWE+@LILT+|66OyBAd_w&d7ZoX8X zN7Xr}PMxYcb!vt-BYLq3p}PT!0RF$fl3(EO(diQrvWLvYjEsC1#Uvmf5jGYg6@7>q zCSY%q5u)|^^2Q@%4Oszi2wMuRMLLD0&>-n;GxVZx(_Cv?d%@4NkHNTgBV+9$x`-BR zGRm+jAXp~pBqRja2WZ9I7m4Y;+n$nU3gj~vXv=RYICgelIGuvdB+{_WMAJ)@dX$QWZ z177egerPlY~|yj8xMOCuMbOIaY3BI7si= z)>NCoEDW&jWMS8u1#6Z|NhR&{WHx9r^UKBM)zernUsf4kNQwZJ%cRkTUN$)4I03z4 znG}o-8p=e(+_Q#RV^WhgbeoCuG==*&4bXLgwzn~&HBEc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z;;*mt>^OSi*;7wVf5fzIZOv`v2NpKZRHzdPncv-_uKMJWuR4GK_Im?Qk3K(T{k+Y~ z7jInMHmmyaZp( literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J18B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J18B.bin new file mode 100755 index 0000000000000000000000000000000000000000..71aaef5ec33dd1c7fe1ddd8d1b25ee57a89142af GIT binary patch literal 8056 zcmaJmX?PS>w)a-A>1>?^=%q-iy8?952w4ClpjN6eOILyzKtl*v3Fxbi40aHmN)%{_ zjzRPZ$uNcl6^IK6I2dUimy7|Oad=G57Qq|4jP`jN3Rd)*7bDD9$3H z9J8G1w~49ZHd|k}BRJL1P*SZ$#QA;QmY_o%$uSR1@mocP?d`S(uhUIYCizLxDn81l z_gPEz;@WOBGx=<~XqbuR;w+>XveJWuSjqNv6G2iW!~?OJEuvHGUCj4^X>GNGkO(p=n16=;f<~ zP<%*N#UuKT2D-tZq&1y25@#q9kMN^ZW3cBqMwF_mPag-q=4ka>(Fme-4Za3Fhxukc zUL@RUzW89Uq_=oEY{VMQ;&4_+fG&0WI%?5K;+VS>jabH9uoDN5MjjvAMxQe{#B?7S z>=0$s_@^Y7>2?Y$;!~JiERqeb_5^~-%t7*0cPCz%Z1N&mM{ma#pHt`X#l}8n7q_@A zi~}^IcO{lue2!pMonw1~>j|G@t7AKkmB86<<4WL>Vc;6uhJC6gid3L({K@m2G2%53uCjOUBex%aSY zD322zg3Wtc7qmd;Rb{B{+l)0k8#o&#!qYr+AR=&M=xg8qdBGw^9D!z1P6n7+6i z0Xd-yCK0>JgsJ}I+w{> zv^=>Ycly+|JE#2$6)#_P-y|m6*E(&*nqQ%it7v&##nd&&0JCU$&HZks`aim1wzwDN%f1G{;kHUu_@-5m`b zA_4s!!99)Gox)y~LUd-uIYUQ7PS7i!HR;cgT(v-Q4mKh?%R_E@N1KmsRwJiWJLeEW zbZb&8(TU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>Kr-REHRFY9_;oW7!Vq&4vPDW@dKoP*IiSjWhAA(cT|KNHmKNtSKey#?jZ%0(-SHmrRxu>St}RV%7jX&ZJ~S!zx0qs)s-{>%>t&0Di~`S;)V+LI@a z%Ktt1-S>H^R^oyDN_V&t^7b1(tGlVq*8K46)m=TO_r9-Q{@YMpmTwNF$LarA`{BkH z7CpAC{zWeAc`R=CKfnIu$0L7w>dex48>XjB&NY7i&`-7k+%|(!hUy^ZP5M+XH(nhrDn7SpBL0&8FYgH#nA9 z3g)NgTs!y0NAF#I?qXwS)s6-4I1azG?(s*?m;b58JyW-kPbeZ^z4Y|8|M}}*zsxxr z-y=L#_Utp8-&lWU^$&~FZpoi@M@BH|dG(Lqefib+C(ifg|9-{u;?pg=4sHFf*Dmf) zkZ(A#`1|_@L)QK1WbP29Uowp;4*m!KR&#sX)vmLz-~2v#ddtx2%dZhTQ!l&w^5?SY zmA|gLbHlgck6t{ud;4SSf4u$cnP(FJ^!GXMXYEVhs=s$*$=a-ChDGOI9(!}o<9~SO z?%~amsUI%<{PgsH&D&)>HuB{VH{<7zr?N7XQ_|T%NdrFPs z458OHXx>)X<=OO6&AD4IW?a3pqrdZ=!yWHD=wDWSWBuf&?=6z!^__U^~ob&b^iYC_XeIGeSXUNd7GCn z-nhDLR`)G((nyA80p@i0Av^A7w0y~;qGh+`&tl6KPt;>o6i4{L3{faQP7g+?WdRLY y$cpt@1XPR&8?rFMCPTB%jMO+i7_S8;H5s-Nj8+g@0YL_g7#?5&_!enx`1@awWhSuz literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D11_SAMD11D14AM.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D11_SAMD11D14AM.bin new file mode 100755 index 0000000000000000000000000000000000000000..c349e2e00df8b1877310db7b9c1efebcd5eb132e GIT binary patch literal 4044 zcmaJ^eQ*@lk?%MAsnyq_6=pw1%j}N8E3E*5FyRcwqZwOB8i`8Iajv@ zb-6KEXbmKhf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2s z+I`}1%ZXnH7F0~H9kcFxd&Ko-R^yCG*Ap*4@I~3DueNVHa_RZgPmN!1ePBi99i{tc z)n{w;$%Jv=-KH=7Z2gzJfA{YD-A@m^IQGG58yC)fcv;h=w%gQ^{b_~<*hZNV$0wqN z^JW(=xFc^8Uo!V*eYlF^2m#a(h4SJ|5TqHIKyx~BU{g8)6$`@Vbd0doTu<7N9%lmO ewZo)V^JaoG3c@H5It5A$Kc3aVx6o+A-~R$rDmy6v literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_A_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_A_SAMD21E18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..f6baa4464b31dee219259e9204d2227d316b36b8 GIT binary patch literal 8128 zcmaJmYj_k@vgdTqE0aJb36GwcPUx9VV3G-t2agD-oo)=tbb=T`Aq4CM^mYQP!(-VF z@)(G&LG%iVXb7l4e1M9J(ZL614X}HaRoCetyGg*cv)~40S>vKk2x0nG2i(se_q+L0 zeI8ZkoH})?>eQ(j+KiYbW`xQB?gIG#{ucZKzX<9Jk`Z!*Ev2l2{8rU0B0mu^6(bFO zh*>u1Xjc$ojQM7dL&z4k0iKLli)|$ag|(QJjkX1PQKWf}t-Yh@XW9)gZtcynj|6{j)*N=a6>Qk`wCV2DWzaOOyrUBP*sZT6r`>CdutQvrv<@f~fB;0?;L+UNkS zIFv{DQJqP}CS`dW%1-PVrI@p^T9l47bNZ+tp_KETZA6e(2<5==+;+vSwD6=F@|wkR zb5E56czYW7!8dqf&}>vlK;02ueRME=Ihrk)#E{pZWN6esG#KrJy#P%xOv)y@dAp0Y zdGtIRKRyy-cGowrPGav4a-LD*&QwjV)+4fG5WTWV+i5f`IyZQ7EjQpf4c;;DO_?SUIc1WW5NNR=&W4% zqUps18}Ml@!Tq&En7yX<6QNe`Z~soK=uwe)B07xIbdU= zo>NgXynYqIlB>7Yh1kWsfhE_sSclF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;{&T0J+?*LXQ)W!fM+@yE&?0~e#KQMBls72{EiPQW{MR)PJ~U(D zqKYNPhCL3RS(ft%_tL!ok@|wREtxw5`&YdA#PP%GpL@UiJ~!DxtjR0)hRY%MzxprL zw=_}p55HB>+J1WPN&U*-&R3@kQy3E-^^fHrt$lI!qw{ND62rbn<97Y)>(76D{f|$c zxqI5`@kwKHEPq}1(*wKidAn%wJL_L@K3nkESJ7DCbASEdqdydXz3{j4D+*_;q6i;b z@ad_`-T(c~@2(batJ!To$R6xKDOaP=^rb-+2kxKp^$##@>AFU`PpY*W*v@im!B+o?%7R8A3U@4hq)=Y_AO=3s#6>n$WRDM+XZ>sNE{cZS@mk#dQ_UMB@-uZR* znGt{d`;?RE`$lasJ+OAp^7Q%U*=JuFd}sG#?>>89-==8lN3;HVdi=kq?X(;jbMFJ| z){QQja!+aZuTG7;I{BNAcYm|(@%LUkG<)Iw#TI3P+(Gr)widMdHhxlh_V!C@*RF2w z+H>r+mSevT%&(YUJ7)d&_K54Pti~CWt|wkz`DNK>ueNVLeDS$cPmbSUUAesSj?x3O z>a#Wac*3~vZqt{1zTvAqzkC0~?xzM`82jL~O$+9(UD`CM?KX8}f105Iwozup@rh`` zyxE2G@5r0Pm(0CcAFiS}LI5>Hp}aT~1ZhSl(43AO*pyB{#e%Ro9V2Wt*ONA+$C*HR d?J%j;yoKP5f-nk%PJj}_k7qUTEi~Hj_rD6)JFWl# literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMC21E18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..af53b978f30c9b12d185653e14052844ae622e46 GIT binary patch literal 6820 zcmaJmdwdgB*7wfj-B+UK{ls1 zGpG|6ccH?JBRQhJ5X)70NYUrzL6g%y%l&1 z0zddNPc&?uw#Jt19m-pbZU|h(qA4_R^Z7(vlgWWb`t-6X$xU&IUqpd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ALJSZ=W95SWBbbGo-SfN_UI*@XDU=KYU0!6Bt`!c;VJ^1<*2wV z3bndbg?tkJ>+9;$vs_XLcu5FqZ)buymz{3t3_?+f<))-=1SyDP!_ugEs9UqQNVLND-9?ua!C&!psJLiyQQ71PHy@9fRuyarZ@uH? zN8i~ke|r4KpNg}r#62Z*+_5=uU%cdthDoiqHGh7kwzK=t<^$@vuTM1O1p5tPkwdN;&`0le`UVMMu;hQEd8Iw7($nfRTUvGcn=2xp0zP9WI`%~o) zeUnJWpZ@aA58exYH~%lf3!>jtZzDWR`N5CQ_W$+t-_HjhZro(q;oJ91?dRdwmOa_@ zN5?En>EtZ$rK86_e*3~RXYTKq-%_#PvFrIeA9~|8)pIWi^uEV$fJTrS*$++3Mk@RQPw|@NUn~R@0-=6&U1<#6)HE-Cl>K`wk z*_tYkeP`xRcOQ>hx1x88PSCnp`TnZNfARa)w6$L7Jo3ua1Jt3FCvH9WGO<4EoV&MV z0-H1EPYpLO`Dg6o=e9rb@Y=h6x$(Qg!)fn-TXrCCOU^3Y?f1@DoHtj0!_gOpUfcB0 z>rdSlUy&H~!IUo#jrsS)4Te1F#akyq>lb^ntID;4}8<{_cz||e{AsCYwnu3 yV&2SqZ*3jdHBC+*$ki;sl%q$;JQdBGbwlOc=_TXX(9A3C;U;PXoJtK5e*Xjc^~_oT literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin new file mode 100755 index 0000000000000000000000000000000000000000..8187c0b03b4be4f012895b8c719f31db09c3a17c GIT binary patch literal 8116 zcmaKRdw3L8^5{9;^U5TU$ph$_>4cu?0Fw-lJOCr0cDf-X(+OYz4IyABu>Lv`b$Be> zL4g5u4Wd6G5e)$qhz}5OF*>@6Sp)1|Wz}^$$ZisF?JT%KS=P9y6GE82)gkWZANRZY zQhgp(=bSoqs_N9K8N3TIi_H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>AwzIZH|?px?Oq%*}s&_Su(N$Ku=Mr;A^Be$zV-om>9Hyp%h0C*PeO9Ql&|hwr}p zYVdRShckY+&{Q1o*2NKjtC+B_ta8Jl_0G-Od$e0$4;|hcSBfYn+sqscj z_giF8@`LMVTPCQ$4n=`7OSUpH!Z|>q`2K>pMF4o;cEc;@5#i z6}Q!n-tfIW;(9BqVaDW}iC0&BS^C-QZ99%#e&Nj1;~%xIT3I=#bH*#(Q{SKn+nSH_ik>nvn%GXCMbQWe`xYAZ*US2wTnDNE_1QOrX4WnAB?CLU2Yw U7zIM7K#Adpvl{po7;X6bziDzeS^xk5 literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..03dbd7ef3d14663afedfbbfd221f05dec04c747d GIT binary patch literal 8116 zcmaKRdw3L8^5{7|&rAZDJb<2=PUx8qFv$eSgGU6!PB(;PIspuzAq4CM)?X*04v%F! zC@>IRgXm94L_>lK#0Lnt7#&^3tO0hfvg$e=WH$-8b{5>AENfiU2_a11>JazykNe$x zsXmXYb55N)Rdwpr3~fX7G801c0g3?re}5&vz~8OYCn97InTr`2`7DY_Kt3XDEJP~$ z5Hn1`-Yz3V>+|J}N5~qo0^Sg|6k3aP3QM6u(%WX}Md79e*7lBqpJ^Y3aT`a*+Cy{^ zE!bp~VO7TaNjXv8L3Xw|11Wx%4p-V_oYUE63pnNe3~To|zg=dzjy8MXHr+UNjGvP2 z@?%_br@hc9uW3V>@jc11DHAINX-GAtB?kz(lBVa$Qr>D{m zd_4=i;M@GrXdcQZpl%PXe`hdl4VuRrhUsVu_1_#E=+p6mkU=t1O}m_w)ve`NxryN* zy|1omeFC#2z`B!#J?j>)TO}oxbkI}Spvlay5?57EXT5w`Wqcti0#vS)Mi+Y7;DqA@ z^onItFg9o?6A^RwI%b_o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S5vx4!C3VH#t? zWB#%Fqx+tl_u%5%=f$w^!GtIN_4VgJzVgRM&)hy^{iKv}xt70f{OPVI?s%hk`CFS_ zbUs!1&{xq||I>ec@1qY(zFzt}`9+1ZRZ)bGE&TMCXlyUw-HUN9>)``X!apS*wdnTvJ%mhPH;-1YJcYaiNtzU+^c-W+m{lvG5&dg-xi z|NQK;FSCy(w#$!}KK<0zH}5&K@`nX!bMvR%mJuBNtp11ZzWi$VbNBnRe!uKl<*|l6 zN4EdzwTlOn)Ehon@cq5LA;&>|2mecYr@p!AYHQEyH=U$UZ|hrm`88s9 z>Sb?d{&arKqTg2EvHsieC(j>#V&{YR{CMlvIcG-w@$b`4W*!)`-E`M|^H*msHqSfz z;?P@rAA0+#JNvgr(?6Q?*VB{!J!6mM*tlQawQ=Lv;%Rr3b>Dqz^p&aKe7yIYoe#hB z@{xH*8KK1CN&DOQ6D{m<~G^ajCqd!QR@ZDT}#pj#9+V}f+-|v2G z@Y(VA%-FhQ!F?;6rnJpfM-OBe8ekh^MjW4vmMolCwD^|%DSYXIk$Sv}5(oj*5QXv+ zOc0zI89;L;a$r*?0Tm0v=1h#R)m%^7ke*-y<+a14R`Yg(GYY~e5IO-$3_qIHz_-X~ H!{7e`2!J|1 literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_arduino_m0_pro_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_arduino_m0_pro_SAMD21G18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..64cf3afa9f61982b21789040040d8442bead58aa GIT binary patch literal 8124 zcmaJmYj_k@vgdTqE0aJb36GwcPUx9VV3LWD2Vex$PB(^RIzi;&LI~IithW}t3vN)BH7@Fe5Tr%s)!I(2G>w;*Pj8KDY*I{^N_zeT^mFM;}^RD>L1OF63`zg0Dh$WKH}rAR~X zVU`U#IuwK$V?J&ILbk9C@MOeVYAZ7+tfi!Ev@Ot!A}w=l9i1gV({6-u_m7Nqggs>* z(XODJ1e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u9Rnl<_<(UiU!`Zy!Ske{$<@jS`CG(YJOY$;6qGFiGY5tmx^V%IXO8f1rI-$ zaE0tVcsRiX!mvkU5V`^27z@8o0xTXWH$u4vPRPJ-A7t`!;6HZ;%FUUXGj-kluKD2M7w0^_ zu;(gq@^Ium*$L5&+zUHUO3x&6b}+G!e(lQBH~#s_C!c2@O=y>% z^6!0a{hJS-UG~Gg)I0Jf-;)s<{et$V?>_%>=u_AGGykyo1^Ma5?T0r0@9UTMCn~p| znD_ldyKO_;y2c)AiP#H*P;gpV@F>+11yHZ7Ekhoq5yvw6fn- z-@EGD$VV?7+`0Mj2Y~-1Sq+e&=`VT4Ok~G~ vOadw?rD0OPg6q-Ntrg3}8^FAzEjMvN?|7QTgg8~*+u6(<{m literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_arduino_mkrzero_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_arduino_mkrzero_SAMD21G18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..ec41692074ccf09e680780018e1ba11b7e7099c4 GIT binary patch literal 8112 zcmaKRdw3L8viLbY&rAZDWCHZebVAQ`fJp`+4;~RvJKY#E(+Oe#H-vzlko9&V$^b5Q zP+%as2GA=I(GWm^_y7SHqoa$OHNfswuDVVK*-Ze~&Vn11WsQqEA%y8)b%^`<$M3uO zQhgp(=bSoqs_Imo8Qg&AQWHXV02BiJUw?Q10v~{SAQd5d#9YG2$Zt_h0`e14V=+?E zhnQhP_I4Q|TAy#qScI$*E8q=LOR+VeQ&@@(lHN8$FN!wLv9@;<{Y?8fjC*8wtUclh zcm$h_vJ(_KNXn`5CbF~56$;ZCK^ECXn~d{1+iW41+?Q?bCWCgFM!BX9O-w$QCYvT=r6?1rrp&YuA(wHTZA6HY3HiX#+&0-Qw{Qj}>@^8x z$R*l=x95N#e2XV~&ummkK;0f$_0B+M4Vujxg|Jtrq$$+*!$7RJqe!O-MGTUWYToLi ztR5}T%8ieP>0J%Yt5T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8V`ERAyWY$_m5UWoKo%z1&@T<$8di+w!pDMi*4YS0gLh6mH&))p! zXP`zi|J2ChB6+L15esnVDB5j;Ejx7rPmw3FPx#>phxwq~(MV;Ajap|=;iEXLZ zyq$SdxwNuJtM6O&ZRC?z4({Ci|=U*Fm zch^(Df8qY#^|ADiX8rZd_q^Fr>sz~azkj&p{oe!^R7|fMz4m)s)b&>Ojv13~ zCSP6tW$9B@$$?o76IJR&(%A3r)Ruhy_*c7s_uhxy&-TAG z=HY4U7tVcTY15>(JC%`r8M+2o(@covlF`C>vkMp8oi~XK%pI-|RZ#-LgBqf6UV;$< zH2o#el!@%vm`OmzjIb#aBWy7>7_3N3FoN>hU{Z@|Bf;tgp%)091SLjRR14oiy$yf= E556cV)c^nh literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_arduino_zero_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_arduino_zero_SAMD21G18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..d447131cba64548a3bcb0914e17fc7b81a90308d GIT binary patch literal 8108 zcmaJmYj_k@vgh;2mw1G>+J+q25{L9 z3JjoY09}EIh5!o02MD+r8C@S)1GrbY>e?M-HvwEb3vN)BH7@Fe5T2&KXyyJ7kaC$eGlL&m!z1 zE>t*yw`YJKe1|6*%|L|&w4Kq_Z}w(Zp&7hci1-XlnnK;*_r|(lFMtz{nj|yTu-#4B zy?UOV8>K|(JzE-9r!e!vtapg8bJd(xOQp2ZR(c#8u~_+~;?nAgte;<4kz7oQP%4&4 zgNyxaWaM!IM#Y6vBr#%IC?e**Rm>`jmbUJKl{imRxLfX_Yr`!kF`{){fBGcwHo<7$ zgSru8TE(w23s~GDCdz~_jZX}RXSEhBfz3Fhj6i!YRQrk@{DlhCJ-XLhjJh*>>5x|_ zi=gg-#)CG{T!I%}KPgbsSPH^fO6bc0?9Z)4jX!++`ew5?(o7&_tqruHr~C-y%qP@$Q$wD?i+oEjFB0!RzxBz zav>`V+K_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yXhxp-z(=sxc0MgJ}JMID>-c0~@Ze(}M# zk7NT>9Jj+FW47mm%&ssYvV_eAg*SmkXZO<()mo9&G{j=`JiXZqa zk?ec?uW!EhZrSHce=9$$aE=;^2(ZN;p8UG!cVGVga@n@}z0M=S*S@d%B=YL|M;q37 z7CDP%XXalyd+vj`ethC$B+Jg?FuNp4NW7Ho8B@)BwjAE8_Tcv}Dn|lEw22r}5#1BlY1bN+ASLLli4au|R-k zz5-fvkqcXL38>f*w&r4l?bfZN0~sk6P+liYYPW7CII|$k0-+P2#K?i_;ag(1;rG9F Crzvs( literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_genuino_zero_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_genuino_zero_SAMD21G18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..b7f09e2db644459c97443b74519e0b8829da1433 GIT binary patch literal 8108 zcmaJmYj_k@vgh;2mw1G>+J+q25{L9 z3JjoY09}EIh5!o02MD+r8C@S)1GrbY>e?M-HvwEb3vN)BH7@Fe5T2&KXyyJ7kaC$eGlL&m!z1 zE>t*yw`YJKe1|6*%|L|&w4Kq_Z}w(Zp&7hci1-XlnnK;*_r|(lFMtz{nj|yTu-#4B zy?UOV8>K|(JzE-9r!e!vtapg8bJd(xOQp2ZR(c#8u~_+~;?nAgte;<4kz7oQP%4&4 zgNyxaWaM!IM#Y6vBr#%IC?e**Rm>`jmbUJKl{imRxLfX_Yr`!kF`{){fBGcwHo<7$ zgSru8TE(w23s~GDCdz~_jZX}RXSEhBfz3Fhj6i!YRQrk@{DlhCJ-XLhjJh*>>5x|_ zi=gg-#)CG{T!I%}KPgbsSPH^fO6bc0?9Z)4jX!++`ew5?(o7&_tqruHr~C-y%qP@$Q$wD?i+oEjFB0!RzxBz zav>`V+K_};GzS%CiVT9srf;#(x8 zS{;0un4pcP9?5v2aES0e*2x0O2U2>g5AR7Xwol~9;T37r-0FkoU5Q(hc9{UbVo`Ns z$ibF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ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. */ -#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +//#define TERMINAL_MODE_ENABLED -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 1 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA30C_SERCOM1_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA08C_SERCOM1_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA09C_SERCOM1_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (15) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +//#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_NONE +#else + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#endif + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 0 +#define ARDUINO_EXTENDED_CAPABILITIES 0 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -79,19 +178,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ -//#define USB_VENDOR_STRINGS_ENABLED +#define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "Generic SAMD11C14A" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA05C_SERCOM0_PAD3 @@ -100,27 +206,48 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (15) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA15 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. - */ -//#define BOARD_LED_PORT (0) -//#define BOARD_LED_PIN (16) -//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -//#define BOARD_LED_FADE_ENABLED + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#if defined(SDCARD_ENABLED) + #define BOARD_LED_PORT (0) + #define BOARD_LED_PIN (16) + #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#else + //#define BOARD_LED_PORT (0) + //#define BOARD_LED_PIN (16) + //#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#endif //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (16) diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h index 31cddd1f6..54a560142 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,17 +23,115 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. */ -#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +//#define TERMINAL_MODE_ENABLED -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 0 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA14C_SERCOM0_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA10C_SERCOM0_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA11C_SERCOM0_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (15) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +//#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_NONE +#else + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#endif + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 0 +#define ARDUINO_EXTENDED_CAPABILITIES 0 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -79,19 +178,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ -//#define USB_VENDOR_STRINGS_ENABLED +#define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "Generic SAMD11D14AM" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA05C_SERCOM0_PAD3 @@ -100,27 +206,48 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (15) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA15 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. - */ -//#define BOARD_LED_PORT (0) -//#define BOARD_LED_PIN (16) -//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -//#define BOARD_LED_FADE_ENABLED + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#if defined(SDCARD_ENABLED) + #define BOARD_LED_PORT (0) + #define BOARD_LED_PIN (16) + #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#else + //#define BOARD_LED_PORT (0) + //#define BOARD_LED_PIN (16) + //#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#endif //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (16) diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h index 9c01e5068..04eb0e033 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,17 +23,115 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. */ -#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +//#define TERMINAL_MODE_ENABLED -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 1 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA30C_SERCOM1_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA08C_SERCOM1_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA09C_SERCOM1_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (15) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +//#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_NONE +#else + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#endif + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 0 +#define ARDUINO_EXTENDED_CAPABILITIES 0 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -79,19 +178,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ -//#define USB_VENDOR_STRINGS_ENABLED +#define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "Generic SAMD11D14AS" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA05C_SERCOM0_PAD3 @@ -100,27 +206,48 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (15) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA15 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. - */ -//#define BOARD_LED_PORT (0) -//#define BOARD_LED_PIN (16) -//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -//#define BOARD_LED_FADE_ENABLED + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#if defined(SDCARD_ENABLED) + #define BOARD_LED_PORT (0) + #define BOARD_LED_PIN (16) + #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#else + //#define BOARD_LED_PORT (0) + //#define BOARD_LED_PIN (16) + //#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#endif //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (16) diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h b/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h index 4992d9404..1ace79979 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,21 +23,121 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 3 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA22C_SERCOM3_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA18D_SERCOM3_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA19D_SERCOM3_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (23) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ #if (SAMC21) - #define SAM_BA_INTERFACE SAM_BA_UART_ONLY + #define SAM_BA_INTERFACE SAM_BA_UART_ONLY #else - #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY #endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#if (SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES) + // The pin functions as a toggle between the two interfaces + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_USBCDC_LOW +#else + // The pin functions as an enable for the compiled interface + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#endif +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -87,19 +188,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "Generic SAMx21E" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -108,27 +216,48 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA27 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (27) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. - */ -//#define BOARD_LED_PORT (0) -//#define BOARD_LED_PIN (6) -//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -//#define BOARD_LED_FADE_ENABLED + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#if defined(SDCARD_ENABLED) + #define BOARD_LED_PORT (0) + #define BOARD_LED_PIN (6) + #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#else + //#define BOARD_LED_PORT (0) + //#define BOARD_LED_PIN (6) + //#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#endif //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (6) diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h b/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h index 8d46e3f42..fc4d47032 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,21 +23,121 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 3 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA22C_SERCOM3_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA18D_SERCOM3_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA19D_SERCOM3_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (23) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ #if (SAMC21) - #define SAM_BA_INTERFACE SAM_BA_UART_ONLY + #define SAM_BA_INTERFACE SAM_BA_UART_ONLY #else - #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY #endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#if (SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES) + // The pin functions as a toggle between the two interfaces + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_USBCDC_LOW +#else + // The pin functions as an enable for the compiled interface + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#endif +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -87,19 +188,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "Generic SAMx21G" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -108,27 +216,48 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA27 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (27) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. - */ -//#define BOARD_LED_PORT (0) -//#define BOARD_LED_PIN (6) -//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -//#define BOARD_LED_FADE_ENABLED + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#if defined(SDCARD_ENABLED) + #define BOARD_LED_PORT (0) + #define BOARD_LED_PIN (6) + #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#else + //#define BOARD_LED_PORT (0) + //#define BOARD_LED_PIN (6) + //#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#endif //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (6) diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h b/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h index 7e993566a..fdb72ae98 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,21 +23,121 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 3 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA22C_SERCOM3_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA18D_SERCOM3_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA19D_SERCOM3_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (23) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ #if (SAMC21) - #define SAM_BA_INTERFACE SAM_BA_UART_ONLY + #define SAM_BA_INTERFACE SAM_BA_UART_ONLY #else - #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY #endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#if (SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES) + // The pin functions as a toggle between the two interfaces + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_USBCDC_LOW +#else + // The pin functions as an enable for the compiled interface + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#endif +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -87,19 +188,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "Generic SAMx21J" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -108,27 +216,48 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA27 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (27) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. - */ -//#define BOARD_LED_PORT (1) -//#define BOARD_LED_PIN (2) -//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -//#define BOARD_LED_FADE_ENABLED + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#if defined(SDCARD_ENABLED) + #define BOARD_LED_PORT (0) + #define BOARD_LED_PIN (6) + #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#else + //#define BOARD_LED_PORT (0) + //#define BOARD_LED_PIN (6) + //#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON +#endif //#define BOARD_LEDRX_PORT (1) //#define BOARD_LEDRX_PIN (2) diff --git a/bootloaders/zero/board_definitions/board_definitions_MT_D11.h b/bootloaders/zero/board_definitions/board_definitions_MT_D11.h index 0555fa327..95270cbf6 100644 --- a/bootloaders/zero/board_definitions/board_definitions_MT_D11.h +++ b/bootloaders/zero/board_definitions/board_definitions_MT_D11.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,15 +23,113 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. */ -#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +//#define TERMINAL_MODE_ENABLED -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 0 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA14C_SERCOM0_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA10C_SERCOM0_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA11C_SERCOM0_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (15) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +//#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_NONE +#else + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#endif + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ #define ARDUINO_EXTENDED_CAPABILITIES 0 @@ -79,19 +178,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ -//#define USB_VENDOR_STRINGS_ENABLED +#define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "MT-D11" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA05C_SERCOM0_PAD3 @@ -100,27 +206,42 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (15) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA15 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (16) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (16) diff --git a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h index 2b430c9c0..caebf81eb 100644 --- a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h +++ b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,15 +23,115 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 3 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA22C_SERCOM3_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA18D_SERCOM3_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA19D_SERCOM3_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (23) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#if (SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES) + // The pin functions as a toggle between the two interfaces + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_USBCDC_LOW +#else + // The pin functions as an enable for the compiled interface + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#endif +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ #define ARDUINO_EXTENDED_CAPABILITIES 1 @@ -79,19 +180,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "MT-D21E Rev A" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -100,27 +208,42 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (27) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA27 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (28) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (28) diff --git a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h index 429008204..0cd06538b 100644 --- a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h +++ b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -22,9 +23,84 @@ #include -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 3 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA22C_SERCOM3_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PA18D_SERCOM3_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PA19D_SERCOM3_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (23) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ #if (SAMC21) #define SAM_BA_INTERFACE SAM_BA_UART_ONLY @@ -32,9 +108,34 @@ #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY #endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#if (SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES) + // The pin functions as a toggle between the two interfaces + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_USBCDC_LOW +#else + // The pin functions as an enable for the compiled interface + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#endif +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ #define ARDUINO_EXTENDED_CAPABILITIES 1 @@ -87,19 +188,26 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" #define STRING_PRODUCT "MT-D21E Rev B" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 #define USB_VID_LOW 0xD0 #define USB_PID_HIGH 0x05 #define USB_PID_LOW 0x57 -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -108,27 +216,42 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (27) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA27 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (6) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (6) diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h b/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h index 1e3bc7b08..97c7ac80b 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -20,17 +21,113 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. */ -#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#define SDCARD_AUTORUN_DISABLED -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -77,18 +174,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Arduino m0" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x2A #define USB_VID_LOW 0x03 #define USB_PID_HIGH 0x00 #define USB_PID_LOW 0x4E -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 5 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3 @@ -97,35 +201,49 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7 -//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (17) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED -#define BOARD_LEDRX_PORT (1) -#define BOARD_LEDRX_PIN (3) -#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDRX_PORT (1) +//#define BOARD_LEDRX_PIN (3) +//#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON -#define BOARD_LEDTX_PORT (0) -#define BOARD_LEDTX_PIN (27) -#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDTX_PORT (0) +//#define BOARD_LEDTX_PIN (27) +//#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON #endif // _BOARD_DEFINITIONS_H_ diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h b/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h index 4b6b22010..6a6986b4a 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -20,17 +21,117 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ -#define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -77,18 +178,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Arduino m0 pro" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x2A #define USB_VID_LOW 0x03 #define USB_PID_HIGH 0x00 #define USB_PID_LOW 0x4D -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 5 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3 @@ -97,35 +205,49 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7 -//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (17) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED -#define BOARD_LEDRX_PORT (1) -#define BOARD_LEDRX_PIN (3) -#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDRX_PORT (1) +//#define BOARD_LEDRX_PIN (3) +//#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON -#define BOARD_LEDTX_PORT (0) -#define BOARD_LEDTX_PIN (27) -#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDTX_PORT (0) +//#define BOARD_LEDTX_PIN (27) +//#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON #endif // _BOARD_DEFINITIONS_H_ diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h b/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h index af128afe6..042544117 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -20,17 +21,117 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. */ -#define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#define SDCARD_AUTORUN_DISABLED -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#endif + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -77,18 +178,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Arduino MKR1000" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x23 #define USB_VID_LOW 0x41 #define USB_PID_HIGH 0x00 #define USB_PID_LOW 0x4E -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -97,29 +205,36 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -#define BOOT_DOUBLE_TAP_ENABLED +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7 -//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5 +#define BOARD_LED_FADE_ENABLED /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ // PA20 (digital pin 6) #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (20) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED // No RX/TX led //#define BOARD_LEDRX_PORT diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h b/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h index 64b55dac4..d34d9e71c 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h @@ -1,5 +1,7 @@ /* - Copyright (c) 2016 Arduino LLC. All right reserved. + Copyright (c) 2017 MattairTech LLC. All right reserved. + 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 @@ -19,17 +21,117 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ -#define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -76,18 +178,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Arduino MKRZero" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x23 #define USB_VID_LOW 0x41 #define USB_PID_HIGH 0x00 #define USB_PID_LOW 0x4F -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 5 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3 @@ -96,28 +205,42 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 -//#define BOOT_LOAD_PIN PIN_PA15 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (1) #define BOARD_LED_PIN (8) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED // No RX/TX led //#define BOARD_LEDRX_PORT diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h b/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h index 8d2698c3d..219544909 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -20,17 +21,117 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ -#define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -77,18 +178,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Arduino Zero" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x23 #define USB_VID_LOW 0x41 #define USB_PID_HIGH 0x00 #define USB_PID_LOW 0x4D -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -97,35 +205,49 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7 -//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (17) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED -#define BOARD_LEDRX_PORT (1) -#define BOARD_LEDRX_PIN (3) -#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDRX_PORT (1) +//#define BOARD_LEDRX_PIN (3) +//#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON -#define BOARD_LEDTX_PORT (0) -#define BOARD_LEDTX_PIN (27) -#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDTX_PORT (0) +//#define BOARD_LEDTX_PIN (27) +//#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON #endif // _BOARD_DEFINITIONS_H_ diff --git a/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h b/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h index 745275a07..fd1ed6521 100644 --- a/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h +++ b/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -20,17 +21,117 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ -#define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -77,18 +178,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Genuino MKR1000" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x23 #define USB_VID_LOW 0x41 #define USB_PID_HIGH 0x02 #define USB_PID_LOW 0x4E -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -97,28 +205,42 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7 -//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (20) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED //#define BOARD_LEDRX_PORT (0) //#define BOARD_LEDRX_PIN (20) diff --git a/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h b/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h index d9978fd93..a563ff51c 100644 --- a/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h +++ b/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h @@ -1,4 +1,5 @@ /* + Copyright (c) 2017 MattairTech LLC. All right reserved. Copyright (c) 2015 Arduino LLC. All right reserved. Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. @@ -20,17 +21,117 @@ #ifndef _BOARD_DEFINITIONS_H_ #define _BOARD_DEFINITIONS_H_ -/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, or - * SAM_BA_BOTH_INTERFACES. Select only one interface with 4KB bootloaders. - * The C21 lacks USB, so set to SAM_BA_UART_ONLY in this case. +#include + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +//#define SDCARD_ENABLED + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 4 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PA12D_SERCOM4_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB10D_SERCOM4_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB11D_SERCOM4_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (0) +#define SDCARD_SPI_CS_PIN (18) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (6) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (7) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. + */ +#define SDCARD_AUTORUN_DISABLED + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). */ -#define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#if defined(SDCARD_ENABLED) + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES +#endif -/* If ARDUINO_EXTENDED_CAPABILITIES is defined, 3 additional commands will - * become available which will speed up programming when using the Arduino +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (21) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). */ -#define ARDUINO_EXTENDED_CAPABILITIES 1 +#define ARDUINO_EXTENDED_CAPABILITIES 1 /* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, @@ -77,18 +178,25 @@ #define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) /* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and - * STRING_PRODUCT will be sent to the host. Do not enable with 4KB bootloaders. + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_PRODUCT "Genuino Zero" -/* USB VID and PID */ +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x23 #define USB_VID_LOW 0x41 #define USB_PID_HIGH 0x02 #define USB_PID_LOW 0x4D -/* USART configuration */ +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ #define BOOT_USART_SERCOM_INSTANCE 0 #define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2 #define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3 @@ -97,35 +205,49 @@ #define BOOT_USART_PAD0 PINMUX_UNUSED /* - * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by - * quickly tapping two times on the reset button. + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. */ #define BOOT_DOUBLE_TAP_ENABLED /* - * If BOOT_LOAD_PIN is defined the bootloader is started if the selected - * pin is tied LOW. + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. */ -//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7 -//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5 +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (0) +#define BOOT_LOAD_PIN (21) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP /* - * LEDs definitions - * If the PORT is defined, then the associated LED is enabled - * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces - * a PWM pulse or heartbeat, otherwise, it simply turns on if enabled. + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. */ #define BOARD_LED_PORT (0) #define BOARD_LED_PIN (17) #define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON -#define BOARD_LED_FADE_ENABLED -#define BOARD_LEDRX_PORT (1) -#define BOARD_LEDRX_PIN (3) -#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDRX_PORT (1) +//#define BOARD_LEDRX_PIN (3) +//#define BOARD_LEDRX_POLARITY LED_POLARITY_LOW_ON -#define BOARD_LEDTX_PORT (0) -#define BOARD_LEDTX_PIN (27) -#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON +//#define BOARD_LEDTX_PORT (0) +//#define BOARD_LEDTX_PIN (27) +//#define BOARD_LEDTX_POLARITY LED_POLARITY_LOW_ON #endif // _BOARD_DEFINITIONS_H_ diff --git a/bootloaders/zero/board_driver_led.c b/bootloaders/zero/board_driver_led.c index 157b1d262..c3fa95639 100644 --- a/bootloaders/zero/board_driver_led.c +++ b/bootloaders/zero/board_driver_led.c @@ -26,10 +26,10 @@ volatile uint8_t ledKeepValue = 0; volatile uint8_t ledTargetValue = 20; -volatile int8_t ledDirection = 4; +volatile int8_t ledDirection = 8; volatile uint8_t ledTargetValueMin = LED_TARGET_VALUE_MIN_1; -inline void LED_pulse() +inline void LED_pulse(void) { if (ledKeepValue == 0) { ledTargetValue += ledDirection; @@ -54,3 +54,13 @@ inline void LED_pulse() LED_toggle(); } } + +void LED_status(uint32_t periodMS) +{ + __disable_irq(); + + while (1) { + LED_toggle(); + delayUs(periodMS * 500UL); + } +} diff --git a/bootloaders/zero/board_driver_led.h b/bootloaders/zero/board_driver_led.h index c5a554e78..7563da20f 100644 --- a/bootloaders/zero/board_driver_led.h +++ b/bootloaders/zero/board_driver_led.h @@ -22,6 +22,18 @@ #include #include "board_definitions.h" +#include "util.h" + +#define LED_STATUS_SUCCESS 1000 +#define LED_STATUS_FILE_ALREADY_MATCHES 500 +#define LED_STATUS_FILE_NOT_FOUND 250 +#define LED_STATUS_NO_SAM_BA_INTERFACE 125 +#define LED_STATUS_FILE_TOO_LARGE 63 +#define LED_STATUS_VERIFICATION_FAILURE 31 + +void LED_pulse(void); +void LED_status(uint32_t periodMS); + #if defined(BOARD_LED_PORT) #if ((defined BOARD_LED_POLARITY) && BOARD_LED_POLARITY == LED_POLARITY_LOW_ON) @@ -40,8 +52,6 @@ inline void LED_toggle(void) { } #endif -void LED_pulse(); - #if defined(BOARD_LEDRX_PORT) #if ((defined BOARD_LEDRX_POLARITY) && BOARD_LEDRX_POLARITY == LED_POLARITY_LOW_ON) inline void LEDRX_on(void) { PORT->Group[BOARD_LEDRX_PORT].OUTCLR.reg = (1<USART.SYNCBUSY.reg); /* Disable the SERCOM UART module */ +#if defined(PARANOIA) sercom->USART.CTRLA.bit.ENABLE = 0; while(sercom->USART.SYNCBUSY.reg); @@ -33,6 +34,7 @@ void uart_basic_init(Sercom *sercom, uint16_t baud_val, enum uart_pad_settings p sercom->USART.CTRLA.bit.SWRST = 1; while(sercom->USART.CTRLA.bit.SWRST); while(sercom->USART.SYNCBUSY.reg); +#endif /* Update the UART pad settings, mode and data order settings */ sercom->USART.CTRLA.reg = pad_conf | SERCOM_USART_CTRLA_MODE(1) | SERCOM_USART_CTRLA_DORD; diff --git a/bootloaders/zero/board_driver_serial.h b/bootloaders/zero/board_driver_serial.h index 809f7ec01..3ecb715f9 100644 --- a/bootloaders/zero/board_driver_serial.h +++ b/bootloaders/zero/board_driver_serial.h @@ -24,16 +24,15 @@ #include #include -#define PINMUX_UNUSED 0xFFFFFFFF /* SERCOM UART available pad settings */ enum uart_pad_settings { - UART_RX_PAD0_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(1), - UART_RX_PAD1_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(1), - UART_RX_PAD2_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(2), - UART_RX_PAD3_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(3), - UART_RX_PAD1_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(1), - UART_RX_PAD3_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(1), + UART_RX_PAD0_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(1), + UART_RX_PAD1_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(1), + UART_RX_PAD2_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(2), + UART_RX_PAD3_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(3), + UART_RX_PAD1_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(1), + UART_RX_PAD3_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(1), }; /** diff --git a/bootloaders/zero/board_driver_usb.c b/bootloaders/zero/board_driver_usb.c index 2656e6aad..15ee2aec8 100644 --- a/bootloaders/zero/board_driver_usb.c +++ b/bootloaders/zero/board_driver_usb.c @@ -22,10 +22,13 @@ #include "sam_ba_usb.h" #include "sam_ba_cdc.h" +#define USB_PAD_TRANSN_REG_POS (6) #define NVM_USB_PAD_TRANSN_POS (45) #define NVM_USB_PAD_TRANSN_SIZE (5) +#define USB_PAD_TRANSP_REG_POS (0) #define NVM_USB_PAD_TRANSP_POS (50) #define NVM_USB_PAD_TRANSP_SIZE (5) +#define USB_PAD_TRIM_REG_POS (12) #define NVM_USB_PAD_TRIM_POS (55) #define NVM_USB_PAD_TRIM_SIZE (3) @@ -67,7 +70,7 @@ P_USB_CDC USB_Open(P_USB_CDC pCdc, Usb *pUsb) */ void USB_Init(void) { - uint32_t pad_transn, pad_transp, pad_trim; + uint8_t pad_transn, pad_transp, pad_trim; /* Enable USB clock */ #if (SAMD21 || SAMD11) @@ -77,33 +80,31 @@ void USB_Init(void) #endif /* Set up the USB DP/DN pins */ - PORT->Group[0].PINCFG[PIN_PA24G_USB_DM].bit.PMUXEN = 1; - PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg &= ~(0xF << (4 * (PIN_PA24G_USB_DM & 0x01u))); - PORT->Group[0].PMUX[PIN_PA24G_USB_DM/2].reg |= MUX_PA24G_USB_DM << (4 * (PIN_PA24G_USB_DM & 0x01u)); - PORT->Group[0].PINCFG[PIN_PA25G_USB_DP].bit.PMUXEN = 1; - PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg &= ~(0xF << (4 * (PIN_PA25G_USB_DP & 0x01u))); - PORT->Group[0].PMUX[PIN_PA25G_USB_DP/2].reg |= MUX_PA25G_USB_DP << (4 * (PIN_PA25G_USB_DP & 0x01u)); + pinMux(PINMUX_PA24G_USB_DM); + pinMux(PINMUX_PA25G_USB_DP); /* ---------------------------------------------------------------------------------------------- * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) */ #if (SAMD21 || SAMD11) GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GCM_USB ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); + waitForSync(); #else GCLK->PCHCTRL[GCM_USB].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); - while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); + waitForSync(); #endif /* Reset */ +#if defined(PARANOIA) USB->DEVICE.CTRLA.bit.SWRST = 1; while (USB->DEVICE.SYNCBUSY.bit.SWRST) { /* Sync wait */ } +#endif /* Load Pad Calibration */ - pad_transn =( *((uint32_t *)(NVMCTRL_OTP4) + pad_transn =(uint8_t)( *((uint32_t *)(NVMCTRL_OTP4) + (NVM_USB_PAD_TRANSN_POS / 32)) >> (NVM_USB_PAD_TRANSN_POS % 32)) & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); @@ -113,9 +114,7 @@ void USB_Init(void) pad_transn = 5; } - USB->DEVICE.PADCAL.bit.TRANSN = pad_transn; - - pad_transp =( *((uint32_t *)(NVMCTRL_OTP4) + pad_transp =(uint8_t)( *((uint32_t *)(NVMCTRL_OTP4) + (NVM_USB_PAD_TRANSP_POS / 32)) >> (NVM_USB_PAD_TRANSP_POS % 32)) & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); @@ -125,8 +124,7 @@ void USB_Init(void) pad_transp = 29; } - USB->DEVICE.PADCAL.bit.TRANSP = pad_transp; - pad_trim =( *((uint32_t *)(NVMCTRL_OTP4) + pad_trim =(uint8_t)( *((uint32_t *)(NVMCTRL_OTP4) + (NVM_USB_PAD_TRIM_POS / 32)) >> (NVM_USB_PAD_TRIM_POS % 32)) & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); @@ -136,7 +134,7 @@ void USB_Init(void) pad_trim = 3; } - USB->DEVICE.PADCAL.bit.TRIM = pad_trim; + USB->DEVICE.PADCAL.reg = (uint16_t)((pad_trim << USB_PAD_TRIM_REG_POS) | (pad_transn << USB_PAD_TRANSN_REG_POS) | (pad_transp << USB_PAD_TRANSP_REG_POS)); /* Set the configuration */ /* Set mode to Device mode */ diff --git a/bootloaders/zero/board_driver_usb.h b/bootloaders/zero/board_driver_usb.h index 4e71b8c1a..878ba626d 100644 --- a/bootloaders/zero/board_driver_usb.h +++ b/bootloaders/zero/board_driver_usb.h @@ -21,6 +21,7 @@ #define _BOARD_DRIVER_USB_H_ #include "sam_ba_cdc.h" +#include "util.h" extern UsbDeviceDescriptor usb_endpoint_table[MAX_EP]; extern uint8_t udd_ep_out_cache_buffer[2][64]; //1 for CTRL, 1 for BULK diff --git a/bootloaders/zero/board_init.c b/bootloaders/zero/board_init.c index 85e5c8640..69237989b 100644 --- a/bootloaders/zero/board_init.c +++ b/bootloaders/zero/board_init.c @@ -20,6 +20,9 @@ #include #include "board_definitions.h" +#include "util.h" + +extern uint32_t SystemCoreClock; /** * \brief SystemInit() configures the needed clocks and according Flash Read Wait States. @@ -43,15 +46,6 @@ #error "startup.c: Unsupported chip" #endif -void waitForSync( void ) -{ -#if (SAMD) - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); -#elif (SAML21 || SAMC21) - while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); -#endif -} - #if (SAMD || SAML21) void waitForDFLL( void ) { @@ -72,6 +66,11 @@ void waitForPLL( void ) void board_init( void ) { + /* + * Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21) + */ + NVMCTRL->CTRLB.bit.MANW = 1; + /* Set 1 Flash Wait State for 48MHz (2 for the L21 and C21), cf tables 20.9 and 35.27 in SAMD21 Datasheet */ #if (SAMD) NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_HALF_Val ; // one wait state @@ -370,6 +369,8 @@ void board_init( void ) waitForSync(); #endif + SystemCoreClock=VARIANT_MCK; + /* Set CPU and APB dividers before switching the CPU/APB clocks to the new clock source */ #if (SAMD) PM->CPUSEL.reg = PM_CPUSEL_CPUDIV_DIV1 ; @@ -379,9 +380,4 @@ void board_init( void ) #elif (SAML21 || SAMC21) MCLK->CPUDIV.reg = MCLK_CPUDIV_CPUDIV_DIV1 ; #endif - - /* - * Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21) - */ - NVMCTRL->CTRLB.bit.MANW = 1; } diff --git a/bootloaders/zero/build_all_bootloaders.sh b/bootloaders/zero/build_all_bootloaders.sh index 77103f151..b9c6c0638 100755 --- a/bootloaders/zero/build_all_bootloaders.sh +++ b/bootloaders/zero/build_all_bootloaders.sh @@ -2,69 +2,136 @@ make clean -BOARD_ID=arduino_zero MCU=SAMD21G18A make all mostly_clean - -BOARD_ID=genuino_zero MCU=SAMD21G18A make all mostly_clean - -BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A make all mostly_clean - -BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A make all mostly_clean - -BOARD_ID=arduino_mkrzero MCU=SAMD21G18A make all mostly_clean - -BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A make all mostly_clean -BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A make all mostly_clean - -BOARD_ID=MT_D21E_rev_B MCU=SAMD21E17A make all mostly_clean -BOARD_ID=MT_D21E_rev_B MCU=SAMD21E18A make all mostly_clean -BOARD_ID=MT_D21E_rev_B MCU=SAML21E18B make all mostly_clean -BOARD_ID=MT_D21E_rev_B MCU=SAMC21E18A make all mostly_clean - -BOARD_ID=MT_D11 MCU=SAMD11D14AM make all mostly_clean - -BOARD_ID=Generic_x21E MCU=SAMD21E15A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMD21E16A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMD21E17A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMD21E18A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAML21E15B make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAML21E16B make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAML21E17B make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAML21E18B make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMC21E15A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMC21E16A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMC21E17A make all mostly_clean -BOARD_ID=Generic_x21E MCU=SAMC21E18A make all mostly_clean - -BOARD_ID=Generic_x21G MCU=SAMD21G15A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMD21G16A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMD21G17A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMD21G18A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAML21G16B make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAML21G17B make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAML21G18B make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMC21G15A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMC21G16A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMC21G17A make all mostly_clean -BOARD_ID=Generic_x21G MCU=SAMC21G18A make all mostly_clean - -BOARD_ID=Generic_x21J MCU=SAMD21J15A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMD21J16A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMD21J17A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMD21J18A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAML21J16B make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAML21J17B make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAML21J18B make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMC21J15A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMC21J16A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMC21J17A make all mostly_clean -BOARD_ID=Generic_x21J MCU=SAMC21J18A make all mostly_clean - -BOARD_ID=Generic_D11D14AM MCU=SAMD11D14AM make all mostly_clean -BOARD_ID=Generic_D11D14AS MCU=SAMD11D14AS make all mostly_clean -BOARD_ID=Generic_D11C14A MCU=SAMD11C14A make all mostly_clean - -BOARD_ID=arduino_m0 MCU=SAMD21G18A make all mostly_clean -BOARD_ID=arduino_m0_pro MCU=SAMD21G18A make all mostly_clean +# With SDCARD_DISABLED +BOARD_ID=arduino_zero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=genuino_zero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=arduino_mkrzero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=MT_D21E_rev_B MCU=SAMD21E17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_B MCU=SAMD21E18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_B MCU=SAML21E18B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_B MCU=SAMC21E18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=MT_D11 MCU=SAMD11D14AM SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=Generic_x21E MCU=SAMD21E15A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMD21E16A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMD21E17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMD21E18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E15B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E16B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E17B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E18B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E15A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E16A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=Generic_x21G MCU=SAMD21G15A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMD21G16A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMD21G17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAML21G16B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAML21G17B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAML21G18B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G15A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G16A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=Generic_x21J MCU=SAMD21J15A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMD21J16A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMD21J17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMD21J18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAML21J16B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAML21J17B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAML21J18B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J15A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J16A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J17A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J18A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=Generic_D11D14AM MCU=SAMD11D14AM SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_D11D14AS MCU=SAMD11D14AS SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Generic_D11C14A MCU=SAMD11C14A SDCARD=SDCARD_DISABLED make all mostly_clean + +BOARD_ID=arduino_m0 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=arduino_m0_pro MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + + +# With SDCARD_ENABLED +BOARD_ID=arduino_zero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=genuino_zero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=arduino_mkrzero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=MT_D21E_rev_B MCU=SAMD21E17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_B MCU=SAMD21E18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_B MCU=SAML21E18B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=MT_D21E_rev_B MCU=SAMC21E18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=MT_D11 MCU=SAMD11D14AM SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=Generic_x21E MCU=SAMD21E15A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMD21E16A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMD21E17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMD21E18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E15B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E16B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E17B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAML21E18B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E15A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E16A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21E MCU=SAMC21E18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=Generic_x21G MCU=SAMD21G15A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMD21G16A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMD21G17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAML21G16B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAML21G17B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAML21G18B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G15A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G16A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21G MCU=SAMC21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=Generic_x21J MCU=SAMD21J15A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMD21J16A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMD21J17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMD21J18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAML21J16B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAML21J17B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAML21J18B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J15A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J16A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J17A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_x21J MCU=SAMC21J18A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=Generic_D11D14AM MCU=SAMD11D14AM SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_D11D14AS MCU=SAMD11D14AS SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Generic_D11C14A MCU=SAMD11C14A SDCARD=SDCARD_ENABLED make all mostly_clean + +BOARD_ID=arduino_m0 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=arduino_m0_pro MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean mv -v *.bin ./binaries/ diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_128KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_128KB.ld index 62808782b..1ac6fa45c 100644 --- a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_128KB.ld +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_128KB.ld @@ -211,11 +211,15 @@ SECTIONS /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); PROVIDE(__stack = __StackTop); __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") } diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_16KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_16KB.ld index 79bf34fc4..919a3cba3 100644 --- a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_16KB.ld +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_16KB.ld @@ -211,11 +211,15 @@ SECTIONS /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); PROVIDE(__stack = __StackTop); __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 4KB (vectors + text + data). Please recompile with different options.") } diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_256KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_256KB.ld index 2a8b056d3..ddba7b6ef 100644 --- a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_256KB.ld +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_256KB.ld @@ -211,11 +211,15 @@ SECTIONS /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); PROVIDE(__stack = __StackTop); __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") } diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_32KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_32KB.ld index 5d89ebcde..ffd55e78e 100644 --- a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_32KB.ld +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_32KB.ld @@ -211,11 +211,15 @@ SECTIONS /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); PROVIDE(__stack = __StackTop); __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") } diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_64KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_64KB.ld index 1a4707232..a9fa8f7ad 100644 --- a/bootloaders/zero/linker_scripts/bootloader_sam_m0p_64KB.ld +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m0p_64KB.ld @@ -211,11 +211,15 @@ SECTIONS /* Set stack top to end of RAM, and stack limit move down by * size of stack_dummy section */ __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); PROVIDE(__stack = __StackTop); __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; /* Check if data + heap + stack exceeds RAM limit */ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") } diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 4789c0005..47acb7bd8 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -18,17 +18,21 @@ */ #include +#include #include #include "sam_ba_monitor.h" #include "sam_ba_serial.h" #include "board_definitions.h" #include "board_driver_led.h" +#include "SDCard/sdBootloader.h" +#include "util.h" #if (SAMD21 || SAMD11 || SAML21) #include "sam_ba_usb.h" #include "sam_ba_cdc.h" #endif extern uint32_t __sketch_vectors_ptr; // Exported value from linker script +extern volatile int8_t ledDirection; extern void board_init(void); #if (defined DEBUG) && (DEBUG == 1) @@ -60,6 +64,7 @@ uint32_t* pulSketch_Start_Address; /* * Load the sketch Reset Handler address * __sketch_vectors_ptr is exported from linker script and point on first 32b word of sketch vector table + * Remember, variables exported from a linker script are different than normal variables (only address, no value) * First 32b word is sketch stack * Second 32b word is sketch entry point: Reset_Handler() */ @@ -76,29 +81,14 @@ uint32_t* pulSketch_Start_Address; return; } -#if defined(BOOT_LOAD_PIN) - volatile PortGroup *boot_port = (volatile PortGroup *)(&(PORT->Group[BOOT_LOAD_PIN / 32])); - volatile bool boot_en; +#if defined(BOOT_LOAD_PIN_ENABLED) + configPin(BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN, BOOT_LOAD_PIN_CONFIG); - // Enable the input mode in Boot GPIO Pin - boot_port->DIRCLR.reg = BOOT_PIN_MASK; - boot_port->PINCFG[BOOT_LOAD_PIN & 0x1F].reg = PORT_PINCFG_INEN | PORT_PINCFG_PULLEN; - boot_port->OUTSET.reg = BOOT_PIN_MASK; - - /* Allow time for debouncing capacitor to charge (10ms) */ - /* Needed when BOOT_DOUBLE_TAP is not used */ - -#if (SAMD21 || SAMD11) - #define numLoopsDebounce 2500UL -#elif (SAML21 || SAMC21) - #define numLoopsDebounce 10000UL -#endif - for (uint32_t i=0; iIN.reg) & BOOT_PIN_MASK; + volatile bool boot_en = isPinActive(BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN, BOOT_LOAD_PIN_POLARITY); // Check the bootloader enable condition if (!boot_en) @@ -135,18 +125,8 @@ uint32_t* pulSketch_Start_Address; /* First tap */ BOOT_DOUBLE_TAP_DATA = DOUBLE_TAP_MAGIC; - /* Wait 0.5sec to see if the user tap reset again. - * The loop value is based on SAMD21 default 1MHz clock @ reset. - * SAML21 and SAMC21 have a default 4MHz clock @ reset. - */ -#if (SAMD21 || SAMD11) - #define numLoops 125000UL -#elif (SAML21 || SAMC21) - #define numLoops 500000UL -#endif - for (uint32_t i=0; iIsConfigured(pCdc) != 0) { @@ -235,6 +335,10 @@ int main(void) } #endif +#if defined(SAM_BA_INTERFACE_USE_PIN) + } else if (sambaInterface == SAM_BA_UART_ONLY) { +#endif + #if SAM_BA_INTERFACE == SAM_BA_UART_ONLY || SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES /* Check if a '#' has been received */ if (!main_b_cdc_enable && serial_sharp_received()) @@ -247,12 +351,16 @@ int main(void) } } #endif + +#if defined(SAM_BA_INTERFACE_USE_PIN) + } +#endif } } void SysTick_Handler(void) { -#if defined BOARD_LED_FADE_ENABLED +#if (defined(BOARD_LED_FADE_ENABLED) && defined(BOARD_LED_PORT)) LED_pulse(); #endif diff --git a/bootloaders/zero/sam_ba_monitor.c b/bootloaders/zero/sam_ba_monitor.c index 93a6bc4d9..0d660f56d 100644 --- a/bootloaders/zero/sam_ba_monitor.c +++ b/bootloaders/zero/sam_ba_monitor.c @@ -28,6 +28,7 @@ #include "sam_ba_cdc.h" #endif #include "board_driver_led.h" +#include "util.h" const char RomBOOT_Version[] = SAM_BA_VERSION; #if (defined ARDUINO_EXTENDED_CAPABILITIES) && (ARDUINO_EXTENDED_CAPABILITIES == 1) @@ -86,13 +87,19 @@ const t_monitor_if usbcdc_if = t_monitor_if * ptr_monitor_if; /* b_terminal_mode mode (ascii) or hex mode */ +#if defined(TERMINAL_MODE_ENABLED) volatile bool b_terminal_mode = false; +#endif volatile bool b_sam_ba_interface_usart = false; /* Pulse generation counters to keep track of the time remaining for each pulse type */ #define TX_RX_LED_PULSE_PERIOD 100 +#if defined(BOARD_LEDTX_PORT) volatile uint16_t txLEDPulse = 0; // time remaining for Tx LED pulse +#endif +#if defined(BOARD_LEDRX_PORT) volatile uint16_t rxLEDPulse = 0; // time remaining for Rx LED pulse +#endif void sam_ba_monitor_init(uint8_t com_interface) { @@ -121,8 +128,10 @@ static uint32_t sam_ba_putdata(t_monitor_if* pInterface, void const* data, uint3 result=pInterface->putdata(data, length); +#if defined(BOARD_LEDTX_PORT) LEDTX_on(); txLEDPulse = TX_RX_LED_PULSE_PERIOD; +#endif return result; } @@ -136,11 +145,13 @@ static uint32_t sam_ba_getdata(t_monitor_if* pInterface, void* data, uint32_t le result=pInterface->getdata(data, length); +#if defined(BOARD_LEDRX_PORT) if (result) { LEDRX_on(); rxLEDPulse = TX_RX_LED_PULSE_PERIOD; } +#endif return result; } @@ -154,8 +165,10 @@ static uint32_t sam_ba_putdata_xmd(t_monitor_if* pInterface, void const* data, u result=pInterface->putdata_xmd(data, length); +#if defined(BOARD_LEDTX_PORT) LEDTX_on(); txLEDPulse = TX_RX_LED_PULSE_PERIOD; +#endif return result; } @@ -169,11 +182,13 @@ static uint32_t sam_ba_getdata_xmd(t_monitor_if* pInterface, void* data, uint32_ result=pInterface->getdata_xmd(data, length); +#if defined(BOARD_LEDRX_PORT) if (result) { LEDRX_on(); rxLEDPulse = TX_RX_LED_PULSE_PERIOD; } +#endif return result; } @@ -186,6 +201,7 @@ static uint32_t sam_ba_getdata_xmd(t_monitor_if* pInterface, void* data, uint32_ */ void sam_ba_putdata_term(uint8_t* data, uint32_t length) { + #if defined(TERMINAL_MODE_ENABLED) uint8_t temp, buf[12], *data_ascii; uint32_t i, int_value; @@ -220,6 +236,7 @@ void sam_ba_putdata_term(uint8_t* data, uint32_t length) sam_ba_putdata(ptr_monitor_if, buf, length * 2 + 4); } else +#endif sam_ba_putdata(ptr_monitor_if, data, length); return; } @@ -249,9 +266,8 @@ uint8_t command, *ptr_data, *ptr, data[SIZEBUFMAX]; uint8_t j; uint32_t u32tmp; -uint32_t PAGE_SIZE, PAGES, MAX_FLASH; - // Prints a 32-bit integer in hex. +#if ((SAM_BA_INTERFACE != SAM_BA_NONE) && ((defined(ARDUINO_EXTENDED_CAPABILITIES)) && (ARDUINO_EXTENDED_CAPABILITIES == 1))) static void put_uint32(uint32_t n) { char buff[8]; @@ -265,6 +281,7 @@ static void put_uint32(uint32_t n) } sam_ba_putdata( ptr_monitor_if, buff, 8); } +#endif static void sam_ba_monitor_loop(void) { @@ -277,10 +294,12 @@ static void sam_ba_monitor_loop(void) if (*ptr == '#') { + #if defined(TERMINAL_MODE_ENABLED) if (b_terminal_mode) { sam_ba_putdata(ptr_monitor_if, "\n\r", 2); } + #endif if (command == 'S') { //Check if some data are remaining in the "data" buffer @@ -351,10 +370,12 @@ static void sam_ba_monitor_loop(void) /* Rebase the Stack Pointer */ __set_MSP(sp); __enable_irq(); + if (b_sam_ba_interface_usart) { ptr_monitor_if->put_c(0x6); } } + #if defined(TERMINAL_MODE_ENABLED) else if (command == 'T') { b_terminal_mode = 1; @@ -368,6 +389,7 @@ static void sam_ba_monitor_loop(void) } b_terminal_mode = 0; } + #endif else if (command == 'V') { sam_ba_putdata( ptr_monitor_if, "v", 1); @@ -399,18 +421,7 @@ static void sam_ba_monitor_loop(void) // Note: the flash memory is erased in ROWS, that is in block of 4 pages. // Even if the starting address is the last byte of a ROW the entire // ROW is erased anyway. - - uint32_t dst_addr = current_number; // starting address - - while (dst_addr < MAX_FLASH) - { - // Execute "ER" Erase Row - NVMCTRL->ADDR.reg = dst_addr / 2; - NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_ER; - while (NVMCTRL->INTFLAG.bit.READY == 0) - ; - dst_addr += PAGE_SIZE * 4; // Skip a ROW - } + flashErase(current_number); // Notify command completed sam_ba_putdata( ptr_monitor_if, "X\n\r", 3); @@ -435,40 +446,7 @@ static void sam_ba_monitor_loop(void) } else { - // Write to flash - uint32_t size = current_number/4; - uint32_t *src_addr = src_buff_addr; - uint32_t *dst_addr = (uint32_t*)ptr_data; - - // Set automatic page write - NVMCTRL->CTRLB.bit.MANW = 0; - - // Do writes in pages - while (size) - { - // Execute "PBC" Page Buffer Clear - NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_PBC; - while (NVMCTRL->INTFLAG.bit.READY == 0) - ; - - // Fill page buffer - uint32_t i; - for (i=0; i<(PAGE_SIZE/4) && iADDR.reg = ((uint32_t)dst_addr) / 2; - NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_WP; - while (NVMCTRL->INTFLAG.bit.READY == 0) - ; - - // Advance to next page - dst_addr += i; - src_addr += i; - size -= i; - } + flashWrite(current_number, src_buff_addr, (uint32_t*)ptr_data); } // Notify command completed @@ -500,10 +478,12 @@ static void sam_ba_monitor_loop(void) command = 'z'; current_number = 0; + #if defined(TERMINAL_MODE_ENABLED) if (b_terminal_mode) { sam_ba_putdata( ptr_monitor_if, ">", 1); } + #endif } else { @@ -535,24 +515,22 @@ static void sam_ba_monitor_loop(void) void sam_ba_monitor_sys_tick(void) { - /* Check whether the TX or RX LED one-shot period has elapsed. if so, turn off the LED */ + /* Check whether the TX or RX LED one-shot period has elapsed. if so, turn off the LED */ + #if defined(BOARD_LEDTX_PORT) if (txLEDPulse && !(--txLEDPulse)) LEDTX_off(); + #endif + #if defined(BOARD_LEDRX_PORT) if (rxLEDPulse && !(--rxLEDPulse)) LEDRX_off(); + #endif } /** * \brief This function starts the SAM-BA monitor. */ -#if (defined ARDUINO_EXTENDED_CAPABILITIES) && (ARDUINO_EXTENDED_CAPABILITIES == 1) void sam_ba_monitor_run(void) { - uint32_t pageSizes[] = { 8, 16, 32, 64, 128, 256, 512, 1024 }; - PAGE_SIZE = pageSizes[NVMCTRL->PARAM.bit.PSZ]; - PAGES = NVMCTRL->PARAM.bit.NVMP; - MAX_FLASH = PAGE_SIZE * PAGES; - ptr_data = NULL; command = 'z'; while (1) @@ -560,14 +538,3 @@ void sam_ba_monitor_run(void) sam_ba_monitor_loop(); } } -#else -void sam_ba_monitor_run(void) -{ - ptr_data = NULL; - command = 'z'; - while (1) - { - sam_ba_monitor_loop(); - } -} -#endif diff --git a/bootloaders/zero/sam_ba_monitor.h b/bootloaders/zero/sam_ba_monitor.h index 4b0f0c537..e8a9e2bd1 100644 --- a/bootloaders/zero/sam_ba_monitor.h +++ b/bootloaders/zero/sam_ba_monitor.h @@ -26,6 +26,7 @@ #define SAM_BA_BOTH_INTERFACES 0 #define SAM_BA_UART_ONLY 1 #define SAM_BA_USBCDC_ONLY 2 +#define SAM_BA_NONE 3 /* Selects USB as the communication interface of the monitor */ #define SAM_BA_INTERFACE_USBCDC 0 diff --git a/bootloaders/zero/sam_ba_serial.c b/bootloaders/zero/sam_ba_serial.c index 256d57d25..5e1be8c99 100644 --- a/bootloaders/zero/sam_ba_serial.c +++ b/bootloaders/zero/sam_ba_serial.c @@ -51,49 +51,11 @@ uint8_t mode_of_transfer; */ void serial_open(void) { - uint32_t port; - uint32_t pin; - - /* Configure the port pins for SERCOM_USART */ - if (BOOT_USART_PAD0 != PINMUX_UNUSED) - { - /* Mask 6th bit in pin number to check whether it is greater than 32 i.e., PORTB pin */ - port = (BOOT_USART_PAD0 & 0x200000) >> 21; - pin = (BOOT_USART_PAD0 >> 16); - PORT->Group[port].PINCFG[(pin - (port*32))].bit.PMUXEN = 1; - PORT->Group[port].PMUX[(pin - (port*32))/2].reg &= ~(0xF << (4 * (pin & 0x01u))); - PORT->Group[port].PMUX[(pin - (port*32))/2].reg |= (BOOT_USART_PAD0 & 0xFF) << (4 * (pin & 0x01u)); - } - - if (BOOT_USART_PAD1 != PINMUX_UNUSED) - { - /* Mask 6th bit in pin number to check whether it is greater than 32 i.e., PORTB pin */ - port = (BOOT_USART_PAD1 & 0x200000) >> 21; - pin = BOOT_USART_PAD1 >> 16; - PORT->Group[port].PINCFG[(pin - (port*32))].bit.PMUXEN = 1; - PORT->Group[port].PMUX[(pin - (port*32))/2].reg &= ~(0xF << (4 * (pin & 0x01u))); - PORT->Group[port].PMUX[(pin - (port*32))/2].reg |= (BOOT_USART_PAD1 & 0xFF) << (4 * (pin & 0x01u)); - } - - if (BOOT_USART_PAD2 != PINMUX_UNUSED) - { - /* Mask 6th bit in pin number to check whether it is greater than 32 i.e., PORTB pin */ - port = (BOOT_USART_PAD2 & 0x200000) >> 21; - pin = BOOT_USART_PAD2 >> 16; - PORT->Group[port].PINCFG[(pin - (port*32))].bit.PMUXEN = 1; - PORT->Group[port].PMUX[(pin - (port*32))/2].reg &= ~(0xF << (4 * (pin & 0x01u))); - PORT->Group[port].PMUX[(pin - (port*32))/2].reg |= (BOOT_USART_PAD2 & 0xFF) << (4 * (pin & 0x01u)); - } - - if (BOOT_USART_PAD3 != PINMUX_UNUSED) - { - /* Mask 6th bit in pin number to check whether it is greater than 32 i.e., PORTB pin */ - port = (BOOT_USART_PAD3 & 0x200000) >> 21; - pin = BOOT_USART_PAD3 >> 16; - PORT->Group[port].PINCFG[(pin - (port*32))].bit.PMUXEN = 1; - PORT->Group[port].PMUX[(pin - (port*32))/2].reg &= ~(0xF << (4 * (pin & 0x01u))); - PORT->Group[port].PMUX[(pin - (port*32))/2].reg |= (BOOT_USART_PAD3 & 0xFF) << (4 * (pin & 0x01u)); - } + /* Configure the port pins for SERCOM_USART */ + pinMux(BOOT_USART_PAD0); + pinMux(BOOT_USART_PAD1); + pinMux(BOOT_USART_PAD2); + pinMux(BOOT_USART_PAD3); /* Enable clock for BOOT_USART_MODULE */ #if (SAMD21 || SAMD11) @@ -114,10 +76,10 @@ void serial_open(void) /* Set GCLK_GEN0 as source for GCLK_ID_SERCOMx_CORE */ #if (SAMD21 || SAMD11) GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( BOOT_USART_PER_CLOCK_INDEX ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); - while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); + waitForSync(); #elif (SAML21 || SAMC21) GCLK->PCHCTRL[BOOT_USART_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); - while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); + waitForSync(); #endif /* Baud rate 115200 - clock 48MHz -> BAUD value-63018 */ diff --git a/bootloaders/zero/sam_ba_serial.h b/bootloaders/zero/sam_ba_serial.h index cb69f459e..f28163b2d 100644 --- a/bootloaders/zero/sam_ba_serial.h +++ b/bootloaders/zero/sam_ba_serial.h @@ -22,6 +22,7 @@ #include #include +#include "util.h" /* USART buffer size (must be a power of two) */ diff --git a/bootloaders/zero/samd21_sam_ba.atsln b/bootloaders/zero/samd21_sam_ba.atsln deleted file mode 100644 index cf1043181..000000000 --- a/bootloaders/zero/samd21_sam_ba.atsln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Atmel Studio Solution File, Format Version 11.00 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "samd21_sam_ba", "samd21_sam_ba.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Release|ARM = Release|ARM - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.ActiveCfg = Debug|ARM - {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.Build.0 = Debug|ARM - {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.ActiveCfg = Release|ARM - {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.Build.0 = Release|ARM - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bootloaders/zero/samd21_sam_ba.cproj b/bootloaders/zero/samd21_sam_ba.cproj deleted file mode 100644 index 70ee7e93a..000000000 --- a/bootloaders/zero/samd21_sam_ba.cproj +++ /dev/null @@ -1,218 +0,0 @@ - - - - 2.0 - 7.0 - com.Atmel.ARMGCC.C - dce6c7e3-ee26-4d79-826b-08594b9ad897 - ATSAMD21G18A - none - Executable - C - $(MSBuildProjectName) - .elf - $(MSBuildProjectDirectory)\$(Configuration) - samd21_sam_ba - samd21_sam_ba - samd21_sam_ba - Native - true - false - true - true - 0x20000000 - - true - exception_table - 2 - 0 - - - - - - - - - - - - - - com.atmel.avrdbg.tool.atmelice - J41800001895 - 0x10010000 - SWD - - - - 2000000 - - SWD - - com.atmel.avrdbg.tool.atmelice - J41800001895 - Atmel-ICE - - 2000000 - - - - - SWD - - com.atmel.avrdbg.tool.edbg - ATML2320040200000259 - EDBG - - - - - - True - True - True - True - True - - - NDEBUG - - - Optimize for size (-Os) - True - True - - - libm - - - True - -Tsamd21j18a_flash.ld - - - - - - - True - True - True - True - True - - - DEBUG - - - Optimize (-O1) - True - Maximum (-g3) - True - - - libm - - - True - -Tsamd21j18a_flash.ld - Default (-g) - Default (-Wa,-g) - - - True - - DEBUG=1 all - clean - Makefile - - - - compile - board_definitions.h - - - compile - board_driver_led.c - - - compile - board_driver_led.h - - - compile - board_driver_serial.c - - - compile - board_driver_serial.h - - - compile - board_driver_usb.c - - - compile - board_driver_usb.h - - - compile - board_init.c - - - compile - board_startup.c - - - compile - main.c - - - compile - sam_ba_cdc.c - - - compile - sam_ba_cdc.h - - - compile - sam_ba_monitor.c - - - compile - sam_ba_monitor.h - - - compile - sam_ba_serial.c - - - compile - sam_ba_serial.h - - - compile - sam_ba_usb.c - - - compile - sam_ba_usb.h - - - - - compile - Makefile - - - compile - README.md - - - compile - bootloader_samd21x18.ld - - - - \ No newline at end of file diff --git a/bootloaders/zero/util.c b/bootloaders/zero/util.c new file mode 100644 index 000000000..46b382902 --- /dev/null +++ b/bootloaders/zero/util.c @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2015 Arduino LLC. All right reserved. + * Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. + * Copyright (c) 2017 MattairTech 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 + */ + +#include "util.h" + +extern uint32_t __sketch_vectors_ptr; // Exported value from linker script + +/* + * The SAMD21 has a default 1MHz clock @ reset. + * SAML21 and SAMC21 have a default 4MHz clock @ reset. + * It is switched to 48MHz in board_init.c + */ +#if (SAMD21 || SAMD11) + #define CLOCK_DEFAULT 1000000ul +#elif (SAML21 || SAMC21) + #define CLOCK_DEFAULT 4000000ul +#endif +uint32_t SystemCoreClock=CLOCK_DEFAULT; + +void flashErase (uint32_t startAddress) +{ + // Syntax: X[ADDR]# + // Erase the flash memory starting from ADDR to the end of flash. + + // Note: the flash memory is erased in ROWS, that is in block of 4 pages. + // Even if the starting address is the last byte of a ROW the entire + // ROW is erased anyway. + + uint32_t dst_addr = startAddress; // starting address + + while (dst_addr < FLASH_SIZE) + { + // Execute "ER" Erase Row + NVMCTRL->ADDR.reg = dst_addr / 2; + NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_ER; + while (NVMCTRL->INTFLAG.bit.READY == 0) + ; + dst_addr += FLASH_PAGE_SIZE * 4; // Skip a ROW + } +} + +void flashWrite (uint32_t numBytes, uint32_t * buffer, uint32_t * ptr_data) +{ + // This command writes the content of a buffer in SRAM into flash memory. + + // Syntax: Y[ADDR],0# + // Set the starting address of the SRAM buffer. + + // Syntax: Y[ROM_ADDR],[SIZE]# + // Write the first SIZE bytes from the SRAM buffer (previously set) into + // flash memory starting from address ROM_ADDR + + // Write to flash + uint32_t size = numBytes/4; + uint32_t *src_addr = buffer; + uint32_t *dst_addr = ptr_data; + + // Do writes in pages + while (size) + { + // Execute "PBC" Page Buffer Clear + NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_PBC; + while (NVMCTRL->INTFLAG.bit.READY == 0) + ; + + // Fill page buffer + uint32_t i; + for (i=0; i<(FLASH_PAGE_SIZE/4) && iADDR.reg = ((uint32_t)dst_addr) / 2; + NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_WP; + while (NVMCTRL->INTFLAG.bit.READY == 0) + ; + + // Advance to next page + dst_addr += i; + src_addr += i; + size -= i; + } +} + +void pinMux (uint32_t pinmux) +{ + uint32_t port; + uint32_t pin; + + if (pinmux != PINMUX_UNUSED) + { + /* Mask 6th bit in pin number to check whether it is greater than 32 i.e., PORTB pin */ + port = (pinmux & 0x200000) >> 21; + pin = (pinmux >> 16); + PORT->Group[port].PINCFG[(pin - (port*32))].bit.PMUXEN = 1; + PORT->Group[port].PMUX[(pin - (port*32))/2].reg &= ~(0xF << (4 * (pin & 0x01u))); + PORT->Group[port].PMUX[(pin - (port*32))/2].reg |= (pinmux & 0xFF) << (4 * (pin & 0x01u)); + } +} + +void pinConfig (uint8_t port, uint8_t pin, uint8_t config) +{ + uint8_t pinCfg = PORT_PINCFG_INEN; + + if (config == INPUT_PULLUP || config == INPUT_PULLDOWN || config == INPUT) { + PORT->Group[port].DIRCLR.reg = (1 << pin); + if (config == INPUT_PULLUP) { + pinCfg |= PORT_PINCFG_PULLEN; + PORT->Group[port].OUTSET.reg = (1 << pin); + } else if (config == INPUT_PULLDOWN) { + pinCfg |= PORT_PINCFG_PULLEN; + PORT->Group[port].OUTCLR.reg = (1 << pin); + } + } else { + if (config == OUTPUT_HIGH) { + PORT->Group[port].OUTSET.reg = (1 << pin); + } else if (config == OUTPUT_LOW) { + PORT->Group[port].OUTCLR.reg = (1 << pin); + } + PORT->Group[port].DIRSET.reg = (1 << pin); + } + + PORT->Group[port].PINCFG[pin].reg = (uint8_t)pinCfg; +} + +bool isPinActive (uint8_t port, uint8_t pin, uint8_t config) +{ + uint32_t pinState = ((PORT->Group[port].IN.reg) & (1 << pin)); + if (config == PIN_POLARITY_ACTIVE_LOW) { + if (!pinState) return(true); + } else { + if (pinState) return(true); + } + return(false); +} + +void delayUs (uint32_t delay) +{ + /* The SAMD21 has a default 1MHz clock @ reset. + * SAML21 and SAMC21 have a default 4MHz clock @ reset. + * It is switched to 48MHz in board_init.c + */ + uint32_t numLoops; + + if (SystemCoreClock == VARIANT_MCK) { + numLoops = (12 * delay); + } else { +#if (SAMD21 || SAMD11) + numLoops = (delay >> 2); +#elif (SAML21 || SAMC21) + numLoops = delay; +#endif + } + + for (uint32_t i=0; i < numLoops; i++) /* 10ms */ + /* force compiler to not optimize this... */ + __asm__ __volatile__(""); +} + +void systemReset (void) +{ + /* Request a system reset */ + SCB->AIRCR = (uint32_t)((1 << SCB_AIRCR_SYSRESETREQ_Pos) | (SCB_AIRCR_VECTKEY_Val << SCB_AIRCR_VECTKEY_Pos)); + + while(1); +} + +void waitForSync (void) +{ + #if (SAMD) + while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); + #elif (SAML21 || SAMC21) + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); + #endif +} diff --git a/bootloaders/zero/util.h b/bootloaders/zero/util.h new file mode 100644 index 000000000..a1040dc12 --- /dev/null +++ b/bootloaders/zero/util.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2015 Arduino LLC. All right reserved. + * Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. + * Copyright (c) 2017 MattairTech LLC. All right reserved. + * Copyright (C) 2014, ChaN, 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 _UTIL_H_ +#define _UTIL_H_ + +#include "sam.h" +#include +#include "board_definitions.h" + +// TODO: Variable bootloader sizes +#if (SAMD11) + #define APP_START 0x00001000 +#else + #define APP_START 0x00002000 +#endif + +#define SCB_AIRCR_VECTKEY_Val 0x05FA + +void flashErase (uint32_t startAddress); +void flashWrite (uint32_t startAddress, uint32_t * buffer, uint32_t * ptr_data); +void pinMux (uint32_t pinmux); +void systemReset (void); +void pinConfig (uint8_t port, uint8_t pin, uint8_t config); +bool isPinActive (uint8_t port, uint8_t pin, uint8_t config); +void delayUs (uint32_t delay); +void waitForSync (void); + +#endif From a3c489d821c65f1a278de1aece602a4f2ec1e291 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Wed, 21 Jun 2017 09:32:05 +0000 Subject: [PATCH 095/124] Update bootloader README.md formatting. --- bootloaders/zero/README.md | 76 +++++++++++--------------------------- 1 file changed, 22 insertions(+), 54 deletions(-) diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index ebd303fcb..c08b938af 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -55,7 +55,7 @@ is running, the LED, if configured, will PWM fade quickly (~4Hz). file on the SD card with the already installed firmware. If they already match, then the bootloader will jump to the firmware, unless SDCARD_AUTORUN_DISABLED is defined, in which case the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. - If the update file differs from the installed firmware, it continues to step 5. + If the update file differs from the installed firmware, continue to step 5. 5. The application section of the FLASH is erased. The selected update file is written to the FLASH. If the file exceeds the size of the FLASH, the LED will blink with status code LED_STATUS_FILE_TOO_LARGE. @@ -391,14 +391,14 @@ BOOT_LOAD_PIN | 84 SDCARD_USE_PIN1 & SDCARD_USE_PIN2 | 92 SDCARD_USE_PIN1 | 60 ARDUINO_EXTENDED_CAPABILITIES (X/Y/Z) | 904* - *X (Chip Erase) & Y (Write FLASH)* | 120* - *Z (CRC Verification)* | 248* - *crc16Table* | 512* +*X (Chip Erase) & Y (Write FLASH)* | 120* +*Z (CRC Verification)* | 248* +*crc16Table* | 512* - *SAM_BA_CDC and SAM_BA_UART automatically pull in SAM-BA Monitor* - *ARDUINO_EXTENDED_CAPABILITIES and SDCARD_ENABLED include X and Y functions* - *ARDUINO_EXTENDED_CAPABILITIES and SAM_BA_UART include crc16Table* - *ARDUINO_EXTENDED_CAPABILITIES includes Z function* +* SAM_BA_CDC and SAM_BA_UART automatically pull in SAM-BA Monitor +* ARDUINO_EXTENDED_CAPABILITIES and SDCARD_ENABLED include X and Y functions +* ARDUINO_EXTENDED_CAPABILITIES and SAM_BA_UART include crc16Table +* ARDUINO_EXTENDED_CAPABILITIES includes Z function #### Example Compiled Binary Size @@ -427,12 +427,8 @@ See "SD Card Bootloader" section. This define can also be set from the makefile (so it can be used with the build_all_bootloaders.sh script). Size: ~2788B. Disabled by default. Available with 4KB bootloader. -#### SDCARD_SPI_SERCOM_INSTANCE -#### SDCARD_SPI_PAD_SETTINGS -#### SDCARD_SPI_PAD0 -#### SDCARD_SPI_PAD1 -#### SDCARD_SPI_PAD2 -#### SDCARD_SPI_PAD3 +### SDCARD_SPI_SERCOM_INSTANCE +#### SDCARD_SPI_PAD_SETTINGS, SDCARD_SPI_PAD0, SDCARD_SPI_PAD1, SDCARD_SPI_PAD2, SDCARD_SPI_PAD3 If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -442,23 +438,16 @@ Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and associated pins are only initialized if either pin is active. -### SDCARD_SPI_CS_PORT -### SDCARD_SPI_CS_PIN +### SDCARD_SPI_CS_PORT, SDCARD_SPI_CS_PIN If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN must also be defined. PORT can be 0 (Port A) or 1 (Port B). ### SDCARD_USE_PIN1 -#### SDCARD_PIN1_POLARITY -#### SDCARD_PIN1_PORT -#### SDCARD_PIN1_PIN -#### SDCARD_PIN1_CONFIG +#### SDCARD_PIN1_POLARITY, SDCARD_PIN1_PORT, SDCARD_PIN1_PIN, SDCARD_PIN1_CONFIG ### SDCARD_USE_PIN2 -#### SDCARD_PIN2_POLARITY -#### SDCARD_PIN2_PORT -#### SDCARD_PIN2_PIN -#### SDCARD_PIN2_CONFIG +#### SDCARD_PIN2_POLARITY, SDCARD_PIN2_PORT, SDCARD_PIN2_PIN, SDCARD_PIN2_CONFIG If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must @@ -492,10 +481,7 @@ lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). ### SAM_BA_INTERFACE_USE_PIN -#### SAM_BA_INTERFACE_PIN_POLARITY -#### SAM_BA_INTERFACE_PIN_PORT -#### SAM_BA_INTERFACE_PIN_PIN -#### SAM_BA_INTERFACE_PIN_CONFIG +#### SAM_BA_INTERFACE_PIN_POLARITY, SAM_BA_INTERFACE_PIN_PORT, SAM_BA_INTERFACE_PIN_PIN, SAM_BA_INTERFACE_PIN_CONFIG If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one @@ -568,26 +554,19 @@ The fine calibration value for DFLL open-loop mode is defined here. The coarse calibration value is loaded from NVM OTP (factory calibration values). ### USB_VENDOR_STRINGS_ENABLED -#### STRING_MANUFACTURER -#### STRING_PRODUCT +#### STRING_MANUFACTURER, STRING_PRODUCT If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and STRING_PRODUCT will be sent to the host. Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). -#### USB_VID_HIGH -#### USB_VID_LOW -#### USB_PID_HIGH -#### USB_PID_LOW +### USB_VID_HIGH +#### USB_VID_LOW, USB_PID_HIGH, USB_PID_LOW If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. ### BOOT_USART_SERCOM_INSTANCE -#### BOOT_USART_PAD_SETTINGS -#### BOOT_USART_PAD3 -#### BOOT_USART_PAD2 -#### BOOT_USART_PAD1 -#### BOOT_USART_PAD0 +#### BOOT_USART_PAD_SETTINGS, BOOT_USART_PAD3, BOOT_USART_PAD2, BOOT_USART_PAD1, BOOT_USART_PAD0 BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting @@ -603,10 +582,7 @@ tapping two times on the reset button (within 1/2 second). Size: ~96B. Enabled by default. ### BOOT_LOAD_PIN_ENABLED -#### BOOT_LOAD_PIN -#### BOOT_LOAD_PIN_PORT -#### BOOT_LOAD_PIN_POLARITY -#### BOOT_LOAD_PIN_CONFIG +#### BOOT_LOAD_PIN, BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN_POLARITY, BOOT_LOAD_PIN_CONFIG If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected pin is active after reset. There is a 10ms delay before testing the pin to @@ -622,17 +598,9 @@ If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in a is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). Size: ~160B. Enabled by default. -### BOARD_LED_PORT -#### BOARD_LED_PIN -#### BOARD_LED_POLARITY - -### BOARD_LEDRX_PORT -#### BOARD_LEDRX_PIN -#### BOARD_LEDRX_POLARITY - -### BOARD_LEDTX_PORT -#### BOARD_LEDTX_PIN -#### BOARD_LEDTX_POLARITY +### BOARD_LED_PORT, BOARD_LED_PIN, BOARD_LED_POLARITY +#### BOARD_LEDRX_PORT, BOARD_LEDRX_PIN, BOARD_LEDRX_POLARITY +#### BOARD_LEDTX_PORT, BOARD_LEDTX_PIN, BOARD_LEDTX_POLARITY If the LED PORT is defined, then the LED on the associated pin is enabled. Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. From 9a3bdbbac9c28283c8828d7b2d7043a66122137f Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 23 Jun 2017 03:27:13 +0000 Subject: [PATCH 096/124] Removed SDU library, as the bootloader now supports SD cards directly --- CHANGELOG | 4 +- bootloaders/zero/README.md | 25 +- libraries/SDU/extras/SDUBoot/SDUBoot.ino | 92 -- libraries/SDU/extras/SDUBoot/build.sh | 26 - libraries/SDU/keywords.txt | 17 - libraries/SDU/library.properties | 9 - libraries/SDU/src/SDU.cpp | 34 - libraries/SDU/src/SDU.h | 24 - libraries/SDU/src/boot/mkr1000.h | 1192 ---------------------- libraries/SDU/src/boot/mkrzero.h | 1192 ---------------------- libraries/SDU/src/boot/zero.h | 1141 --------------------- 11 files changed, 14 insertions(+), 3742 deletions(-) delete mode 100644 libraries/SDU/extras/SDUBoot/SDUBoot.ino delete mode 100755 libraries/SDU/extras/SDUBoot/build.sh delete mode 100644 libraries/SDU/keywords.txt delete mode 100644 libraries/SDU/library.properties delete mode 100644 libraries/SDU/src/SDU.cpp delete mode 100644 libraries/SDU/src/SDU.h delete mode 100644 libraries/SDU/src/boot/mkr1000.h delete mode 100644 libraries/SDU/src/boot/mkrzero.h delete mode 100644 libraries/SDU/src/boot/zero.h diff --git a/CHANGELOG b/CHANGELOG index 56ff3407f..6ddec2c37 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,7 @@ 1.6.8-beta-b2 (in-progress): * Added more Serial, SPI, and WIRE options -* Added MicroSD card firmware loading in the bootloader -* Fixed SDU library to work with MattairTech boards +* Added SD Card firmware loading support to the bootloader (4KB and 8KB) +* Removed SDU library, as the bootloader now supports SD cards directly * Fixed auto-detection for Arduino Zero and M0 board variants * Fixed bootloader compilation on Windows * Documentation updates diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index c08b938af..ef25211d1 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -69,16 +69,20 @@ is running, the LED, if configured, will PWM fade quickly (~4Hz). ### SD Card External Pins -If SDCARD_USE_PIN1 is defined, then the SD Card bootloader will run depending +If only SDCARD_USE_PIN1 is defined, then the SD Card bootloader will run depending on the state of an external pin and the value of SDCARD_PIN1_POLARITY. The SPI peripheral and SPI pins will only be setup if the SD card bootloader runs. +This is the default setting with the precompiled binaries that include SD Card support. + +*Hint: When doing development with an SD card installed, and thus probably using the* +*SAM-BA interface, either ensure there is no UPDATE.BIN, or use pin 1 to skip the SD card* Pin1 | Action ----------------|--------------------- Inactive | Skip SD bootloader Active | Run SD bootloader -If SDCARD_USE_PIN1 and SDCARD_USE_PIN2 are defined, then the SD Card bootloader +If both SDCARD_USE_PIN1 and SDCARD_USE_PIN2 are defined, then the SD Card bootloader will run depending on the state of two external pins and the values of SDCARD_PIN1_POLARITY and SDCARD_PIN1_POLARITY. The SPI peripheral and pins will only be setup if the SD card bootloader runs. Note that if SDCARD_USE_PIN2 @@ -155,6 +159,7 @@ at https://github.com/mattairtech/ArduinoCore-samd. Each board and chip combination has two bootloaders available: * SAM-BA interface only + * This is the bootloader that is installed by the Arduino IDE * USB CDC only for all MattairTech boards * Both USB CDC and UART for most Arduino boards * The Generic board variants minimize external pin usage @@ -263,9 +268,14 @@ If using Bossac standalone, download bossac directly at: * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) +Linux 64 bit users can also download Bossa (GUI) and bossash (shell) from: + +* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) + Note that the SAM-BA tools from Atmel will not work, and the version of bossac from the Arduino SAMD Core currently does not support the L21, C21, or D11 (but it does support the D21). + #### Using Bossac Standalone TODO: Update https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip with new chips (L21 and C21). @@ -281,17 +291,6 @@ Wl,sectionstart=.text=0x2000 You can also use a linker script. See the MattairTech SAM M0+ package for examples. Be sure to generate and use a binary file. Many makefiles are set up to generate an elf, hex, and bin already. -Download Bossac from: - -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) - -Linux 64 bit users can also download Bossa (GUI) and bossash (shell) from: - -* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) - As an example, bossac will be used to upload the test firmware (blink sketch): 1. Download firmware from https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip and unzip. diff --git a/libraries/SDU/extras/SDUBoot/SDUBoot.ino b/libraries/SDU/extras/SDUBoot/SDUBoot.ino deleted file mode 100644 index 016360cda..000000000 --- a/libraries/SDU/extras/SDUBoot/SDUBoot.ino +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (c) 2017 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 -*/ - -#include -#include - -#define SDU_START 0x2000 -#define SDU_SIZE 0x4000 - -#define SKETCH_START (uint32_t*)(SDU_START + SDU_SIZE) - -#ifndef SDCARD_SS_PIN -#define SDCARD_SS_PIN 4 -#endif - -#define UPDATE_FILE "UPDATE.BIN" - -FlashClass flash; - -// Initialize C library -extern "C" void __libc_init_array(void); - -int main() { - init(); - - __libc_init_array(); - - delay(1); - - if (SD.begin(SDCARD_SS_PIN) && SD.exists(UPDATE_FILE)) { - File updateFile = SD.open(UPDATE_FILE); - uint32_t updateSize = updateFile.size(); - bool updateFlashed = false; - - if (updateSize > SDU_SIZE) { - // skip the SDU section - updateFile.seek(SDU_SIZE); - updateSize -= SDU_SIZE; - - uint32_t flashAddress = (uint32_t)SKETCH_START; - - // erase the pages - flash.erase((void*)flashAddress, updateSize); - - uint8_t buffer[512]; - - // write the pages - for (uint32_t i = 0; i < updateSize; i += sizeof(buffer)) { - updateFile.read(buffer, sizeof(buffer)); - - flash.write((void*)flashAddress, buffer, sizeof(buffer)); - - flashAddress += sizeof(buffer); - } - - updateFlashed = true; - } - - updateFile.close(); - - if (updateFlashed) { - SD.remove(UPDATE_FILE); - } - } - - // jump to the sketch - __set_MSP(*SKETCH_START); - - //Reset vector table address - SCB->VTOR = ((uint32_t)(SKETCH_START) & SCB_VTOR_TBLOFF_Msk); - - // address of Reset_Handler is written by the linker at the beginning of the .text section (see linker script) - uint32_t resetHandlerAddress = (uint32_t) * (SKETCH_START + 1); - // jump to reset handler - asm("bx %0"::"r"(resetHandlerAddress)); -} - diff --git a/libraries/SDU/extras/SDUBoot/build.sh b/libraries/SDU/extras/SDUBoot/build.sh deleted file mode 100755 index d62592535..000000000 --- a/libraries/SDU/extras/SDUBoot/build.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -x - -ARDUINO=arduino -SKETCH_NAME="SDUBoot.ino" -SKETCH="$PWD/$SKETCH_NAME" -BUILD_PATH="$PWD/build" -OUTPUT_PATH="../../src/boot" - -if [[ "$OSTYPE" == "darwin"* ]]; then - ARDUINO="/Applications/Arduino.app/Contents/MacOS/Arduino" -fi - -buildSDUBootSketch() { - BOARD=$1 - DESTINATION=$2 - - $ARDUINO --verify --board $BOARD --preserve-temp-files --pref build.path="$BUILD_PATH" $SKETCH - cat "$BUILD_PATH/$SKETCH_NAME.bin" | xxd -i > $DESTINATION - rm -rf "$BUILD_PATH" -} - -mkdir -p "$OUTPUT_PATH" - -buildSDUBootSketch "arduino:samd:arduino_zero_edbg" "$OUTPUT_PATH/zero.h" -buildSDUBootSketch "arduino:samd:mkr1000" "$OUTPUT_PATH/mkr1000.h" -buildSDUBootSketch "arduino:samd:mkrzero" "$OUTPUT_PATH/mkrzero.h" diff --git a/libraries/SDU/keywords.txt b/libraries/SDU/keywords.txt deleted file mode 100644 index a9db990ee..000000000 --- a/libraries/SDU/keywords.txt +++ /dev/null @@ -1,17 +0,0 @@ -####################################### -# Syntax Coloring Map For SDU -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -SDU KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### - -####################################### -# Constants (LITERAL1) -####################################### diff --git a/libraries/SDU/library.properties b/libraries/SDU/library.properties deleted file mode 100644 index 68113aed8..000000000 --- a/libraries/SDU/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=SDU -version=1.0.0 -author=Arduino -maintainer=Arduino -sentence=Update the sketch on your board from an SD card -paragraph=Requires an SD card -category=Other -url=http://www.arduino.cc/en/Reference/SDU -architectures=samd diff --git a/libraries/SDU/src/SDU.cpp b/libraries/SDU/src/SDU.cpp deleted file mode 100644 index 984687ca3..000000000 --- a/libraries/SDU/src/SDU.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (c) 2017 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 -*/ - -#include - -#include "SDU.h" - -__attribute__ ((section(".sketch_boot"))) -unsigned char sduBoot[0x4000] = { -#if defined(ARDUINO_SAMD_ZERO) - #include "boot/zero.h" -#elif defined(ARDUINO_SAMD_MKR1000) - #include "boot/mkr1000.h" -#elif defined(ARDUINO_SAMD_MKRZERO) - #include "boot/mkrzero.h" -#else - #error "Unsupported board!" -#endif -}; diff --git a/libraries/SDU/src/SDU.h b/libraries/SDU/src/SDU.h deleted file mode 100644 index 59fcc16fd..000000000 --- a/libraries/SDU/src/SDU.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2017 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 _SDU_H_INCLUDED -#define _SDU_H_INCLUDED - -// nothing for now - -#endif diff --git a/libraries/SDU/src/boot/mkr1000.h b/libraries/SDU/src/boot/mkr1000.h deleted file mode 100644 index dc7bf119e..000000000 --- a/libraries/SDU/src/boot/mkr1000.h +++ /dev/null @@ -1,1192 +0,0 @@ - 0x00, 0x80, 0x00, 0x20, 0x8d, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0xe1, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0xe5, 0x3a, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0xb5, 0x06, 0x4c, 0x23, 0x78, 0x00, 0x2b, 0x07, 0xd1, 0x05, 0x4b, - 0x00, 0x2b, 0x02, 0xd0, 0x04, 0x48, 0x00, 0xe0, 0x00, 0xbf, 0x01, 0x23, - 0x23, 0x70, 0x10, 0xbd, 0xa0, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x3c, 0x57, 0x00, 0x00, 0x08, 0xb5, 0x08, 0x4b, 0x00, 0x2b, 0x03, 0xd0, - 0x07, 0x48, 0x08, 0x49, 0x00, 0xe0, 0x00, 0xbf, 0x07, 0x48, 0x03, 0x68, - 0x00, 0x2b, 0x03, 0xd0, 0x06, 0x4b, 0x00, 0x2b, 0x00, 0xd0, 0x98, 0x47, - 0x08, 0xbd, 0xc0, 0x46, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x57, 0x00, 0x00, - 0xa4, 0x00, 0x00, 0x20, 0x9c, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0xb5, 0x33, 0x4c, 0xa5, 0x44, 0x01, 0xf0, 0x47, 0xfe, 0x02, 0xf0, - 0x9b, 0xfc, 0x01, 0x20, 0x01, 0xf0, 0x6a, 0xfd, 0x2f, 0x4d, 0x04, 0x21, - 0x28, 0x1c, 0x00, 0xf0, 0xe3, 0xf9, 0x00, 0x28, 0x44, 0xd0, 0x2d, 0x4e, - 0x28, 0x1c, 0x31, 0x1c, 0x00, 0xf0, 0xbc, 0xfa, 0x00, 0x28, 0x3d, 0xd0, - 0x29, 0x1c, 0x01, 0xa8, 0x32, 0x1c, 0x01, 0x23, 0x00, 0xf0, 0x5e, 0xfa, - 0x01, 0xa8, 0x00, 0xf0, 0xfc, 0xf8, 0x80, 0x21, 0x04, 0x1c, 0xc9, 0x01, - 0x88, 0x42, 0x2d, 0xd9, 0x01, 0xa8, 0x00, 0xf0, 0xe2, 0xf8, 0x22, 0x4a, - 0xc0, 0x21, 0xa7, 0x18, 0x21, 0x48, 0xc9, 0x01, 0x3a, 0x1c, 0x01, 0xf0, - 0xf9, 0xfb, 0xc0, 0x24, 0xe4, 0x01, 0x80, 0x22, 0x0a, 0xa9, 0x92, 0x00, - 0x01, 0xa8, 0x00, 0xf0, 0xcb, 0xf8, 0x80, 0x23, 0x21, 0x1c, 0x0a, 0xaa, - 0x9b, 0x00, 0x19, 0x48, 0x01, 0xf0, 0x92, 0xfb, 0x80, 0x22, 0x92, 0x00, - 0xa3, 0x18, 0x17, 0x4a, 0xa4, 0x18, 0xbc, 0x42, 0x01, 0xd2, 0x1c, 0x1c, - 0xe9, 0xe7, 0x01, 0x24, 0x01, 0xa8, 0x00, 0xf0, 0xe9, 0xf8, 0x00, 0x2c, - 0x06, 0xd0, 0x28, 0x1c, 0x31, 0x1c, 0x00, 0xf0, 0x8b, 0xfa, 0x01, 0xe0, - 0x00, 0x24, 0xf3, 0xe7, 0xc0, 0x23, 0xdb, 0x01, 0x1b, 0x68, 0x83, 0xf3, - 0x08, 0x88, 0x0c, 0x4b, 0xc0, 0x22, 0xd2, 0x01, 0x9a, 0x60, 0x0b, 0x4b, - 0x1b, 0x68, 0x18, 0x47, 0x00, 0x20, 0x8b, 0x23, 0x9b, 0x00, 0x9d, 0x44, - 0xf0, 0xbd, 0xc0, 0x46, 0xd4, 0xfd, 0xff, 0xff, 0xd4, 0x00, 0x00, 0x20, - 0xf4, 0x4c, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xbc, 0x00, 0x00, 0x20, - 0x00, 0xa2, 0xff, 0xff, 0x00, 0xed, 0x00, 0xe0, 0x04, 0x60, 0x00, 0x00, - 0x08, 0xb5, 0x00, 0x21, 0x02, 0x48, 0x0a, 0x1c, 0x01, 0xf0, 0x3c, 0xfb, - 0x08, 0xbd, 0xc0, 0x46, 0xbc, 0x00, 0x00, 0x20, 0x13, 0xb5, 0x02, 0x68, - 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, 0x54, 0x68, 0x19, 0x1c, 0x01, 0x22, - 0xa0, 0x47, 0x16, 0xbd, 0x38, 0xb5, 0x04, 0x1c, 0x00, 0x6a, 0x00, 0x25, - 0xa8, 0x42, 0x02, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x0a, 0xe0, 0x45, 0x60, - 0x92, 0xb2, 0x01, 0xf0, 0x0b, 0xf8, 0x23, 0x6a, 0x5b, 0x68, 0x00, 0x2b, - 0x02, 0xd0, 0x01, 0x23, 0x63, 0x60, 0x28, 0x1c, 0x38, 0xbd, 0x00, 0x6a, - 0x08, 0xb5, 0x00, 0x28, 0x01, 0xd0, 0x00, 0xf0, 0x49, 0xfe, 0x08, 0xbd, - 0x13, 0xb5, 0x6c, 0x46, 0x07, 0x34, 0x21, 0x1c, 0x01, 0x22, 0x00, 0xf0, - 0x65, 0xfd, 0x01, 0x28, 0x01, 0xd1, 0x20, 0x78, 0x00, 0xe0, 0x01, 0x48, - 0x00, 0xb2, 0x16, 0xbd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x08, 0xb5, - 0x00, 0x28, 0x02, 0xd0, 0xff, 0xf7, 0xea, 0xff, 0x01, 0xe0, 0x01, 0x20, - 0x40, 0x42, 0x08, 0xbd, 0x38, 0xb5, 0x05, 0x1c, 0x00, 0x6a, 0x00, 0x28, - 0x0a, 0xd0, 0xff, 0xf7, 0xdf, 0xff, 0x04, 0x1c, 0x63, 0x1c, 0x05, 0xd0, - 0x28, 0x6a, 0x01, 0x69, 0x01, 0x39, 0x00, 0xf0, 0xed, 0xfd, 0x20, 0x1c, - 0x38, 0xbd, 0x00, 0x00, 0xf8, 0xb5, 0xfa, 0x23, 0x9b, 0x00, 0x83, 0x60, - 0x0d, 0x4b, 0x00, 0x25, 0x08, 0x33, 0x04, 0x1c, 0x45, 0x60, 0x03, 0x60, - 0x28, 0x20, 0x0f, 0x1c, 0x16, 0x1c, 0x02, 0xf0, 0xe5, 0xfb, 0x20, 0x62, - 0xa8, 0x42, 0x0a, 0xd0, 0x39, 0x1c, 0x28, 0x22, 0x02, 0xf0, 0x01, 0xfc, - 0x20, 0x1c, 0x10, 0x30, 0x31, 0x1c, 0x0c, 0x22, 0x02, 0xf0, 0xc6, 0xfc, - 0x25, 0x77, 0x20, 0x1c, 0xf8, 0xbd, 0xc0, 0x46, 0x00, 0x4d, 0x00, 0x00, - 0xfa, 0x22, 0x92, 0x00, 0x82, 0x60, 0x04, 0x4a, 0x00, 0x23, 0x08, 0x32, - 0x43, 0x60, 0x02, 0x60, 0x03, 0x62, 0x03, 0x74, 0x70, 0x47, 0xc0, 0x46, - 0x00, 0x4d, 0x00, 0x00, 0x00, 0x6a, 0x08, 0xb5, 0x00, 0x28, 0x01, 0xd0, - 0x00, 0xf0, 0x0a, 0xfd, 0x08, 0xbd, 0x00, 0x6a, 0x08, 0xb5, 0x00, 0x28, - 0x04, 0xd0, 0x00, 0xf0, 0xad, 0xfd, 0x43, 0x1e, 0x98, 0x41, 0xc0, 0xb2, - 0x08, 0xbd, 0x03, 0x6a, 0x00, 0x2b, 0x01, 0xd0, 0x18, 0x69, 0x01, 0xe0, - 0x01, 0x20, 0x40, 0x42, 0x70, 0x47, 0x00, 0x6a, 0x00, 0x28, 0x00, 0xd0, - 0xc0, 0x69, 0x70, 0x47, 0x38, 0xb5, 0x04, 0x1c, 0x00, 0x6a, 0x00, 0x28, - 0x0b, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0xf3, 0xff, 0x05, 0x1c, 0x20, 0x1c, - 0xff, 0xf7, 0xe7, 0xff, 0x02, 0x4b, 0x28, 0x1a, 0x98, 0x42, 0x00, 0xd9, - 0x18, 0x1c, 0x38, 0xbd, 0xff, 0x7f, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, - 0x00, 0x6a, 0x00, 0x28, 0x06, 0xd0, 0x00, 0xf0, 0xef, 0xfd, 0x20, 0x6a, - 0x02, 0xf0, 0x92, 0xfb, 0x00, 0x23, 0x23, 0x62, 0x10, 0xbd, 0x00, 0x00, - 0x10, 0xb5, 0x0a, 0x1c, 0x0c, 0x49, 0x8a, 0xb0, 0x04, 0x1c, 0x00, 0x23, - 0x00, 0x91, 0x69, 0x46, 0x4b, 0x72, 0x01, 0x93, 0x21, 0x1c, 0x68, 0x46, - 0x01, 0x23, 0x00, 0xf0, 0x89, 0xfe, 0x04, 0x1c, 0x60, 0x1e, 0x84, 0x41, - 0xe4, 0xb2, 0x00, 0x2c, 0x02, 0xd0, 0x68, 0x46, 0x00, 0xf0, 0xd0, 0xfd, - 0x20, 0x1c, 0x0a, 0xb0, 0x10, 0xbd, 0xc0, 0x46, 0x40, 0x4d, 0x00, 0x00, - 0x08, 0xb5, 0x01, 0x23, 0x00, 0x2a, 0x05, 0xd0, 0x00, 0xf0, 0x22, 0xff, - 0x03, 0x1c, 0x58, 0x1e, 0x83, 0x41, 0xdb, 0xb2, 0x18, 0x1c, 0x08, 0xbd, - 0x38, 0xb5, 0x01, 0x22, 0x05, 0x1c, 0x0c, 0x1c, 0x01, 0xf0, 0x9c, 0xf9, - 0x02, 0x1c, 0x01, 0x20, 0x00, 0x2a, 0x03, 0xd1, 0x28, 0x1c, 0x21, 0x1c, - 0x01, 0xf0, 0x94, 0xf9, 0x38, 0xbd, 0xf0, 0xb5, 0x0c, 0x68, 0x03, 0x5d, - 0x2f, 0x3b, 0x5d, 0x42, 0x6b, 0x41, 0xe4, 0x18, 0x27, 0x1c, 0x0c, 0x37, - 0x23, 0x1c, 0xc5, 0x5c, 0x1e, 0x1b, 0x2f, 0x2d, 0x09, 0xd0, 0x00, 0x2d, - 0x07, 0xd0, 0x01, 0x33, 0x16, 0x1b, 0xf6, 0x18, 0x01, 0x3e, 0x35, 0x70, - 0xbb, 0x42, 0xf2, 0xd1, 0x0c, 0x26, 0x00, 0x24, 0x94, 0x55, 0xc2, 0x5c, - 0x2f, 0x3a, 0x54, 0x42, 0x62, 0x41, 0x9b, 0x18, 0x0b, 0x60, 0xc0, 0x5c, - 0x43, 0x1e, 0x98, 0x41, 0xc0, 0xb2, 0xf0, 0xbd, 0xf0, 0xb5, 0xa1, 0xb0, - 0x03, 0x90, 0x25, 0x48, 0x0d, 0x1c, 0x04, 0x92, 0x05, 0x93, 0x0c, 0xaa, - 0x00, 0x23, 0x16, 0xa9, 0x0d, 0x93, 0x0c, 0x90, 0x53, 0x72, 0x17, 0x93, - 0x16, 0x90, 0x4b, 0x72, 0x07, 0x93, 0x2c, 0x1c, 0x00, 0x92, 0x07, 0xa9, - 0x08, 0xaa, 0x03, 0x98, 0xff, 0xf7, 0xc3, 0xff, 0x01, 0x26, 0x02, 0x1c, - 0x72, 0x40, 0x01, 0x90, 0xd2, 0xb2, 0x20, 0x1c, 0x08, 0xa9, 0x05, 0x9b, - 0x04, 0x9f, 0xb8, 0x47, 0x00, 0x28, 0x07, 0xd1, 0xac, 0x42, 0x01, 0xd1, - 0x00, 0x20, 0x23, 0xe0, 0x20, 0x1c, 0x00, 0xf0, 0x5f, 0xfd, 0xf9, 0xe7, - 0x01, 0x9f, 0x00, 0x2f, 0x11, 0xd0, 0x33, 0x1c, 0x00, 0x98, 0x21, 0x1c, - 0x08, 0xaa, 0x00, 0xf0, 0x05, 0xfe, 0x06, 0x1c, 0xac, 0x42, 0x0f, 0xd0, - 0x20, 0x1c, 0x00, 0xf0, 0x4f, 0xfd, 0x00, 0x2e, 0xe8, 0xd0, 0x23, 0x1c, - 0x00, 0x9c, 0x00, 0x93, 0xd1, 0xe7, 0xac, 0x42, 0x02, 0xd0, 0x20, 0x1c, - 0x00, 0xf0, 0x44, 0xfd, 0x30, 0x1c, 0x03, 0xe0, 0x00, 0x28, 0xdb, 0xd0, - 0x16, 0xac, 0xf0, 0xe7, 0x21, 0xb0, 0xf0, 0xbd, 0x40, 0x4d, 0x00, 0x00, - 0x38, 0xb5, 0x0a, 0x1c, 0x01, 0x21, 0x04, 0x1c, 0x00, 0xf0, 0xd6, 0xf9, - 0x00, 0x28, 0x01, 0xd1, 0x00, 0x20, 0x0f, 0xe0, 0x25, 0x1c, 0x10, 0x35, - 0x28, 0x1c, 0x21, 0x1c, 0xff, 0xf7, 0x6c, 0xff, 0x00, 0x28, 0xf5, 0xd0, - 0x20, 0x1c, 0x38, 0x30, 0x29, 0x1c, 0x00, 0xf0, 0xe1, 0xfb, 0x43, 0x1e, - 0x98, 0x41, 0xc0, 0xb2, 0x38, 0xbd, 0x00, 0x00, 0x4b, 0x68, 0x43, 0x60, - 0x0a, 0x4b, 0x03, 0x60, 0x0b, 0x7a, 0x03, 0x72, 0x4b, 0x7a, 0x43, 0x72, - 0xcb, 0x68, 0xc3, 0x60, 0x0b, 0x69, 0x03, 0x61, 0x4b, 0x69, 0x43, 0x61, - 0x0b, 0x7e, 0x03, 0x76, 0xcb, 0x69, 0xc3, 0x61, 0x0b, 0x6a, 0x49, 0x6a, - 0x03, 0x62, 0x41, 0x62, 0x70, 0x47, 0xc0, 0x46, 0x40, 0x4d, 0x00, 0x00, - 0xf0, 0xb5, 0x9d, 0xb0, 0x05, 0x1c, 0x38, 0x31, 0x08, 0xa8, 0x02, 0x92, - 0x03, 0x93, 0xff, 0xf7, 0xdd, 0xff, 0x24, 0x4a, 0x12, 0xaf, 0x00, 0x23, - 0x02, 0x9c, 0x7b, 0x60, 0x12, 0x92, 0x7b, 0x72, 0x08, 0xae, 0x20, 0x1c, - 0x2f, 0x21, 0x02, 0xf0, 0x6d, 0xfb, 0x00, 0x28, 0x2e, 0xd0, 0x23, 0x78, - 0x2f, 0x2b, 0x01, 0xd1, 0x01, 0x34, 0xf4, 0xe7, 0x00, 0x1b, 0xc0, 0xb2, - 0x03, 0x1c, 0x0c, 0x28, 0x00, 0xd9, 0x0c, 0x23, 0xdb, 0xb2, 0x1a, 0x1c, - 0x21, 0x1c, 0x04, 0xa8, 0x01, 0x93, 0x02, 0xf0, 0x65, 0xfb, 0x01, 0x9a, - 0x00, 0x23, 0x04, 0xa9, 0x38, 0x1c, 0x8b, 0x54, 0x00, 0xf0, 0xd4, 0xfc, - 0x38, 0x1c, 0x31, 0x1c, 0x04, 0xaa, 0x01, 0x23, 0x00, 0xf0, 0x7e, 0xfd, - 0x00, 0x28, 0x04, 0xd1, 0x0c, 0x4b, 0x68, 0x60, 0x2b, 0x60, 0x68, 0x72, - 0x10, 0xe0, 0x01, 0x9b, 0x30, 0x1c, 0xe4, 0x18, 0x00, 0xf0, 0xc2, 0xfc, - 0x33, 0x1c, 0x3e, 0x1c, 0x1f, 0x1c, 0xca, 0xe7, 0x02, 0x99, 0x03, 0x9a, - 0x64, 0x1a, 0x14, 0x60, 0x28, 0x1c, 0x31, 0x1c, 0xff, 0xf7, 0x98, 0xff, - 0x28, 0x1c, 0x1d, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0x40, 0x4d, 0x00, 0x00, - 0xf0, 0xb5, 0xa3, 0xb0, 0x05, 0x1c, 0x1f, 0x1c, 0x04, 0xa8, 0x03, 0xab, - 0x16, 0x1c, 0x01, 0x91, 0xff, 0xf7, 0xa2, 0xff, 0x03, 0x9b, 0xf6, 0x18, - 0x33, 0x78, 0x00, 0x2b, 0x07, 0xd1, 0x04, 0xa9, 0x18, 0xa8, 0xff, 0xf7, - 0x7f, 0xff, 0x28, 0x1c, 0x18, 0xa9, 0x1e, 0x4a, 0x34, 0xe0, 0x00, 0x23, - 0x0e, 0xac, 0x63, 0x60, 0x63, 0x72, 0x6b, 0x46, 0x19, 0x33, 0x1b, 0x4a, - 0x1b, 0x78, 0x0e, 0x92, 0x00, 0x2b, 0x03, 0xd1, 0x28, 0x1c, 0xff, 0xf7, - 0x55, 0xfe, 0x27, 0xe0, 0x02, 0x3b, 0x01, 0x2b, 0x09, 0xd8, 0x01, 0x99, - 0x20, 0x1c, 0x38, 0x31, 0x32, 0x1c, 0x3b, 0x1c, 0x00, 0xf0, 0x30, 0xfd, - 0x00, 0x28, 0x0b, 0xd1, 0xee, 0xe7, 0x20, 0x1c, 0x04, 0xa9, 0x32, 0x1c, - 0x3b, 0x1c, 0x00, 0xf0, 0x27, 0xfd, 0x00, 0x28, 0xe6, 0xd0, 0x04, 0xa8, - 0x00, 0xf0, 0x72, 0xfc, 0x06, 0x23, 0x1f, 0x42, 0x03, 0xd0, 0x20, 0x1c, - 0x15, 0x99, 0x00, 0xf0, 0xfd, 0xfb, 0x21, 0x1c, 0x18, 0xa8, 0xff, 0xf7, - 0x49, 0xff, 0x28, 0x1c, 0x18, 0xa9, 0x32, 0x1c, 0xff, 0xf7, 0x0a, 0xfe, - 0x28, 0x1c, 0x23, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0x20, 0x4d, 0x00, 0x00, - 0x40, 0x4d, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x1c, 0x08, 0x1c, 0x19, 0x1c, - 0x38, 0x31, 0x02, 0x4a, 0x00, 0x23, 0xff, 0xf7, 0xc7, 0xfe, 0x08, 0xbd, - 0x9d, 0x23, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x1c, 0x08, 0x1c, 0x19, 0x1c, - 0x38, 0x31, 0x02, 0x4a, 0x00, 0x23, 0xff, 0xf7, 0xbb, 0xfe, 0x08, 0xbd, - 0xd9, 0x23, 0x00, 0x00, 0x08, 0x4b, 0x02, 0x21, 0x19, 0x61, 0x19, 0x1c, - 0x00, 0x22, 0x30, 0x31, 0x0a, 0x70, 0x06, 0x49, 0x5a, 0x71, 0x9a, 0x71, - 0x9a, 0x72, 0x1a, 0x73, 0xda, 0x63, 0x99, 0x63, 0x41, 0x33, 0x1a, 0x70, - 0x70, 0x47, 0xc0, 0x46, 0xd4, 0x00, 0x00, 0x20, 0x40, 0x4d, 0x00, 0x00, - 0x08, 0xb5, 0x01, 0x1c, 0x01, 0x48, 0x01, 0xf0, 0xb1, 0xf9, 0x08, 0xbd, - 0x78, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x02, 0x48, 0xff, 0x21, 0x01, 0xf0, - 0xa9, 0xf9, 0x08, 0xbd, 0x78, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x01, 0x21, - 0x00, 0x79, 0x01, 0xf0, 0x3d, 0xfc, 0x05, 0x4b, 0x1a, 0x78, 0x00, 0x2a, - 0x04, 0xd0, 0x00, 0x22, 0x03, 0x48, 0x1a, 0x70, 0x01, 0xf0, 0x86, 0xf9, - 0x08, 0xbd, 0xc0, 0x46, 0x40, 0x01, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x10, 0xb5, 0x08, 0x4b, 0x04, 0x1c, 0x1a, 0x78, 0x00, 0x2a, 0x06, 0xd1, - 0x01, 0x22, 0x1a, 0x70, 0x05, 0x4b, 0x06, 0x48, 0x06, 0xcb, 0x01, 0xf0, - 0x57, 0xf9, 0x20, 0x79, 0x00, 0x21, 0x01, 0xf0, 0x1d, 0xfc, 0x10, 0xbd, - 0x40, 0x01, 0x00, 0x20, 0x38, 0x01, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x10, 0xb5, 0x83, 0x79, 0x04, 0x1c, 0x00, 0x2b, 0x0d, 0xd0, 0x23, 0x89, - 0x5a, 0x1c, 0x22, 0x81, 0x05, 0x4a, 0x93, 0x42, 0x02, 0xd8, 0xff, 0xf7, - 0xbf, 0xff, 0xf6, 0xe7, 0x20, 0x1c, 0xff, 0xf7, 0xc3, 0xff, 0x00, 0x23, - 0xa3, 0x71, 0x10, 0xbd, 0x01, 0x02, 0x00, 0x00, 0x00, 0xb5, 0x06, 0x29, - 0x03, 0xd9, 0x16, 0x23, 0x43, 0x71, 0x00, 0x20, 0x1c, 0xe0, 0x0f, 0x4b, - 0x05, 0x29, 0x13, 0xd8, 0x08, 0x1c, 0x00, 0x22, 0x02, 0xf0, 0xe8, 0xf8, - 0x03, 0x05, 0x07, 0x09, 0x0b, 0x0d, 0x0b, 0x49, 0x08, 0xe0, 0x0b, 0x49, - 0x06, 0xe0, 0x0b, 0x49, 0x04, 0xe0, 0x0b, 0x49, 0x02, 0xe0, 0x0b, 0x49, - 0x00, 0xe0, 0x0b, 0x49, 0x19, 0x60, 0x02, 0xe0, 0x0a, 0x4a, 0x1a, 0x60, - 0x00, 0x22, 0x1a, 0x71, 0x5a, 0x71, 0x01, 0x20, 0x00, 0xbd, 0xc0, 0x46, - 0x38, 0x01, 0x00, 0x20, 0x00, 0x1b, 0xb7, 0x00, 0x00, 0x09, 0x3d, 0x00, - 0x80, 0x84, 0x1e, 0x00, 0x40, 0x42, 0x0f, 0x00, 0x20, 0xa1, 0x07, 0x00, - 0x90, 0xd0, 0x03, 0x00, 0x48, 0xe8, 0x01, 0x00, 0x38, 0xb5, 0x0c, 0x1c, - 0x01, 0xf0, 0xe2, 0xf9, 0x05, 0x1c, 0xff, 0xf7, 0x79, 0xff, 0xff, 0x28, - 0x08, 0xd0, 0x01, 0xf0, 0xdb, 0xf9, 0xab, 0xb2, 0x80, 0xb2, 0xc0, 0x1a, - 0xa0, 0x42, 0xf4, 0xdb, 0x00, 0x20, 0x00, 0xe0, 0x01, 0x20, 0x38, 0xbd, - 0xf8, 0xb5, 0x04, 0x1c, 0x0e, 0x1c, 0x17, 0x1c, 0xff, 0xf7, 0x9a, 0xff, - 0x20, 0x1c, 0xff, 0xf7, 0x7f, 0xff, 0x96, 0x21, 0x49, 0x00, 0x20, 0x1c, - 0xff, 0xf7, 0xde, 0xff, 0x40, 0x20, 0x30, 0x43, 0xff, 0xf7, 0x52, 0xff, - 0x18, 0x25, 0x38, 0x1c, 0xe8, 0x40, 0xc0, 0xb2, 0x08, 0x3d, 0xff, 0xf7, - 0x4b, 0xff, 0x2b, 0x1c, 0x08, 0x33, 0xf6, 0xd1, 0x95, 0x20, 0x00, 0x2e, - 0x03, 0xd0, 0x87, 0x20, 0x08, 0x2e, 0x00, 0xd0, 0xff, 0x20, 0xff, 0xf7, - 0x3f, 0xff, 0x00, 0x25, 0xff, 0xf7, 0x44, 0xff, 0x43, 0xb2, 0xe0, 0x72, - 0x00, 0x2b, 0x04, 0xda, 0xff, 0x2d, 0x02, 0xd0, 0x01, 0x35, 0xed, 0xb2, - 0xf4, 0xe7, 0xf8, 0xbd, 0xf7, 0xb5, 0x00, 0x25, 0x02, 0x71, 0x05, 0x73, - 0x85, 0x72, 0x85, 0x71, 0x45, 0x71, 0x04, 0x1c, 0x01, 0x91, 0x01, 0xf0, - 0x95, 0xf9, 0x01, 0x21, 0x87, 0xb2, 0x20, 0x79, 0x01, 0xf0, 0x14, 0xfb, - 0x01, 0x21, 0x20, 0x79, 0x01, 0xf0, 0x70, 0xfb, 0x43, 0x4e, 0x30, 0x1c, - 0x01, 0xf0, 0x7a, 0xf8, 0x42, 0x4b, 0x43, 0x49, 0x1d, 0x71, 0x5d, 0x71, - 0x19, 0x60, 0x30, 0x1c, 0x5a, 0x68, 0x01, 0xf0, 0x99, 0xf8, 0x0a, 0x25, - 0x01, 0x3d, 0xff, 0x20, 0xed, 0xb2, 0xff, 0xf7, 0x0b, 0xff, 0x00, 0x2d, - 0xf8, 0xd1, 0x30, 0x1c, 0x01, 0xf0, 0xaa, 0xf8, 0x20, 0x1c, 0xff, 0xf7, - 0x27, 0xff, 0x00, 0x21, 0x20, 0x1c, 0x0a, 0x1c, 0xff, 0xf7, 0x9a, 0xff, - 0x06, 0x1c, 0xe0, 0x72, 0x01, 0x28, 0x09, 0xd0, 0x01, 0xf0, 0x66, 0xf9, - 0xc0, 0x1b, 0xfa, 0x23, 0x80, 0xb2, 0xdb, 0x00, 0x98, 0x42, 0xee, 0xd9, - 0x01, 0x23, 0x3c, 0xe0, 0xd5, 0x22, 0x20, 0x1c, 0x08, 0x21, 0x52, 0x00, - 0xff, 0xf7, 0x86, 0xff, 0x04, 0x23, 0x18, 0x42, 0x01, 0xd0, 0x26, 0x73, - 0x0b, 0xe0, 0x1e, 0x1c, 0xff, 0xf7, 0xea, 0xfe, 0x01, 0x3e, 0xf6, 0xb2, - 0xe0, 0x72, 0x00, 0x2e, 0xf8, 0xd1, 0x02, 0x23, 0xaa, 0x28, 0x26, 0xd1, - 0x23, 0x73, 0x26, 0x7b, 0x02, 0x3e, 0x73, 0x42, 0x5e, 0x41, 0xb6, 0x07, - 0x37, 0x21, 0x00, 0x22, 0x20, 0x1c, 0xff, 0xf7, 0x6b, 0xff, 0x32, 0x1c, - 0x20, 0x1c, 0x29, 0x21, 0xff, 0xf7, 0x66, 0xff, 0x02, 0x1c, 0xe0, 0x72, - 0x09, 0xd0, 0x01, 0xf0, 0x33, 0xf9, 0xc0, 0x1b, 0xfa, 0x23, 0x80, 0xb2, - 0xdb, 0x00, 0x98, 0x42, 0xea, 0xd9, 0x08, 0x23, 0x09, 0xe0, 0x23, 0x7b, - 0x02, 0x2b, 0x19, 0xd1, 0x20, 0x1c, 0x3a, 0x21, 0xff, 0xf7, 0x52, 0xff, - 0x00, 0x28, 0x05, 0xd0, 0x06, 0x23, 0x63, 0x71, 0x20, 0x1c, 0xff, 0xf7, - 0xbf, 0xfe, 0x15, 0xe0, 0xff, 0xf7, 0xb4, 0xfe, 0xc0, 0x23, 0x18, 0x40, - 0x98, 0x42, 0x01, 0xd1, 0x03, 0x23, 0x23, 0x73, 0xff, 0xf7, 0xac, 0xfe, - 0xff, 0xf7, 0xaa, 0xfe, 0xff, 0xf7, 0xa8, 0xfe, 0x20, 0x1c, 0xff, 0xf7, - 0xad, 0xfe, 0x20, 0x1c, 0x01, 0x99, 0xff, 0xf7, 0xeb, 0xfe, 0x05, 0x1c, - 0x28, 0x1c, 0xfe, 0xbd, 0x78, 0x07, 0x00, 0x20, 0x38, 0x01, 0x00, 0x20, - 0x90, 0xd0, 0x03, 0x00, 0x38, 0xb5, 0x04, 0x1c, 0x01, 0xf0, 0xfa, 0xf8, - 0x05, 0x1c, 0xff, 0xf7, 0x91, 0xfe, 0xe0, 0x72, 0xff, 0x28, 0x0a, 0xd1, - 0x01, 0xf0, 0xf2, 0xf8, 0xab, 0xb2, 0x80, 0xb2, 0xc0, 0x1a, 0x96, 0x23, - 0x5b, 0x00, 0x98, 0x42, 0xf1, 0xdd, 0x0f, 0x23, 0x02, 0xe0, 0xfe, 0x28, - 0x06, 0xd0, 0x0d, 0x23, 0x20, 0x1c, 0x63, 0x71, 0xff, 0xf7, 0x84, 0xfe, - 0x00, 0x20, 0x00, 0xe0, 0x01, 0x20, 0x38, 0xbd, 0xf8, 0xb5, 0x04, 0x1c, - 0x0f, 0x1c, 0x15, 0x1c, 0x1e, 0x1e, 0x45, 0xd0, 0x9a, 0x18, 0x80, 0x23, - 0x9b, 0x00, 0x9a, 0x42, 0x42, 0xdc, 0x83, 0x79, 0x00, 0x2b, 0x05, 0xd0, - 0x02, 0x68, 0x91, 0x42, 0x02, 0xd1, 0x03, 0x89, 0xab, 0x42, 0x16, 0xd9, - 0x23, 0x7b, 0x27, 0x60, 0x03, 0x2b, 0x00, 0xd0, 0x7f, 0x02, 0x3a, 0x1c, - 0x20, 0x1c, 0x11, 0x21, 0xff, 0xf7, 0xee, 0xfe, 0x07, 0x1e, 0x02, 0xd0, - 0x03, 0x23, 0x63, 0x71, 0x2a, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0xba, 0xff, - 0x00, 0x28, 0x25, 0xd0, 0x01, 0x23, 0x27, 0x81, 0xa3, 0x71, 0x23, 0x89, - 0xab, 0x42, 0x05, 0xd2, 0xff, 0xf7, 0x48, 0xfe, 0x23, 0x89, 0x01, 0x33, - 0x23, 0x81, 0xf6, 0xe7, 0x06, 0x9d, 0x06, 0x9a, 0xab, 0x1a, 0x9b, 0xb2, - 0xb3, 0x42, 0x04, 0xd2, 0xff, 0xf7, 0x3c, 0xfe, 0x28, 0x70, 0x01, 0x35, - 0xf5, 0xe7, 0x23, 0x89, 0xa2, 0x7a, 0xf3, 0x18, 0x9b, 0xb2, 0x23, 0x81, - 0x00, 0x2a, 0x02, 0xd0, 0x06, 0x4a, 0x93, 0x42, 0x02, 0xd9, 0x20, 0x1c, - 0xff, 0xf7, 0x60, 0xfe, 0x01, 0x20, 0x03, 0xe0, 0x20, 0x1c, 0xff, 0xf7, - 0x2f, 0xfe, 0x00, 0x20, 0xf8, 0xbd, 0xc0, 0x46, 0xff, 0x01, 0x00, 0x00, - 0x07, 0xb5, 0x80, 0x23, 0x00, 0x92, 0x9b, 0x00, 0x00, 0x22, 0xff, 0xf7, - 0xa3, 0xff, 0x0e, 0xbd, 0x70, 0xb5, 0x05, 0x1c, 0x08, 0x1c, 0x16, 0x1c, - 0xff, 0xf7, 0x0c, 0xfe, 0x00, 0x24, 0x30, 0x5d, 0xff, 0xf7, 0x08, 0xfe, - 0x01, 0x34, 0x80, 0x23, 0x9b, 0x00, 0x9c, 0x42, 0xf7, 0xd1, 0xff, 0x20, - 0xff, 0xf7, 0x00, 0xfe, 0xff, 0x20, 0xff, 0xf7, 0xfd, 0xfd, 0xff, 0xf7, - 0x03, 0xfe, 0x1f, 0x23, 0xe8, 0x72, 0x03, 0x40, 0x01, 0x20, 0x05, 0x2b, - 0x05, 0xd0, 0x11, 0x23, 0x28, 0x1c, 0x6b, 0x71, 0xff, 0xf7, 0x00, 0xfe, - 0x00, 0x20, 0x70, 0xbd, 0x70, 0xb5, 0x0b, 0x1c, 0x04, 0x1c, 0x16, 0x1c, - 0x00, 0x29, 0x01, 0xd1, 0x12, 0x23, 0x28, 0xe0, 0x02, 0x7b, 0x03, 0x2a, - 0x00, 0xd0, 0x4b, 0x02, 0x20, 0x1c, 0x18, 0x21, 0x1a, 0x1c, 0xff, 0xf7, - 0x79, 0xfe, 0x05, 0x1e, 0x01, 0xd0, 0x04, 0x23, 0x1b, 0xe0, 0x20, 0x1c, - 0xfe, 0x21, 0x32, 0x1c, 0xff, 0xf7, 0xc2, 0xff, 0x00, 0x28, 0x15, 0xd0, - 0x96, 0x21, 0x20, 0x1c, 0x89, 0x00, 0xff, 0xf7, 0x55, 0xfe, 0x00, 0x28, - 0x01, 0xd1, 0x15, 0x23, 0x0b, 0xe0, 0x20, 0x1c, 0x0d, 0x21, 0x2a, 0x1c, - 0xff, 0xf7, 0x60, 0xfe, 0x00, 0x28, 0x03, 0xd1, 0xff, 0xf7, 0xc8, 0xfd, - 0x00, 0x28, 0x06, 0xd0, 0x14, 0x23, 0x63, 0x71, 0x20, 0x1c, 0xff, 0xf7, - 0xc9, 0xfd, 0x00, 0x20, 0x03, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0xc4, 0xfd, - 0x01, 0x20, 0x70, 0xbd, 0x03, 0x4b, 0x04, 0x4a, 0x1a, 0x60, 0x00, 0x22, - 0x5a, 0x71, 0x1a, 0x71, 0x70, 0x47, 0xc0, 0x46, 0x38, 0x01, 0x00, 0x20, - 0x00, 0x09, 0x3d, 0x00, 0x02, 0x1c, 0x10, 0xb5, 0x0c, 0x32, 0x04, 0x1c, - 0x01, 0x21, 0x40, 0x6a, 0x00, 0xf0, 0x24, 0xfd, 0x00, 0x28, 0x0a, 0xd0, - 0x23, 0x6a, 0x01, 0x20, 0x00, 0x2b, 0x06, 0xd1, 0xe3, 0x68, 0x22, 0x7a, - 0x23, 0x62, 0x80, 0x23, 0x5b, 0x42, 0x13, 0x43, 0x23, 0x72, 0x10, 0xbd, - 0x70, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xe6, 0xff, 0x00, 0x28, 0x01, 0xd1, - 0x00, 0x20, 0x1b, 0xe0, 0x63, 0x6a, 0xe6, 0x68, 0x1a, 0x7c, 0x02, 0x3e, - 0x96, 0x40, 0x5a, 0x69, 0x1d, 0x79, 0xb6, 0x18, 0x00, 0x2d, 0x08, 0xd0, - 0x70, 0x1e, 0x40, 0x19, 0x00, 0xf0, 0x4c, 0xfc, 0x00, 0x28, 0xed, 0xd0, - 0x01, 0x3d, 0xed, 0xb2, 0xf4, 0xe7, 0x63, 0x6a, 0x01, 0x20, 0x1a, 0x7c, - 0x80, 0x23, 0x9b, 0x00, 0x93, 0x40, 0xe2, 0x69, 0xd3, 0x18, 0xe3, 0x61, - 0x70, 0xbd, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, 0x40, 0x69, 0x00, 0xf0, - 0x13, 0xfc, 0x00, 0x28, 0x03, 0xd0, 0x20, 0x7e, 0x01, 0x4b, 0x40, 0x01, - 0xc0, 0x18, 0x10, 0xbd, 0x50, 0x01, 0x00, 0x20, 0xf0, 0xb5, 0x00, 0x23, - 0x87, 0xb0, 0x07, 0x1c, 0x0e, 0x1c, 0x20, 0x22, 0xf2, 0x54, 0x01, 0x33, - 0x0b, 0x2b, 0xfa, 0xd1, 0x07, 0x21, 0x00, 0x25, 0x01, 0x91, 0x3c, 0x78, - 0x00, 0x2c, 0x2a, 0xd0, 0x2e, 0x2c, 0x06, 0xd1, 0x01, 0x9b, 0x0a, 0x2b, - 0x2b, 0xd0, 0x0a, 0x21, 0x08, 0x25, 0x01, 0x91, 0x1f, 0xe0, 0x02, 0xa8, - 0x14, 0x49, 0x10, 0x22, 0x01, 0xf0, 0x29, 0xff, 0x00, 0x23, 0x02, 0xa9, - 0xca, 0x5c, 0x00, 0x2a, 0x03, 0xd0, 0x01, 0x33, 0xa2, 0x42, 0xf8, 0xd1, - 0x19, 0xe0, 0x01, 0x9b, 0x9d, 0x42, 0x16, 0xd8, 0x23, 0x1c, 0x21, 0x3b, - 0x5d, 0x2b, 0x12, 0xd8, 0x22, 0x1c, 0x6b, 0x1c, 0x61, 0x3a, 0xdb, 0xb2, - 0x75, 0x19, 0x19, 0x2a, 0x01, 0xd8, 0x20, 0x3c, 0xe4, 0xb2, 0x2c, 0x70, - 0x1d, 0x1c, 0x01, 0x37, 0xd1, 0xe7, 0x30, 0x78, 0x20, 0x38, 0x43, 0x1e, - 0x98, 0x41, 0xc0, 0xb2, 0x00, 0xe0, 0x00, 0x20, 0x07, 0xb0, 0xf0, 0xbd, - 0x22, 0x4d, 0x00, 0x00, 0x38, 0xb5, 0x42, 0x7a, 0x04, 0x1c, 0x0d, 0x1c, - 0x00, 0x2a, 0x01, 0xd0, 0x00, 0x20, 0x1f, 0xe0, 0x4b, 0x1c, 0xdb, 0x7f, - 0x10, 0x2b, 0x06, 0xd1, 0x02, 0x23, 0x43, 0x72, 0x02, 0x62, 0x4b, 0x8c, - 0x5b, 0x01, 0xc3, 0x61, 0x0c, 0xe0, 0x20, 0x2b, 0xf0, 0xd1, 0x03, 0x23, - 0x43, 0x72, 0x49, 0x6a, 0x22, 0x1c, 0x01, 0x62, 0x1c, 0x32, 0x28, 0x1c, - 0x00, 0xf0, 0x18, 0xfc, 0x00, 0x28, 0xe5, 0xd0, 0x00, 0x23, 0x01, 0x20, - 0x65, 0x62, 0x20, 0x72, 0xe3, 0x60, 0x23, 0x61, 0x63, 0x61, 0x23, 0x76, - 0x38, 0xbd, 0x00, 0x00, 0xf0, 0xb5, 0x43, 0x7a, 0x85, 0xb0, 0x04, 0x1c, - 0x0e, 0x1c, 0x03, 0x92, 0x00, 0x2b, 0x01, 0xd1, 0x3a, 0x48, 0x11, 0xe0, - 0x03, 0x7a, 0xd8, 0x07, 0xfa, 0xd5, 0xe2, 0x69, 0x20, 0x69, 0x03, 0x99, - 0x13, 0x1a, 0x99, 0x42, 0x01, 0xd9, 0x9b, 0xb2, 0x03, 0x93, 0x03, 0x99, - 0x02, 0x91, 0x02, 0x9b, 0x00, 0x2b, 0x04, 0xd1, 0x03, 0x99, 0x88, 0xb2, - 0x00, 0xb2, 0x05, 0xb0, 0xf0, 0xbd, 0x23, 0x69, 0x61, 0x7a, 0xdf, 0x05, - 0xff, 0x0d, 0x5a, 0x0a, 0x60, 0x6a, 0x02, 0x29, 0x02, 0xd1, 0x41, 0x6a, - 0x51, 0x18, 0x1b, 0xe0, 0x05, 0x79, 0x01, 0x3d, 0x2a, 0x40, 0xd5, 0xb2, - 0x00, 0x2f, 0x0d, 0xd1, 0x00, 0x2d, 0x0b, 0xd1, 0x00, 0x2b, 0x02, 0xd1, - 0x22, 0x6a, 0xe2, 0x60, 0x06, 0xe0, 0x22, 0x1c, 0xe1, 0x68, 0x0c, 0x32, - 0x00, 0xf0, 0xa0, 0xfb, 0x00, 0x28, 0xc9, 0xd0, 0x63, 0x6a, 0xe1, 0x68, - 0x1a, 0x7c, 0x02, 0x39, 0x5b, 0x69, 0x91, 0x40, 0xc9, 0x18, 0x49, 0x19, - 0x80, 0x22, 0x02, 0x9d, 0x92, 0x00, 0xd3, 0x1b, 0x9d, 0x42, 0x00, 0xdd, - 0x9d, 0xb2, 0x23, 0x7a, 0x58, 0x06, 0x01, 0xd4, 0x95, 0x42, 0x18, 0xd1, - 0x16, 0x4b, 0x1b, 0x68, 0x99, 0x42, 0x14, 0xd0, 0x15, 0x4b, 0x3a, 0x1c, - 0x18, 0x68, 0x00, 0x96, 0x2b, 0x1c, 0xff, 0xf7, 0x1f, 0xfe, 0x00, 0x28, - 0xa8, 0xd0, 0x76, 0x19, 0x01, 0xe0, 0xdf, 0x1b, 0xf6, 0x19, 0x21, 0x69, - 0x02, 0x9a, 0x4b, 0x19, 0x55, 0x1b, 0xad, 0xb2, 0x23, 0x61, 0x02, 0x95, - 0xab, 0xe7, 0x08, 0x1c, 0x00, 0x21, 0x00, 0xf0, 0x2b, 0xfb, 0x00, 0x28, - 0x96, 0xd0, 0x09, 0x4b, 0x32, 0x1c, 0xff, 0x18, 0x79, 0x19, 0x3b, 0x1c, - 0x8b, 0x42, 0xe8, 0xd0, 0x18, 0x78, 0x01, 0x33, 0x10, 0x70, 0x01, 0x32, - 0xf8, 0xe7, 0xc0, 0x46, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x73, 0xb5, 0x43, 0x7a, - 0x04, 0x1c, 0x01, 0x2b, 0x01, 0xd8, 0x00, 0x20, 0x16, 0xe0, 0x03, 0x69, - 0x6d, 0x46, 0x07, 0x35, 0xde, 0x05, 0x29, 0x1c, 0x01, 0x22, 0x36, 0x0f, - 0xff, 0xf7, 0x6a, 0xff, 0x01, 0x28, 0x01, 0xd1, 0x2b, 0x78, 0x00, 0xe0, - 0x05, 0x4b, 0x1b, 0xb2, 0x01, 0x33, 0xec, 0xd0, 0x23, 0x69, 0x70, 0x01, - 0x1f, 0x33, 0x23, 0x61, 0x02, 0x4b, 0xc0, 0x18, 0x76, 0xbd, 0xc0, 0x46, - 0xff, 0xff, 0x00, 0x00, 0x50, 0x01, 0x00, 0x20, 0x70, 0xb5, 0x04, 0x1c, - 0x40, 0x7a, 0x0d, 0x1c, 0x00, 0x28, 0x2a, 0xd0, 0xe2, 0x69, 0x91, 0x42, - 0x01, 0xd9, 0x00, 0x20, 0x25, 0xe0, 0x02, 0x28, 0x21, 0xd0, 0x00, 0x2d, - 0x01, 0xd1, 0xe5, 0x60, 0x1d, 0xe0, 0x62, 0x6a, 0x21, 0x69, 0x13, 0x7c, - 0x68, 0x1e, 0x09, 0x33, 0x4a, 0x1e, 0xd8, 0x40, 0xda, 0x40, 0x03, 0x1e, - 0x93, 0x42, 0x01, 0xd3, 0x00, 0x29, 0x02, 0xd1, 0x22, 0x6a, 0xe2, 0x60, - 0x00, 0xe0, 0x83, 0x1a, 0x1e, 0x1c, 0x00, 0x2e, 0x09, 0xd0, 0x22, 0x1c, - 0x60, 0x6a, 0xe1, 0x68, 0x0c, 0x32, 0x00, 0xf0, 0x07, 0xfb, 0x01, 0x3e, - 0x00, 0x28, 0xf4, 0xd1, 0x01, 0xe0, 0x25, 0x61, 0x01, 0x20, 0x70, 0xbd, - 0x38, 0xb5, 0x05, 0x1c, 0x40, 0x7a, 0x00, 0x28, 0x33, 0xd0, 0x2b, 0x7a, - 0x7f, 0x2b, 0x2d, 0xd9, 0x28, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x9a, 0xfe, - 0x04, 0x1e, 0x2a, 0xd0, 0x6b, 0x7a, 0x01, 0x2b, 0x07, 0xd8, 0x2b, 0x7f, - 0x03, 0x77, 0x6b, 0x7f, 0x43, 0x77, 0xab, 0x7f, 0x83, 0x77, 0xeb, 0x7f, - 0xc3, 0x77, 0x2b, 0x6a, 0x9a, 0xb2, 0x1b, 0x0c, 0x23, 0x75, 0x1b, 0x0a, - 0x63, 0x75, 0x0d, 0x4b, 0xa2, 0x76, 0x1b, 0x68, 0x12, 0x0a, 0xe2, 0x76, - 0x00, 0x2b, 0x0b, 0xd0, 0x20, 0x1c, 0x21, 0x1c, 0x18, 0x30, 0x16, 0x31, - 0x98, 0x47, 0x63, 0x7e, 0x22, 0x7e, 0x1b, 0x02, 0x13, 0x43, 0xa3, 0x74, - 0x1b, 0x0a, 0xe3, 0x74, 0x2a, 0x7a, 0x7f, 0x23, 0x13, 0x40, 0x2b, 0x72, - 0x00, 0xf0, 0x5c, 0xfa, 0xff, 0xe7, 0x38, 0xbd, 0x44, 0x01, 0x00, 0x20, - 0x10, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xc0, 0xff, 0x00, 0x28, 0x02, 0xd0, - 0x00, 0x23, 0x63, 0x72, 0x01, 0x20, 0x10, 0xbd, 0x73, 0xb5, 0x42, 0x7a, - 0x04, 0x1c, 0x0d, 0x1c, 0x00, 0x20, 0x01, 0x2a, 0x4b, 0xd1, 0x20, 0x7a, - 0x02, 0x23, 0x18, 0x40, 0x47, 0xd0, 0xe3, 0x69, 0x00, 0x20, 0x99, 0x42, - 0x43, 0xd8, 0x10, 0x1c, 0x00, 0x2b, 0x40, 0xd0, 0x20, 0x1c, 0x29, 0x1c, - 0x26, 0x69, 0xff, 0xf7, 0x71, 0xff, 0x00, 0x28, 0x25, 0xd0, 0x60, 0x6a, - 0x00, 0x2d, 0x06, 0xd1, 0x21, 0x6a, 0x00, 0xf0, 0x95, 0xfb, 0x00, 0x28, - 0x1d, 0xd0, 0x25, 0x62, 0x1d, 0xe0, 0xe1, 0x68, 0x01, 0xaa, 0x00, 0xf0, - 0x93, 0xfa, 0x00, 0x28, 0x15, 0xd0, 0x60, 0x6a, 0x01, 0x99, 0x43, 0x1c, - 0xdb, 0x7f, 0x10, 0x2b, 0x01, 0xd1, 0x12, 0x4b, 0x00, 0xe0, 0x12, 0x4b, - 0x99, 0x42, 0x0c, 0xd2, 0x00, 0xf0, 0x7e, 0xfb, 0x00, 0x28, 0x06, 0xd0, - 0x60, 0x6a, 0xe1, 0x68, 0x0e, 0x4a, 0x00, 0xf0, 0xcf, 0xfa, 0x00, 0x28, - 0x01, 0xd1, 0x00, 0x20, 0x11, 0xe0, 0x22, 0x7a, 0x80, 0x23, 0x5b, 0x42, - 0x13, 0x43, 0xe5, 0x61, 0x23, 0x72, 0x20, 0x1c, 0xff, 0xf7, 0x70, 0xff, - 0x00, 0x28, 0xf2, 0xd0, 0x29, 0x1e, 0xb1, 0x42, 0x00, 0xd9, 0x31, 0x1c, - 0x20, 0x1c, 0xff, 0xf7, 0x35, 0xff, 0x76, 0xbd, 0xf8, 0xff, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x38, 0xb5, 0x23, 0x4b, - 0x15, 0x1c, 0x4a, 0x01, 0xd3, 0x18, 0x04, 0x1c, 0xd8, 0x7a, 0x11, 0x22, - 0x10, 0x42, 0x04, 0xd0, 0x42, 0x22, 0x15, 0x42, 0x01, 0xd0, 0x00, 0x20, - 0x36, 0xe0, 0x1d, 0x4a, 0x21, 0x76, 0x12, 0x68, 0x62, 0x61, 0x5a, 0x7d, - 0x18, 0x7d, 0xd9, 0x7e, 0x12, 0x02, 0x02, 0x43, 0x98, 0x7e, 0x09, 0x02, - 0x12, 0x04, 0x01, 0x43, 0x11, 0x43, 0x21, 0x62, 0xd8, 0x7a, 0x18, 0x22, - 0x02, 0x40, 0x0c, 0xd1, 0x5a, 0x7f, 0x19, 0x7f, 0x12, 0x02, 0x0a, 0x43, - 0x99, 0x7f, 0xdb, 0x7f, 0x09, 0x04, 0x0a, 0x43, 0x1b, 0x06, 0x13, 0x43, - 0xe3, 0x61, 0x01, 0x23, 0x09, 0xe0, 0x10, 0x2a, 0xdb, 0xd1, 0x22, 0x1c, - 0x60, 0x6a, 0x1c, 0x32, 0x00, 0xf0, 0x5a, 0xfa, 0x00, 0x28, 0xd4, 0xd0, - 0x04, 0x23, 0x63, 0x72, 0x0f, 0x23, 0x00, 0x21, 0x2b, 0x40, 0x23, 0x72, - 0xe1, 0x60, 0x21, 0x61, 0x01, 0x20, 0x6a, 0x06, 0x02, 0xd5, 0x20, 0x1c, - 0xff, 0xf7, 0x60, 0xff, 0x38, 0xbd, 0xc0, 0x46, 0x50, 0x01, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x20, 0xf0, 0xb5, 0x45, 0x7a, 0x87, 0xb0, 0x04, 0x1c, - 0x0e, 0x1c, 0x01, 0x93, 0x00, 0x2d, 0x00, 0xd0, 0x86, 0xe0, 0x10, 0x1c, - 0x03, 0xa9, 0xff, 0xf7, 0xbb, 0xfd, 0x00, 0x28, 0x00, 0xd1, 0x80, 0xe0, - 0x72, 0x6a, 0x2f, 0x1c, 0x62, 0x62, 0xf5, 0x60, 0x35, 0x61, 0x33, 0x69, - 0xf2, 0x69, 0x93, 0x42, 0x26, 0xd2, 0xdb, 0x05, 0x1b, 0x0f, 0x30, 0x1c, - 0x00, 0x93, 0xff, 0xf7, 0x9f, 0xfe, 0x01, 0x1e, 0x6f, 0xd0, 0x03, 0x78, - 0x00, 0x2b, 0x01, 0xd0, 0xe5, 0x2b, 0x0b, 0xd1, 0x00, 0x2f, 0x04, 0xd1, - 0x00, 0x9b, 0x23, 0x76, 0x34, 0x4b, 0x1b, 0x68, 0x63, 0x61, 0x0b, 0x78, - 0x01, 0x27, 0x00, 0x2b, 0xe3, 0xd1, 0x0d, 0xe0, 0x03, 0xa8, 0x0b, 0x22, - 0x01, 0xf0, 0xca, 0xfc, 0x00, 0x28, 0xdc, 0xd1, 0x01, 0x9a, 0x30, 0x23, - 0x13, 0x40, 0x30, 0x2b, 0x53, 0xd0, 0x20, 0x1c, 0x00, 0x99, 0x4b, 0xe0, - 0x01, 0x9a, 0x12, 0x23, 0x13, 0x40, 0x12, 0x2b, 0x4b, 0xd1, 0x00, 0x2f, - 0x06, 0xd0, 0x20, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x6f, 0xfd, 0x06, 0x1e, - 0x0a, 0xd1, 0x42, 0xe0, 0x73, 0x7a, 0x02, 0x2b, 0x3f, 0xd0, 0x30, 0x1c, - 0xff, 0xf7, 0x40, 0xfd, 0x00, 0x28, 0x3a, 0xd0, 0x1f, 0x4e, 0x27, 0x76, - 0x00, 0x21, 0x20, 0x22, 0x30, 0x1c, 0x01, 0xf0, 0xbb, 0xfc, 0x30, 0x1c, - 0x03, 0xa9, 0x0b, 0x22, 0x01, 0xf0, 0xad, 0xfc, 0x1a, 0x4b, 0x1b, 0x68, - 0x00, 0x2b, 0x05, 0xd0, 0x30, 0x1c, 0x31, 0x1c, 0x10, 0x30, 0x0e, 0x31, - 0x98, 0x47, 0x06, 0xe0, 0x21, 0x22, 0x32, 0x74, 0xb3, 0x73, 0x28, 0x22, - 0x08, 0x23, 0x72, 0x74, 0xf3, 0x73, 0x73, 0x7c, 0x32, 0x7c, 0x1b, 0x02, - 0x13, 0x43, 0xff, 0x22, 0x1a, 0x40, 0x1b, 0x0a, 0xf3, 0x74, 0x73, 0x76, - 0xf3, 0x7b, 0xb2, 0x74, 0x32, 0x76, 0xb2, 0x7b, 0x1b, 0x02, 0x13, 0x43, - 0xb3, 0x75, 0x1b, 0x0a, 0xf3, 0x75, 0x00, 0xf0, 0x21, 0xf9, 0x00, 0x28, - 0x07, 0xd0, 0x21, 0x7e, 0x01, 0x9a, 0x20, 0x1c, 0xff, 0xf7, 0x26, 0xff, - 0x05, 0x1c, 0x00, 0xe0, 0x00, 0x25, 0x28, 0x1c, 0x07, 0xb0, 0xf0, 0xbd, - 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x44, 0x01, 0x00, 0x20, - 0x10, 0xb5, 0x00, 0x21, 0x04, 0x1c, 0xff, 0xf7, 0xbb, 0xfe, 0x00, 0x28, - 0x0b, 0xd0, 0x20, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x15, 0xfd, 0x00, 0x28, - 0x05, 0xd0, 0xe5, 0x23, 0x03, 0x70, 0x00, 0x23, 0x63, 0x72, 0x00, 0xf0, - 0xfb, 0xf8, 0x10, 0xbd, 0x10, 0xb5, 0x0a, 0x1c, 0x0a, 0x49, 0x8a, 0xb0, - 0x08, 0x31, 0x00, 0x23, 0x04, 0x1c, 0x00, 0x91, 0x69, 0x46, 0x4b, 0x72, - 0x01, 0x93, 0x68, 0x46, 0x21, 0x1c, 0x02, 0x23, 0xff, 0xf7, 0x42, 0xff, - 0x00, 0x28, 0x02, 0xd0, 0x68, 0x46, 0xff, 0xf7, 0xd7, 0xff, 0x0a, 0xb0, - 0x10, 0xbd, 0xc0, 0x46, 0x38, 0x4d, 0x00, 0x00, 0xf0, 0xb5, 0x43, 0x7a, - 0x87, 0xb0, 0x04, 0x1c, 0x0d, 0x1c, 0x03, 0x92, 0x01, 0x2b, 0x0d, 0xd1, - 0x03, 0x7a, 0x99, 0x07, 0x0a, 0xd5, 0x5a, 0x07, 0x0c, 0xd5, 0xe1, 0x69, - 0x22, 0x69, 0x8a, 0x42, 0x08, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0x06, 0xfe, - 0x00, 0x28, 0x03, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x00, 0x20, 0xaa, 0xe0, - 0x03, 0x9b, 0x01, 0x93, 0x3b, 0xe0, 0x60, 0x6a, 0x73, 0x0a, 0x07, 0x79, - 0xf6, 0x05, 0x01, 0x3f, 0x1f, 0x40, 0xff, 0xb2, 0xf6, 0x0d, 0x00, 0x2f, - 0x36, 0xd0, 0x80, 0x22, 0x92, 0x00, 0x92, 0x1b, 0x01, 0x99, 0x92, 0xb2, - 0x0b, 0x1c, 0x91, 0x42, 0x00, 0xd9, 0x13, 0x1c, 0x9b, 0xb2, 0x02, 0x93, - 0x63, 0x6a, 0xe1, 0x68, 0x1a, 0x7c, 0x02, 0x39, 0x91, 0x40, 0x5a, 0x69, - 0x8b, 0x18, 0x02, 0x9a, 0xdf, 0x19, 0x80, 0x23, 0x9b, 0x00, 0x9a, 0x42, - 0x3f, 0xd1, 0x44, 0x4b, 0x19, 0x68, 0xb9, 0x42, 0x02, 0xd1, 0x01, 0x22, - 0x52, 0x42, 0x1a, 0x60, 0x41, 0x4b, 0x39, 0x1c, 0x18, 0x68, 0x2a, 0x1c, - 0xff, 0xf7, 0x22, 0xfc, 0x00, 0x28, 0xc7, 0xd0, 0x80, 0x22, 0x92, 0x00, - 0xad, 0x18, 0x01, 0x99, 0x02, 0x9a, 0x8b, 0x1a, 0x21, 0x69, 0x9b, 0xb2, - 0x01, 0x93, 0x8b, 0x18, 0x23, 0x61, 0x01, 0x9a, 0x26, 0x69, 0x00, 0x2a, - 0xbf, 0xd1, 0x49, 0xe0, 0x00, 0x2e, 0xc6, 0xd1, 0xe1, 0x68, 0x00, 0x29, - 0x03, 0xd1, 0x23, 0x6a, 0x00, 0x2b, 0x16, 0xd1, 0x0f, 0xe0, 0x05, 0xaa, - 0x00, 0xf0, 0xe2, 0xf8, 0x00, 0x28, 0x58, 0xd0, 0x62, 0x6a, 0x05, 0x9b, - 0x01, 0x32, 0xd2, 0x7f, 0x10, 0x2a, 0x01, 0xd1, 0x2c, 0x4a, 0x00, 0xe0, - 0x2c, 0x4a, 0x93, 0x42, 0x05, 0xd3, 0x20, 0x1c, 0xff, 0xf7, 0x3c, 0xfc, - 0x00, 0x28, 0xaa, 0xd1, 0x98, 0xe7, 0xe3, 0x60, 0xa7, 0xe7, 0x00, 0x2e, - 0x0f, 0xd1, 0x23, 0x69, 0xe1, 0x69, 0x8b, 0x42, 0x0b, 0xd3, 0x00, 0xf0, - 0x59, 0xf8, 0x00, 0x28, 0x8c, 0xd0, 0x1f, 0x4b, 0x01, 0x21, 0x1f, 0x60, - 0x21, 0x4b, 0x1a, 0x78, 0x0a, 0x43, 0x1a, 0x70, 0x06, 0xe0, 0x38, 0x1c, - 0x01, 0x21, 0x00, 0xf0, 0x75, 0xf8, 0x00, 0x28, 0x00, 0xd1, 0x7d, 0xe7, - 0x1c, 0x4b, 0x2a, 0x1c, 0xf6, 0x18, 0x02, 0x9b, 0xf1, 0x18, 0x33, 0x1c, - 0x8b, 0x42, 0x04, 0xd0, 0x10, 0x78, 0x01, 0x32, 0x18, 0x70, 0x01, 0x33, - 0xf8, 0xe7, 0x9e, 0x1b, 0xad, 0x19, 0xa8, 0xe7, 0xe1, 0x69, 0x23, 0x7a, - 0x8e, 0x42, 0x01, 0xd9, 0xe6, 0x61, 0x06, 0xe0, 0x12, 0x4a, 0x12, 0x68, - 0x00, 0x2a, 0x06, 0xd0, 0x03, 0x9a, 0x00, 0x2a, 0x03, 0xd0, 0x80, 0x22, - 0x52, 0x42, 0x13, 0x43, 0x23, 0x72, 0x23, 0x7a, 0x19, 0x07, 0x01, 0xd4, - 0x03, 0x98, 0x06, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0x8b, 0xfd, 0x00, 0x28, - 0x00, 0xd1, 0x51, 0xe7, 0xf6, 0xe7, 0x07, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, - 0x00, 0x00, 0x00, 0x20, 0x4c, 0x01, 0x00, 0x20, 0xf8, 0xff, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x0f, 0x50, 0x03, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, - 0x44, 0x01, 0x00, 0x20, 0x07, 0xb5, 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, - 0x19, 0x1c, 0x01, 0x22, 0xff, 0xf7, 0x22, 0xff, 0x0e, 0xbd, 0x00, 0x00, - 0xf8, 0xb5, 0x0f, 0x4f, 0x01, 0x20, 0x3b, 0x78, 0x00, 0x2b, 0x18, 0xd0, - 0x0d, 0x4e, 0x0e, 0x4b, 0x0e, 0x4d, 0x19, 0x68, 0x30, 0x68, 0x2a, 0x1c, - 0xff, 0xf7, 0x80, 0xfb, 0x00, 0x28, 0x0e, 0xd0, 0x0b, 0x4c, 0x21, 0x68, - 0x00, 0x29, 0x07, 0xd0, 0x30, 0x68, 0x2a, 0x1c, 0xff, 0xf7, 0x76, 0xfb, - 0x00, 0x28, 0x04, 0xd0, 0x00, 0x23, 0x23, 0x60, 0x00, 0x23, 0x3b, 0x70, - 0x01, 0x20, 0xf8, 0xbd, 0x50, 0x03, 0x00, 0x20, 0x4c, 0x01, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x48, 0x01, 0x00, 0x20, - 0x70, 0xb5, 0x0d, 0x4d, 0x04, 0x1c, 0x2b, 0x68, 0x0e, 0x1c, 0x83, 0x42, - 0x0e, 0xd0, 0xff, 0xf7, 0xcd, 0xff, 0x00, 0x28, 0x01, 0xd1, 0x00, 0x20, - 0x0d, 0xe0, 0x08, 0x4b, 0x21, 0x1c, 0x18, 0x68, 0x07, 0x4a, 0xff, 0xf7, - 0x25, 0xfb, 0x00, 0x28, 0xf5, 0xd0, 0x2c, 0x60, 0x05, 0x4b, 0x01, 0x20, - 0x1a, 0x78, 0x16, 0x43, 0x1e, 0x70, 0x70, 0xbd, 0x00, 0x00, 0x00, 0x20, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, - 0x10, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xae, 0xff, 0x00, 0x28, 0x0f, 0xd0, - 0x00, 0x23, 0x08, 0x4a, 0x00, 0x21, 0x99, 0x54, 0x80, 0x22, 0x01, 0x33, - 0x92, 0x00, 0x93, 0x42, 0xf7, 0xd1, 0x05, 0x4b, 0x01, 0x20, 0x1c, 0x60, - 0x04, 0x4b, 0x1a, 0x78, 0x02, 0x43, 0x1a, 0x70, 0x10, 0xbd, 0xc0, 0x46, - 0x50, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, - 0xc3, 0x68, 0x70, 0xb5, 0x01, 0x33, 0x0c, 0x1c, 0x15, 0x1c, 0x99, 0x42, - 0x01, 0xd9, 0x00, 0x20, 0x21, 0xe0, 0x46, 0x1c, 0xf1, 0x7f, 0xc2, 0x69, - 0xe3, 0x09, 0x10, 0x29, 0x00, 0xd1, 0x23, 0x0a, 0x98, 0x18, 0x0d, 0x4b, - 0x1b, 0x68, 0x98, 0x42, 0x07, 0xd1, 0xf2, 0x7f, 0x0b, 0x4b, 0x10, 0x2a, - 0x09, 0xd1, 0xe4, 0xb2, 0x64, 0x00, 0x1b, 0x5b, 0x0b, 0xe0, 0x00, 0x21, - 0xff, 0xf7, 0x9e, 0xff, 0x00, 0x28, 0xf2, 0xd1, 0xe3, 0xe7, 0x7f, 0x22, - 0x14, 0x40, 0xa4, 0x00, 0x1b, 0x59, 0x1b, 0x01, 0x1b, 0x09, 0x2b, 0x60, - 0x01, 0x20, 0x70, 0xbd, 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, - 0x73, 0xb5, 0x05, 0x1c, 0x01, 0x91, 0x16, 0x1c, 0x00, 0x24, 0x28, 0x1c, - 0x01, 0x99, 0x01, 0xaa, 0xff, 0xf7, 0xc6, 0xff, 0x00, 0x28, 0x10, 0xd0, - 0x2a, 0x7c, 0x80, 0x23, 0x9b, 0x00, 0x93, 0x40, 0xe4, 0x18, 0x6b, 0x1c, - 0xdb, 0x7f, 0x01, 0x9a, 0x10, 0x2b, 0x01, 0xd1, 0x03, 0x4b, 0x00, 0xe0, - 0x03, 0x4b, 0x9a, 0x42, 0xe9, 0xd3, 0x34, 0x60, 0x01, 0x20, 0x76, 0xbd, - 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, 0xf7, 0xb5, 0x05, 0x1c, - 0x0c, 0x1c, 0x01, 0x92, 0x01, 0x29, 0x32, 0xd9, 0xc3, 0x68, 0x00, 0x20, - 0x01, 0x33, 0x99, 0x42, 0x2e, 0xd8, 0x6f, 0x1c, 0xfa, 0x7f, 0xee, 0x69, - 0xcb, 0x09, 0x10, 0x2a, 0x00, 0xd1, 0x0b, 0x0a, 0x9e, 0x19, 0x14, 0x4b, - 0x1b, 0x68, 0x9e, 0x42, 0x08, 0xd1, 0xfa, 0x7f, 0x12, 0x4b, 0x10, 0x2a, - 0x0b, 0xd1, 0xe4, 0xb2, 0x01, 0x9a, 0x64, 0x00, 0x1a, 0x53, 0x0b, 0xe0, - 0x30, 0x1c, 0x00, 0x21, 0xff, 0xf7, 0x48, 0xff, 0x00, 0x28, 0xf0, 0xd1, - 0x12, 0xe0, 0x7f, 0x22, 0x14, 0x40, 0x01, 0x9a, 0xa4, 0x00, 0x1a, 0x51, - 0x09, 0x4b, 0x01, 0x20, 0x1a, 0x78, 0x02, 0x43, 0x1a, 0x70, 0x2b, 0x7e, - 0x83, 0x42, 0x05, 0xd9, 0xab, 0x68, 0xf6, 0x18, 0x05, 0x4b, 0x1e, 0x60, - 0x00, 0xe0, 0x00, 0x20, 0xfe, 0xbd, 0xc0, 0x46, 0x00, 0x00, 0x00, 0x20, - 0x50, 0x01, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, 0x48, 0x01, 0x00, 0x20, - 0xf0, 0xb5, 0x15, 0x68, 0x87, 0xb0, 0x06, 0x1c, 0x02, 0x91, 0x17, 0x1c, - 0x00, 0x2d, 0x03, 0xd0, 0x00, 0x21, 0x01, 0x35, 0x01, 0x91, 0x06, 0xe0, - 0x02, 0x9b, 0x05, 0x68, 0x01, 0x3b, 0x5a, 0x42, 0x53, 0x41, 0xdb, 0xb2, - 0x01, 0x93, 0xf2, 0x68, 0x00, 0x23, 0x01, 0x32, 0x03, 0x92, 0x2c, 0x1c, - 0x00, 0x93, 0x00, 0x99, 0xf2, 0x68, 0x91, 0x42, 0x21, 0xd2, 0x03, 0x9b, - 0x9c, 0x42, 0x01, 0xd9, 0x02, 0x24, 0x25, 0x1c, 0x30, 0x1c, 0x21, 0x1c, - 0x05, 0xaa, 0xff, 0xf7, 0x43, 0xff, 0x00, 0x28, 0x15, 0xd0, 0x05, 0x99, - 0x63, 0x1c, 0x00, 0x29, 0x01, 0xd0, 0x1d, 0x1c, 0x03, 0xe0, 0x02, 0x99, - 0x5a, 0x1b, 0x8a, 0x42, 0x04, 0xd0, 0x00, 0x9a, 0x1c, 0x1c, 0x01, 0x32, - 0x00, 0x92, 0xe0, 0xe7, 0x30, 0x1c, 0x21, 0x1c, 0x13, 0x4a, 0xff, 0xf7, - 0x7f, 0xff, 0x00, 0x28, 0x0b, 0xd1, 0x00, 0x20, 0x1d, 0xe0, 0x63, 0x1e, - 0x30, 0x1c, 0x19, 0x1c, 0x22, 0x1c, 0x00, 0x93, 0xff, 0xf7, 0x74, 0xff, - 0x00, 0x28, 0xf4, 0xd0, 0x00, 0x9c, 0xac, 0x42, 0xf3, 0xd8, 0x39, 0x68, - 0x00, 0x29, 0x06, 0xd1, 0x01, 0x99, 0x3d, 0x60, 0x00, 0x29, 0x09, 0xd0, - 0x01, 0x35, 0x35, 0x60, 0x06, 0xe0, 0x30, 0x1c, 0x2a, 0x1c, 0xff, 0xf7, - 0x61, 0xff, 0x00, 0x28, 0xf2, 0xd1, 0xe0, 0xe7, 0x01, 0x20, 0x07, 0xb0, - 0xf0, 0xbd, 0xc0, 0x46, 0xff, 0xff, 0xff, 0x0f, 0x02, 0x23, 0x37, 0xb5, - 0x05, 0x1c, 0x0c, 0x1c, 0x03, 0x60, 0x28, 0x1c, 0x21, 0x1c, 0x01, 0xaa, - 0xff, 0xf7, 0xfc, 0xfe, 0x00, 0x28, 0x12, 0xd0, 0x28, 0x1c, 0x21, 0x1c, - 0x00, 0x22, 0xff, 0xf7, 0x47, 0xff, 0x00, 0x28, 0x0b, 0xd0, 0x6b, 0x1c, - 0xdb, 0x7f, 0x01, 0x9c, 0x10, 0x2b, 0x01, 0xd1, 0x04, 0x4b, 0x00, 0xe0, - 0x04, 0x4b, 0x9c, 0x42, 0xe7, 0xd3, 0x01, 0x20, 0x00, 0xe0, 0x00, 0x20, - 0x3e, 0xbd, 0xc0, 0x46, 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, - 0xf8, 0xb5, 0x44, 0x4b, 0x04, 0x1c, 0x15, 0x1c, 0x19, 0x60, 0x29, 0xd0, - 0x04, 0x2a, 0x01, 0xd9, 0x00, 0x20, 0x7d, 0xe0, 0x00, 0x20, 0x01, 0x1c, - 0xff, 0xf7, 0x90, 0xfe, 0x00, 0x28, 0xf7, 0xd0, 0x2d, 0x01, 0x3d, 0x4b, - 0xa9, 0x35, 0xff, 0x35, 0x5d, 0x19, 0xaa, 0x79, 0xab, 0x1d, 0x50, 0x06, - 0xee, 0xd1, 0xea, 0x7c, 0xa9, 0x7c, 0x12, 0x02, 0x0a, 0x43, 0x29, 0x7d, - 0x09, 0x04, 0x0a, 0x43, 0x69, 0x7d, 0x09, 0x06, 0x0a, 0x43, 0x63, 0x2a, - 0xe2, 0xd9, 0xaa, 0x7b, 0xed, 0x7b, 0x2d, 0x02, 0x15, 0x43, 0x9a, 0x7a, - 0xdb, 0x7a, 0x12, 0x04, 0x15, 0x43, 0x1b, 0x06, 0x1d, 0x43, 0xd7, 0xd0, - 0x28, 0x1c, 0x00, 0x21, 0xff, 0xf7, 0x6a, 0xfe, 0x00, 0x28, 0xd1, 0xd0, - 0x2a, 0x4b, 0x19, 0x7b, 0xda, 0x7a, 0x09, 0x02, 0x11, 0x43, 0x80, 0x22, - 0x92, 0x00, 0x91, 0x42, 0xc8, 0xd1, 0x1a, 0x7c, 0x00, 0x2a, 0xc5, 0xd0, - 0xd9, 0x89, 0x00, 0x29, 0xc2, 0xd0, 0x59, 0x7b, 0x00, 0x29, 0xbf, 0xd0, - 0x22, 0x76, 0x00, 0x22, 0x21, 0x71, 0x22, 0x74, 0x22, 0x7c, 0x01, 0x20, - 0x90, 0x40, 0x81, 0x42, 0x04, 0xd0, 0x50, 0x1c, 0x20, 0x74, 0x07, 0x2a, - 0xf6, 0xd9, 0xb1, 0xe7, 0xd9, 0x8a, 0x00, 0x29, 0x00, 0xd1, 0x59, 0x6a, - 0xa1, 0x60, 0xd8, 0x89, 0x28, 0x18, 0xe0, 0x61, 0x1f, 0x69, 0x3e, 0x02, - 0x36, 0x0c, 0x66, 0x84, 0xb7, 0xb2, 0x1e, 0x7c, 0x71, 0x43, 0x0e, 0x18, - 0x13, 0x48, 0x79, 0x01, 0x09, 0x18, 0x49, 0x12, 0x71, 0x18, 0x66, 0x62, - 0x61, 0x61, 0x18, 0x7d, 0xde, 0x7c, 0x00, 0x02, 0x30, 0x43, 0x00, 0xd1, - 0x18, 0x6a, 0x6d, 0x1a, 0x28, 0x18, 0xd0, 0x40, 0x02, 0x1c, 0xe0, 0x60, - 0x0b, 0x48, 0x61, 0x1c, 0x82, 0x42, 0x01, 0xd8, 0x0c, 0x23, 0x07, 0xe0, - 0x09, 0x48, 0x82, 0x42, 0x01, 0xd8, 0x10, 0x23, 0x02, 0xe0, 0xdb, 0x6a, - 0x63, 0x62, 0x20, 0x23, 0xcb, 0x77, 0x01, 0x20, 0xf8, 0xbd, 0xc0, 0x46, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0xff, 0x01, 0x00, 0x00, - 0xf4, 0x0f, 0x00, 0x00, 0xf4, 0xff, 0x00, 0x00, 0x08, 0xb5, 0x05, 0x49, - 0x05, 0x4a, 0x06, 0x48, 0x00, 0xf0, 0x10, 0xf8, 0x05, 0x4b, 0x06, 0x49, - 0x00, 0x22, 0x1a, 0x70, 0x5a, 0x54, 0x08, 0xbd, 0x00, 0x4e, 0x00, 0x00, - 0x01, 0x04, 0x00, 0x00, 0x54, 0x03, 0x00, 0x20, 0x6c, 0x03, 0x00, 0x20, - 0x02, 0x04, 0x00, 0x00, 0x30, 0xb5, 0x09, 0x4c, 0x09, 0x4b, 0xa5, 0x68, - 0x6d, 0x03, 0x6d, 0x0f, 0xad, 0x00, 0xeb, 0x58, 0x03, 0x60, 0xa4, 0x68, - 0x01, 0x61, 0xa4, 0xb2, 0x44, 0x60, 0x5c, 0x43, 0x9b, 0x00, 0x84, 0x60, - 0xc3, 0x60, 0x42, 0x61, 0x30, 0xbd, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, - 0x00, 0x53, 0x00, 0x00, 0xf7, 0xb5, 0x1f, 0x4e, 0x80, 0x27, 0x75, 0x68, - 0x03, 0x33, 0x3d, 0x43, 0x9b, 0x08, 0x75, 0x60, 0x00, 0x2b, 0x34, 0xd0, - 0x1b, 0x4d, 0x35, 0x80, 0x35, 0x7d, 0xef, 0x07, 0xfc, 0xd5, 0x1d, 0x1c, - 0x5f, 0x1b, 0x01, 0x97, 0x07, 0x68, 0xbf, 0x08, 0xbc, 0x46, 0x01, 0x9f, - 0x67, 0x45, 0x1f, 0xd2, 0x00, 0x2d, 0x1d, 0xd0, 0x17, 0x78, 0x01, 0x3d, - 0x01, 0x97, 0xff, 0x27, 0xbc, 0x43, 0x01, 0x9f, 0x3c, 0x43, 0x57, 0x78, - 0x3f, 0x02, 0x01, 0x97, 0x0f, 0x4f, 0x3c, 0x40, 0x01, 0x9f, 0x3c, 0x43, - 0x97, 0x78, 0x3f, 0x04, 0xbc, 0x46, 0x0d, 0x4f, 0x3c, 0x40, 0xd7, 0x78, - 0xa4, 0xb2, 0x3f, 0x06, 0x00, 0x97, 0x67, 0x46, 0x3c, 0x43, 0x00, 0x9f, - 0x04, 0x32, 0x3c, 0x43, 0x10, 0xc1, 0xd7, 0xe7, 0x07, 0x4b, 0x33, 0x80, - 0x33, 0x7d, 0xdf, 0x07, 0xfc, 0xd5, 0x2b, 0x1c, 0xc8, 0xe7, 0xf7, 0xbd, - 0x00, 0x40, 0x00, 0x41, 0x44, 0xa5, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xff, 0x04, 0xa5, 0xff, 0xff, 0x04, 0x4b, 0x05, 0x4a, - 0x49, 0x08, 0xd9, 0x61, 0x1a, 0x80, 0x1a, 0x7d, 0xd1, 0x07, 0xfc, 0xd5, - 0x70, 0x47, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, 0x02, 0xa5, 0xff, 0xff, - 0x70, 0xb5, 0x05, 0x1c, 0x0c, 0x1c, 0x16, 0x1c, 0xeb, 0x68, 0x28, 0x1c, - 0x21, 0x1c, 0x9e, 0x42, 0x05, 0xd9, 0xff, 0xf7, 0xe7, 0xff, 0xeb, 0x68, - 0xe4, 0x18, 0xf6, 0x1a, 0xf4, 0xe7, 0xff, 0xf7, 0xe1, 0xff, 0x70, 0xbd, - 0x43, 0x7a, 0x00, 0x2b, 0x04, 0xd1, 0x83, 0x72, 0xc3, 0x72, 0xc3, 0x60, - 0x01, 0x23, 0x43, 0x72, 0x70, 0x47, 0x30, 0xb5, 0x85, 0xb0, 0x04, 0x1c, - 0x02, 0xad, 0x00, 0x68, 0x02, 0x91, 0x03, 0x92, 0x00, 0xf0, 0x84, 0xfc, - 0x6b, 0x79, 0xe1, 0x79, 0x22, 0x7a, 0x00, 0x93, 0x20, 0x68, 0x00, 0x23, - 0x00, 0xf0, 0x1e, 0xfd, 0x29, 0x79, 0x20, 0x68, 0x02, 0x9a, 0x00, 0xf0, - 0x47, 0xfc, 0x20, 0x68, 0x00, 0xf0, 0x6a, 0xfc, 0x05, 0xb0, 0x30, 0xbd, - 0x70, 0xb5, 0x04, 0x1c, 0x18, 0x26, 0xff, 0xf7, 0xd7, 0xff, 0x20, 0x79, - 0x33, 0x1c, 0x43, 0x43, 0x0d, 0x4d, 0x08, 0x21, 0xeb, 0x18, 0x59, 0x56, - 0x00, 0xf0, 0x14, 0xfb, 0xa0, 0x79, 0x33, 0x1c, 0x43, 0x43, 0x08, 0x21, - 0xeb, 0x18, 0x59, 0x56, 0x00, 0xf0, 0x0c, 0xfb, 0x60, 0x79, 0x08, 0x21, - 0x46, 0x43, 0xad, 0x19, 0x69, 0x56, 0x00, 0xf0, 0x05, 0xfb, 0x04, 0x4b, - 0x20, 0x1c, 0x06, 0xcb, 0xff, 0xf7, 0xc3, 0xff, 0x70, 0xbd, 0xc0, 0x46, - 0x20, 0x53, 0x00, 0x00, 0x70, 0x07, 0x00, 0x20, 0x07, 0xb5, 0x83, 0x7a, - 0x00, 0x91, 0x01, 0x92, 0x00, 0x2b, 0x0d, 0xd0, 0x9a, 0x07, 0x06, 0xd5, - 0xef, 0xf3, 0x10, 0x83, 0x5a, 0x42, 0x53, 0x41, 0xc3, 0x72, 0x72, 0xb6, - 0x04, 0xe0, 0xda, 0x07, 0x02, 0xd5, 0x82, 0x89, 0x03, 0x4b, 0x9a, 0x60, - 0x00, 0x99, 0x01, 0x9a, 0xff, 0xf7, 0xa5, 0xff, 0x07, 0xbd, 0xc0, 0x46, - 0x00, 0x18, 0x00, 0x40, 0x83, 0x7a, 0x00, 0x2b, 0x0b, 0xd0, 0x9a, 0x07, - 0x04, 0xd5, 0xc3, 0x7a, 0x00, 0x2b, 0x06, 0xd0, 0x62, 0xb6, 0x04, 0xe0, - 0xda, 0x07, 0x02, 0xd5, 0x82, 0x89, 0x01, 0x4b, 0xda, 0x60, 0x70, 0x47, - 0x00, 0x18, 0x00, 0x40, 0x08, 0xb5, 0x00, 0x68, 0x00, 0xf0, 0x21, 0xfc, - 0x08, 0xbd, 0x00, 0x00, 0x0f, 0x4b, 0x10, 0x4a, 0x10, 0x49, 0x1a, 0x60, - 0x00, 0x22, 0x5a, 0x71, 0x1a, 0x71, 0x0f, 0x4b, 0x0f, 0x48, 0x19, 0x60, - 0x0a, 0x21, 0x19, 0x71, 0x09, 0x21, 0x99, 0x71, 0x08, 0x21, 0x59, 0x71, - 0x03, 0x21, 0x5a, 0x72, 0xda, 0x71, 0x19, 0x72, 0x0a, 0x4b, 0x18, 0x60, - 0x1d, 0x20, 0x18, 0x71, 0x1b, 0x20, 0x98, 0x71, 0x1a, 0x20, 0x5a, 0x72, - 0x58, 0x71, 0xda, 0x71, 0x19, 0x72, 0x70, 0x47, 0x70, 0x07, 0x00, 0x20, - 0x00, 0x09, 0x3d, 0x00, 0x00, 0x08, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x04, 0x08, 0x00, 0x20, 0x88, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x02, 0x48, - 0x00, 0xf0, 0xfc, 0xfc, 0x08, 0xbd, 0xc0, 0x46, 0x98, 0x07, 0x00, 0x20, - 0x13, 0xb5, 0x12, 0x49, 0x12, 0x48, 0x00, 0xf0, 0x3d, 0xfb, 0x12, 0x49, - 0x12, 0x48, 0x00, 0xf0, 0x39, 0xfb, 0x12, 0x49, 0x12, 0x48, 0x00, 0xf0, - 0x35, 0xfb, 0x12, 0x49, 0x12, 0x48, 0x00, 0xf0, 0x31, 0xfb, 0x12, 0x49, - 0x12, 0x48, 0x00, 0xf0, 0x2d, 0xfb, 0x12, 0x4c, 0x12, 0x49, 0x20, 0x1c, - 0x00, 0xf0, 0x28, 0xfb, 0x03, 0x23, 0x00, 0x93, 0x01, 0x23, 0x01, 0x93, - 0x21, 0x1c, 0x0d, 0x22, 0x0e, 0x23, 0x0e, 0x48, 0x00, 0xf0, 0xb0, 0xfc, - 0x13, 0xbd, 0xc0, 0x46, 0x00, 0x08, 0x00, 0x42, 0xfc, 0x07, 0x00, 0x20, - 0x00, 0x0c, 0x00, 0x42, 0x00, 0x08, 0x00, 0x20, 0x00, 0x10, 0x00, 0x42, - 0x04, 0x08, 0x00, 0x20, 0x00, 0x14, 0x00, 0x42, 0xf8, 0x07, 0x00, 0x20, - 0x00, 0x18, 0x00, 0x42, 0x08, 0x08, 0x00, 0x20, 0x0c, 0x08, 0x00, 0x20, - 0x00, 0x1c, 0x00, 0x42, 0x98, 0x07, 0x00, 0x20, 0xfe, 0xe7, 0x00, 0x00, - 0x08, 0xb5, 0x03, 0x4b, 0x1b, 0x68, 0x00, 0x2b, 0x00, 0xd0, 0x98, 0x47, - 0x08, 0xbd, 0xc0, 0x46, 0x10, 0x08, 0x00, 0x20, 0x38, 0xb5, 0x0f, 0x49, - 0x0f, 0x4c, 0xa1, 0x42, 0x04, 0xd1, 0x00, 0xf0, 0x4f, 0xf8, 0xfe, 0xf7, - 0xbb, 0xfa, 0x0b, 0xe0, 0x0c, 0x4d, 0x8d, 0x42, 0xf7, 0xd0, 0x00, 0x23, - 0xca, 0x18, 0xe8, 0x18, 0xa2, 0x42, 0x04, 0xd2, 0x00, 0x68, 0x04, 0x33, - 0x10, 0x60, 0xf7, 0xe7, 0xfe, 0xe7, 0x90, 0x42, 0xeb, 0xd0, 0x06, 0x4b, - 0x06, 0x4a, 0x93, 0x42, 0xe7, 0xd2, 0x00, 0x22, 0x04, 0xc3, 0xf9, 0xe7, - 0x00, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x00, 0x20, 0x40, 0x57, 0x00, 0x00, - 0xa0, 0x00, 0x00, 0x20, 0xf4, 0x0c, 0x00, 0x20, 0x08, 0xb5, 0x00, 0xf0, - 0x26, 0xf8, 0x00, 0x28, 0x01, 0xd1, 0x00, 0xf0, 0x17, 0xf8, 0x08, 0xbd, - 0x01, 0x4b, 0x18, 0x68, 0x70, 0x47, 0xc0, 0x46, 0x14, 0x08, 0x00, 0x20, - 0x70, 0xb5, 0x04, 0x1e, 0x08, 0xd0, 0x05, 0x4b, 0x1d, 0x68, 0x1e, 0x1c, - 0x00, 0xf0, 0x12, 0xf8, 0x33, 0x68, 0x5b, 0x1b, 0xa3, 0x42, 0xf9, 0xd3, - 0x70, 0xbd, 0xc0, 0x46, 0x14, 0x08, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, - 0x1a, 0x68, 0x01, 0x32, 0x1a, 0x60, 0x00, 0xf0, 0x6d, 0xfa, 0x08, 0xbd, - 0x14, 0x08, 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 0x00, 0x00, - 0x70, 0xb5, 0x4c, 0x4a, 0x1e, 0x21, 0x53, 0x68, 0x02, 0x20, 0x8b, 0x43, - 0x03, 0x43, 0x4a, 0x49, 0x53, 0x60, 0x8b, 0x69, 0x08, 0x24, 0x23, 0x43, - 0x8b, 0x61, 0x48, 0x4c, 0x48, 0x4b, 0x9c, 0x82, 0x9c, 0x8a, 0x20, 0x43, - 0x98, 0x82, 0x10, 0x1c, 0xda, 0x68, 0x94, 0x07, 0xfc, 0xd5, 0x45, 0x4a, - 0x01, 0x24, 0x14, 0x70, 0x14, 0x78, 0xe5, 0x07, 0x04, 0xd5, 0x42, 0x4c, - 0x64, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xf7, 0xdb, 0x01, 0x24, 0x94, 0x60, - 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, 0x3d, 0x4d, 0x3c, 0x4c, - 0x65, 0x60, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, 0x82, 0x25, - 0x38, 0x4c, 0xed, 0x01, 0x65, 0x80, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, - 0xfb, 0xdb, 0x9c, 0x8c, 0x80, 0x25, 0xac, 0x43, 0x9c, 0x84, 0xdc, 0x68, - 0xe6, 0x06, 0xfc, 0xd5, 0x33, 0x4d, 0x30, 0x4c, 0xe5, 0x62, 0xdd, 0x68, - 0x2e, 0x4c, 0xee, 0x06, 0xfb, 0xd5, 0xa5, 0x8c, 0x30, 0x4e, 0x35, 0x43, - 0xa5, 0x84, 0xdd, 0x68, 0x2a, 0x4c, 0xee, 0x06, 0xfb, 0xd5, 0xa5, 0x8c, - 0x02, 0x26, 0x35, 0x43, 0xa5, 0x84, 0xdc, 0x68, 0x25, 0x06, 0xfc, 0xd5, - 0x25, 0x4c, 0xe4, 0x68, 0x66, 0x06, 0xf8, 0xd5, 0xdc, 0x68, 0xe5, 0x06, - 0xfc, 0xd5, 0x00, 0x24, 0x94, 0x60, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, - 0xfb, 0xdb, 0x24, 0x4d, 0x1f, 0x4c, 0x65, 0x60, 0x55, 0x78, 0x1e, 0x4c, - 0x6d, 0xb2, 0x00, 0x2d, 0xfa, 0xdb, 0x1e, 0x6a, 0x20, 0x4d, 0x35, 0x40, - 0x80, 0x26, 0x76, 0x00, 0x35, 0x43, 0x1d, 0x62, 0x1d, 0x6a, 0x80, 0x26, - 0xb5, 0x43, 0x1d, 0x62, 0x03, 0x23, 0xa3, 0x60, 0x1b, 0x4b, 0x63, 0x60, - 0x53, 0x78, 0x5b, 0xb2, 0x00, 0x2b, 0xfb, 0xdb, 0x00, 0x23, 0x0b, 0x72, - 0x18, 0x4a, 0x4b, 0x72, 0x8b, 0x72, 0xcb, 0x72, 0x17, 0x4b, 0xff, 0x21, - 0x1a, 0x60, 0x17, 0x4b, 0x17, 0x4a, 0x1b, 0x68, 0x12, 0x68, 0x5c, 0x01, - 0xd2, 0x0e, 0x21, 0x40, 0x11, 0x43, 0x9a, 0x06, 0x52, 0x0f, 0x12, 0x02, - 0x0b, 0x1c, 0x13, 0x43, 0x12, 0x4a, 0x13, 0x85, 0x43, 0x68, 0x80, 0x22, - 0x13, 0x43, 0x43, 0x60, 0x70, 0xbd, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, - 0x00, 0x04, 0x00, 0x40, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x40, - 0x00, 0x0c, 0x00, 0x40, 0x01, 0x05, 0x01, 0x00, 0xb8, 0x05, 0xff, 0x7d, - 0x04, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, 0xff, 0xfc, 0xff, 0xff, - 0x03, 0x06, 0x01, 0x00, 0x00, 0x6c, 0xdc, 0x02, 0x04, 0x00, 0x00, 0x20, - 0x24, 0x60, 0x80, 0x00, 0x20, 0x60, 0x80, 0x00, 0x00, 0x40, 0x00, 0x42, - 0x31, 0x4b, 0xfa, 0x21, 0x18, 0x68, 0x10, 0xb5, 0x89, 0x00, 0x00, 0xf0, - 0xff, 0xfd, 0x2f, 0x4b, 0x01, 0x38, 0x98, 0x42, 0x24, 0xd8, 0x2e, 0x4a, - 0x2e, 0x4b, 0x50, 0x60, 0x18, 0x6a, 0xc0, 0x21, 0x00, 0x02, 0x00, 0x0a, - 0x09, 0x06, 0x01, 0x43, 0x19, 0x62, 0x00, 0x24, 0x07, 0x21, 0x94, 0x60, - 0x11, 0x60, 0x19, 0x6a, 0x80, 0x22, 0x09, 0x02, 0x09, 0x0a, 0x12, 0x06, - 0x0a, 0x43, 0x1a, 0x62, 0x25, 0x4b, 0xfc, 0x21, 0x1a, 0x6a, 0x0a, 0x43, - 0x1a, 0x62, 0x19, 0x6a, 0xfc, 0x22, 0x92, 0x01, 0x0a, 0x43, 0x1a, 0x62, - 0x19, 0x6a, 0xa0, 0x22, 0xd2, 0x02, 0x0a, 0x43, 0x1a, 0x62, 0x00, 0xe0, - 0xfe, 0xe7, 0x20, 0x1c, 0x00, 0x21, 0x01, 0x34, 0x00, 0xf0, 0x70, 0xf8, - 0x16, 0x2c, 0xf8, 0xd1, 0x1a, 0x4c, 0x63, 0x78, 0x5b, 0xb2, 0x00, 0x2b, - 0xfa, 0xdb, 0x19, 0x4b, 0x63, 0x80, 0x19, 0x4b, 0x5a, 0x7e, 0xd2, 0x09, - 0x01, 0x2a, 0xfa, 0xd0, 0xe4, 0x22, 0xd2, 0x00, 0x9a, 0x80, 0x3f, 0x22, - 0xda, 0x70, 0x59, 0x7e, 0x13, 0x4a, 0xc9, 0x09, 0x01, 0x29, 0xfa, 0xd0, - 0xc0, 0x23, 0x5b, 0x01, 0x00, 0x20, 0x13, 0x61, 0x90, 0x70, 0x00, 0xf0, - 0x23, 0xf8, 0x63, 0x78, 0x5b, 0xb2, 0x00, 0x2b, 0xfb, 0xdb, 0x0d, 0x4a, - 0x09, 0x4b, 0x5a, 0x80, 0x0c, 0x4b, 0xda, 0x79, 0xd2, 0x09, 0x01, 0x2a, - 0xfa, 0xd0, 0x41, 0x22, 0x5a, 0x70, 0x10, 0xbd, 0x04, 0x00, 0x00, 0x20, - 0xff, 0xff, 0xff, 0x00, 0x10, 0xe0, 0x00, 0xe0, 0x00, 0xed, 0x00, 0xe0, - 0x00, 0x04, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x40, 0x1e, 0x40, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x42, 0x21, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x42, - 0x00, 0xb5, 0x14, 0x4a, 0x51, 0x7e, 0x13, 0x1c, 0xc9, 0x09, 0x01, 0x29, - 0xf9, 0xd0, 0x01, 0x38, 0x04, 0x28, 0x13, 0xd8, 0x19, 0x69, 0x10, 0x4a, - 0x0a, 0x40, 0x1a, 0x61, 0x5a, 0x78, 0x0f, 0x21, 0x8a, 0x43, 0x00, 0xf0, - 0x71, 0xfd, 0x03, 0x05, 0x09, 0x07, 0x03, 0x00, 0x01, 0x21, 0x02, 0xe0, - 0x03, 0x21, 0x00, 0xe0, 0x02, 0x21, 0x0a, 0x43, 0x5a, 0x70, 0x0a, 0xe0, - 0x11, 0x69, 0xf0, 0x23, 0x1b, 0x05, 0x0b, 0x43, 0x13, 0x61, 0x53, 0x78, - 0x0f, 0x21, 0x8b, 0x43, 0x02, 0x21, 0x0b, 0x43, 0x53, 0x70, 0x00, 0xbd, - 0x00, 0x40, 0x00, 0x42, 0xff, 0xff, 0xff, 0xf0, 0x10, 0xb5, 0x18, 0x24, - 0x02, 0x1c, 0x20, 0x1c, 0x50, 0x43, 0x2a, 0x4b, 0x18, 0x18, 0x00, 0x7a, - 0x40, 0xb2, 0x01, 0x30, 0x4c, 0xd0, 0x03, 0x29, 0x4a, 0xd8, 0x08, 0x1c, - 0x21, 0x1c, 0x00, 0xf0, 0x45, 0xfd, 0x02, 0x33, 0x11, 0x21, 0x62, 0x43, - 0x98, 0x56, 0x9a, 0x18, 0xc3, 0x01, 0x22, 0x48, 0x52, 0x68, 0x1b, 0x18, - 0x99, 0x18, 0x40, 0x31, 0x02, 0x20, 0x08, 0x70, 0x01, 0x21, 0x91, 0x40, - 0x59, 0x60, 0x35, 0xe0, 0x62, 0x43, 0x98, 0x56, 0x1b, 0x49, 0x9a, 0x18, - 0x52, 0x68, 0xc3, 0x01, 0x5b, 0x18, 0x99, 0x18, 0x40, 0x31, 0x06, 0x20, - 0x08, 0x70, 0x01, 0x21, 0x91, 0x40, 0x59, 0x60, 0x99, 0x61, 0x25, 0xe0, - 0x51, 0x43, 0x5a, 0x56, 0x13, 0x48, 0x59, 0x18, 0x4b, 0x68, 0xd2, 0x01, - 0x11, 0x18, 0xc8, 0x18, 0x40, 0x30, 0x06, 0x24, 0x04, 0x70, 0x01, 0x20, - 0x98, 0x40, 0x48, 0x60, 0x0e, 0x49, 0x52, 0x18, 0x50, 0x60, 0x13, 0xe0, - 0x51, 0x43, 0x5a, 0x56, 0x59, 0x18, 0x0a, 0x4b, 0x49, 0x68, 0xd2, 0x01, - 0xd2, 0x18, 0x53, 0x18, 0x40, 0x33, 0x18, 0x78, 0x02, 0x24, 0x20, 0x43, - 0x18, 0x70, 0x18, 0x78, 0x04, 0x24, 0xa0, 0x43, 0x18, 0x70, 0x01, 0x23, - 0x8b, 0x40, 0x93, 0x60, 0x10, 0xbd, 0xc0, 0x46, 0x20, 0x53, 0x00, 0x00, - 0x00, 0x44, 0x00, 0x41, 0x10, 0x44, 0x00, 0x41, 0x18, 0x23, 0x58, 0x43, - 0x13, 0x4a, 0xf0, 0xb5, 0x13, 0x18, 0x08, 0x24, 0x1c, 0x57, 0x01, 0x34, - 0x1f, 0xd0, 0x82, 0x56, 0x10, 0x4e, 0xd2, 0x01, 0x5d, 0x68, 0x01, 0x24, - 0x90, 0x19, 0x23, 0x1c, 0x86, 0x68, 0xab, 0x40, 0x1e, 0x42, 0x0b, 0xd1, - 0x0e, 0x1c, 0x77, 0x1e, 0xbe, 0x41, 0x40, 0x19, 0x34, 0x40, 0x40, 0x30, - 0xa5, 0x00, 0x04, 0x78, 0x04, 0x26, 0xb4, 0x43, 0x2c, 0x43, 0x04, 0x70, - 0x00, 0x29, 0x03, 0xd1, 0x05, 0x49, 0x52, 0x18, 0x53, 0x60, 0x02, 0xe0, - 0x02, 0x4e, 0x92, 0x19, 0x93, 0x61, 0xf0, 0xbd, 0x20, 0x53, 0x00, 0x00, - 0x00, 0x44, 0x00, 0x41, 0x10, 0x44, 0x00, 0x41, 0x18, 0x22, 0x42, 0x43, - 0xf8, 0xb5, 0x2d, 0x4d, 0x08, 0x24, 0xaa, 0x18, 0x14, 0x57, 0x03, 0x1c, - 0x62, 0x1c, 0x50, 0xd0, 0x48, 0x1c, 0x00, 0x24, 0x0c, 0x28, 0x4c, 0xd8, - 0x00, 0xf0, 0xb6, 0xfc, 0x07, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, - 0x1e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x01, 0x24, 0x64, 0x42, 0x40, 0xe0, - 0x09, 0x29, 0x02, 0xd1, 0x18, 0x1c, 0x00, 0x21, 0x03, 0xe0, 0x0a, 0x29, - 0x04, 0xd1, 0x18, 0x1c, 0x02, 0x21, 0xff, 0xf7, 0x4b, 0xff, 0x23, 0xe0, - 0x00, 0x24, 0x0b, 0x29, 0x31, 0xd1, 0x18, 0x1c, 0x01, 0x21, 0xff, 0xf7, - 0x43, 0xff, 0x2c, 0xe0, 0x18, 0x22, 0x53, 0x43, 0xea, 0x18, 0x52, 0x68, - 0xeb, 0x56, 0x01, 0x20, 0x14, 0x1c, 0x04, 0x40, 0x55, 0x08, 0xdb, 0x01, - 0x00, 0x2c, 0x11, 0xd0, 0x12, 0x4c, 0x1b, 0x19, 0x5d, 0x19, 0x30, 0x35, - 0x2e, 0x78, 0x0c, 0x01, 0x0f, 0x21, 0x31, 0x40, 0x21, 0x43, 0x9a, 0x18, - 0xc9, 0xb2, 0x29, 0x70, 0x40, 0x32, 0x13, 0x78, 0x18, 0x43, 0x10, 0x70, - 0x00, 0x24, 0x0e, 0xe0, 0x09, 0x4e, 0x0f, 0x27, 0x9b, 0x19, 0x5d, 0x19, - 0x30, 0x35, 0x2e, 0x78, 0x9a, 0x18, 0xbe, 0x43, 0x31, 0x43, 0xc9, 0xb2, - 0x29, 0x70, 0x40, 0x32, 0x13, 0x78, 0x18, 0x43, 0x10, 0x70, 0x20, 0x1c, - 0xf8, 0xbd, 0xc0, 0x46, 0x20, 0x53, 0x00, 0x00, 0x00, 0x44, 0x00, 0x41, - 0xf7, 0xb5, 0x8a, 0x18, 0x06, 0x1c, 0x0d, 0x1c, 0x01, 0x92, 0x0c, 0x1c, - 0x01, 0x9b, 0x67, 0x1b, 0x9c, 0x42, 0x07, 0xd0, 0x33, 0x68, 0x21, 0x78, - 0x1b, 0x68, 0x30, 0x1c, 0x98, 0x47, 0x01, 0x34, 0x00, 0x28, 0xf3, 0xd1, - 0x38, 0x1c, 0xfe, 0xbd, 0x15, 0x4a, 0x13, 0x68, 0x58, 0x1c, 0x25, 0xd0, - 0x01, 0x3b, 0x13, 0x60, 0x00, 0x2b, 0x21, 0xd1, 0x72, 0xb6, 0x12, 0x4a, - 0x12, 0x4b, 0x04, 0x32, 0x9a, 0x42, 0x07, 0xd8, 0xbf, 0xf3, 0x4f, 0x8f, - 0x10, 0x4a, 0x11, 0x4b, 0xda, 0x60, 0xbf, 0xf3, 0x4f, 0x8f, 0x11, 0xe0, - 0x0f, 0x4b, 0x19, 0x7d, 0xc8, 0x07, 0xfb, 0xd5, 0x18, 0x8b, 0x20, 0x21, - 0xff, 0x31, 0x92, 0x08, 0x52, 0x00, 0x01, 0x43, 0x19, 0x83, 0xda, 0x61, - 0x0a, 0x4a, 0x1a, 0x80, 0x1a, 0x7d, 0xd1, 0x07, 0xfc, 0xd5, 0xe5, 0xe7, - 0xc0, 0x46, 0xfd, 0xe7, 0x70, 0x47, 0xc0, 0x46, 0x08, 0x00, 0x00, 0x20, - 0x00, 0x20, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x04, 0x00, 0xfa, 0x05, - 0x00, 0xed, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x41, 0x02, 0xa5, 0xff, 0xff, - 0x01, 0x60, 0x70, 0x47, 0xf7, 0xb5, 0x08, 0xac, 0x26, 0x78, 0x04, 0x68, - 0x9d, 0x1e, 0x27, 0x68, 0x6c, 0x1e, 0xa5, 0x41, 0xec, 0xb2, 0x92, 0x07, - 0x05, 0x68, 0x3a, 0x43, 0x27, 0x06, 0x3a, 0x43, 0x2a, 0x60, 0x02, 0x68, - 0x07, 0x25, 0x29, 0x40, 0x50, 0x68, 0xb5, 0x01, 0x00, 0x2c, 0x00, 0xd0, - 0x5c, 0x03, 0x29, 0x43, 0x01, 0x43, 0x0c, 0x43, 0x54, 0x60, 0xf7, 0xbd, - 0x30, 0xb5, 0x03, 0x68, 0xc0, 0x25, 0x1c, 0x68, 0xad, 0x03, 0x12, 0x05, - 0x2a, 0x40, 0x22, 0x43, 0xc0, 0x24, 0xa4, 0x02, 0x09, 0x04, 0x21, 0x40, - 0x11, 0x43, 0x19, 0x60, 0x03, 0x68, 0x5a, 0x68, 0x14, 0x43, 0x5c, 0x60, - 0x30, 0xbd, 0x03, 0x68, 0x01, 0x21, 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, - 0x02, 0x68, 0x11, 0x68, 0x01, 0x23, 0x19, 0x42, 0xfb, 0xd1, 0xd1, 0x69, - 0x19, 0x42, 0xf8, 0xd1, 0x70, 0x47, 0x03, 0x68, 0x02, 0x21, 0x1a, 0x68, - 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, 0xd3, 0x69, 0x99, 0x07, 0xfc, 0xd4, - 0x70, 0x47, 0x03, 0x68, 0x1a, 0x7e, 0xd1, 0x07, 0x02, 0xd4, 0x1a, 0x7e, - 0x91, 0x07, 0xfc, 0xd5, 0x70, 0x47, 0x03, 0x68, 0x00, 0x22, 0x5a, 0x83, - 0x70, 0x47, 0x03, 0x68, 0x18, 0x7e, 0x40, 0x07, 0xc0, 0x0f, 0x70, 0x47, - 0x03, 0x68, 0x18, 0x7e, 0xc0, 0x09, 0x70, 0x47, 0x03, 0x68, 0x80, 0x22, - 0x19, 0x7e, 0x52, 0x42, 0x0a, 0x43, 0x1a, 0x76, 0x70, 0x47, 0x03, 0x68, - 0x18, 0x8d, 0xc0, 0xb2, 0x70, 0x47, 0x03, 0x68, 0x1a, 0x7e, 0x01, 0x20, - 0x02, 0x42, 0xfb, 0xd0, 0x19, 0x85, 0x70, 0x47, 0x70, 0xb5, 0x03, 0x68, - 0x01, 0x26, 0x8d, 0x07, 0xed, 0x0f, 0x31, 0x40, 0x1c, 0x68, 0x6d, 0x07, - 0x09, 0x07, 0x29, 0x43, 0x21, 0x43, 0x19, 0x60, 0x04, 0x68, 0x51, 0x00, - 0x03, 0x48, 0x00, 0xf0, 0x9f, 0xfb, 0x01, 0x38, 0xc0, 0xb2, 0x20, 0x73, - 0x70, 0xbd, 0xc0, 0x46, 0x00, 0x6c, 0xdc, 0x02, 0x03, 0x68, 0x01, 0x21, - 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, 0x11, 0x68, 0x01, 0x23, - 0x19, 0x42, 0xfb, 0xd1, 0xd1, 0x69, 0x19, 0x42, 0xf8, 0xd1, 0x70, 0x47, - 0x03, 0x68, 0x02, 0x21, 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, - 0xd3, 0x69, 0x99, 0x07, 0xfc, 0xd4, 0x70, 0x47, 0x03, 0x68, 0xda, 0x69, - 0x91, 0x07, 0xfc, 0xd4, 0x1a, 0x68, 0x02, 0x21, 0x8a, 0x43, 0x1a, 0x60, - 0x70, 0x47, 0x03, 0x68, 0x9a, 0x6a, 0x52, 0x0a, 0x52, 0x02, 0x11, 0x43, - 0x99, 0x62, 0x03, 0x68, 0x1a, 0x7e, 0x51, 0x07, 0xfc, 0xd5, 0x98, 0x6a, - 0xc0, 0xb2, 0x70, 0x47, 0x03, 0x68, 0x22, 0x4a, 0x30, 0xb5, 0x93, 0x42, - 0x11, 0xd0, 0x21, 0x4a, 0x93, 0x42, 0x11, 0xd0, 0x20, 0x4a, 0x93, 0x42, - 0x11, 0xd0, 0x20, 0x4a, 0x93, 0x42, 0x11, 0xd0, 0x1f, 0x4a, 0x93, 0x42, - 0x11, 0xd0, 0x1f, 0x4a, 0x93, 0x42, 0x30, 0xd1, 0x0e, 0x23, 0x19, 0x22, - 0x0d, 0xe0, 0x09, 0x23, 0x14, 0x22, 0x0a, 0xe0, 0x0a, 0x23, 0x15, 0x22, - 0x07, 0xe0, 0x0b, 0x23, 0x16, 0x22, 0x04, 0xe0, 0x0c, 0x23, 0x17, 0x22, - 0x01, 0xe0, 0x0d, 0x23, 0x18, 0x22, 0xdc, 0xb2, 0x15, 0x49, 0x01, 0x20, - 0x9b, 0x08, 0xa0, 0x40, 0x9b, 0x00, 0x08, 0x60, 0x5b, 0x18, 0x03, 0x20, - 0xc0, 0x21, 0x89, 0x00, 0x04, 0x40, 0x5d, 0x58, 0xe0, 0x00, 0xff, 0x24, - 0x84, 0x40, 0xa5, 0x43, 0x2c, 0x1c, 0xc0, 0x25, 0x85, 0x40, 0x28, 0x1c, - 0x20, 0x43, 0x58, 0x50, 0x80, 0x23, 0xdb, 0x01, 0x1a, 0x43, 0x0a, 0x4b, - 0x5a, 0x80, 0x5a, 0x78, 0x52, 0xb2, 0x00, 0x2a, 0xfb, 0xdb, 0x30, 0xbd, - 0x00, 0x08, 0x00, 0x42, 0x00, 0x0c, 0x00, 0x42, 0x00, 0x10, 0x00, 0x42, - 0x00, 0x14, 0x00, 0x42, 0x00, 0x18, 0x00, 0x42, 0x00, 0x1c, 0x00, 0x42, - 0x00, 0xe1, 0x00, 0xe0, 0x00, 0x0c, 0x00, 0x40, 0xf8, 0xb5, 0x04, 0x1c, - 0x15, 0x1c, 0x0e, 0x1c, 0x1f, 0x1c, 0xff, 0xf7, 0xa3, 0xff, 0x20, 0x1c, - 0xff, 0xf7, 0x1b, 0xff, 0xb1, 0x00, 0x1c, 0x22, 0x0a, 0x40, 0x69, 0x07, - 0x23, 0x68, 0x09, 0x0c, 0x0a, 0x43, 0x1a, 0x60, 0x22, 0x68, 0x84, 0x23, - 0x93, 0x75, 0x01, 0x2e, 0x1a, 0xd1, 0x08, 0x21, 0x01, 0x2d, 0x00, 0xd1, - 0x10, 0x21, 0x0c, 0x4b, 0x79, 0x43, 0x18, 0x68, 0xc0, 0x00, 0x00, 0xf0, - 0xf3, 0xfa, 0x23, 0x68, 0x07, 0x21, 0x9a, 0x89, 0x01, 0x40, 0xd2, 0x04, - 0x49, 0x03, 0xd2, 0x0c, 0x0a, 0x43, 0x9a, 0x81, 0x23, 0x68, 0x00, 0x04, - 0xc2, 0x0c, 0x98, 0x89, 0x40, 0x0b, 0x40, 0x03, 0x10, 0x43, 0x98, 0x81, - 0xf8, 0xbd, 0xc0, 0x46, 0x04, 0x00, 0x00, 0x20, 0xf7, 0xb5, 0x01, 0x93, - 0x08, 0xab, 0x04, 0x1c, 0x1f, 0x78, 0x0d, 0x1c, 0x16, 0x1c, 0xff, 0xf7, - 0x3d, 0xff, 0x20, 0x1c, 0xff, 0xf7, 0x68, 0xff, 0xbf, 0x07, 0x0c, 0x22, - 0x17, 0x43, 0xc0, 0x22, 0x92, 0x03, 0x36, 0x05, 0x16, 0x40, 0xc0, 0x22, - 0x92, 0x02, 0x2d, 0x04, 0x23, 0x68, 0x3e, 0x43, 0x01, 0x99, 0x15, 0x40, - 0x35, 0x43, 0x07, 0x22, 0x1d, 0x60, 0x0a, 0x40, 0x80, 0x21, 0x23, 0x68, - 0x89, 0x02, 0x0a, 0x43, 0x5a, 0x60, 0xf7, 0xbd, 0x01, 0x20, 0x70, 0x47, - 0x08, 0xb5, 0x03, 0x68, 0x13, 0x22, 0xdb, 0x69, 0x98, 0x47, 0x08, 0xbd, - 0x10, 0xb5, 0x04, 0x1c, 0x00, 0x69, 0xff, 0xf7, 0xbe, 0xfe, 0x20, 0x1c, - 0x14, 0x30, 0x00, 0xf0, 0x7d, 0xfa, 0x10, 0xbd, 0x08, 0xb5, 0x00, 0x69, - 0xff, 0xf7, 0xcd, 0xfe, 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, - 0x85, 0xfa, 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, 0x86, 0xfa, - 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, 0x6d, 0xfa, 0x08, 0xbd, - 0x08, 0xb5, 0x00, 0x69, 0xff, 0xf7, 0xd9, 0xfe, 0x01, 0x20, 0x08, 0xbd, - 0xf7, 0xb5, 0x1d, 0x1c, 0x08, 0xab, 0x1b, 0x78, 0x04, 0x1c, 0x00, 0x93, - 0x09, 0xab, 0x1b, 0x78, 0x16, 0x1c, 0x01, 0x93, 0x00, 0x23, 0x43, 0x60, - 0xfa, 0x23, 0x9b, 0x00, 0x83, 0x60, 0x09, 0x4b, 0x0f, 0x1c, 0x08, 0x33, - 0x03, 0x60, 0x14, 0x30, 0x00, 0xf0, 0x36, 0xfa, 0x00, 0x9a, 0x23, 0x1c, - 0x5c, 0x33, 0x27, 0x61, 0x9a, 0x70, 0x01, 0x9a, 0x1e, 0x70, 0x5d, 0x70, - 0x20, 0x1c, 0xda, 0x70, 0xfe, 0xbd, 0xc0, 0x46, 0x80, 0x56, 0x00, 0x00, - 0x10, 0xb5, 0x04, 0x1c, 0x00, 0x69, 0xff, 0xf7, 0x9a, 0xfe, 0x00, 0x28, - 0x07, 0xd0, 0x20, 0x69, 0xff, 0xf7, 0xa5, 0xfe, 0x01, 0x1c, 0x20, 0x1c, - 0x14, 0x30, 0x00, 0xf0, 0x24, 0xfa, 0x20, 0x69, 0xff, 0xf7, 0x92, 0xfe, - 0x00, 0x28, 0x05, 0xd0, 0x20, 0x69, 0xff, 0xf7, 0x91, 0xfe, 0x20, 0x69, - 0xff, 0xf7, 0x81, 0xfe, 0x10, 0xbd, 0xf0, 0x23, 0x08, 0x1c, 0x18, 0x40, - 0x30, 0x38, 0x43, 0x42, 0x58, 0x41, 0x70, 0x47, 0xf0, 0x23, 0x1b, 0x01, - 0x19, 0x40, 0x80, 0x23, 0x9b, 0x00, 0x99, 0x42, 0x0c, 0xd0, 0xc0, 0x23, - 0x9b, 0x00, 0x99, 0x42, 0x06, 0xd0, 0x80, 0x23, 0x5b, 0x00, 0x05, 0x20, - 0x99, 0x42, 0x04, 0xd0, 0x00, 0x20, 0x02, 0xe0, 0x07, 0x20, 0x00, 0xe0, - 0x06, 0x20, 0x70, 0x47, 0x0f, 0x23, 0x19, 0x40, 0x01, 0x29, 0x05, 0xd0, - 0x02, 0x39, 0x4b, 0x42, 0x4b, 0x41, 0x02, 0x20, 0xc0, 0x1a, 0x00, 0xe0, - 0x00, 0x20, 0x70, 0x47, 0xf0, 0xb5, 0x03, 0x1c, 0x85, 0xb0, 0x03, 0x91, - 0x5c, 0x33, 0x04, 0x1c, 0x18, 0x27, 0x18, 0x78, 0x3b, 0x1c, 0x43, 0x43, - 0x1b, 0x4e, 0x08, 0x21, 0xf3, 0x18, 0x59, 0x56, 0x15, 0x1c, 0xff, 0xf7, - 0x45, 0xfd, 0x23, 0x1c, 0x5d, 0x33, 0x18, 0x78, 0x08, 0x21, 0x47, 0x43, - 0xf6, 0x19, 0x71, 0x56, 0xff, 0xf7, 0x3c, 0xfd, 0x01, 0x21, 0x0a, 0x1c, - 0x03, 0x9b, 0x20, 0x69, 0xff, 0xf7, 0xf2, 0xfe, 0x29, 0x1c, 0x20, 0x1c, - 0xff, 0xf7, 0xba, 0xff, 0x29, 0x1c, 0x07, 0x1c, 0x20, 0x1c, 0xff, 0xf7, - 0xcb, 0xff, 0x29, 0x1c, 0x06, 0x1c, 0x20, 0x1c, 0xff, 0xf7, 0xa9, 0xff, - 0x39, 0x1c, 0x00, 0x90, 0x33, 0x1c, 0x20, 0x69, 0x01, 0x22, 0xff, 0xf7, - 0xd3, 0xfd, 0x23, 0x1c, 0x5f, 0x33, 0x19, 0x78, 0x01, 0x3b, 0x1a, 0x78, - 0x20, 0x69, 0xff, 0xf7, 0xe7, 0xfd, 0x20, 0x69, 0xff, 0xf7, 0x05, 0xfe, - 0x05, 0xb0, 0xf0, 0xbd, 0x20, 0x53, 0x00, 0x00, 0x3f, 0x20, 0x70, 0x47, - 0x13, 0xb5, 0x02, 0x68, 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, 0x54, 0x68, - 0x19, 0x1c, 0x01, 0x22, 0xa0, 0x47, 0x16, 0xbd, 0x08, 0xb5, 0x00, 0x69, - 0x02, 0x21, 0x00, 0xf0, 0x49, 0xf8, 0x08, 0xbd, 0x08, 0xb5, 0x00, 0x69, - 0x03, 0x21, 0x00, 0xf0, 0x59, 0xf8, 0x08, 0xbd, 0x38, 0xb5, 0x0d, 0x1c, - 0x04, 0x1c, 0x13, 0x1c, 0x00, 0x69, 0x03, 0x21, 0x2a, 0x1c, 0x00, 0xf0, - 0xf1, 0xf8, 0x00, 0x28, 0x01, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x38, 0xbd, - 0x10, 0xb5, 0x05, 0x4c, 0x23, 0x68, 0x5a, 0x1c, 0x04, 0xd1, 0x03, 0x68, - 0xdb, 0x68, 0x98, 0x47, 0x20, 0x60, 0x03, 0x1c, 0x18, 0x1c, 0x10, 0xbd, - 0x0c, 0x00, 0x00, 0x20, 0x07, 0x4a, 0x08, 0xb5, 0x13, 0x68, 0x59, 0x1c, - 0x04, 0xd0, 0x01, 0x21, 0x49, 0x42, 0x11, 0x60, 0x18, 0x1c, 0x03, 0xe0, - 0x00, 0x69, 0x02, 0x21, 0x00, 0xf0, 0xc2, 0xf8, 0x08, 0xbd, 0xc0, 0x46, - 0x0c, 0x00, 0x00, 0x20, 0x06, 0x4b, 0xfa, 0x21, 0x89, 0x00, 0x99, 0x60, - 0x05, 0x49, 0x00, 0x22, 0x08, 0x31, 0x19, 0x60, 0x04, 0x49, 0x5a, 0x60, - 0x19, 0x61, 0x1a, 0x76, 0x70, 0x47, 0xc0, 0x46, 0x18, 0x08, 0x00, 0x20, - 0xb0, 0x56, 0x00, 0x00, 0xd8, 0x0b, 0x00, 0x20, 0x08, 0xb5, 0x08, 0x4b, - 0x8a, 0x00, 0xd0, 0x58, 0x00, 0x28, 0x03, 0xd0, 0x03, 0x68, 0x9b, 0x68, - 0x98, 0x47, 0x06, 0xe0, 0xc9, 0xb2, 0x04, 0x4b, 0x49, 0x01, 0x59, 0x18, - 0x88, 0x68, 0x80, 0x04, 0x80, 0x0c, 0x08, 0xbd, 0xbc, 0x0b, 0x00, 0x20, - 0xdc, 0x0b, 0x00, 0x20, 0x10, 0xb5, 0x0c, 0x1c, 0xff, 0xf7, 0xe6, 0xff, - 0x00, 0x28, 0x0c, 0xd0, 0x06, 0x4b, 0xe1, 0xb2, 0x1b, 0x68, 0x08, 0x31, - 0x49, 0x01, 0x59, 0x18, 0x4a, 0x79, 0x80, 0x23, 0x5b, 0x42, 0x13, 0x43, - 0x4b, 0x71, 0x02, 0x23, 0xcb, 0x71, 0x10, 0xbd, 0xdc, 0x0b, 0x00, 0x20, - 0x10, 0xb5, 0xc9, 0xb2, 0x0c, 0x48, 0x49, 0x01, 0x43, 0x18, 0x9a, 0x68, - 0x92, 0x04, 0x92, 0x0c, 0x3f, 0x2a, 0x08, 0xd9, 0x14, 0x1c, 0x9a, 0x68, - 0x40, 0x3c, 0xa4, 0x04, 0x92, 0x0b, 0xa4, 0x0c, 0x92, 0x03, 0x22, 0x43, - 0x02, 0xe0, 0x9a, 0x68, 0x92, 0x0b, 0x92, 0x03, 0x9a, 0x60, 0x41, 0x18, - 0x88, 0x68, 0xc0, 0xb2, 0x10, 0xbd, 0xc0, 0x46, 0xdc, 0x0b, 0x00, 0x20, - 0xf0, 0xb5, 0x1c, 0x1c, 0x2a, 0x4b, 0x85, 0xb0, 0x1b, 0x68, 0x06, 0x1c, - 0x0d, 0x1c, 0x02, 0x92, 0x00, 0x2b, 0x46, 0xd0, 0x27, 0x4b, 0x8a, 0x00, - 0xd0, 0x58, 0x00, 0x28, 0x05, 0xd0, 0x03, 0x68, 0x02, 0x99, 0x5b, 0x68, - 0x22, 0x1c, 0x98, 0x47, 0x3f, 0xe0, 0x30, 0x1c, 0xff, 0xf7, 0x9e, 0xff, - 0xa0, 0x42, 0x04, 0xd2, 0x30, 0x1c, 0x29, 0x1c, 0xff, 0xf7, 0x98, 0xff, - 0x04, 0x1c, 0x29, 0x1c, 0x30, 0x1c, 0xff, 0xf7, 0xbf, 0xff, 0x1c, 0x4f, - 0xe9, 0xb2, 0x4a, 0x01, 0x01, 0x91, 0x39, 0x68, 0x03, 0x92, 0x8b, 0x18, - 0xff, 0x33, 0x5a, 0x7a, 0x01, 0x21, 0x0a, 0x43, 0x17, 0x49, 0x5a, 0x72, - 0xab, 0x01, 0xc9, 0x18, 0x02, 0x98, 0x22, 0x1c, 0x00, 0xf0, 0xa1, 0xf9, - 0x00, 0x2c, 0x1b, 0xd0, 0x30, 0x1c, 0x29, 0x1c, 0xff, 0xf7, 0x7a, 0xff, - 0x00, 0x28, 0x15, 0xd1, 0x01, 0x9b, 0x3a, 0x68, 0x08, 0x33, 0x5b, 0x01, - 0xd3, 0x18, 0x19, 0x79, 0x40, 0x20, 0x01, 0x43, 0x19, 0x71, 0x01, 0x21, - 0xd9, 0x71, 0x03, 0x99, 0x53, 0x18, 0xff, 0x33, 0x9a, 0x7a, 0x01, 0x21, - 0x0a, 0x43, 0x9a, 0x72, 0x02, 0xe0, 0x01, 0x20, 0x40, 0x42, 0x00, 0xe0, - 0x20, 0x1c, 0x05, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0xe0, 0x0c, 0x00, 0x20, - 0xbc, 0x0b, 0x00, 0x20, 0xdc, 0x0b, 0x00, 0x20, 0xfc, 0x09, 0x00, 0x20, - 0x13, 0xb5, 0x6c, 0x46, 0x07, 0x34, 0x22, 0x1c, 0x01, 0x23, 0xff, 0xf7, - 0x99, 0xff, 0x01, 0x28, 0x01, 0xd1, 0x20, 0x78, 0x01, 0xe0, 0x01, 0x20, - 0x40, 0x42, 0x16, 0xbd, 0xf0, 0xb5, 0x1c, 0x1c, 0x3a, 0x4b, 0x85, 0xb0, - 0x1b, 0x68, 0x0e, 0x1c, 0x02, 0x92, 0x00, 0x2b, 0x60, 0xd0, 0x80, 0x23, - 0xdb, 0x01, 0x9c, 0x42, 0x5c, 0xd8, 0x00, 0x22, 0x00, 0x92, 0x00, 0x2c, - 0x56, 0xd0, 0x34, 0x4d, 0xf7, 0xb2, 0x2b, 0x68, 0x01, 0x93, 0x3b, 0x1c, - 0x08, 0x33, 0x01, 0x9a, 0x5b, 0x01, 0xd3, 0x18, 0x9b, 0x79, 0xdb, 0x09, - 0x1a, 0xd0, 0x2f, 0x4b, 0x2f, 0x49, 0x18, 0x68, 0x00, 0xf0, 0xae, 0xf8, - 0x2e, 0x4b, 0x17, 0x21, 0x58, 0x43, 0x00, 0xf0, 0xa9, 0xf8, 0x3b, 0x1c, - 0x08, 0x33, 0x01, 0x9a, 0x5b, 0x01, 0xd3, 0x18, 0xdb, 0x79, 0x9a, 0x07, - 0x08, 0xd4, 0x29, 0x4b, 0x9a, 0x5d, 0x00, 0x2a, 0x38, 0xd1, 0x42, 0x1e, - 0x00, 0x28, 0x35, 0xd0, 0x10, 0x1c, 0xee, 0xe7, 0x24, 0x4b, 0x00, 0x22, - 0x9a, 0x55, 0x25, 0x1e, 0x3f, 0x2d, 0x00, 0xd9, 0x3f, 0x25, 0x22, 0x4a, - 0xb3, 0x01, 0xd3, 0x18, 0x18, 0x1c, 0x02, 0x99, 0x2a, 0x1c, 0x03, 0x93, - 0x00, 0xf0, 0x21, 0xf9, 0x18, 0x4a, 0x7b, 0x01, 0xd3, 0x18, 0x03, 0x9a, - 0xa9, 0x04, 0x5a, 0x61, 0x9a, 0x69, 0x89, 0x0c, 0x92, 0x0b, 0x92, 0x03, - 0x0a, 0x43, 0x9a, 0x61, 0x3b, 0x1c, 0x01, 0x9a, 0x08, 0x33, 0x5b, 0x01, - 0xd3, 0x18, 0x02, 0x22, 0xda, 0x71, 0x59, 0x79, 0x80, 0x22, 0x52, 0x42, - 0x0a, 0x43, 0x5a, 0x71, 0x00, 0x9b, 0x02, 0x9a, 0x5b, 0x19, 0x52, 0x19, - 0x00, 0x93, 0x64, 0x1b, 0x02, 0x92, 0xa6, 0xe7, 0x00, 0x98, 0x0b, 0xe0, - 0x01, 0x20, 0x08, 0xe0, 0x01, 0x22, 0x9a, 0x55, 0x7b, 0x01, 0xed, 0x18, - 0xab, 0x69, 0x10, 0x1c, 0x9b, 0x0b, 0x9b, 0x03, 0xab, 0x61, 0x40, 0x42, - 0x05, 0xb0, 0xf0, 0xbd, 0xe0, 0x0c, 0x00, 0x20, 0xdc, 0x0b, 0x00, 0x20, - 0x04, 0x00, 0x00, 0x20, 0x40, 0x42, 0x0f, 0x00, 0x70, 0x11, 0x01, 0x00, - 0x34, 0x08, 0x00, 0x20, 0x3c, 0x08, 0x00, 0x20, 0x01, 0x4a, 0x02, 0x4b, - 0x1a, 0x60, 0x70, 0x47, 0x00, 0x50, 0x00, 0x41, 0xdc, 0x0b, 0x00, 0x20, - 0x10, 0xb5, 0x00, 0x21, 0x40, 0x22, 0x04, 0x1c, 0x00, 0xf0, 0xde, 0xf8, - 0x00, 0x23, 0x20, 0x1c, 0x23, 0x64, 0x63, 0x64, 0x10, 0xbd, 0x02, 0x6c, - 0x10, 0xb5, 0x3f, 0x23, 0x54, 0x1c, 0x23, 0x40, 0x44, 0x6c, 0xa3, 0x42, - 0x01, 0xd0, 0x81, 0x54, 0x03, 0x64, 0x10, 0xbd, 0x00, 0x23, 0x03, 0x64, - 0x43, 0x64, 0x70, 0x47, 0x43, 0x6c, 0x02, 0x6c, 0x93, 0x42, 0x06, 0xd0, - 0xc2, 0x5c, 0x3f, 0x21, 0x01, 0x33, 0x0b, 0x40, 0x43, 0x64, 0x10, 0x1c, - 0x01, 0xe0, 0x01, 0x20, 0x40, 0x42, 0x70, 0x47, 0x02, 0x6c, 0x43, 0x6c, - 0xd0, 0x1a, 0x00, 0xd5, 0x40, 0x30, 0x70, 0x47, 0x43, 0x6c, 0x02, 0x6c, - 0x93, 0x42, 0x01, 0xd0, 0xc0, 0x5c, 0x01, 0xe0, 0x01, 0x20, 0x40, 0x42, - 0x70, 0x47, 0x00, 0x00, 0x02, 0xb4, 0x71, 0x46, 0x49, 0x08, 0x49, 0x00, - 0x09, 0x5c, 0x49, 0x00, 0x8e, 0x44, 0x02, 0xbc, 0x70, 0x47, 0xc0, 0x46, - 0x00, 0x29, 0x34, 0xd0, 0x01, 0x23, 0x00, 0x22, 0x10, 0xb4, 0x88, 0x42, - 0x2c, 0xd3, 0x01, 0x24, 0x24, 0x07, 0xa1, 0x42, 0x04, 0xd2, 0x81, 0x42, - 0x02, 0xd2, 0x09, 0x01, 0x1b, 0x01, 0xf8, 0xe7, 0xe4, 0x00, 0xa1, 0x42, - 0x04, 0xd2, 0x81, 0x42, 0x02, 0xd2, 0x49, 0x00, 0x5b, 0x00, 0xf8, 0xe7, - 0x88, 0x42, 0x01, 0xd3, 0x40, 0x1a, 0x1a, 0x43, 0x4c, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0x5c, 0x08, 0x22, 0x43, 0x8c, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0x9c, 0x08, 0x22, 0x43, 0xcc, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0xdc, 0x08, 0x22, 0x43, 0x00, 0x28, 0x03, 0xd0, - 0x1b, 0x09, 0x01, 0xd0, 0x09, 0x09, 0xe3, 0xe7, 0x10, 0x1c, 0x10, 0xbc, - 0x70, 0x47, 0x00, 0x28, 0x01, 0xd0, 0x00, 0x20, 0xc0, 0x43, 0x07, 0xb4, - 0x02, 0x48, 0x02, 0xa1, 0x40, 0x18, 0x02, 0x90, 0x03, 0xbd, 0xc0, 0x46, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x29, 0xf0, 0xd0, 0x03, 0xb5, 0xff, 0xf7, - 0xb9, 0xff, 0x0e, 0xbc, 0x42, 0x43, 0x89, 0x1a, 0x18, 0x47, 0xc0, 0x46, - 0x70, 0x47, 0xc0, 0x46, 0x70, 0xb5, 0x0e, 0x4b, 0x0e, 0x4d, 0x00, 0x24, - 0xed, 0x1a, 0xad, 0x10, 0x1e, 0x1c, 0xac, 0x42, 0x04, 0xd0, 0xa3, 0x00, - 0xf3, 0x58, 0x98, 0x47, 0x01, 0x34, 0xf8, 0xe7, 0x00, 0xf0, 0x32, 0xf9, - 0x08, 0x4b, 0x09, 0x4d, 0x00, 0x24, 0xed, 0x1a, 0xad, 0x10, 0x1e, 0x1c, - 0xac, 0x42, 0x04, 0xd0, 0xa3, 0x00, 0xf3, 0x58, 0x98, 0x47, 0x01, 0x34, - 0xf8, 0xe7, 0x70, 0xbd, 0x74, 0x00, 0x00, 0x20, 0x74, 0x00, 0x00, 0x20, - 0x74, 0x00, 0x00, 0x20, 0x98, 0x00, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, - 0x01, 0x1c, 0x18, 0x68, 0x00, 0xf0, 0x76, 0xf8, 0x08, 0xbd, 0xc0, 0x46, - 0x70, 0x00, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, 0x01, 0x1c, 0x18, 0x68, - 0x00, 0xf0, 0x24, 0xf8, 0x08, 0xbd, 0xc0, 0x46, 0x70, 0x00, 0x00, 0x20, - 0x30, 0xb5, 0x00, 0x23, 0x93, 0x42, 0x08, 0xd0, 0xc5, 0x5c, 0x01, 0x33, - 0xcc, 0x18, 0x01, 0x3c, 0x24, 0x78, 0xa5, 0x42, 0xf6, 0xd0, 0x28, 0x1b, - 0x00, 0xe0, 0x00, 0x20, 0x30, 0xbd, 0x10, 0xb5, 0x00, 0x23, 0x93, 0x42, - 0x03, 0xd0, 0xcc, 0x5c, 0xc4, 0x54, 0x01, 0x33, 0xf9, 0xe7, 0x10, 0xbd, - 0x03, 0x1c, 0x82, 0x18, 0x93, 0x42, 0x02, 0xd0, 0x19, 0x70, 0x01, 0x33, - 0xfa, 0xe7, 0x70, 0x47, 0x30, 0xb5, 0x00, 0x29, 0x40, 0xd0, 0x04, 0x39, - 0x0b, 0x68, 0x00, 0x2b, 0x00, 0xda, 0xc9, 0x18, 0x1e, 0x4a, 0x13, 0x68, - 0x14, 0x1c, 0x00, 0x2b, 0x02, 0xd1, 0x4b, 0x60, 0x11, 0x60, 0x33, 0xe0, - 0x99, 0x42, 0x0f, 0xd2, 0x08, 0x68, 0x0a, 0x18, 0x9a, 0x42, 0x05, 0xd1, - 0x13, 0x68, 0x52, 0x68, 0xc0, 0x18, 0x08, 0x60, 0x4a, 0x60, 0x00, 0xe0, - 0x4b, 0x60, 0x21, 0x60, 0x24, 0xe0, 0x8a, 0x42, 0x03, 0xd8, 0x13, 0x1c, - 0x5a, 0x68, 0x00, 0x2a, 0xf9, 0xd1, 0x1d, 0x68, 0x5c, 0x19, 0x8c, 0x42, - 0x0b, 0xd1, 0x09, 0x68, 0x69, 0x18, 0x58, 0x18, 0x19, 0x60, 0x90, 0x42, - 0x14, 0xd1, 0x14, 0x68, 0x52, 0x68, 0x09, 0x19, 0x19, 0x60, 0x5a, 0x60, - 0x0e, 0xe0, 0x8c, 0x42, 0x02, 0xd9, 0x0c, 0x23, 0x03, 0x60, 0x09, 0xe0, - 0x08, 0x68, 0x0c, 0x18, 0x94, 0x42, 0x03, 0xd1, 0x14, 0x68, 0x52, 0x68, - 0x00, 0x19, 0x08, 0x60, 0x4a, 0x60, 0x59, 0x60, 0x30, 0xbd, 0xc0, 0x46, - 0xe8, 0x0c, 0x00, 0x20, 0x70, 0xb5, 0x03, 0x23, 0xcd, 0x1c, 0x9d, 0x43, - 0x08, 0x35, 0x06, 0x1c, 0x0c, 0x2d, 0x01, 0xd2, 0x0c, 0x25, 0x01, 0xe0, - 0x00, 0x2d, 0x3f, 0xdb, 0x8d, 0x42, 0x3d, 0xd3, 0x20, 0x4b, 0x1c, 0x68, - 0x1a, 0x1c, 0x21, 0x1c, 0x00, 0x29, 0x13, 0xd0, 0x08, 0x68, 0x43, 0x1b, - 0x0d, 0xd4, 0x0b, 0x2b, 0x02, 0xd9, 0x0b, 0x60, 0xcc, 0x18, 0x1e, 0xe0, - 0x8c, 0x42, 0x02, 0xd1, 0x63, 0x68, 0x13, 0x60, 0x1a, 0xe0, 0x48, 0x68, - 0x60, 0x60, 0x0c, 0x1c, 0x16, 0xe0, 0x0c, 0x1c, 0x49, 0x68, 0xe9, 0xe7, - 0x14, 0x4c, 0x20, 0x68, 0x00, 0x28, 0x03, 0xd1, 0x30, 0x1c, 0x00, 0xf0, - 0x25, 0xf8, 0x20, 0x60, 0x30, 0x1c, 0x29, 0x1c, 0x00, 0xf0, 0x20, 0xf8, - 0x43, 0x1c, 0x15, 0xd0, 0xc4, 0x1c, 0x03, 0x23, 0x9c, 0x43, 0x84, 0x42, - 0x0a, 0xd1, 0x25, 0x60, 0x20, 0x1c, 0x0b, 0x30, 0x07, 0x22, 0x23, 0x1d, - 0x90, 0x43, 0xc3, 0x1a, 0x0b, 0xd0, 0x5a, 0x42, 0xe2, 0x50, 0x08, 0xe0, - 0x21, 0x1a, 0x30, 0x1c, 0x00, 0xf0, 0x0a, 0xf8, 0x01, 0x30, 0xee, 0xd1, - 0x0c, 0x23, 0x33, 0x60, 0x00, 0x20, 0x70, 0xbd, 0xe8, 0x0c, 0x00, 0x20, - 0xe4, 0x0c, 0x00, 0x20, 0x38, 0xb5, 0x07, 0x4c, 0x00, 0x23, 0x05, 0x1c, - 0x08, 0x1c, 0x23, 0x60, 0x00, 0xf0, 0x2a, 0xf8, 0x43, 0x1c, 0x03, 0xd1, - 0x23, 0x68, 0x00, 0x2b, 0x00, 0xd0, 0x2b, 0x60, 0x38, 0xbd, 0xc0, 0x46, - 0xf0, 0x0c, 0x00, 0x20, 0xc9, 0xb2, 0x03, 0x78, 0x00, 0x2b, 0x03, 0xd0, - 0x8b, 0x42, 0x04, 0xd0, 0x01, 0x30, 0xf8, 0xe7, 0x00, 0x29, 0x00, 0xd0, - 0x18, 0x1c, 0x70, 0x47, 0x30, 0xb5, 0x03, 0x1c, 0x00, 0x2a, 0x07, 0xd0, - 0x0c, 0x78, 0x01, 0x33, 0x5d, 0x1e, 0x01, 0x3a, 0x2c, 0x70, 0x01, 0x31, - 0x00, 0x2c, 0xf5, 0xd1, 0x9a, 0x18, 0x93, 0x42, 0x03, 0xd0, 0x00, 0x21, - 0x19, 0x70, 0x01, 0x33, 0xf9, 0xe7, 0x30, 0xbd, 0x09, 0x4a, 0x13, 0x68, - 0x00, 0x2b, 0x0c, 0xd0, 0x18, 0x18, 0x69, 0x46, 0x88, 0x42, 0x02, 0xd8, - 0x10, 0x60, 0x18, 0x1c, 0x70, 0x47, 0x05, 0x4b, 0x0c, 0x22, 0x01, 0x20, - 0x1a, 0x60, 0x40, 0x42, 0xf8, 0xe7, 0x03, 0x4b, 0x13, 0x60, 0xef, 0xe7, - 0xec, 0x0c, 0x00, 0x20, 0xf0, 0x0c, 0x00, 0x20, 0xf4, 0x0c, 0x00, 0x20, - 0xf8, 0xb5, 0xc0, 0x46, 0xf8, 0xbc, 0x08, 0xbc, 0x9e, 0x46, 0x70, 0x47, - 0xf8, 0xb5, 0xc0, 0x46, 0xf8, 0xbc, 0x08, 0xbc, 0x9e, 0x46, 0x70, 0x47, - 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x2e, 0x42, 0x49, 0x4e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x22, 0x00, 0x00, - 0x2d, 0x22, 0x00, 0x00, 0x59, 0x23, 0x00, 0x00, 0x85, 0x22, 0x00, 0x00, - 0x99, 0x22, 0x00, 0x00, 0x57, 0x22, 0x00, 0x00, 0x2f, 0x00, 0x7c, 0x3c, - 0x3e, 0x5e, 0x2b, 0x3d, 0x3f, 0x2f, 0x5b, 0x5d, 0x3b, 0x2c, 0x2a, 0x22, - 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x34, 0x00, 0x00, 0xdd, 0x40, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x04, 0x00, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x04, 0x01, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x01, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x01, 0x01, 0x01, 0x01, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x05, 0x00, 0x05, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x05, 0x01, 0x05, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x03, 0x01, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x06, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x07, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x91, 0x44, 0x00, 0x00, 0xdd, 0x40, 0x00, 0x00, - 0x73, 0x44, 0x00, 0x00, 0x87, 0x44, 0x00, 0x00, 0x7d, 0x44, 0x00, 0x00, - 0x69, 0x44, 0x00, 0x00, 0x49, 0x44, 0x00, 0x00, 0x6d, 0x45, 0x00, 0x00, - 0x55, 0x44, 0x00, 0x00, 0x45, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf9, 0x45, 0x00, 0x00, 0x25, 0x46, 0x00, 0x00, - 0x0d, 0x46, 0x00, 0x00, 0x5d, 0x46, 0x00, 0x00, 0x41, 0x46, 0x00, 0x00, - 0x19, 0x46, 0x00, 0x00, 0xf5, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x40, 0x42, 0x0f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xdc, 0x56, 0x00, 0x00, 0xfc, 0x56, 0x00, 0x00, - 0x1c, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x56, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x20, 0xdd, 0x20, 0x00, 0x00, 0x05, 0x22, 0x00, 0x00, - 0xe9, 0x26, 0x00, 0x00, 0xb1, 0x2b, 0x00, 0x00, 0x5d, 0x38, 0x00, 0x00, - 0x8d, 0x3a, 0x00, 0x00, 0xf5, 0x3a, 0x00, 0x00, 0x81, 0x46, 0x00, 0x00, - 0x25, 0x49, 0x00, 0x00, 0xb5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/libraries/SDU/src/boot/mkrzero.h b/libraries/SDU/src/boot/mkrzero.h deleted file mode 100644 index cc4f4da03..000000000 --- a/libraries/SDU/src/boot/mkrzero.h +++ /dev/null @@ -1,1192 +0,0 @@ - 0x00, 0x80, 0x00, 0x20, 0x8d, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0xe1, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0xe5, 0x3a, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, - 0x75, 0x3b, 0x00, 0x00, 0x75, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0xb5, 0x06, 0x4c, 0x23, 0x78, 0x00, 0x2b, 0x07, 0xd1, 0x05, 0x4b, - 0x00, 0x2b, 0x02, 0xd0, 0x04, 0x48, 0x00, 0xe0, 0x00, 0xbf, 0x01, 0x23, - 0x23, 0x70, 0x10, 0xbd, 0xa0, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x3c, 0x57, 0x00, 0x00, 0x08, 0xb5, 0x08, 0x4b, 0x00, 0x2b, 0x03, 0xd0, - 0x07, 0x48, 0x08, 0x49, 0x00, 0xe0, 0x00, 0xbf, 0x07, 0x48, 0x03, 0x68, - 0x00, 0x2b, 0x03, 0xd0, 0x06, 0x4b, 0x00, 0x2b, 0x00, 0xd0, 0x98, 0x47, - 0x08, 0xbd, 0xc0, 0x46, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x57, 0x00, 0x00, - 0xa4, 0x00, 0x00, 0x20, 0x9c, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0xb5, 0x33, 0x4c, 0xa5, 0x44, 0x01, 0xf0, 0x47, 0xf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, - 0x1b, 0x68, 0x18, 0x47, 0x00, 0x20, 0x8b, 0x23, 0x9b, 0x00, 0x9d, 0x44, - 0xf0, 0xbd, 0xc0, 0x46, 0xd4, 0xfd, 0xff, 0xff, 0xd4, 0x00, 0x00, 0x20, - 0xf4, 0x4c, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xbc, 0x00, 0x00, 0x20, - 0x00, 0xa2, 0xff, 0xff, 0x00, 0xed, 0x00, 0xe0, 0x04, 0x60, 0x00, 0x00, - 0x08, 0xb5, 0x00, 0x21, 0x02, 0x48, 0x0a, 0x1c, 0x01, 0xf0, 0x3c, 0xfb, - 0x08, 0xbd, 0xc0, 0x46, 0xbc, 0x00, 0x00, 0x20, 0x13, 0xb5, 0x02, 0x68, - 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, 0x54, 0x68, 0x19, 0x1c, 0x01, 0x22, - 0xa0, 0x47, 0x16, 0xbd, 0x38, 0xb5, 0x04, 0x1c, 0x00, 0x6a, 0x00, 0x25, - 0xa8, 0x42, 0x02, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x0a, 0xe0, 0x45, 0x60, - 0x92, 0xb2, 0x01, 0xf0, 0x0b, 0xf8, 0x23, 0x6a, 0x5b, 0x68, 0x00, 0x2b, - 0x02, 0xd0, 0x01, 0x23, 0x63, 0x60, 0x28, 0x1c, 0x38, 0xbd, 0x00, 0x6a, - 0x08, 0xb5, 0x00, 0x28, 0x01, 0xd0, 0x00, 0xf0, 0x49, 0xfe, 0x08, 0xbd, - 0x13, 0xb5, 0x6c, 0x46, 0x07, 0x34, 0x21, 0x1c, 0x01, 0x22, 0x00, 0xf0, - 0x65, 0xfd, 0x01, 0x28, 0x01, 0xd1, 0x20, 0x78, 0x00, 0xe0, 0x01, 0x48, - 0x00, 0xb2, 0x16, 0xbd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x08, 0xb5, - 0x00, 0x28, 0x02, 0xd0, 0xff, 0xf7, 0xea, 0xff, 0x01, 0xe0, 0x01, 0x20, - 0x40, 0x42, 0x08, 0xbd, 0x38, 0xb5, 0x05, 0x1c, 0x00, 0x6a, 0x00, 0x28, - 0x0a, 0xd0, 0xff, 0xf7, 0xdf, 0xff, 0x04, 0x1c, 0x63, 0x1c, 0x05, 0xd0, - 0x28, 0x6a, 0x01, 0x69, 0x01, 0x39, 0x00, 0xf0, 0xed, 0xfd, 0x20, 0x1c, - 0x38, 0xbd, 0x00, 0x00, 0xf8, 0xb5, 0xfa, 0x23, 0x9b, 0x00, 0x83, 0x60, - 0x0d, 0x4b, 0x00, 0x25, 0x08, 0x33, 0x04, 0x1c, 0x45, 0x60, 0x03, 0x60, - 0x28, 0x20, 0x0f, 0x1c, 0x16, 0x1c, 0x02, 0xf0, 0xe5, 0xfb, 0x20, 0x62, - 0xa8, 0x42, 0x0a, 0xd0, 0x39, 0x1c, 0x28, 0x22, 0x02, 0xf0, 0x01, 0xfc, - 0x20, 0x1c, 0x10, 0x30, 0x31, 0x1c, 0x0c, 0x22, 0x02, 0xf0, 0xc6, 0xfc, - 0x25, 0x77, 0x20, 0x1c, 0xf8, 0xbd, 0xc0, 0x46, 0x00, 0x4d, 0x00, 0x00, - 0xfa, 0x22, 0x92, 0x00, 0x82, 0x60, 0x04, 0x4a, 0x00, 0x23, 0x08, 0x32, - 0x43, 0x60, 0x02, 0x60, 0x03, 0x62, 0x03, 0x74, 0x70, 0x47, 0xc0, 0x46, - 0x00, 0x4d, 0x00, 0x00, 0x00, 0x6a, 0x08, 0xb5, 0x00, 0x28, 0x01, 0xd0, - 0x00, 0xf0, 0x0a, 0xfd, 0x08, 0xbd, 0x00, 0x6a, 0x08, 0xb5, 0x00, 0x28, - 0x04, 0xd0, 0x00, 0xf0, 0xad, 0xfd, 0x43, 0x1e, 0x98, 0x41, 0xc0, 0xb2, - 0x08, 0xbd, 0x03, 0x6a, 0x00, 0x2b, 0x01, 0xd0, 0x18, 0x69, 0x01, 0xe0, - 0x01, 0x20, 0x40, 0x42, 0x70, 0x47, 0x00, 0x6a, 0x00, 0x28, 0x00, 0xd0, - 0xc0, 0x69, 0x70, 0x47, 0x38, 0xb5, 0x04, 0x1c, 0x00, 0x6a, 0x00, 0x28, - 0x0b, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0xf3, 0xff, 0x05, 0x1c, 0x20, 0x1c, - 0xff, 0xf7, 0xe7, 0xff, 0x02, 0x4b, 0x28, 0x1a, 0x98, 0x42, 0x00, 0xd9, - 0x18, 0x1c, 0x38, 0xbd, 0xff, 0x7f, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, - 0x00, 0x6a, 0x00, 0x28, 0x06, 0xd0, 0x00, 0xf0, 0xef, 0xfd, 0x20, 0x6a, - 0x02, 0xf0, 0x92, 0xfb, 0x00, 0x23, 0x23, 0x62, 0x10, 0xbd, 0x00, 0x00, - 0x10, 0xb5, 0x0a, 0x1c, 0x0c, 0x49, 0x8a, 0xb0, 0x04, 0x1c, 0x00, 0x23, - 0x00, 0x91, 0x69, 0x46, 0x4b, 0x72, 0x01, 0x93, 0x21, 0x1c, 0x68, 0x46, - 0x01, 0x23, 0x00, 0xf0, 0x89, 0xfe, 0x04, 0x1c, 0x60, 0x1e, 0x84, 0x41, - 0xe4, 0xb2, 0x00, 0x2c, 0x02, 0xd0, 0x68, 0x46, 0x00, 0xf0, 0xd0, 0xfd, - 0x20, 0x1c, 0x0a, 0xb0, 0x10, 0xbd, 0xc0, 0x46, 0x40, 0x4d, 0x00, 0x00, - 0x08, 0xb5, 0x01, 0x23, 0x00, 0x2a, 0x05, 0xd0, 0x00, 0xf0, 0x22, 0xff, - 0x03, 0x1c, 0x58, 0x1e, 0x83, 0x41, 0xdb, 0xb2, 0x18, 0x1c, 0x08, 0xbd, - 0x38, 0xb5, 0x01, 0x22, 0x05, 0x1c, 0x0c, 0x1c, 0x01, 0xf0, 0x9c, 0xf9, - 0x02, 0x1c, 0x01, 0x20, 0x00, 0x2a, 0x03, 0xd1, 0x28, 0x1c, 0x21, 0x1c, - 0x01, 0xf0, 0x94, 0xf9, 0x38, 0xbd, 0xf0, 0xb5, 0x0c, 0x68, 0x03, 0x5d, - 0x2f, 0x3b, 0x5d, 0x42, 0x6b, 0x41, 0xe4, 0x18, 0x27, 0x1c, 0x0c, 0x37, - 0x23, 0x1c, 0xc5, 0x5c, 0x1e, 0x1b, 0x2f, 0x2d, 0x09, 0xd0, 0x00, 0x2d, - 0x07, 0xd0, 0x01, 0x33, 0x16, 0x1b, 0xf6, 0x18, 0x01, 0x3e, 0x35, 0x70, - 0xbb, 0x42, 0xf2, 0xd1, 0x0c, 0x26, 0x00, 0x24, 0x94, 0x55, 0xc2, 0x5c, - 0x2f, 0x3a, 0x54, 0x42, 0x62, 0x41, 0x9b, 0x18, 0x0b, 0x60, 0xc0, 0x5c, - 0x43, 0x1e, 0x98, 0x41, 0xc0, 0xb2, 0xf0, 0xbd, 0xf0, 0xb5, 0xa1, 0xb0, - 0x03, 0x90, 0x25, 0x48, 0x0d, 0x1c, 0x04, 0x92, 0x05, 0x93, 0x0c, 0xaa, - 0x00, 0x23, 0x16, 0xa9, 0x0d, 0x93, 0x0c, 0x90, 0x53, 0x72, 0x17, 0x93, - 0x16, 0x90, 0x4b, 0x72, 0x07, 0x93, 0x2c, 0x1c, 0x00, 0x92, 0x07, 0xa9, - 0x08, 0xaa, 0x03, 0x98, 0xff, 0xf7, 0xc3, 0xff, 0x01, 0x26, 0x02, 0x1c, - 0x72, 0x40, 0x01, 0x90, 0xd2, 0xb2, 0x20, 0x1c, 0x08, 0xa9, 0x05, 0x9b, - 0x04, 0x9f, 0xb8, 0x47, 0x00, 0x28, 0x07, 0xd1, 0xac, 0x42, 0x01, 0xd1, - 0x00, 0x20, 0x23, 0xe0, 0x20, 0x1c, 0x00, 0xf0, 0x5f, 0xfd, 0xf9, 0xe7, - 0x01, 0x9f, 0x00, 0x2f, 0x11, 0xd0, 0x33, 0x1c, 0x00, 0x98, 0x21, 0x1c, - 0x08, 0xaa, 0x00, 0xf0, 0x05, 0xfe, 0x06, 0x1c, 0xac, 0x42, 0x0f, 0xd0, - 0x20, 0x1c, 0x00, 0xf0, 0x4f, 0xfd, 0x00, 0x2e, 0xe8, 0xd0, 0x23, 0x1c, - 0x00, 0x9c, 0x00, 0x93, 0xd1, 0xe7, 0xac, 0x42, 0x02, 0xd0, 0x20, 0x1c, - 0x00, 0xf0, 0x44, 0xfd, 0x30, 0x1c, 0x03, 0xe0, 0x00, 0x28, 0xdb, 0xd0, - 0x16, 0xac, 0xf0, 0xe7, 0x21, 0xb0, 0xf0, 0xbd, 0x40, 0x4d, 0x00, 0x00, - 0x38, 0xb5, 0x0a, 0x1c, 0x01, 0x21, 0x04, 0x1c, 0x00, 0xf0, 0xd6, 0xf9, - 0x00, 0x28, 0x01, 0xd1, 0x00, 0x20, 0x0f, 0xe0, 0x25, 0x1c, 0x10, 0x35, - 0x28, 0x1c, 0x21, 0x1c, 0xff, 0xf7, 0x6c, 0xff, 0x00, 0x28, 0xf5, 0xd0, - 0x20, 0x1c, 0x38, 0x30, 0x29, 0x1c, 0x00, 0xf0, 0xe1, 0xfb, 0x43, 0x1e, - 0x98, 0x41, 0xc0, 0xb2, 0x38, 0xbd, 0x00, 0x00, 0x4b, 0x68, 0x43, 0x60, - 0x0a, 0x4b, 0x03, 0x60, 0x0b, 0x7a, 0x03, 0x72, 0x4b, 0x7a, 0x43, 0x72, - 0xcb, 0x68, 0xc3, 0x60, 0x0b, 0x69, 0x03, 0x61, 0x4b, 0x69, 0x43, 0x61, - 0x0b, 0x7e, 0x03, 0x76, 0xcb, 0x69, 0xc3, 0x61, 0x0b, 0x6a, 0x49, 0x6a, - 0x03, 0x62, 0x41, 0x62, 0x70, 0x47, 0xc0, 0x46, 0x40, 0x4d, 0x00, 0x00, - 0xf0, 0xb5, 0x9d, 0xb0, 0x05, 0x1c, 0x38, 0x31, 0x08, 0xa8, 0x02, 0x92, - 0x03, 0x93, 0xff, 0xf7, 0xdd, 0xff, 0x24, 0x4a, 0x12, 0xaf, 0x00, 0x23, - 0x02, 0x9c, 0x7b, 0x60, 0x12, 0x92, 0x7b, 0x72, 0x08, 0xae, 0x20, 0x1c, - 0x2f, 0x21, 0x02, 0xf0, 0x6d, 0xfb, 0x00, 0x28, 0x2e, 0xd0, 0x23, 0x78, - 0x2f, 0x2b, 0x01, 0xd1, 0x01, 0x34, 0xf4, 0xe7, 0x00, 0x1b, 0xc0, 0xb2, - 0x03, 0x1c, 0x0c, 0x28, 0x00, 0xd9, 0x0c, 0x23, 0xdb, 0xb2, 0x1a, 0x1c, - 0x21, 0x1c, 0x04, 0xa8, 0x01, 0x93, 0x02, 0xf0, 0x65, 0xfb, 0x01, 0x9a, - 0x00, 0x23, 0x04, 0xa9, 0x38, 0x1c, 0x8b, 0x54, 0x00, 0xf0, 0xd4, 0xfc, - 0x38, 0x1c, 0x31, 0x1c, 0x04, 0xaa, 0x01, 0x23, 0x00, 0xf0, 0x7e, 0xfd, - 0x00, 0x28, 0x04, 0xd1, 0x0c, 0x4b, 0x68, 0x60, 0x2b, 0x60, 0x68, 0x72, - 0x10, 0xe0, 0x01, 0x9b, 0x30, 0x1c, 0xe4, 0x18, 0x00, 0xf0, 0xc2, 0xfc, - 0x33, 0x1c, 0x3e, 0x1c, 0x1f, 0x1c, 0xca, 0xe7, 0x02, 0x99, 0x03, 0x9a, - 0x64, 0x1a, 0x14, 0x60, 0x28, 0x1c, 0x31, 0x1c, 0xff, 0xf7, 0x98, 0xff, - 0x28, 0x1c, 0x1d, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0x40, 0x4d, 0x00, 0x00, - 0xf0, 0xb5, 0xa3, 0xb0, 0x05, 0x1c, 0x1f, 0x1c, 0x04, 0xa8, 0x03, 0xab, - 0x16, 0x1c, 0x01, 0x91, 0xff, 0xf7, 0xa2, 0xff, 0x03, 0x9b, 0xf6, 0x18, - 0x33, 0x78, 0x00, 0x2b, 0x07, 0xd1, 0x04, 0xa9, 0x18, 0xa8, 0xff, 0xf7, - 0x7f, 0xff, 0x28, 0x1c, 0x18, 0xa9, 0x1e, 0x4a, 0x34, 0xe0, 0x00, 0x23, - 0x0e, 0xac, 0x63, 0x60, 0x63, 0x72, 0x6b, 0x46, 0x19, 0x33, 0x1b, 0x4a, - 0x1b, 0x78, 0x0e, 0x92, 0x00, 0x2b, 0x03, 0xd1, 0x28, 0x1c, 0xff, 0xf7, - 0x55, 0xfe, 0x27, 0xe0, 0x02, 0x3b, 0x01, 0x2b, 0x09, 0xd8, 0x01, 0x99, - 0x20, 0x1c, 0x38, 0x31, 0x32, 0x1c, 0x3b, 0x1c, 0x00, 0xf0, 0x30, 0xfd, - 0x00, 0x28, 0x0b, 0xd1, 0xee, 0xe7, 0x20, 0x1c, 0x04, 0xa9, 0x32, 0x1c, - 0x3b, 0x1c, 0x00, 0xf0, 0x27, 0xfd, 0x00, 0x28, 0xe6, 0xd0, 0x04, 0xa8, - 0x00, 0xf0, 0x72, 0xfc, 0x06, 0x23, 0x1f, 0x42, 0x03, 0xd0, 0x20, 0x1c, - 0x15, 0x99, 0x00, 0xf0, 0xfd, 0xfb, 0x21, 0x1c, 0x18, 0xa8, 0xff, 0xf7, - 0x49, 0xff, 0x28, 0x1c, 0x18, 0xa9, 0x32, 0x1c, 0xff, 0xf7, 0x0a, 0xfe, - 0x28, 0x1c, 0x23, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0x20, 0x4d, 0x00, 0x00, - 0x40, 0x4d, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x1c, 0x08, 0x1c, 0x19, 0x1c, - 0x38, 0x31, 0x02, 0x4a, 0x00, 0x23, 0xff, 0xf7, 0xc7, 0xfe, 0x08, 0xbd, - 0x9d, 0x23, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x1c, 0x08, 0x1c, 0x19, 0x1c, - 0x38, 0x31, 0x02, 0x4a, 0x00, 0x23, 0xff, 0xf7, 0xbb, 0xfe, 0x08, 0xbd, - 0xd9, 0x23, 0x00, 0x00, 0x08, 0x4b, 0x02, 0x21, 0x19, 0x61, 0x19, 0x1c, - 0x00, 0x22, 0x30, 0x31, 0x0a, 0x70, 0x06, 0x49, 0x5a, 0x71, 0x9a, 0x71, - 0x9a, 0x72, 0x1a, 0x73, 0xda, 0x63, 0x99, 0x63, 0x41, 0x33, 0x1a, 0x70, - 0x70, 0x47, 0xc0, 0x46, 0xd4, 0x00, 0x00, 0x20, 0x40, 0x4d, 0x00, 0x00, - 0x08, 0xb5, 0x01, 0x1c, 0x01, 0x48, 0x01, 0xf0, 0xb1, 0xf9, 0x08, 0xbd, - 0x88, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x02, 0x48, 0xff, 0x21, 0x01, 0xf0, - 0xa9, 0xf9, 0x08, 0xbd, 0x88, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x01, 0x21, - 0x00, 0x79, 0x01, 0xf0, 0x3d, 0xfc, 0x05, 0x4b, 0x1a, 0x78, 0x00, 0x2a, - 0x04, 0xd0, 0x00, 0x22, 0x03, 0x48, 0x1a, 0x70, 0x01, 0xf0, 0x86, 0xf9, - 0x08, 0xbd, 0xc0, 0x46, 0x40, 0x01, 0x00, 0x20, 0x88, 0x07, 0x00, 0x20, - 0x10, 0xb5, 0x08, 0x4b, 0x04, 0x1c, 0x1a, 0x78, 0x00, 0x2a, 0x06, 0xd1, - 0x01, 0x22, 0x1a, 0x70, 0x05, 0x4b, 0x06, 0x48, 0x06, 0xcb, 0x01, 0xf0, - 0x57, 0xf9, 0x20, 0x79, 0x00, 0x21, 0x01, 0xf0, 0x1d, 0xfc, 0x10, 0xbd, - 0x40, 0x01, 0x00, 0x20, 0x38, 0x01, 0x00, 0x20, 0x88, 0x07, 0x00, 0x20, - 0x10, 0xb5, 0x83, 0x79, 0x04, 0x1c, 0x00, 0x2b, 0x0d, 0xd0, 0x23, 0x89, - 0x5a, 0x1c, 0x22, 0x81, 0x05, 0x4a, 0x93, 0x42, 0x02, 0xd8, 0xff, 0xf7, - 0xbf, 0xff, 0xf6, 0xe7, 0x20, 0x1c, 0xff, 0xf7, 0xc3, 0xff, 0x00, 0x23, - 0xa3, 0x71, 0x10, 0xbd, 0x01, 0x02, 0x00, 0x00, 0x00, 0xb5, 0x06, 0x29, - 0x03, 0xd9, 0x16, 0x23, 0x43, 0x71, 0x00, 0x20, 0x1c, 0xe0, 0x0f, 0x4b, - 0x05, 0x29, 0x13, 0xd8, 0x08, 0x1c, 0x00, 0x22, 0x02, 0xf0, 0xe8, 0xf8, - 0x03, 0x05, 0x07, 0x09, 0x0b, 0x0d, 0x0b, 0x49, 0x08, 0xe0, 0x0b, 0x49, - 0x06, 0xe0, 0x0b, 0x49, 0x04, 0xe0, 0x0b, 0x49, 0x02, 0xe0, 0x0b, 0x49, - 0x00, 0xe0, 0x0b, 0x49, 0x19, 0x60, 0x02, 0xe0, 0x0a, 0x4a, 0x1a, 0x60, - 0x00, 0x22, 0x1a, 0x71, 0x5a, 0x71, 0x01, 0x20, 0x00, 0xbd, 0xc0, 0x46, - 0x38, 0x01, 0x00, 0x20, 0x00, 0x1b, 0xb7, 0x00, 0x00, 0x09, 0x3d, 0x00, - 0x80, 0x84, 0x1e, 0x00, 0x40, 0x42, 0x0f, 0x00, 0x20, 0xa1, 0x07, 0x00, - 0x90, 0xd0, 0x03, 0x00, 0x48, 0xe8, 0x01, 0x00, 0x38, 0xb5, 0x0c, 0x1c, - 0x01, 0xf0, 0xe2, 0xf9, 0x05, 0x1c, 0xff, 0xf7, 0x79, 0xff, 0xff, 0x28, - 0x08, 0xd0, 0x01, 0xf0, 0xdb, 0xf9, 0xab, 0xb2, 0x80, 0xb2, 0xc0, 0x1a, - 0xa0, 0x42, 0xf4, 0xdb, 0x00, 0x20, 0x00, 0xe0, 0x01, 0x20, 0x38, 0xbd, - 0xf8, 0xb5, 0x04, 0x1c, 0x0e, 0x1c, 0x17, 0x1c, 0xff, 0xf7, 0x9a, 0xff, - 0x20, 0x1c, 0xff, 0xf7, 0x7f, 0xff, 0x96, 0x21, 0x49, 0x00, 0x20, 0x1c, - 0xff, 0xf7, 0xde, 0xff, 0x40, 0x20, 0x30, 0x43, 0xff, 0xf7, 0x52, 0xff, - 0x18, 0x25, 0x38, 0x1c, 0xe8, 0x40, 0xc0, 0xb2, 0x08, 0x3d, 0xff, 0xf7, - 0x4b, 0xff, 0x2b, 0x1c, 0x08, 0x33, 0xf6, 0xd1, 0x95, 0x20, 0x00, 0x2e, - 0x03, 0xd0, 0x87, 0x20, 0x08, 0x2e, 0x00, 0xd0, 0xff, 0x20, 0xff, 0xf7, - 0x3f, 0xff, 0x00, 0x25, 0xff, 0xf7, 0x44, 0xff, 0x43, 0xb2, 0xe0, 0x72, - 0x00, 0x2b, 0x04, 0xda, 0xff, 0x2d, 0x02, 0xd0, 0x01, 0x35, 0xed, 0xb2, - 0xf4, 0xe7, 0xf8, 0xbd, 0xf7, 0xb5, 0x00, 0x25, 0x02, 0x71, 0x05, 0x73, - 0x85, 0x72, 0x85, 0x71, 0x45, 0x71, 0x04, 0x1c, 0x01, 0x91, 0x01, 0xf0, - 0x95, 0xf9, 0x01, 0x21, 0x87, 0xb2, 0x20, 0x79, 0x01, 0xf0, 0x14, 0xfb, - 0x01, 0x21, 0x20, 0x79, 0x01, 0xf0, 0x70, 0xfb, 0x43, 0x4e, 0x30, 0x1c, - 0x01, 0xf0, 0x7a, 0xf8, 0x42, 0x4b, 0x43, 0x49, 0x1d, 0x71, 0x5d, 0x71, - 0x19, 0x60, 0x30, 0x1c, 0x5a, 0x68, 0x01, 0xf0, 0x99, 0xf8, 0x0a, 0x25, - 0x01, 0x3d, 0xff, 0x20, 0xed, 0xb2, 0xff, 0xf7, 0x0b, 0xff, 0x00, 0x2d, - 0xf8, 0xd1, 0x30, 0x1c, 0x01, 0xf0, 0xaa, 0xf8, 0x20, 0x1c, 0xff, 0xf7, - 0x27, 0xff, 0x00, 0x21, 0x20, 0x1c, 0x0a, 0x1c, 0xff, 0xf7, 0x9a, 0xff, - 0x06, 0x1c, 0xe0, 0x72, 0x01, 0x28, 0x09, 0xd0, 0x01, 0xf0, 0x66, 0xf9, - 0xc0, 0x1b, 0xfa, 0x23, 0x80, 0xb2, 0xdb, 0x00, 0x98, 0x42, 0xee, 0xd9, - 0x01, 0x23, 0x3c, 0xe0, 0xd5, 0x22, 0x20, 0x1c, 0x08, 0x21, 0x52, 0x00, - 0xff, 0xf7, 0x86, 0xff, 0x04, 0x23, 0x18, 0x42, 0x01, 0xd0, 0x26, 0x73, - 0x0b, 0xe0, 0x1e, 0x1c, 0xff, 0xf7, 0xea, 0xfe, 0x01, 0x3e, 0xf6, 0xb2, - 0xe0, 0x72, 0x00, 0x2e, 0xf8, 0xd1, 0x02, 0x23, 0xaa, 0x28, 0x26, 0xd1, - 0x23, 0x73, 0x26, 0x7b, 0x02, 0x3e, 0x73, 0x42, 0x5e, 0x41, 0xb6, 0x07, - 0x37, 0x21, 0x00, 0x22, 0x20, 0x1c, 0xff, 0xf7, 0x6b, 0xff, 0x32, 0x1c, - 0x20, 0x1c, 0x29, 0x21, 0xff, 0xf7, 0x66, 0xff, 0x02, 0x1c, 0xe0, 0x72, - 0x09, 0xd0, 0x01, 0xf0, 0x33, 0xf9, 0xc0, 0x1b, 0xfa, 0x23, 0x80, 0xb2, - 0xdb, 0x00, 0x98, 0x42, 0xea, 0xd9, 0x08, 0x23, 0x09, 0xe0, 0x23, 0x7b, - 0x02, 0x2b, 0x19, 0xd1, 0x20, 0x1c, 0x3a, 0x21, 0xff, 0xf7, 0x52, 0xff, - 0x00, 0x28, 0x05, 0xd0, 0x06, 0x23, 0x63, 0x71, 0x20, 0x1c, 0xff, 0xf7, - 0xbf, 0xfe, 0x15, 0xe0, 0xff, 0xf7, 0xb4, 0xfe, 0xc0, 0x23, 0x18, 0x40, - 0x98, 0x42, 0x01, 0xd1, 0x03, 0x23, 0x23, 0x73, 0xff, 0xf7, 0xac, 0xfe, - 0xff, 0xf7, 0xaa, 0xfe, 0xff, 0xf7, 0xa8, 0xfe, 0x20, 0x1c, 0xff, 0xf7, - 0xad, 0xfe, 0x20, 0x1c, 0x01, 0x99, 0xff, 0xf7, 0xeb, 0xfe, 0x05, 0x1c, - 0x28, 0x1c, 0xfe, 0xbd, 0x88, 0x07, 0x00, 0x20, 0x38, 0x01, 0x00, 0x20, - 0x90, 0xd0, 0x03, 0x00, 0x38, 0xb5, 0x04, 0x1c, 0x01, 0xf0, 0xfa, 0xf8, - 0x05, 0x1c, 0xff, 0xf7, 0x91, 0xfe, 0xe0, 0x72, 0xff, 0x28, 0x0a, 0xd1, - 0x01, 0xf0, 0xf2, 0xf8, 0xab, 0xb2, 0x80, 0xb2, 0xc0, 0x1a, 0x96, 0x23, - 0x5b, 0x00, 0x98, 0x42, 0xf1, 0xdd, 0x0f, 0x23, 0x02, 0xe0, 0xfe, 0x28, - 0x06, 0xd0, 0x0d, 0x23, 0x20, 0x1c, 0x63, 0x71, 0xff, 0xf7, 0x84, 0xfe, - 0x00, 0x20, 0x00, 0xe0, 0x01, 0x20, 0x38, 0xbd, 0xf8, 0xb5, 0x04, 0x1c, - 0x0f, 0x1c, 0x15, 0x1c, 0x1e, 0x1e, 0x45, 0xd0, 0x9a, 0x18, 0x80, 0x23, - 0x9b, 0x00, 0x9a, 0x42, 0x42, 0xdc, 0x83, 0x79, 0x00, 0x2b, 0x05, 0xd0, - 0x02, 0x68, 0x91, 0x42, 0x02, 0xd1, 0x03, 0x89, 0xab, 0x42, 0x16, 0xd9, - 0x23, 0x7b, 0x27, 0x60, 0x03, 0x2b, 0x00, 0xd0, 0x7f, 0x02, 0x3a, 0x1c, - 0x20, 0x1c, 0x11, 0x21, 0xff, 0xf7, 0xee, 0xfe, 0x07, 0x1e, 0x02, 0xd0, - 0x03, 0x23, 0x63, 0x71, 0x2a, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0xba, 0xff, - 0x00, 0x28, 0x25, 0xd0, 0x01, 0x23, 0x27, 0x81, 0xa3, 0x71, 0x23, 0x89, - 0xab, 0x42, 0x05, 0xd2, 0xff, 0xf7, 0x48, 0xfe, 0x23, 0x89, 0x01, 0x33, - 0x23, 0x81, 0xf6, 0xe7, 0x06, 0x9d, 0x06, 0x9a, 0xab, 0x1a, 0x9b, 0xb2, - 0xb3, 0x42, 0x04, 0xd2, 0xff, 0xf7, 0x3c, 0xfe, 0x28, 0x70, 0x01, 0x35, - 0xf5, 0xe7, 0x23, 0x89, 0xa2, 0x7a, 0xf3, 0x18, 0x9b, 0xb2, 0x23, 0x81, - 0x00, 0x2a, 0x02, 0xd0, 0x06, 0x4a, 0x93, 0x42, 0x02, 0xd9, 0x20, 0x1c, - 0xff, 0xf7, 0x60, 0xfe, 0x01, 0x20, 0x03, 0xe0, 0x20, 0x1c, 0xff, 0xf7, - 0x2f, 0xfe, 0x00, 0x20, 0xf8, 0xbd, 0xc0, 0x46, 0xff, 0x01, 0x00, 0x00, - 0x07, 0xb5, 0x80, 0x23, 0x00, 0x92, 0x9b, 0x00, 0x00, 0x22, 0xff, 0xf7, - 0xa3, 0xff, 0x0e, 0xbd, 0x70, 0xb5, 0x05, 0x1c, 0x08, 0x1c, 0x16, 0x1c, - 0xff, 0xf7, 0x0c, 0xfe, 0x00, 0x24, 0x30, 0x5d, 0xff, 0xf7, 0x08, 0xfe, - 0x01, 0x34, 0x80, 0x23, 0x9b, 0x00, 0x9c, 0x42, 0xf7, 0xd1, 0xff, 0x20, - 0xff, 0xf7, 0x00, 0xfe, 0xff, 0x20, 0xff, 0xf7, 0xfd, 0xfd, 0xff, 0xf7, - 0x03, 0xfe, 0x1f, 0x23, 0xe8, 0x72, 0x03, 0x40, 0x01, 0x20, 0x05, 0x2b, - 0x05, 0xd0, 0x11, 0x23, 0x28, 0x1c, 0x6b, 0x71, 0xff, 0xf7, 0x00, 0xfe, - 0x00, 0x20, 0x70, 0xbd, 0x70, 0xb5, 0x0b, 0x1c, 0x04, 0x1c, 0x16, 0x1c, - 0x00, 0x29, 0x01, 0xd1, 0x12, 0x23, 0x28, 0xe0, 0x02, 0x7b, 0x03, 0x2a, - 0x00, 0xd0, 0x4b, 0x02, 0x20, 0x1c, 0x18, 0x21, 0x1a, 0x1c, 0xff, 0xf7, - 0x79, 0xfe, 0x05, 0x1e, 0x01, 0xd0, 0x04, 0x23, 0x1b, 0xe0, 0x20, 0x1c, - 0xfe, 0x21, 0x32, 0x1c, 0xff, 0xf7, 0xc2, 0xff, 0x00, 0x28, 0x15, 0xd0, - 0x96, 0x21, 0x20, 0x1c, 0x89, 0x00, 0xff, 0xf7, 0x55, 0xfe, 0x00, 0x28, - 0x01, 0xd1, 0x15, 0x23, 0x0b, 0xe0, 0x20, 0x1c, 0x0d, 0x21, 0x2a, 0x1c, - 0xff, 0xf7, 0x60, 0xfe, 0x00, 0x28, 0x03, 0xd1, 0xff, 0xf7, 0xc8, 0xfd, - 0x00, 0x28, 0x06, 0xd0, 0x14, 0x23, 0x63, 0x71, 0x20, 0x1c, 0xff, 0xf7, - 0xc9, 0xfd, 0x00, 0x20, 0x03, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0xc4, 0xfd, - 0x01, 0x20, 0x70, 0xbd, 0x03, 0x4b, 0x04, 0x4a, 0x1a, 0x60, 0x00, 0x22, - 0x5a, 0x71, 0x1a, 0x71, 0x70, 0x47, 0xc0, 0x46, 0x38, 0x01, 0x00, 0x20, - 0x00, 0x09, 0x3d, 0x00, 0x02, 0x1c, 0x10, 0xb5, 0x0c, 0x32, 0x04, 0x1c, - 0x01, 0x21, 0x40, 0x6a, 0x00, 0xf0, 0x24, 0xfd, 0x00, 0x28, 0x0a, 0xd0, - 0x23, 0x6a, 0x01, 0x20, 0x00, 0x2b, 0x06, 0xd1, 0xe3, 0x68, 0x22, 0x7a, - 0x23, 0x62, 0x80, 0x23, 0x5b, 0x42, 0x13, 0x43, 0x23, 0x72, 0x10, 0xbd, - 0x70, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xe6, 0xff, 0x00, 0x28, 0x01, 0xd1, - 0x00, 0x20, 0x1b, 0xe0, 0x63, 0x6a, 0xe6, 0x68, 0x1a, 0x7c, 0x02, 0x3e, - 0x96, 0x40, 0x5a, 0x69, 0x1d, 0x79, 0xb6, 0x18, 0x00, 0x2d, 0x08, 0xd0, - 0x70, 0x1e, 0x40, 0x19, 0x00, 0xf0, 0x4c, 0xfc, 0x00, 0x28, 0xed, 0xd0, - 0x01, 0x3d, 0xed, 0xb2, 0xf4, 0xe7, 0x63, 0x6a, 0x01, 0x20, 0x1a, 0x7c, - 0x80, 0x23, 0x9b, 0x00, 0x93, 0x40, 0xe2, 0x69, 0xd3, 0x18, 0xe3, 0x61, - 0x70, 0xbd, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, 0x40, 0x69, 0x00, 0xf0, - 0x13, 0xfc, 0x00, 0x28, 0x03, 0xd0, 0x20, 0x7e, 0x01, 0x4b, 0x40, 0x01, - 0xc0, 0x18, 0x10, 0xbd, 0x50, 0x01, 0x00, 0x20, 0xf0, 0xb5, 0x00, 0x23, - 0x87, 0xb0, 0x07, 0x1c, 0x0e, 0x1c, 0x20, 0x22, 0xf2, 0x54, 0x01, 0x33, - 0x0b, 0x2b, 0xfa, 0xd1, 0x07, 0x21, 0x00, 0x25, 0x01, 0x91, 0x3c, 0x78, - 0x00, 0x2c, 0x2a, 0xd0, 0x2e, 0x2c, 0x06, 0xd1, 0x01, 0x9b, 0x0a, 0x2b, - 0x2b, 0xd0, 0x0a, 0x21, 0x08, 0x25, 0x01, 0x91, 0x1f, 0xe0, 0x02, 0xa8, - 0x14, 0x49, 0x10, 0x22, 0x01, 0xf0, 0x29, 0xff, 0x00, 0x23, 0x02, 0xa9, - 0xca, 0x5c, 0x00, 0x2a, 0x03, 0xd0, 0x01, 0x33, 0xa2, 0x42, 0xf8, 0xd1, - 0x19, 0xe0, 0x01, 0x9b, 0x9d, 0x42, 0x16, 0xd8, 0x23, 0x1c, 0x21, 0x3b, - 0x5d, 0x2b, 0x12, 0xd8, 0x22, 0x1c, 0x6b, 0x1c, 0x61, 0x3a, 0xdb, 0xb2, - 0x75, 0x19, 0x19, 0x2a, 0x01, 0xd8, 0x20, 0x3c, 0xe4, 0xb2, 0x2c, 0x70, - 0x1d, 0x1c, 0x01, 0x37, 0xd1, 0xe7, 0x30, 0x78, 0x20, 0x38, 0x43, 0x1e, - 0x98, 0x41, 0xc0, 0xb2, 0x00, 0xe0, 0x00, 0x20, 0x07, 0xb0, 0xf0, 0xbd, - 0x22, 0x4d, 0x00, 0x00, 0x38, 0xb5, 0x42, 0x7a, 0x04, 0x1c, 0x0d, 0x1c, - 0x00, 0x2a, 0x01, 0xd0, 0x00, 0x20, 0x1f, 0xe0, 0x4b, 0x1c, 0xdb, 0x7f, - 0x10, 0x2b, 0x06, 0xd1, 0x02, 0x23, 0x43, 0x72, 0x02, 0x62, 0x4b, 0x8c, - 0x5b, 0x01, 0xc3, 0x61, 0x0c, 0xe0, 0x20, 0x2b, 0xf0, 0xd1, 0x03, 0x23, - 0x43, 0x72, 0x49, 0x6a, 0x22, 0x1c, 0x01, 0x62, 0x1c, 0x32, 0x28, 0x1c, - 0x00, 0xf0, 0x18, 0xfc, 0x00, 0x28, 0xe5, 0xd0, 0x00, 0x23, 0x01, 0x20, - 0x65, 0x62, 0x20, 0x72, 0xe3, 0x60, 0x23, 0x61, 0x63, 0x61, 0x23, 0x76, - 0x38, 0xbd, 0x00, 0x00, 0xf0, 0xb5, 0x43, 0x7a, 0x85, 0xb0, 0x04, 0x1c, - 0x0e, 0x1c, 0x03, 0x92, 0x00, 0x2b, 0x01, 0xd1, 0x3a, 0x48, 0x11, 0xe0, - 0x03, 0x7a, 0xd8, 0x07, 0xfa, 0xd5, 0xe2, 0x69, 0x20, 0x69, 0x03, 0x99, - 0x13, 0x1a, 0x99, 0x42, 0x01, 0xd9, 0x9b, 0xb2, 0x03, 0x93, 0x03, 0x99, - 0x02, 0x91, 0x02, 0x9b, 0x00, 0x2b, 0x04, 0xd1, 0x03, 0x99, 0x88, 0xb2, - 0x00, 0xb2, 0x05, 0xb0, 0xf0, 0xbd, 0x23, 0x69, 0x61, 0x7a, 0xdf, 0x05, - 0xff, 0x0d, 0x5a, 0x0a, 0x60, 0x6a, 0x02, 0x29, 0x02, 0xd1, 0x41, 0x6a, - 0x51, 0x18, 0x1b, 0xe0, 0x05, 0x79, 0x01, 0x3d, 0x2a, 0x40, 0xd5, 0xb2, - 0x00, 0x2f, 0x0d, 0xd1, 0x00, 0x2d, 0x0b, 0xd1, 0x00, 0x2b, 0x02, 0xd1, - 0x22, 0x6a, 0xe2, 0x60, 0x06, 0xe0, 0x22, 0x1c, 0xe1, 0x68, 0x0c, 0x32, - 0x00, 0xf0, 0xa0, 0xfb, 0x00, 0x28, 0xc9, 0xd0, 0x63, 0x6a, 0xe1, 0x68, - 0x1a, 0x7c, 0x02, 0x39, 0x5b, 0x69, 0x91, 0x40, 0xc9, 0x18, 0x49, 0x19, - 0x80, 0x22, 0x02, 0x9d, 0x92, 0x00, 0xd3, 0x1b, 0x9d, 0x42, 0x00, 0xdd, - 0x9d, 0xb2, 0x23, 0x7a, 0x58, 0x06, 0x01, 0xd4, 0x95, 0x42, 0x18, 0xd1, - 0x16, 0x4b, 0x1b, 0x68, 0x99, 0x42, 0x14, 0xd0, 0x15, 0x4b, 0x3a, 0x1c, - 0x18, 0x68, 0x00, 0x96, 0x2b, 0x1c, 0xff, 0xf7, 0x1f, 0xfe, 0x00, 0x28, - 0xa8, 0xd0, 0x76, 0x19, 0x01, 0xe0, 0xdf, 0x1b, 0xf6, 0x19, 0x21, 0x69, - 0x02, 0x9a, 0x4b, 0x19, 0x55, 0x1b, 0xad, 0xb2, 0x23, 0x61, 0x02, 0x95, - 0xab, 0xe7, 0x08, 0x1c, 0x00, 0x21, 0x00, 0xf0, 0x2b, 0xfb, 0x00, 0x28, - 0x96, 0xd0, 0x09, 0x4b, 0x32, 0x1c, 0xff, 0x18, 0x79, 0x19, 0x3b, 0x1c, - 0x8b, 0x42, 0xe8, 0xd0, 0x18, 0x78, 0x01, 0x33, 0x10, 0x70, 0x01, 0x32, - 0xf8, 0xe7, 0xc0, 0x46, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x73, 0xb5, 0x43, 0x7a, - 0x04, 0x1c, 0x01, 0x2b, 0x01, 0xd8, 0x00, 0x20, 0x16, 0xe0, 0x03, 0x69, - 0x6d, 0x46, 0x07, 0x35, 0xde, 0x05, 0x29, 0x1c, 0x01, 0x22, 0x36, 0x0f, - 0xff, 0xf7, 0x6a, 0xff, 0x01, 0x28, 0x01, 0xd1, 0x2b, 0x78, 0x00, 0xe0, - 0x05, 0x4b, 0x1b, 0xb2, 0x01, 0x33, 0xec, 0xd0, 0x23, 0x69, 0x70, 0x01, - 0x1f, 0x33, 0x23, 0x61, 0x02, 0x4b, 0xc0, 0x18, 0x76, 0xbd, 0xc0, 0x46, - 0xff, 0xff, 0x00, 0x00, 0x50, 0x01, 0x00, 0x20, 0x70, 0xb5, 0x04, 0x1c, - 0x40, 0x7a, 0x0d, 0x1c, 0x00, 0x28, 0x2a, 0xd0, 0xe2, 0x69, 0x91, 0x42, - 0x01, 0xd9, 0x00, 0x20, 0x25, 0xe0, 0x02, 0x28, 0x21, 0xd0, 0x00, 0x2d, - 0x01, 0xd1, 0xe5, 0x60, 0x1d, 0xe0, 0x62, 0x6a, 0x21, 0x69, 0x13, 0x7c, - 0x68, 0x1e, 0x09, 0x33, 0x4a, 0x1e, 0xd8, 0x40, 0xda, 0x40, 0x03, 0x1e, - 0x93, 0x42, 0x01, 0xd3, 0x00, 0x29, 0x02, 0xd1, 0x22, 0x6a, 0xe2, 0x60, - 0x00, 0xe0, 0x83, 0x1a, 0x1e, 0x1c, 0x00, 0x2e, 0x09, 0xd0, 0x22, 0x1c, - 0x60, 0x6a, 0xe1, 0x68, 0x0c, 0x32, 0x00, 0xf0, 0x07, 0xfb, 0x01, 0x3e, - 0x00, 0x28, 0xf4, 0xd1, 0x01, 0xe0, 0x25, 0x61, 0x01, 0x20, 0x70, 0xbd, - 0x38, 0xb5, 0x05, 0x1c, 0x40, 0x7a, 0x00, 0x28, 0x33, 0xd0, 0x2b, 0x7a, - 0x7f, 0x2b, 0x2d, 0xd9, 0x28, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x9a, 0xfe, - 0x04, 0x1e, 0x2a, 0xd0, 0x6b, 0x7a, 0x01, 0x2b, 0x07, 0xd8, 0x2b, 0x7f, - 0x03, 0x77, 0x6b, 0x7f, 0x43, 0x77, 0xab, 0x7f, 0x83, 0x77, 0xeb, 0x7f, - 0xc3, 0x77, 0x2b, 0x6a, 0x9a, 0xb2, 0x1b, 0x0c, 0x23, 0x75, 0x1b, 0x0a, - 0x63, 0x75, 0x0d, 0x4b, 0xa2, 0x76, 0x1b, 0x68, 0x12, 0x0a, 0xe2, 0x76, - 0x00, 0x2b, 0x0b, 0xd0, 0x20, 0x1c, 0x21, 0x1c, 0x18, 0x30, 0x16, 0x31, - 0x98, 0x47, 0x63, 0x7e, 0x22, 0x7e, 0x1b, 0x02, 0x13, 0x43, 0xa3, 0x74, - 0x1b, 0x0a, 0xe3, 0x74, 0x2a, 0x7a, 0x7f, 0x23, 0x13, 0x40, 0x2b, 0x72, - 0x00, 0xf0, 0x5c, 0xfa, 0xff, 0xe7, 0x38, 0xbd, 0x44, 0x01, 0x00, 0x20, - 0x10, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xc0, 0xff, 0x00, 0x28, 0x02, 0xd0, - 0x00, 0x23, 0x63, 0x72, 0x01, 0x20, 0x10, 0xbd, 0x73, 0xb5, 0x42, 0x7a, - 0x04, 0x1c, 0x0d, 0x1c, 0x00, 0x20, 0x01, 0x2a, 0x4b, 0xd1, 0x20, 0x7a, - 0x02, 0x23, 0x18, 0x40, 0x47, 0xd0, 0xe3, 0x69, 0x00, 0x20, 0x99, 0x42, - 0x43, 0xd8, 0x10, 0x1c, 0x00, 0x2b, 0x40, 0xd0, 0x20, 0x1c, 0x29, 0x1c, - 0x26, 0x69, 0xff, 0xf7, 0x71, 0xff, 0x00, 0x28, 0x25, 0xd0, 0x60, 0x6a, - 0x00, 0x2d, 0x06, 0xd1, 0x21, 0x6a, 0x00, 0xf0, 0x95, 0xfb, 0x00, 0x28, - 0x1d, 0xd0, 0x25, 0x62, 0x1d, 0xe0, 0xe1, 0x68, 0x01, 0xaa, 0x00, 0xf0, - 0x93, 0xfa, 0x00, 0x28, 0x15, 0xd0, 0x60, 0x6a, 0x01, 0x99, 0x43, 0x1c, - 0xdb, 0x7f, 0x10, 0x2b, 0x01, 0xd1, 0x12, 0x4b, 0x00, 0xe0, 0x12, 0x4b, - 0x99, 0x42, 0x0c, 0xd2, 0x00, 0xf0, 0x7e, 0xfb, 0x00, 0x28, 0x06, 0xd0, - 0x60, 0x6a, 0xe1, 0x68, 0x0e, 0x4a, 0x00, 0xf0, 0xcf, 0xfa, 0x00, 0x28, - 0x01, 0xd1, 0x00, 0x20, 0x11, 0xe0, 0x22, 0x7a, 0x80, 0x23, 0x5b, 0x42, - 0x13, 0x43, 0xe5, 0x61, 0x23, 0x72, 0x20, 0x1c, 0xff, 0xf7, 0x70, 0xff, - 0x00, 0x28, 0xf2, 0xd0, 0x29, 0x1e, 0xb1, 0x42, 0x00, 0xd9, 0x31, 0x1c, - 0x20, 0x1c, 0xff, 0xf7, 0x35, 0xff, 0x76, 0xbd, 0xf8, 0xff, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x38, 0xb5, 0x23, 0x4b, - 0x15, 0x1c, 0x4a, 0x01, 0xd3, 0x18, 0x04, 0x1c, 0xd8, 0x7a, 0x11, 0x22, - 0x10, 0x42, 0x04, 0xd0, 0x42, 0x22, 0x15, 0x42, 0x01, 0xd0, 0x00, 0x20, - 0x36, 0xe0, 0x1d, 0x4a, 0x21, 0x76, 0x12, 0x68, 0x62, 0x61, 0x5a, 0x7d, - 0x18, 0x7d, 0xd9, 0x7e, 0x12, 0x02, 0x02, 0x43, 0x98, 0x7e, 0x09, 0x02, - 0x12, 0x04, 0x01, 0x43, 0x11, 0x43, 0x21, 0x62, 0xd8, 0x7a, 0x18, 0x22, - 0x02, 0x40, 0x0c, 0xd1, 0x5a, 0x7f, 0x19, 0x7f, 0x12, 0x02, 0x0a, 0x43, - 0x99, 0x7f, 0xdb, 0x7f, 0x09, 0x04, 0x0a, 0x43, 0x1b, 0x06, 0x13, 0x43, - 0xe3, 0x61, 0x01, 0x23, 0x09, 0xe0, 0x10, 0x2a, 0xdb, 0xd1, 0x22, 0x1c, - 0x60, 0x6a, 0x1c, 0x32, 0x00, 0xf0, 0x5a, 0xfa, 0x00, 0x28, 0xd4, 0xd0, - 0x04, 0x23, 0x63, 0x72, 0x0f, 0x23, 0x00, 0x21, 0x2b, 0x40, 0x23, 0x72, - 0xe1, 0x60, 0x21, 0x61, 0x01, 0x20, 0x6a, 0x06, 0x02, 0xd5, 0x20, 0x1c, - 0xff, 0xf7, 0x60, 0xff, 0x38, 0xbd, 0xc0, 0x46, 0x50, 0x01, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x20, 0xf0, 0xb5, 0x45, 0x7a, 0x87, 0xb0, 0x04, 0x1c, - 0x0e, 0x1c, 0x01, 0x93, 0x00, 0x2d, 0x00, 0xd0, 0x86, 0xe0, 0x10, 0x1c, - 0x03, 0xa9, 0xff, 0xf7, 0xbb, 0xfd, 0x00, 0x28, 0x00, 0xd1, 0x80, 0xe0, - 0x72, 0x6a, 0x2f, 0x1c, 0x62, 0x62, 0xf5, 0x60, 0x35, 0x61, 0x33, 0x69, - 0xf2, 0x69, 0x93, 0x42, 0x26, 0xd2, 0xdb, 0x05, 0x1b, 0x0f, 0x30, 0x1c, - 0x00, 0x93, 0xff, 0xf7, 0x9f, 0xfe, 0x01, 0x1e, 0x6f, 0xd0, 0x03, 0x78, - 0x00, 0x2b, 0x01, 0xd0, 0xe5, 0x2b, 0x0b, 0xd1, 0x00, 0x2f, 0x04, 0xd1, - 0x00, 0x9b, 0x23, 0x76, 0x34, 0x4b, 0x1b, 0x68, 0x63, 0x61, 0x0b, 0x78, - 0x01, 0x27, 0x00, 0x2b, 0xe3, 0xd1, 0x0d, 0xe0, 0x03, 0xa8, 0x0b, 0x22, - 0x01, 0xf0, 0xca, 0xfc, 0x00, 0x28, 0xdc, 0xd1, 0x01, 0x9a, 0x30, 0x23, - 0x13, 0x40, 0x30, 0x2b, 0x53, 0xd0, 0x20, 0x1c, 0x00, 0x99, 0x4b, 0xe0, - 0x01, 0x9a, 0x12, 0x23, 0x13, 0x40, 0x12, 0x2b, 0x4b, 0xd1, 0x00, 0x2f, - 0x06, 0xd0, 0x20, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x6f, 0xfd, 0x06, 0x1e, - 0x0a, 0xd1, 0x42, 0xe0, 0x73, 0x7a, 0x02, 0x2b, 0x3f, 0xd0, 0x30, 0x1c, - 0xff, 0xf7, 0x40, 0xfd, 0x00, 0x28, 0x3a, 0xd0, 0x1f, 0x4e, 0x27, 0x76, - 0x00, 0x21, 0x20, 0x22, 0x30, 0x1c, 0x01, 0xf0, 0xbb, 0xfc, 0x30, 0x1c, - 0x03, 0xa9, 0x0b, 0x22, 0x01, 0xf0, 0xad, 0xfc, 0x1a, 0x4b, 0x1b, 0x68, - 0x00, 0x2b, 0x05, 0xd0, 0x30, 0x1c, 0x31, 0x1c, 0x10, 0x30, 0x0e, 0x31, - 0x98, 0x47, 0x06, 0xe0, 0x21, 0x22, 0x32, 0x74, 0xb3, 0x73, 0x28, 0x22, - 0x08, 0x23, 0x72, 0x74, 0xf3, 0x73, 0x73, 0x7c, 0x32, 0x7c, 0x1b, 0x02, - 0x13, 0x43, 0xff, 0x22, 0x1a, 0x40, 0x1b, 0x0a, 0xf3, 0x74, 0x73, 0x76, - 0xf3, 0x7b, 0xb2, 0x74, 0x32, 0x76, 0xb2, 0x7b, 0x1b, 0x02, 0x13, 0x43, - 0xb3, 0x75, 0x1b, 0x0a, 0xf3, 0x75, 0x00, 0xf0, 0x21, 0xf9, 0x00, 0x28, - 0x07, 0xd0, 0x21, 0x7e, 0x01, 0x9a, 0x20, 0x1c, 0xff, 0xf7, 0x26, 0xff, - 0x05, 0x1c, 0x00, 0xe0, 0x00, 0x25, 0x28, 0x1c, 0x07, 0xb0, 0xf0, 0xbd, - 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x44, 0x01, 0x00, 0x20, - 0x10, 0xb5, 0x00, 0x21, 0x04, 0x1c, 0xff, 0xf7, 0xbb, 0xfe, 0x00, 0x28, - 0x0b, 0xd0, 0x20, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x15, 0xfd, 0x00, 0x28, - 0x05, 0xd0, 0xe5, 0x23, 0x03, 0x70, 0x00, 0x23, 0x63, 0x72, 0x00, 0xf0, - 0xfb, 0xf8, 0x10, 0xbd, 0x10, 0xb5, 0x0a, 0x1c, 0x0a, 0x49, 0x8a, 0xb0, - 0x08, 0x31, 0x00, 0x23, 0x04, 0x1c, 0x00, 0x91, 0x69, 0x46, 0x4b, 0x72, - 0x01, 0x93, 0x68, 0x46, 0x21, 0x1c, 0x02, 0x23, 0xff, 0xf7, 0x42, 0xff, - 0x00, 0x28, 0x02, 0xd0, 0x68, 0x46, 0xff, 0xf7, 0xd7, 0xff, 0x0a, 0xb0, - 0x10, 0xbd, 0xc0, 0x46, 0x38, 0x4d, 0x00, 0x00, 0xf0, 0xb5, 0x43, 0x7a, - 0x87, 0xb0, 0x04, 0x1c, 0x0d, 0x1c, 0x03, 0x92, 0x01, 0x2b, 0x0d, 0xd1, - 0x03, 0x7a, 0x99, 0x07, 0x0a, 0xd5, 0x5a, 0x07, 0x0c, 0xd5, 0xe1, 0x69, - 0x22, 0x69, 0x8a, 0x42, 0x08, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0x06, 0xfe, - 0x00, 0x28, 0x03, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x00, 0x20, 0xaa, 0xe0, - 0x03, 0x9b, 0x01, 0x93, 0x3b, 0xe0, 0x60, 0x6a, 0x73, 0x0a, 0x07, 0x79, - 0xf6, 0x05, 0x01, 0x3f, 0x1f, 0x40, 0xff, 0xb2, 0xf6, 0x0d, 0x00, 0x2f, - 0x36, 0xd0, 0x80, 0x22, 0x92, 0x00, 0x92, 0x1b, 0x01, 0x99, 0x92, 0xb2, - 0x0b, 0x1c, 0x91, 0x42, 0x00, 0xd9, 0x13, 0x1c, 0x9b, 0xb2, 0x02, 0x93, - 0x63, 0x6a, 0xe1, 0x68, 0x1a, 0x7c, 0x02, 0x39, 0x91, 0x40, 0x5a, 0x69, - 0x8b, 0x18, 0x02, 0x9a, 0xdf, 0x19, 0x80, 0x23, 0x9b, 0x00, 0x9a, 0x42, - 0x3f, 0xd1, 0x44, 0x4b, 0x19, 0x68, 0xb9, 0x42, 0x02, 0xd1, 0x01, 0x22, - 0x52, 0x42, 0x1a, 0x60, 0x41, 0x4b, 0x39, 0x1c, 0x18, 0x68, 0x2a, 0x1c, - 0xff, 0xf7, 0x22, 0xfc, 0x00, 0x28, 0xc7, 0xd0, 0x80, 0x22, 0x92, 0x00, - 0xad, 0x18, 0x01, 0x99, 0x02, 0x9a, 0x8b, 0x1a, 0x21, 0x69, 0x9b, 0xb2, - 0x01, 0x93, 0x8b, 0x18, 0x23, 0x61, 0x01, 0x9a, 0x26, 0x69, 0x00, 0x2a, - 0xbf, 0xd1, 0x49, 0xe0, 0x00, 0x2e, 0xc6, 0xd1, 0xe1, 0x68, 0x00, 0x29, - 0x03, 0xd1, 0x23, 0x6a, 0x00, 0x2b, 0x16, 0xd1, 0x0f, 0xe0, 0x05, 0xaa, - 0x00, 0xf0, 0xe2, 0xf8, 0x00, 0x28, 0x58, 0xd0, 0x62, 0x6a, 0x05, 0x9b, - 0x01, 0x32, 0xd2, 0x7f, 0x10, 0x2a, 0x01, 0xd1, 0x2c, 0x4a, 0x00, 0xe0, - 0x2c, 0x4a, 0x93, 0x42, 0x05, 0xd3, 0x20, 0x1c, 0xff, 0xf7, 0x3c, 0xfc, - 0x00, 0x28, 0xaa, 0xd1, 0x98, 0xe7, 0xe3, 0x60, 0xa7, 0xe7, 0x00, 0x2e, - 0x0f, 0xd1, 0x23, 0x69, 0xe1, 0x69, 0x8b, 0x42, 0x0b, 0xd3, 0x00, 0xf0, - 0x59, 0xf8, 0x00, 0x28, 0x8c, 0xd0, 0x1f, 0x4b, 0x01, 0x21, 0x1f, 0x60, - 0x21, 0x4b, 0x1a, 0x78, 0x0a, 0x43, 0x1a, 0x70, 0x06, 0xe0, 0x38, 0x1c, - 0x01, 0x21, 0x00, 0xf0, 0x75, 0xf8, 0x00, 0x28, 0x00, 0xd1, 0x7d, 0xe7, - 0x1c, 0x4b, 0x2a, 0x1c, 0xf6, 0x18, 0x02, 0x9b, 0xf1, 0x18, 0x33, 0x1c, - 0x8b, 0x42, 0x04, 0xd0, 0x10, 0x78, 0x01, 0x32, 0x18, 0x70, 0x01, 0x33, - 0xf8, 0xe7, 0x9e, 0x1b, 0xad, 0x19, 0xa8, 0xe7, 0xe1, 0x69, 0x23, 0x7a, - 0x8e, 0x42, 0x01, 0xd9, 0xe6, 0x61, 0x06, 0xe0, 0x12, 0x4a, 0x12, 0x68, - 0x00, 0x2a, 0x06, 0xd0, 0x03, 0x9a, 0x00, 0x2a, 0x03, 0xd0, 0x80, 0x22, - 0x52, 0x42, 0x13, 0x43, 0x23, 0x72, 0x23, 0x7a, 0x19, 0x07, 0x01, 0xd4, - 0x03, 0x98, 0x06, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0x8b, 0xfd, 0x00, 0x28, - 0x00, 0xd1, 0x51, 0xe7, 0xf6, 0xe7, 0x07, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, - 0x00, 0x00, 0x00, 0x20, 0x4c, 0x01, 0x00, 0x20, 0xf8, 0xff, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x0f, 0x50, 0x03, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, - 0x44, 0x01, 0x00, 0x20, 0x07, 0xb5, 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, - 0x19, 0x1c, 0x01, 0x22, 0xff, 0xf7, 0x22, 0xff, 0x0e, 0xbd, 0x00, 0x00, - 0xf8, 0xb5, 0x0f, 0x4f, 0x01, 0x20, 0x3b, 0x78, 0x00, 0x2b, 0x18, 0xd0, - 0x0d, 0x4e, 0x0e, 0x4b, 0x0e, 0x4d, 0x19, 0x68, 0x30, 0x68, 0x2a, 0x1c, - 0xff, 0xf7, 0x80, 0xfb, 0x00, 0x28, 0x0e, 0xd0, 0x0b, 0x4c, 0x21, 0x68, - 0x00, 0x29, 0x07, 0xd0, 0x30, 0x68, 0x2a, 0x1c, 0xff, 0xf7, 0x76, 0xfb, - 0x00, 0x28, 0x04, 0xd0, 0x00, 0x23, 0x23, 0x60, 0x00, 0x23, 0x3b, 0x70, - 0x01, 0x20, 0xf8, 0xbd, 0x50, 0x03, 0x00, 0x20, 0x4c, 0x01, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x48, 0x01, 0x00, 0x20, - 0x70, 0xb5, 0x0d, 0x4d, 0x04, 0x1c, 0x2b, 0x68, 0x0e, 0x1c, 0x83, 0x42, - 0x0e, 0xd0, 0xff, 0xf7, 0xcd, 0xff, 0x00, 0x28, 0x01, 0xd1, 0x00, 0x20, - 0x0d, 0xe0, 0x08, 0x4b, 0x21, 0x1c, 0x18, 0x68, 0x07, 0x4a, 0xff, 0xf7, - 0x25, 0xfb, 0x00, 0x28, 0xf5, 0xd0, 0x2c, 0x60, 0x05, 0x4b, 0x01, 0x20, - 0x1a, 0x78, 0x16, 0x43, 0x1e, 0x70, 0x70, 0xbd, 0x00, 0x00, 0x00, 0x20, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, - 0x10, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xae, 0xff, 0x00, 0x28, 0x0f, 0xd0, - 0x00, 0x23, 0x08, 0x4a, 0x00, 0x21, 0x99, 0x54, 0x80, 0x22, 0x01, 0x33, - 0x92, 0x00, 0x93, 0x42, 0xf7, 0xd1, 0x05, 0x4b, 0x01, 0x20, 0x1c, 0x60, - 0x04, 0x4b, 0x1a, 0x78, 0x02, 0x43, 0x1a, 0x70, 0x10, 0xbd, 0xc0, 0x46, - 0x50, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, - 0xc3, 0x68, 0x70, 0xb5, 0x01, 0x33, 0x0c, 0x1c, 0x15, 0x1c, 0x99, 0x42, - 0x01, 0xd9, 0x00, 0x20, 0x21, 0xe0, 0x46, 0x1c, 0xf1, 0x7f, 0xc2, 0x69, - 0xe3, 0x09, 0x10, 0x29, 0x00, 0xd1, 0x23, 0x0a, 0x98, 0x18, 0x0d, 0x4b, - 0x1b, 0x68, 0x98, 0x42, 0x07, 0xd1, 0xf2, 0x7f, 0x0b, 0x4b, 0x10, 0x2a, - 0x09, 0xd1, 0xe4, 0xb2, 0x64, 0x00, 0x1b, 0x5b, 0x0b, 0xe0, 0x00, 0x21, - 0xff, 0xf7, 0x9e, 0xff, 0x00, 0x28, 0xf2, 0xd1, 0xe3, 0xe7, 0x7f, 0x22, - 0x14, 0x40, 0xa4, 0x00, 0x1b, 0x59, 0x1b, 0x01, 0x1b, 0x09, 0x2b, 0x60, - 0x01, 0x20, 0x70, 0xbd, 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, - 0x73, 0xb5, 0x05, 0x1c, 0x01, 0x91, 0x16, 0x1c, 0x00, 0x24, 0x28, 0x1c, - 0x01, 0x99, 0x01, 0xaa, 0xff, 0xf7, 0xc6, 0xff, 0x00, 0x28, 0x10, 0xd0, - 0x2a, 0x7c, 0x80, 0x23, 0x9b, 0x00, 0x93, 0x40, 0xe4, 0x18, 0x6b, 0x1c, - 0xdb, 0x7f, 0x01, 0x9a, 0x10, 0x2b, 0x01, 0xd1, 0x03, 0x4b, 0x00, 0xe0, - 0x03, 0x4b, 0x9a, 0x42, 0xe9, 0xd3, 0x34, 0x60, 0x01, 0x20, 0x76, 0xbd, - 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, 0xf7, 0xb5, 0x05, 0x1c, - 0x0c, 0x1c, 0x01, 0x92, 0x01, 0x29, 0x32, 0xd9, 0xc3, 0x68, 0x00, 0x20, - 0x01, 0x33, 0x99, 0x42, 0x2e, 0xd8, 0x6f, 0x1c, 0xfa, 0x7f, 0xee, 0x69, - 0xcb, 0x09, 0x10, 0x2a, 0x00, 0xd1, 0x0b, 0x0a, 0x9e, 0x19, 0x14, 0x4b, - 0x1b, 0x68, 0x9e, 0x42, 0x08, 0xd1, 0xfa, 0x7f, 0x12, 0x4b, 0x10, 0x2a, - 0x0b, 0xd1, 0xe4, 0xb2, 0x01, 0x9a, 0x64, 0x00, 0x1a, 0x53, 0x0b, 0xe0, - 0x30, 0x1c, 0x00, 0x21, 0xff, 0xf7, 0x48, 0xff, 0x00, 0x28, 0xf0, 0xd1, - 0x12, 0xe0, 0x7f, 0x22, 0x14, 0x40, 0x01, 0x9a, 0xa4, 0x00, 0x1a, 0x51, - 0x09, 0x4b, 0x01, 0x20, 0x1a, 0x78, 0x02, 0x43, 0x1a, 0x70, 0x2b, 0x7e, - 0x83, 0x42, 0x05, 0xd9, 0xab, 0x68, 0xf6, 0x18, 0x05, 0x4b, 0x1e, 0x60, - 0x00, 0xe0, 0x00, 0x20, 0xfe, 0xbd, 0xc0, 0x46, 0x00, 0x00, 0x00, 0x20, - 0x50, 0x01, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, 0x48, 0x01, 0x00, 0x20, - 0xf0, 0xb5, 0x15, 0x68, 0x87, 0xb0, 0x06, 0x1c, 0x02, 0x91, 0x17, 0x1c, - 0x00, 0x2d, 0x03, 0xd0, 0x00, 0x21, 0x01, 0x35, 0x01, 0x91, 0x06, 0xe0, - 0x02, 0x9b, 0x05, 0x68, 0x01, 0x3b, 0x5a, 0x42, 0x53, 0x41, 0xdb, 0xb2, - 0x01, 0x93, 0xf2, 0x68, 0x00, 0x23, 0x01, 0x32, 0x03, 0x92, 0x2c, 0x1c, - 0x00, 0x93, 0x00, 0x99, 0xf2, 0x68, 0x91, 0x42, 0x21, 0xd2, 0x03, 0x9b, - 0x9c, 0x42, 0x01, 0xd9, 0x02, 0x24, 0x25, 0x1c, 0x30, 0x1c, 0x21, 0x1c, - 0x05, 0xaa, 0xff, 0xf7, 0x43, 0xff, 0x00, 0x28, 0x15, 0xd0, 0x05, 0x99, - 0x63, 0x1c, 0x00, 0x29, 0x01, 0xd0, 0x1d, 0x1c, 0x03, 0xe0, 0x02, 0x99, - 0x5a, 0x1b, 0x8a, 0x42, 0x04, 0xd0, 0x00, 0x9a, 0x1c, 0x1c, 0x01, 0x32, - 0x00, 0x92, 0xe0, 0xe7, 0x30, 0x1c, 0x21, 0x1c, 0x13, 0x4a, 0xff, 0xf7, - 0x7f, 0xff, 0x00, 0x28, 0x0b, 0xd1, 0x00, 0x20, 0x1d, 0xe0, 0x63, 0x1e, - 0x30, 0x1c, 0x19, 0x1c, 0x22, 0x1c, 0x00, 0x93, 0xff, 0xf7, 0x74, 0xff, - 0x00, 0x28, 0xf4, 0xd0, 0x00, 0x9c, 0xac, 0x42, 0xf3, 0xd8, 0x39, 0x68, - 0x00, 0x29, 0x06, 0xd1, 0x01, 0x99, 0x3d, 0x60, 0x00, 0x29, 0x09, 0xd0, - 0x01, 0x35, 0x35, 0x60, 0x06, 0xe0, 0x30, 0x1c, 0x2a, 0x1c, 0xff, 0xf7, - 0x61, 0xff, 0x00, 0x28, 0xf2, 0xd1, 0xe0, 0xe7, 0x01, 0x20, 0x07, 0xb0, - 0xf0, 0xbd, 0xc0, 0x46, 0xff, 0xff, 0xff, 0x0f, 0x02, 0x23, 0x37, 0xb5, - 0x05, 0x1c, 0x0c, 0x1c, 0x03, 0x60, 0x28, 0x1c, 0x21, 0x1c, 0x01, 0xaa, - 0xff, 0xf7, 0xfc, 0xfe, 0x00, 0x28, 0x12, 0xd0, 0x28, 0x1c, 0x21, 0x1c, - 0x00, 0x22, 0xff, 0xf7, 0x47, 0xff, 0x00, 0x28, 0x0b, 0xd0, 0x6b, 0x1c, - 0xdb, 0x7f, 0x01, 0x9c, 0x10, 0x2b, 0x01, 0xd1, 0x04, 0x4b, 0x00, 0xe0, - 0x04, 0x4b, 0x9c, 0x42, 0xe7, 0xd3, 0x01, 0x20, 0x00, 0xe0, 0x00, 0x20, - 0x3e, 0xbd, 0xc0, 0x46, 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, - 0xf8, 0xb5, 0x44, 0x4b, 0x04, 0x1c, 0x15, 0x1c, 0x19, 0x60, 0x29, 0xd0, - 0x04, 0x2a, 0x01, 0xd9, 0x00, 0x20, 0x7d, 0xe0, 0x00, 0x20, 0x01, 0x1c, - 0xff, 0xf7, 0x90, 0xfe, 0x00, 0x28, 0xf7, 0xd0, 0x2d, 0x01, 0x3d, 0x4b, - 0xa9, 0x35, 0xff, 0x35, 0x5d, 0x19, 0xaa, 0x79, 0xab, 0x1d, 0x50, 0x06, - 0xee, 0xd1, 0xea, 0x7c, 0xa9, 0x7c, 0x12, 0x02, 0x0a, 0x43, 0x29, 0x7d, - 0x09, 0x04, 0x0a, 0x43, 0x69, 0x7d, 0x09, 0x06, 0x0a, 0x43, 0x63, 0x2a, - 0xe2, 0xd9, 0xaa, 0x7b, 0xed, 0x7b, 0x2d, 0x02, 0x15, 0x43, 0x9a, 0x7a, - 0xdb, 0x7a, 0x12, 0x04, 0x15, 0x43, 0x1b, 0x06, 0x1d, 0x43, 0xd7, 0xd0, - 0x28, 0x1c, 0x00, 0x21, 0xff, 0xf7, 0x6a, 0xfe, 0x00, 0x28, 0xd1, 0xd0, - 0x2a, 0x4b, 0x19, 0x7b, 0xda, 0x7a, 0x09, 0x02, 0x11, 0x43, 0x80, 0x22, - 0x92, 0x00, 0x91, 0x42, 0xc8, 0xd1, 0x1a, 0x7c, 0x00, 0x2a, 0xc5, 0xd0, - 0xd9, 0x89, 0x00, 0x29, 0xc2, 0xd0, 0x59, 0x7b, 0x00, 0x29, 0xbf, 0xd0, - 0x22, 0x76, 0x00, 0x22, 0x21, 0x71, 0x22, 0x74, 0x22, 0x7c, 0x01, 0x20, - 0x90, 0x40, 0x81, 0x42, 0x04, 0xd0, 0x50, 0x1c, 0x20, 0x74, 0x07, 0x2a, - 0xf6, 0xd9, 0xb1, 0xe7, 0xd9, 0x8a, 0x00, 0x29, 0x00, 0xd1, 0x59, 0x6a, - 0xa1, 0x60, 0xd8, 0x89, 0x28, 0x18, 0xe0, 0x61, 0x1f, 0x69, 0x3e, 0x02, - 0x36, 0x0c, 0x66, 0x84, 0xb7, 0xb2, 0x1e, 0x7c, 0x71, 0x43, 0x0e, 0x18, - 0x13, 0x48, 0x79, 0x01, 0x09, 0x18, 0x49, 0x12, 0x71, 0x18, 0x66, 0x62, - 0x61, 0x61, 0x18, 0x7d, 0xde, 0x7c, 0x00, 0x02, 0x30, 0x43, 0x00, 0xd1, - 0x18, 0x6a, 0x6d, 0x1a, 0x28, 0x18, 0xd0, 0x40, 0x02, 0x1c, 0xe0, 0x60, - 0x0b, 0x48, 0x61, 0x1c, 0x82, 0x42, 0x01, 0xd8, 0x0c, 0x23, 0x07, 0xe0, - 0x09, 0x48, 0x82, 0x42, 0x01, 0xd8, 0x10, 0x23, 0x02, 0xe0, 0xdb, 0x6a, - 0x63, 0x62, 0x20, 0x23, 0xcb, 0x77, 0x01, 0x20, 0xf8, 0xbd, 0xc0, 0x46, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0xff, 0x01, 0x00, 0x00, - 0xf4, 0x0f, 0x00, 0x00, 0xf4, 0xff, 0x00, 0x00, 0x08, 0xb5, 0x05, 0x49, - 0x05, 0x4a, 0x06, 0x48, 0x00, 0xf0, 0x10, 0xf8, 0x05, 0x4b, 0x06, 0x49, - 0x00, 0x22, 0x1a, 0x70, 0x5a, 0x54, 0x08, 0xbd, 0x00, 0x4e, 0x00, 0x00, - 0x01, 0x04, 0x00, 0x00, 0x54, 0x03, 0x00, 0x20, 0x6c, 0x03, 0x00, 0x20, - 0x02, 0x04, 0x00, 0x00, 0x30, 0xb5, 0x09, 0x4c, 0x09, 0x4b, 0xa5, 0x68, - 0x6d, 0x03, 0x6d, 0x0f, 0xad, 0x00, 0xeb, 0x58, 0x03, 0x60, 0xa4, 0x68, - 0x01, 0x61, 0xa4, 0xb2, 0x44, 0x60, 0x5c, 0x43, 0x9b, 0x00, 0x84, 0x60, - 0xc3, 0x60, 0x42, 0x61, 0x30, 0xbd, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, - 0x00, 0x53, 0x00, 0x00, 0xf7, 0xb5, 0x1f, 0x4e, 0x80, 0x27, 0x75, 0x68, - 0x03, 0x33, 0x3d, 0x43, 0x9b, 0x08, 0x75, 0x60, 0x00, 0x2b, 0x34, 0xd0, - 0x1b, 0x4d, 0x35, 0x80, 0x35, 0x7d, 0xef, 0x07, 0xfc, 0xd5, 0x1d, 0x1c, - 0x5f, 0x1b, 0x01, 0x97, 0x07, 0x68, 0xbf, 0x08, 0xbc, 0x46, 0x01, 0x9f, - 0x67, 0x45, 0x1f, 0xd2, 0x00, 0x2d, 0x1d, 0xd0, 0x17, 0x78, 0x01, 0x3d, - 0x01, 0x97, 0xff, 0x27, 0xbc, 0x43, 0x01, 0x9f, 0x3c, 0x43, 0x57, 0x78, - 0x3f, 0x02, 0x01, 0x97, 0x0f, 0x4f, 0x3c, 0x40, 0x01, 0x9f, 0x3c, 0x43, - 0x97, 0x78, 0x3f, 0x04, 0xbc, 0x46, 0x0d, 0x4f, 0x3c, 0x40, 0xd7, 0x78, - 0xa4, 0xb2, 0x3f, 0x06, 0x00, 0x97, 0x67, 0x46, 0x3c, 0x43, 0x00, 0x9f, - 0x04, 0x32, 0x3c, 0x43, 0x10, 0xc1, 0xd7, 0xe7, 0x07, 0x4b, 0x33, 0x80, - 0x33, 0x7d, 0xdf, 0x07, 0xfc, 0xd5, 0x2b, 0x1c, 0xc8, 0xe7, 0xf7, 0xbd, - 0x00, 0x40, 0x00, 0x41, 0x44, 0xa5, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xff, 0x04, 0xa5, 0xff, 0xff, 0x04, 0x4b, 0x05, 0x4a, - 0x49, 0x08, 0xd9, 0x61, 0x1a, 0x80, 0x1a, 0x7d, 0xd1, 0x07, 0xfc, 0xd5, - 0x70, 0x47, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, 0x02, 0xa5, 0xff, 0xff, - 0x70, 0xb5, 0x05, 0x1c, 0x0c, 0x1c, 0x16, 0x1c, 0xeb, 0x68, 0x28, 0x1c, - 0x21, 0x1c, 0x9e, 0x42, 0x05, 0xd9, 0xff, 0xf7, 0xe7, 0xff, 0xeb, 0x68, - 0xe4, 0x18, 0xf6, 0x1a, 0xf4, 0xe7, 0xff, 0xf7, 0xe1, 0xff, 0x70, 0xbd, - 0x43, 0x7a, 0x00, 0x2b, 0x04, 0xd1, 0x83, 0x72, 0xc3, 0x72, 0xc3, 0x60, - 0x01, 0x23, 0x43, 0x72, 0x70, 0x47, 0x30, 0xb5, 0x85, 0xb0, 0x04, 0x1c, - 0x02, 0xad, 0x00, 0x68, 0x02, 0x91, 0x03, 0x92, 0x00, 0xf0, 0x84, 0xfc, - 0x6b, 0x79, 0xe1, 0x79, 0x22, 0x7a, 0x00, 0x93, 0x20, 0x68, 0x00, 0x23, - 0x00, 0xf0, 0x1e, 0xfd, 0x29, 0x79, 0x20, 0x68, 0x02, 0x9a, 0x00, 0xf0, - 0x47, 0xfc, 0x20, 0x68, 0x00, 0xf0, 0x6a, 0xfc, 0x05, 0xb0, 0x30, 0xbd, - 0x70, 0xb5, 0x04, 0x1c, 0x18, 0x26, 0xff, 0xf7, 0xd7, 0xff, 0x20, 0x79, - 0x33, 0x1c, 0x43, 0x43, 0x0d, 0x4d, 0x08, 0x21, 0xeb, 0x18, 0x59, 0x56, - 0x00, 0xf0, 0x14, 0xfb, 0xa0, 0x79, 0x33, 0x1c, 0x43, 0x43, 0x08, 0x21, - 0xeb, 0x18, 0x59, 0x56, 0x00, 0xf0, 0x0c, 0xfb, 0x60, 0x79, 0x08, 0x21, - 0x46, 0x43, 0xad, 0x19, 0x69, 0x56, 0x00, 0xf0, 0x05, 0xfb, 0x04, 0x4b, - 0x20, 0x1c, 0x06, 0xcb, 0xff, 0xf7, 0xc3, 0xff, 0x70, 0xbd, 0xc0, 0x46, - 0x20, 0x53, 0x00, 0x00, 0x70, 0x07, 0x00, 0x20, 0x07, 0xb5, 0x83, 0x7a, - 0x00, 0x91, 0x01, 0x92, 0x00, 0x2b, 0x0d, 0xd0, 0x9a, 0x07, 0x06, 0xd5, - 0xef, 0xf3, 0x10, 0x83, 0x5a, 0x42, 0x53, 0x41, 0xc3, 0x72, 0x72, 0xb6, - 0x04, 0xe0, 0xda, 0x07, 0x02, 0xd5, 0x82, 0x89, 0x03, 0x4b, 0x9a, 0x60, - 0x00, 0x99, 0x01, 0x9a, 0xff, 0xf7, 0xa5, 0xff, 0x07, 0xbd, 0xc0, 0x46, - 0x00, 0x18, 0x00, 0x40, 0x83, 0x7a, 0x00, 0x2b, 0x0b, 0xd0, 0x9a, 0x07, - 0x04, 0xd5, 0xc3, 0x7a, 0x00, 0x2b, 0x06, 0xd0, 0x62, 0xb6, 0x04, 0xe0, - 0xda, 0x07, 0x02, 0xd5, 0x82, 0x89, 0x01, 0x4b, 0xda, 0x60, 0x70, 0x47, - 0x00, 0x18, 0x00, 0x40, 0x08, 0xb5, 0x00, 0x68, 0x00, 0xf0, 0x21, 0xfc, - 0x08, 0xbd, 0x00, 0x00, 0x0f, 0x4b, 0x10, 0x4a, 0x10, 0x49, 0x1a, 0x60, - 0x00, 0x22, 0x5a, 0x71, 0x1a, 0x71, 0x0f, 0x4b, 0x0f, 0x48, 0x19, 0x60, - 0x0a, 0x21, 0x19, 0x71, 0x09, 0x21, 0x99, 0x71, 0x08, 0x21, 0x59, 0x71, - 0x03, 0x21, 0x5a, 0x72, 0xda, 0x71, 0x19, 0x72, 0x0a, 0x4b, 0x18, 0x60, - 0x1d, 0x20, 0x18, 0x71, 0x1b, 0x20, 0x98, 0x71, 0x1a, 0x20, 0x5a, 0x72, - 0x58, 0x71, 0xda, 0x71, 0x19, 0x72, 0x70, 0x47, 0x70, 0x07, 0x00, 0x20, - 0x00, 0x09, 0x3d, 0x00, 0x00, 0x08, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x04, 0x08, 0x00, 0x20, 0x88, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x02, 0x48, - 0x00, 0xf0, 0xfc, 0xfc, 0x08, 0xbd, 0xc0, 0x46, 0x98, 0x07, 0x00, 0x20, - 0x13, 0xb5, 0x12, 0x49, 0x12, 0x48, 0x00, 0xf0, 0x3d, 0xfb, 0x12, 0x49, - 0x12, 0x48, 0x00, 0xf0, 0x39, 0xfb, 0x12, 0x49, 0x12, 0x48, 0x00, 0xf0, - 0x35, 0xfb, 0x12, 0x49, 0x12, 0x48, 0x00, 0xf0, 0x31, 0xfb, 0x12, 0x49, - 0x12, 0x48, 0x00, 0xf0, 0x2d, 0xfb, 0x12, 0x4c, 0x12, 0x49, 0x20, 0x1c, - 0x00, 0xf0, 0x28, 0xfb, 0x03, 0x23, 0x00, 0x93, 0x01, 0x23, 0x01, 0x93, - 0x21, 0x1c, 0x0d, 0x22, 0x0e, 0x23, 0x0e, 0x48, 0x00, 0xf0, 0xb0, 0xfc, - 0x13, 0xbd, 0xc0, 0x46, 0x00, 0x08, 0x00, 0x42, 0xfc, 0x07, 0x00, 0x20, - 0x00, 0x0c, 0x00, 0x42, 0x00, 0x08, 0x00, 0x20, 0x00, 0x10, 0x00, 0x42, - 0x04, 0x08, 0x00, 0x20, 0x00, 0x14, 0x00, 0x42, 0xf8, 0x07, 0x00, 0x20, - 0x00, 0x18, 0x00, 0x42, 0x08, 0x08, 0x00, 0x20, 0x0c, 0x08, 0x00, 0x20, - 0x00, 0x1c, 0x00, 0x42, 0x98, 0x07, 0x00, 0x20, 0xfe, 0xe7, 0x00, 0x00, - 0x08, 0xb5, 0x03, 0x4b, 0x1b, 0x68, 0x00, 0x2b, 0x00, 0xd0, 0x98, 0x47, - 0x08, 0xbd, 0xc0, 0x46, 0x10, 0x08, 0x00, 0x20, 0x38, 0xb5, 0x0f, 0x49, - 0x0f, 0x4c, 0xa1, 0x42, 0x04, 0xd1, 0x00, 0xf0, 0x4f, 0xf8, 0xfe, 0xf7, - 0xbb, 0xfa, 0x0b, 0xe0, 0x0c, 0x4d, 0x8d, 0x42, 0xf7, 0xd0, 0x00, 0x23, - 0xca, 0x18, 0xe8, 0x18, 0xa2, 0x42, 0x04, 0xd2, 0x00, 0x68, 0x04, 0x33, - 0x10, 0x60, 0xf7, 0xe7, 0xfe, 0xe7, 0x90, 0x42, 0xeb, 0xd0, 0x06, 0x4b, - 0x06, 0x4a, 0x93, 0x42, 0xe7, 0xd2, 0x00, 0x22, 0x04, 0xc3, 0xf9, 0xe7, - 0x00, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x00, 0x20, 0x40, 0x57, 0x00, 0x00, - 0xa0, 0x00, 0x00, 0x20, 0xf4, 0x0c, 0x00, 0x20, 0x08, 0xb5, 0x00, 0xf0, - 0x26, 0xf8, 0x00, 0x28, 0x01, 0xd1, 0x00, 0xf0, 0x17, 0xf8, 0x08, 0xbd, - 0x01, 0x4b, 0x18, 0x68, 0x70, 0x47, 0xc0, 0x46, 0x14, 0x08, 0x00, 0x20, - 0x70, 0xb5, 0x04, 0x1e, 0x08, 0xd0, 0x05, 0x4b, 0x1d, 0x68, 0x1e, 0x1c, - 0x00, 0xf0, 0x12, 0xf8, 0x33, 0x68, 0x5b, 0x1b, 0xa3, 0x42, 0xf9, 0xd3, - 0x70, 0xbd, 0xc0, 0x46, 0x14, 0x08, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, - 0x1a, 0x68, 0x01, 0x32, 0x1a, 0x60, 0x00, 0xf0, 0x6d, 0xfa, 0x08, 0xbd, - 0x14, 0x08, 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 0x00, 0x00, - 0x70, 0xb5, 0x4c, 0x4a, 0x1e, 0x21, 0x53, 0x68, 0x02, 0x20, 0x8b, 0x43, - 0x03, 0x43, 0x4a, 0x49, 0x53, 0x60, 0x8b, 0x69, 0x08, 0x24, 0x23, 0x43, - 0x8b, 0x61, 0x48, 0x4c, 0x48, 0x4b, 0x9c, 0x82, 0x9c, 0x8a, 0x20, 0x43, - 0x98, 0x82, 0x10, 0x1c, 0xda, 0x68, 0x94, 0x07, 0xfc, 0xd5, 0x45, 0x4a, - 0x01, 0x24, 0x14, 0x70, 0x14, 0x78, 0xe5, 0x07, 0x04, 0xd5, 0x42, 0x4c, - 0x64, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xf7, 0xdb, 0x01, 0x24, 0x94, 0x60, - 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, 0x3d, 0x4d, 0x3c, 0x4c, - 0x65, 0x60, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, 0x82, 0x25, - 0x38, 0x4c, 0xed, 0x01, 0x65, 0x80, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, - 0xfb, 0xdb, 0x9c, 0x8c, 0x80, 0x25, 0xac, 0x43, 0x9c, 0x84, 0xdc, 0x68, - 0xe6, 0x06, 0xfc, 0xd5, 0x33, 0x4d, 0x30, 0x4c, 0xe5, 0x62, 0xdd, 0x68, - 0x2e, 0x4c, 0xee, 0x06, 0xfb, 0xd5, 0xa5, 0x8c, 0x30, 0x4e, 0x35, 0x43, - 0xa5, 0x84, 0xdd, 0x68, 0x2a, 0x4c, 0xee, 0x06, 0xfb, 0xd5, 0xa5, 0x8c, - 0x02, 0x26, 0x35, 0x43, 0xa5, 0x84, 0xdc, 0x68, 0x25, 0x06, 0xfc, 0xd5, - 0x25, 0x4c, 0xe4, 0x68, 0x66, 0x06, 0xf8, 0xd5, 0xdc, 0x68, 0xe5, 0x06, - 0xfc, 0xd5, 0x00, 0x24, 0x94, 0x60, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, - 0xfb, 0xdb, 0x24, 0x4d, 0x1f, 0x4c, 0x65, 0x60, 0x55, 0x78, 0x1e, 0x4c, - 0x6d, 0xb2, 0x00, 0x2d, 0xfa, 0xdb, 0x1e, 0x6a, 0x20, 0x4d, 0x35, 0x40, - 0x80, 0x26, 0x76, 0x00, 0x35, 0x43, 0x1d, 0x62, 0x1d, 0x6a, 0x80, 0x26, - 0xb5, 0x43, 0x1d, 0x62, 0x03, 0x23, 0xa3, 0x60, 0x1b, 0x4b, 0x63, 0x60, - 0x53, 0x78, 0x5b, 0xb2, 0x00, 0x2b, 0xfb, 0xdb, 0x00, 0x23, 0x0b, 0x72, - 0x18, 0x4a, 0x4b, 0x72, 0x8b, 0x72, 0xcb, 0x72, 0x17, 0x4b, 0xff, 0x21, - 0x1a, 0x60, 0x17, 0x4b, 0x17, 0x4a, 0x1b, 0x68, 0x12, 0x68, 0x5c, 0x01, - 0xd2, 0x0e, 0x21, 0x40, 0x11, 0x43, 0x9a, 0x06, 0x52, 0x0f, 0x12, 0x02, - 0x0b, 0x1c, 0x13, 0x43, 0x12, 0x4a, 0x13, 0x85, 0x43, 0x68, 0x80, 0x22, - 0x13, 0x43, 0x43, 0x60, 0x70, 0xbd, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, - 0x00, 0x04, 0x00, 0x40, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x40, - 0x00, 0x0c, 0x00, 0x40, 0x01, 0x05, 0x01, 0x00, 0xb8, 0x05, 0xff, 0x7d, - 0x04, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, 0xff, 0xfc, 0xff, 0xff, - 0x03, 0x06, 0x01, 0x00, 0x00, 0x6c, 0xdc, 0x02, 0x04, 0x00, 0x00, 0x20, - 0x24, 0x60, 0x80, 0x00, 0x20, 0x60, 0x80, 0x00, 0x00, 0x40, 0x00, 0x42, - 0x31, 0x4b, 0xfa, 0x21, 0x18, 0x68, 0x10, 0xb5, 0x89, 0x00, 0x00, 0xf0, - 0xff, 0xfd, 0x2f, 0x4b, 0x01, 0x38, 0x98, 0x42, 0x24, 0xd8, 0x2e, 0x4a, - 0x2e, 0x4b, 0x50, 0x60, 0x18, 0x6a, 0xc0, 0x21, 0x00, 0x02, 0x00, 0x0a, - 0x09, 0x06, 0x01, 0x43, 0x19, 0x62, 0x00, 0x24, 0x07, 0x21, 0x94, 0x60, - 0x11, 0x60, 0x19, 0x6a, 0x80, 0x22, 0x09, 0x02, 0x09, 0x0a, 0x12, 0x06, - 0x0a, 0x43, 0x1a, 0x62, 0x25, 0x4b, 0xfc, 0x21, 0x1a, 0x6a, 0x0a, 0x43, - 0x1a, 0x62, 0x19, 0x6a, 0xfc, 0x22, 0x92, 0x01, 0x0a, 0x43, 0x1a, 0x62, - 0x19, 0x6a, 0xa0, 0x22, 0xd2, 0x02, 0x0a, 0x43, 0x1a, 0x62, 0x00, 0xe0, - 0xfe, 0xe7, 0x20, 0x1c, 0x00, 0x21, 0x01, 0x34, 0x00, 0xf0, 0x70, 0xf8, - 0x0f, 0x2c, 0xf8, 0xd1, 0x1a, 0x4c, 0x63, 0x78, 0x5b, 0xb2, 0x00, 0x2b, - 0xfa, 0xdb, 0x19, 0x4b, 0x63, 0x80, 0x19, 0x4b, 0x5a, 0x7e, 0xd2, 0x09, - 0x01, 0x2a, 0xfa, 0xd0, 0xe4, 0x22, 0xd2, 0x00, 0x9a, 0x80, 0x3f, 0x22, - 0xda, 0x70, 0x59, 0x7e, 0x13, 0x4a, 0xc9, 0x09, 0x01, 0x29, 0xfa, 0xd0, - 0xc0, 0x23, 0x5b, 0x01, 0x00, 0x20, 0x13, 0x61, 0x90, 0x70, 0x00, 0xf0, - 0x23, 0xf8, 0x63, 0x78, 0x5b, 0xb2, 0x00, 0x2b, 0xfb, 0xdb, 0x0d, 0x4a, - 0x09, 0x4b, 0x5a, 0x80, 0x0c, 0x4b, 0xda, 0x79, 0xd2, 0x09, 0x01, 0x2a, - 0xfa, 0xd0, 0x41, 0x22, 0x5a, 0x70, 0x10, 0xbd, 0x04, 0x00, 0x00, 0x20, - 0xff, 0xff, 0xff, 0x00, 0x10, 0xe0, 0x00, 0xe0, 0x00, 0xed, 0x00, 0xe0, - 0x00, 0x04, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x40, 0x1e, 0x40, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x42, 0x21, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x42, - 0x00, 0xb5, 0x14, 0x4a, 0x51, 0x7e, 0x13, 0x1c, 0xc9, 0x09, 0x01, 0x29, - 0xf9, 0xd0, 0x01, 0x38, 0x04, 0x28, 0x13, 0xd8, 0x19, 0x69, 0x10, 0x4a, - 0x0a, 0x40, 0x1a, 0x61, 0x5a, 0x78, 0x0f, 0x21, 0x8a, 0x43, 0x00, 0xf0, - 0x71, 0xfd, 0x03, 0x05, 0x09, 0x07, 0x03, 0x00, 0x01, 0x21, 0x02, 0xe0, - 0x03, 0x21, 0x00, 0xe0, 0x02, 0x21, 0x0a, 0x43, 0x5a, 0x70, 0x0a, 0xe0, - 0x11, 0x69, 0xf0, 0x23, 0x1b, 0x05, 0x0b, 0x43, 0x13, 0x61, 0x53, 0x78, - 0x0f, 0x21, 0x8b, 0x43, 0x02, 0x21, 0x0b, 0x43, 0x53, 0x70, 0x00, 0xbd, - 0x00, 0x40, 0x00, 0x42, 0xff, 0xff, 0xff, 0xf0, 0x10, 0xb5, 0x18, 0x24, - 0x02, 0x1c, 0x20, 0x1c, 0x50, 0x43, 0x2a, 0x4b, 0x18, 0x18, 0x00, 0x7a, - 0x40, 0xb2, 0x01, 0x30, 0x4c, 0xd0, 0x03, 0x29, 0x4a, 0xd8, 0x08, 0x1c, - 0x21, 0x1c, 0x00, 0xf0, 0x45, 0xfd, 0x02, 0x33, 0x11, 0x21, 0x62, 0x43, - 0x98, 0x56, 0x9a, 0x18, 0xc3, 0x01, 0x22, 0x48, 0x52, 0x68, 0x1b, 0x18, - 0x99, 0x18, 0x40, 0x31, 0x02, 0x20, 0x08, 0x70, 0x01, 0x21, 0x91, 0x40, - 0x59, 0x60, 0x35, 0xe0, 0x62, 0x43, 0x98, 0x56, 0x1b, 0x49, 0x9a, 0x18, - 0x52, 0x68, 0xc3, 0x01, 0x5b, 0x18, 0x99, 0x18, 0x40, 0x31, 0x06, 0x20, - 0x08, 0x70, 0x01, 0x21, 0x91, 0x40, 0x59, 0x60, 0x99, 0x61, 0x25, 0xe0, - 0x51, 0x43, 0x5a, 0x56, 0x13, 0x48, 0x59, 0x18, 0x4b, 0x68, 0xd2, 0x01, - 0x11, 0x18, 0xc8, 0x18, 0x40, 0x30, 0x06, 0x24, 0x04, 0x70, 0x01, 0x20, - 0x98, 0x40, 0x48, 0x60, 0x0e, 0x49, 0x52, 0x18, 0x50, 0x60, 0x13, 0xe0, - 0x51, 0x43, 0x5a, 0x56, 0x59, 0x18, 0x0a, 0x4b, 0x49, 0x68, 0xd2, 0x01, - 0xd2, 0x18, 0x53, 0x18, 0x40, 0x33, 0x18, 0x78, 0x02, 0x24, 0x20, 0x43, - 0x18, 0x70, 0x18, 0x78, 0x04, 0x24, 0xa0, 0x43, 0x18, 0x70, 0x01, 0x23, - 0x8b, 0x40, 0x93, 0x60, 0x10, 0xbd, 0xc0, 0x46, 0x20, 0x53, 0x00, 0x00, - 0x00, 0x44, 0x00, 0x41, 0x10, 0x44, 0x00, 0x41, 0x18, 0x23, 0x58, 0x43, - 0x13, 0x4a, 0xf0, 0xb5, 0x13, 0x18, 0x08, 0x24, 0x1c, 0x57, 0x01, 0x34, - 0x1f, 0xd0, 0x82, 0x56, 0x10, 0x4e, 0xd2, 0x01, 0x5d, 0x68, 0x01, 0x24, - 0x90, 0x19, 0x23, 0x1c, 0x86, 0x68, 0xab, 0x40, 0x1e, 0x42, 0x0b, 0xd1, - 0x0e, 0x1c, 0x77, 0x1e, 0xbe, 0x41, 0x40, 0x19, 0x34, 0x40, 0x40, 0x30, - 0xa5, 0x00, 0x04, 0x78, 0x04, 0x26, 0xb4, 0x43, 0x2c, 0x43, 0x04, 0x70, - 0x00, 0x29, 0x03, 0xd1, 0x05, 0x49, 0x52, 0x18, 0x53, 0x60, 0x02, 0xe0, - 0x02, 0x4e, 0x92, 0x19, 0x93, 0x61, 0xf0, 0xbd, 0x20, 0x53, 0x00, 0x00, - 0x00, 0x44, 0x00, 0x41, 0x10, 0x44, 0x00, 0x41, 0x18, 0x22, 0x42, 0x43, - 0xf8, 0xb5, 0x2d, 0x4d, 0x08, 0x24, 0xaa, 0x18, 0x14, 0x57, 0x03, 0x1c, - 0x62, 0x1c, 0x50, 0xd0, 0x48, 0x1c, 0x00, 0x24, 0x0c, 0x28, 0x4c, 0xd8, - 0x00, 0xf0, 0xb6, 0xfc, 0x07, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, - 0x1e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x01, 0x24, 0x64, 0x42, 0x40, 0xe0, - 0x09, 0x29, 0x02, 0xd1, 0x18, 0x1c, 0x00, 0x21, 0x03, 0xe0, 0x0a, 0x29, - 0x04, 0xd1, 0x18, 0x1c, 0x02, 0x21, 0xff, 0xf7, 0x4b, 0xff, 0x23, 0xe0, - 0x00, 0x24, 0x0b, 0x29, 0x31, 0xd1, 0x18, 0x1c, 0x01, 0x21, 0xff, 0xf7, - 0x43, 0xff, 0x2c, 0xe0, 0x18, 0x22, 0x53, 0x43, 0xea, 0x18, 0x52, 0x68, - 0xeb, 0x56, 0x01, 0x20, 0x14, 0x1c, 0x04, 0x40, 0x55, 0x08, 0xdb, 0x01, - 0x00, 0x2c, 0x11, 0xd0, 0x12, 0x4c, 0x1b, 0x19, 0x5d, 0x19, 0x30, 0x35, - 0x2e, 0x78, 0x0c, 0x01, 0x0f, 0x21, 0x31, 0x40, 0x21, 0x43, 0x9a, 0x18, - 0xc9, 0xb2, 0x29, 0x70, 0x40, 0x32, 0x13, 0x78, 0x18, 0x43, 0x10, 0x70, - 0x00, 0x24, 0x0e, 0xe0, 0x09, 0x4e, 0x0f, 0x27, 0x9b, 0x19, 0x5d, 0x19, - 0x30, 0x35, 0x2e, 0x78, 0x9a, 0x18, 0xbe, 0x43, 0x31, 0x43, 0xc9, 0xb2, - 0x29, 0x70, 0x40, 0x32, 0x13, 0x78, 0x18, 0x43, 0x10, 0x70, 0x20, 0x1c, - 0xf8, 0xbd, 0xc0, 0x46, 0x20, 0x53, 0x00, 0x00, 0x00, 0x44, 0x00, 0x41, - 0xf7, 0xb5, 0x8a, 0x18, 0x06, 0x1c, 0x0d, 0x1c, 0x01, 0x92, 0x0c, 0x1c, - 0x01, 0x9b, 0x67, 0x1b, 0x9c, 0x42, 0x07, 0xd0, 0x33, 0x68, 0x21, 0x78, - 0x1b, 0x68, 0x30, 0x1c, 0x98, 0x47, 0x01, 0x34, 0x00, 0x28, 0xf3, 0xd1, - 0x38, 0x1c, 0xfe, 0xbd, 0x15, 0x4a, 0x13, 0x68, 0x58, 0x1c, 0x25, 0xd0, - 0x01, 0x3b, 0x13, 0x60, 0x00, 0x2b, 0x21, 0xd1, 0x72, 0xb6, 0x12, 0x4a, - 0x12, 0x4b, 0x04, 0x32, 0x9a, 0x42, 0x07, 0xd8, 0xbf, 0xf3, 0x4f, 0x8f, - 0x10, 0x4a, 0x11, 0x4b, 0xda, 0x60, 0xbf, 0xf3, 0x4f, 0x8f, 0x11, 0xe0, - 0x0f, 0x4b, 0x19, 0x7d, 0xc8, 0x07, 0xfb, 0xd5, 0x18, 0x8b, 0x20, 0x21, - 0xff, 0x31, 0x92, 0x08, 0x52, 0x00, 0x01, 0x43, 0x19, 0x83, 0xda, 0x61, - 0x0a, 0x4a, 0x1a, 0x80, 0x1a, 0x7d, 0xd1, 0x07, 0xfc, 0xd5, 0xe5, 0xe7, - 0xc0, 0x46, 0xfd, 0xe7, 0x70, 0x47, 0xc0, 0x46, 0x08, 0x00, 0x00, 0x20, - 0x00, 0x20, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x04, 0x00, 0xfa, 0x05, - 0x00, 0xed, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x41, 0x02, 0xa5, 0xff, 0xff, - 0x01, 0x60, 0x70, 0x47, 0xf7, 0xb5, 0x08, 0xac, 0x26, 0x78, 0x04, 0x68, - 0x9d, 0x1e, 0x27, 0x68, 0x6c, 0x1e, 0xa5, 0x41, 0xec, 0xb2, 0x92, 0x07, - 0x05, 0x68, 0x3a, 0x43, 0x27, 0x06, 0x3a, 0x43, 0x2a, 0x60, 0x02, 0x68, - 0x07, 0x25, 0x29, 0x40, 0x50, 0x68, 0xb5, 0x01, 0x00, 0x2c, 0x00, 0xd0, - 0x5c, 0x03, 0x29, 0x43, 0x01, 0x43, 0x0c, 0x43, 0x54, 0x60, 0xf7, 0xbd, - 0x30, 0xb5, 0x03, 0x68, 0xc0, 0x25, 0x1c, 0x68, 0xad, 0x03, 0x12, 0x05, - 0x2a, 0x40, 0x22, 0x43, 0xc0, 0x24, 0xa4, 0x02, 0x09, 0x04, 0x21, 0x40, - 0x11, 0x43, 0x19, 0x60, 0x03, 0x68, 0x5a, 0x68, 0x14, 0x43, 0x5c, 0x60, - 0x30, 0xbd, 0x03, 0x68, 0x01, 0x21, 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, - 0x02, 0x68, 0x11, 0x68, 0x01, 0x23, 0x19, 0x42, 0xfb, 0xd1, 0xd1, 0x69, - 0x19, 0x42, 0xf8, 0xd1, 0x70, 0x47, 0x03, 0x68, 0x02, 0x21, 0x1a, 0x68, - 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, 0xd3, 0x69, 0x99, 0x07, 0xfc, 0xd4, - 0x70, 0x47, 0x03, 0x68, 0x1a, 0x7e, 0xd1, 0x07, 0x02, 0xd4, 0x1a, 0x7e, - 0x91, 0x07, 0xfc, 0xd5, 0x70, 0x47, 0x03, 0x68, 0x00, 0x22, 0x5a, 0x83, - 0x70, 0x47, 0x03, 0x68, 0x18, 0x7e, 0x40, 0x07, 0xc0, 0x0f, 0x70, 0x47, - 0x03, 0x68, 0x18, 0x7e, 0xc0, 0x09, 0x70, 0x47, 0x03, 0x68, 0x80, 0x22, - 0x19, 0x7e, 0x52, 0x42, 0x0a, 0x43, 0x1a, 0x76, 0x70, 0x47, 0x03, 0x68, - 0x18, 0x8d, 0xc0, 0xb2, 0x70, 0x47, 0x03, 0x68, 0x1a, 0x7e, 0x01, 0x20, - 0x02, 0x42, 0xfb, 0xd0, 0x19, 0x85, 0x70, 0x47, 0x70, 0xb5, 0x03, 0x68, - 0x01, 0x26, 0x8d, 0x07, 0xed, 0x0f, 0x31, 0x40, 0x1c, 0x68, 0x6d, 0x07, - 0x09, 0x07, 0x29, 0x43, 0x21, 0x43, 0x19, 0x60, 0x04, 0x68, 0x51, 0x00, - 0x03, 0x48, 0x00, 0xf0, 0x9f, 0xfb, 0x01, 0x38, 0xc0, 0xb2, 0x20, 0x73, - 0x70, 0xbd, 0xc0, 0x46, 0x00, 0x6c, 0xdc, 0x02, 0x03, 0x68, 0x01, 0x21, - 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, 0x11, 0x68, 0x01, 0x23, - 0x19, 0x42, 0xfb, 0xd1, 0xd1, 0x69, 0x19, 0x42, 0xf8, 0xd1, 0x70, 0x47, - 0x03, 0x68, 0x02, 0x21, 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, - 0xd3, 0x69, 0x99, 0x07, 0xfc, 0xd4, 0x70, 0x47, 0x03, 0x68, 0xda, 0x69, - 0x91, 0x07, 0xfc, 0xd4, 0x1a, 0x68, 0x02, 0x21, 0x8a, 0x43, 0x1a, 0x60, - 0x70, 0x47, 0x03, 0x68, 0x9a, 0x6a, 0x52, 0x0a, 0x52, 0x02, 0x11, 0x43, - 0x99, 0x62, 0x03, 0x68, 0x1a, 0x7e, 0x51, 0x07, 0xfc, 0xd5, 0x98, 0x6a, - 0xc0, 0xb2, 0x70, 0x47, 0x03, 0x68, 0x22, 0x4a, 0x30, 0xb5, 0x93, 0x42, - 0x11, 0xd0, 0x21, 0x4a, 0x93, 0x42, 0x11, 0xd0, 0x20, 0x4a, 0x93, 0x42, - 0x11, 0xd0, 0x20, 0x4a, 0x93, 0x42, 0x11, 0xd0, 0x1f, 0x4a, 0x93, 0x42, - 0x11, 0xd0, 0x1f, 0x4a, 0x93, 0x42, 0x30, 0xd1, 0x0e, 0x23, 0x19, 0x22, - 0x0d, 0xe0, 0x09, 0x23, 0x14, 0x22, 0x0a, 0xe0, 0x0a, 0x23, 0x15, 0x22, - 0x07, 0xe0, 0x0b, 0x23, 0x16, 0x22, 0x04, 0xe0, 0x0c, 0x23, 0x17, 0x22, - 0x01, 0xe0, 0x0d, 0x23, 0x18, 0x22, 0xdc, 0xb2, 0x15, 0x49, 0x01, 0x20, - 0x9b, 0x08, 0xa0, 0x40, 0x9b, 0x00, 0x08, 0x60, 0x5b, 0x18, 0x03, 0x20, - 0xc0, 0x21, 0x89, 0x00, 0x04, 0x40, 0x5d, 0x58, 0xe0, 0x00, 0xff, 0x24, - 0x84, 0x40, 0xa5, 0x43, 0x2c, 0x1c, 0xc0, 0x25, 0x85, 0x40, 0x28, 0x1c, - 0x20, 0x43, 0x58, 0x50, 0x80, 0x23, 0xdb, 0x01, 0x1a, 0x43, 0x0a, 0x4b, - 0x5a, 0x80, 0x5a, 0x78, 0x52, 0xb2, 0x00, 0x2a, 0xfb, 0xdb, 0x30, 0xbd, - 0x00, 0x08, 0x00, 0x42, 0x00, 0x0c, 0x00, 0x42, 0x00, 0x10, 0x00, 0x42, - 0x00, 0x14, 0x00, 0x42, 0x00, 0x18, 0x00, 0x42, 0x00, 0x1c, 0x00, 0x42, - 0x00, 0xe1, 0x00, 0xe0, 0x00, 0x0c, 0x00, 0x40, 0xf8, 0xb5, 0x04, 0x1c, - 0x15, 0x1c, 0x0e, 0x1c, 0x1f, 0x1c, 0xff, 0xf7, 0xa3, 0xff, 0x20, 0x1c, - 0xff, 0xf7, 0x1b, 0xff, 0xb1, 0x00, 0x1c, 0x22, 0x0a, 0x40, 0x69, 0x07, - 0x23, 0x68, 0x09, 0x0c, 0x0a, 0x43, 0x1a, 0x60, 0x22, 0x68, 0x84, 0x23, - 0x93, 0x75, 0x01, 0x2e, 0x1a, 0xd1, 0x08, 0x21, 0x01, 0x2d, 0x00, 0xd1, - 0x10, 0x21, 0x0c, 0x4b, 0x79, 0x43, 0x18, 0x68, 0xc0, 0x00, 0x00, 0xf0, - 0xf3, 0xfa, 0x23, 0x68, 0x07, 0x21, 0x9a, 0x89, 0x01, 0x40, 0xd2, 0x04, - 0x49, 0x03, 0xd2, 0x0c, 0x0a, 0x43, 0x9a, 0x81, 0x23, 0x68, 0x00, 0x04, - 0xc2, 0x0c, 0x98, 0x89, 0x40, 0x0b, 0x40, 0x03, 0x10, 0x43, 0x98, 0x81, - 0xf8, 0xbd, 0xc0, 0x46, 0x04, 0x00, 0x00, 0x20, 0xf7, 0xb5, 0x01, 0x93, - 0x08, 0xab, 0x04, 0x1c, 0x1f, 0x78, 0x0d, 0x1c, 0x16, 0x1c, 0xff, 0xf7, - 0x3d, 0xff, 0x20, 0x1c, 0xff, 0xf7, 0x68, 0xff, 0xbf, 0x07, 0x0c, 0x22, - 0x17, 0x43, 0xc0, 0x22, 0x92, 0x03, 0x36, 0x05, 0x16, 0x40, 0xc0, 0x22, - 0x92, 0x02, 0x2d, 0x04, 0x23, 0x68, 0x3e, 0x43, 0x01, 0x99, 0x15, 0x40, - 0x35, 0x43, 0x07, 0x22, 0x1d, 0x60, 0x0a, 0x40, 0x80, 0x21, 0x23, 0x68, - 0x89, 0x02, 0x0a, 0x43, 0x5a, 0x60, 0xf7, 0xbd, 0x01, 0x20, 0x70, 0x47, - 0x08, 0xb5, 0x03, 0x68, 0x13, 0x22, 0xdb, 0x69, 0x98, 0x47, 0x08, 0xbd, - 0x10, 0xb5, 0x04, 0x1c, 0x00, 0x69, 0xff, 0xf7, 0xbe, 0xfe, 0x20, 0x1c, - 0x14, 0x30, 0x00, 0xf0, 0x7d, 0xfa, 0x10, 0xbd, 0x08, 0xb5, 0x00, 0x69, - 0xff, 0xf7, 0xcd, 0xfe, 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, - 0x85, 0xfa, 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, 0x86, 0xfa, - 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, 0x6d, 0xfa, 0x08, 0xbd, - 0x08, 0xb5, 0x00, 0x69, 0xff, 0xf7, 0xd9, 0xfe, 0x01, 0x20, 0x08, 0xbd, - 0xf7, 0xb5, 0x1d, 0x1c, 0x08, 0xab, 0x1b, 0x78, 0x04, 0x1c, 0x00, 0x93, - 0x09, 0xab, 0x1b, 0x78, 0x16, 0x1c, 0x01, 0x93, 0x00, 0x23, 0x43, 0x60, - 0xfa, 0x23, 0x9b, 0x00, 0x83, 0x60, 0x09, 0x4b, 0x0f, 0x1c, 0x08, 0x33, - 0x03, 0x60, 0x14, 0x30, 0x00, 0xf0, 0x36, 0xfa, 0x00, 0x9a, 0x23, 0x1c, - 0x5c, 0x33, 0x27, 0x61, 0x9a, 0x70, 0x01, 0x9a, 0x1e, 0x70, 0x5d, 0x70, - 0x20, 0x1c, 0xda, 0x70, 0xfe, 0xbd, 0xc0, 0x46, 0x80, 0x56, 0x00, 0x00, - 0x10, 0xb5, 0x04, 0x1c, 0x00, 0x69, 0xff, 0xf7, 0x9a, 0xfe, 0x00, 0x28, - 0x07, 0xd0, 0x20, 0x69, 0xff, 0xf7, 0xa5, 0xfe, 0x01, 0x1c, 0x20, 0x1c, - 0x14, 0x30, 0x00, 0xf0, 0x24, 0xfa, 0x20, 0x69, 0xff, 0xf7, 0x92, 0xfe, - 0x00, 0x28, 0x05, 0xd0, 0x20, 0x69, 0xff, 0xf7, 0x91, 0xfe, 0x20, 0x69, - 0xff, 0xf7, 0x81, 0xfe, 0x10, 0xbd, 0xf0, 0x23, 0x08, 0x1c, 0x18, 0x40, - 0x30, 0x38, 0x43, 0x42, 0x58, 0x41, 0x70, 0x47, 0xf0, 0x23, 0x1b, 0x01, - 0x19, 0x40, 0x80, 0x23, 0x9b, 0x00, 0x99, 0x42, 0x0c, 0xd0, 0xc0, 0x23, - 0x9b, 0x00, 0x99, 0x42, 0x06, 0xd0, 0x80, 0x23, 0x5b, 0x00, 0x05, 0x20, - 0x99, 0x42, 0x04, 0xd0, 0x00, 0x20, 0x02, 0xe0, 0x07, 0x20, 0x00, 0xe0, - 0x06, 0x20, 0x70, 0x47, 0x0f, 0x23, 0x19, 0x40, 0x01, 0x29, 0x05, 0xd0, - 0x02, 0x39, 0x4b, 0x42, 0x4b, 0x41, 0x02, 0x20, 0xc0, 0x1a, 0x00, 0xe0, - 0x00, 0x20, 0x70, 0x47, 0xf0, 0xb5, 0x03, 0x1c, 0x85, 0xb0, 0x03, 0x91, - 0x5c, 0x33, 0x04, 0x1c, 0x18, 0x27, 0x18, 0x78, 0x3b, 0x1c, 0x43, 0x43, - 0x1b, 0x4e, 0x08, 0x21, 0xf3, 0x18, 0x59, 0x56, 0x15, 0x1c, 0xff, 0xf7, - 0x45, 0xfd, 0x23, 0x1c, 0x5d, 0x33, 0x18, 0x78, 0x08, 0x21, 0x47, 0x43, - 0xf6, 0x19, 0x71, 0x56, 0xff, 0xf7, 0x3c, 0xfd, 0x01, 0x21, 0x0a, 0x1c, - 0x03, 0x9b, 0x20, 0x69, 0xff, 0xf7, 0xf2, 0xfe, 0x29, 0x1c, 0x20, 0x1c, - 0xff, 0xf7, 0xba, 0xff, 0x29, 0x1c, 0x07, 0x1c, 0x20, 0x1c, 0xff, 0xf7, - 0xcb, 0xff, 0x29, 0x1c, 0x06, 0x1c, 0x20, 0x1c, 0xff, 0xf7, 0xa9, 0xff, - 0x39, 0x1c, 0x00, 0x90, 0x33, 0x1c, 0x20, 0x69, 0x01, 0x22, 0xff, 0xf7, - 0xd3, 0xfd, 0x23, 0x1c, 0x5f, 0x33, 0x19, 0x78, 0x01, 0x3b, 0x1a, 0x78, - 0x20, 0x69, 0xff, 0xf7, 0xe7, 0xfd, 0x20, 0x69, 0xff, 0xf7, 0x05, 0xfe, - 0x05, 0xb0, 0xf0, 0xbd, 0x20, 0x53, 0x00, 0x00, 0x3f, 0x20, 0x70, 0x47, - 0x13, 0xb5, 0x02, 0x68, 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, 0x54, 0x68, - 0x19, 0x1c, 0x01, 0x22, 0xa0, 0x47, 0x16, 0xbd, 0x08, 0xb5, 0x00, 0x69, - 0x02, 0x21, 0x00, 0xf0, 0x49, 0xf8, 0x08, 0xbd, 0x08, 0xb5, 0x00, 0x69, - 0x03, 0x21, 0x00, 0xf0, 0x59, 0xf8, 0x08, 0xbd, 0x38, 0xb5, 0x0d, 0x1c, - 0x04, 0x1c, 0x13, 0x1c, 0x00, 0x69, 0x03, 0x21, 0x2a, 0x1c, 0x00, 0xf0, - 0xf1, 0xf8, 0x00, 0x28, 0x01, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x38, 0xbd, - 0x10, 0xb5, 0x05, 0x4c, 0x23, 0x68, 0x5a, 0x1c, 0x04, 0xd1, 0x03, 0x68, - 0xdb, 0x68, 0x98, 0x47, 0x20, 0x60, 0x03, 0x1c, 0x18, 0x1c, 0x10, 0xbd, - 0x0c, 0x00, 0x00, 0x20, 0x07, 0x4a, 0x08, 0xb5, 0x13, 0x68, 0x59, 0x1c, - 0x04, 0xd0, 0x01, 0x21, 0x49, 0x42, 0x11, 0x60, 0x18, 0x1c, 0x03, 0xe0, - 0x00, 0x69, 0x02, 0x21, 0x00, 0xf0, 0xc2, 0xf8, 0x08, 0xbd, 0xc0, 0x46, - 0x0c, 0x00, 0x00, 0x20, 0x06, 0x4b, 0xfa, 0x21, 0x89, 0x00, 0x99, 0x60, - 0x05, 0x49, 0x00, 0x22, 0x08, 0x31, 0x19, 0x60, 0x04, 0x49, 0x5a, 0x60, - 0x19, 0x61, 0x1a, 0x76, 0x70, 0x47, 0xc0, 0x46, 0x18, 0x08, 0x00, 0x20, - 0xb0, 0x56, 0x00, 0x00, 0xd8, 0x0b, 0x00, 0x20, 0x08, 0xb5, 0x08, 0x4b, - 0x8a, 0x00, 0xd0, 0x58, 0x00, 0x28, 0x03, 0xd0, 0x03, 0x68, 0x9b, 0x68, - 0x98, 0x47, 0x06, 0xe0, 0xc9, 0xb2, 0x04, 0x4b, 0x49, 0x01, 0x59, 0x18, - 0x88, 0x68, 0x80, 0x04, 0x80, 0x0c, 0x08, 0xbd, 0xbc, 0x0b, 0x00, 0x20, - 0xdc, 0x0b, 0x00, 0x20, 0x10, 0xb5, 0x0c, 0x1c, 0xff, 0xf7, 0xe6, 0xff, - 0x00, 0x28, 0x0c, 0xd0, 0x06, 0x4b, 0xe1, 0xb2, 0x1b, 0x68, 0x08, 0x31, - 0x49, 0x01, 0x59, 0x18, 0x4a, 0x79, 0x80, 0x23, 0x5b, 0x42, 0x13, 0x43, - 0x4b, 0x71, 0x02, 0x23, 0xcb, 0x71, 0x10, 0xbd, 0xdc, 0x0b, 0x00, 0x20, - 0x10, 0xb5, 0xc9, 0xb2, 0x0c, 0x48, 0x49, 0x01, 0x43, 0x18, 0x9a, 0x68, - 0x92, 0x04, 0x92, 0x0c, 0x3f, 0x2a, 0x08, 0xd9, 0x14, 0x1c, 0x9a, 0x68, - 0x40, 0x3c, 0xa4, 0x04, 0x92, 0x0b, 0xa4, 0x0c, 0x92, 0x03, 0x22, 0x43, - 0x02, 0xe0, 0x9a, 0x68, 0x92, 0x0b, 0x92, 0x03, 0x9a, 0x60, 0x41, 0x18, - 0x88, 0x68, 0xc0, 0xb2, 0x10, 0xbd, 0xc0, 0x46, 0xdc, 0x0b, 0x00, 0x20, - 0xf0, 0xb5, 0x1c, 0x1c, 0x2a, 0x4b, 0x85, 0xb0, 0x1b, 0x68, 0x06, 0x1c, - 0x0d, 0x1c, 0x02, 0x92, 0x00, 0x2b, 0x46, 0xd0, 0x27, 0x4b, 0x8a, 0x00, - 0xd0, 0x58, 0x00, 0x28, 0x05, 0xd0, 0x03, 0x68, 0x02, 0x99, 0x5b, 0x68, - 0x22, 0x1c, 0x98, 0x47, 0x3f, 0xe0, 0x30, 0x1c, 0xff, 0xf7, 0x9e, 0xff, - 0xa0, 0x42, 0x04, 0xd2, 0x30, 0x1c, 0x29, 0x1c, 0xff, 0xf7, 0x98, 0xff, - 0x04, 0x1c, 0x29, 0x1c, 0x30, 0x1c, 0xff, 0xf7, 0xbf, 0xff, 0x1c, 0x4f, - 0xe9, 0xb2, 0x4a, 0x01, 0x01, 0x91, 0x39, 0x68, 0x03, 0x92, 0x8b, 0x18, - 0xff, 0x33, 0x5a, 0x7a, 0x01, 0x21, 0x0a, 0x43, 0x17, 0x49, 0x5a, 0x72, - 0xab, 0x01, 0xc9, 0x18, 0x02, 0x98, 0x22, 0x1c, 0x00, 0xf0, 0xa1, 0xf9, - 0x00, 0x2c, 0x1b, 0xd0, 0x30, 0x1c, 0x29, 0x1c, 0xff, 0xf7, 0x7a, 0xff, - 0x00, 0x28, 0x15, 0xd1, 0x01, 0x9b, 0x3a, 0x68, 0x08, 0x33, 0x5b, 0x01, - 0xd3, 0x18, 0x19, 0x79, 0x40, 0x20, 0x01, 0x43, 0x19, 0x71, 0x01, 0x21, - 0xd9, 0x71, 0x03, 0x99, 0x53, 0x18, 0xff, 0x33, 0x9a, 0x7a, 0x01, 0x21, - 0x0a, 0x43, 0x9a, 0x72, 0x02, 0xe0, 0x01, 0x20, 0x40, 0x42, 0x00, 0xe0, - 0x20, 0x1c, 0x05, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0xe0, 0x0c, 0x00, 0x20, - 0xbc, 0x0b, 0x00, 0x20, 0xdc, 0x0b, 0x00, 0x20, 0xfc, 0x09, 0x00, 0x20, - 0x13, 0xb5, 0x6c, 0x46, 0x07, 0x34, 0x22, 0x1c, 0x01, 0x23, 0xff, 0xf7, - 0x99, 0xff, 0x01, 0x28, 0x01, 0xd1, 0x20, 0x78, 0x01, 0xe0, 0x01, 0x20, - 0x40, 0x42, 0x16, 0xbd, 0xf0, 0xb5, 0x1c, 0x1c, 0x3a, 0x4b, 0x85, 0xb0, - 0x1b, 0x68, 0x0e, 0x1c, 0x02, 0x92, 0x00, 0x2b, 0x60, 0xd0, 0x80, 0x23, - 0xdb, 0x01, 0x9c, 0x42, 0x5c, 0xd8, 0x00, 0x22, 0x00, 0x92, 0x00, 0x2c, - 0x56, 0xd0, 0x34, 0x4d, 0xf7, 0xb2, 0x2b, 0x68, 0x01, 0x93, 0x3b, 0x1c, - 0x08, 0x33, 0x01, 0x9a, 0x5b, 0x01, 0xd3, 0x18, 0x9b, 0x79, 0xdb, 0x09, - 0x1a, 0xd0, 0x2f, 0x4b, 0x2f, 0x49, 0x18, 0x68, 0x00, 0xf0, 0xae, 0xf8, - 0x2e, 0x4b, 0x17, 0x21, 0x58, 0x43, 0x00, 0xf0, 0xa9, 0xf8, 0x3b, 0x1c, - 0x08, 0x33, 0x01, 0x9a, 0x5b, 0x01, 0xd3, 0x18, 0xdb, 0x79, 0x9a, 0x07, - 0x08, 0xd4, 0x29, 0x4b, 0x9a, 0x5d, 0x00, 0x2a, 0x38, 0xd1, 0x42, 0x1e, - 0x00, 0x28, 0x35, 0xd0, 0x10, 0x1c, 0xee, 0xe7, 0x24, 0x4b, 0x00, 0x22, - 0x9a, 0x55, 0x25, 0x1e, 0x3f, 0x2d, 0x00, 0xd9, 0x3f, 0x25, 0x22, 0x4a, - 0xb3, 0x01, 0xd3, 0x18, 0x18, 0x1c, 0x02, 0x99, 0x2a, 0x1c, 0x03, 0x93, - 0x00, 0xf0, 0x21, 0xf9, 0x18, 0x4a, 0x7b, 0x01, 0xd3, 0x18, 0x03, 0x9a, - 0xa9, 0x04, 0x5a, 0x61, 0x9a, 0x69, 0x89, 0x0c, 0x92, 0x0b, 0x92, 0x03, - 0x0a, 0x43, 0x9a, 0x61, 0x3b, 0x1c, 0x01, 0x9a, 0x08, 0x33, 0x5b, 0x01, - 0xd3, 0x18, 0x02, 0x22, 0xda, 0x71, 0x59, 0x79, 0x80, 0x22, 0x52, 0x42, - 0x0a, 0x43, 0x5a, 0x71, 0x00, 0x9b, 0x02, 0x9a, 0x5b, 0x19, 0x52, 0x19, - 0x00, 0x93, 0x64, 0x1b, 0x02, 0x92, 0xa6, 0xe7, 0x00, 0x98, 0x0b, 0xe0, - 0x01, 0x20, 0x08, 0xe0, 0x01, 0x22, 0x9a, 0x55, 0x7b, 0x01, 0xed, 0x18, - 0xab, 0x69, 0x10, 0x1c, 0x9b, 0x0b, 0x9b, 0x03, 0xab, 0x61, 0x40, 0x42, - 0x05, 0xb0, 0xf0, 0xbd, 0xe0, 0x0c, 0x00, 0x20, 0xdc, 0x0b, 0x00, 0x20, - 0x04, 0x00, 0x00, 0x20, 0x40, 0x42, 0x0f, 0x00, 0x70, 0x11, 0x01, 0x00, - 0x34, 0x08, 0x00, 0x20, 0x3c, 0x08, 0x00, 0x20, 0x01, 0x4a, 0x02, 0x4b, - 0x1a, 0x60, 0x70, 0x47, 0x00, 0x50, 0x00, 0x41, 0xdc, 0x0b, 0x00, 0x20, - 0x10, 0xb5, 0x00, 0x21, 0x40, 0x22, 0x04, 0x1c, 0x00, 0xf0, 0xde, 0xf8, - 0x00, 0x23, 0x20, 0x1c, 0x23, 0x64, 0x63, 0x64, 0x10, 0xbd, 0x02, 0x6c, - 0x10, 0xb5, 0x3f, 0x23, 0x54, 0x1c, 0x23, 0x40, 0x44, 0x6c, 0xa3, 0x42, - 0x01, 0xd0, 0x81, 0x54, 0x03, 0x64, 0x10, 0xbd, 0x00, 0x23, 0x03, 0x64, - 0x43, 0x64, 0x70, 0x47, 0x43, 0x6c, 0x02, 0x6c, 0x93, 0x42, 0x06, 0xd0, - 0xc2, 0x5c, 0x3f, 0x21, 0x01, 0x33, 0x0b, 0x40, 0x43, 0x64, 0x10, 0x1c, - 0x01, 0xe0, 0x01, 0x20, 0x40, 0x42, 0x70, 0x47, 0x02, 0x6c, 0x43, 0x6c, - 0xd0, 0x1a, 0x00, 0xd5, 0x40, 0x30, 0x70, 0x47, 0x43, 0x6c, 0x02, 0x6c, - 0x93, 0x42, 0x01, 0xd0, 0xc0, 0x5c, 0x01, 0xe0, 0x01, 0x20, 0x40, 0x42, - 0x70, 0x47, 0x00, 0x00, 0x02, 0xb4, 0x71, 0x46, 0x49, 0x08, 0x49, 0x00, - 0x09, 0x5c, 0x49, 0x00, 0x8e, 0x44, 0x02, 0xbc, 0x70, 0x47, 0xc0, 0x46, - 0x00, 0x29, 0x34, 0xd0, 0x01, 0x23, 0x00, 0x22, 0x10, 0xb4, 0x88, 0x42, - 0x2c, 0xd3, 0x01, 0x24, 0x24, 0x07, 0xa1, 0x42, 0x04, 0xd2, 0x81, 0x42, - 0x02, 0xd2, 0x09, 0x01, 0x1b, 0x01, 0xf8, 0xe7, 0xe4, 0x00, 0xa1, 0x42, - 0x04, 0xd2, 0x81, 0x42, 0x02, 0xd2, 0x49, 0x00, 0x5b, 0x00, 0xf8, 0xe7, - 0x88, 0x42, 0x01, 0xd3, 0x40, 0x1a, 0x1a, 0x43, 0x4c, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0x5c, 0x08, 0x22, 0x43, 0x8c, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0x9c, 0x08, 0x22, 0x43, 0xcc, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0xdc, 0x08, 0x22, 0x43, 0x00, 0x28, 0x03, 0xd0, - 0x1b, 0x09, 0x01, 0xd0, 0x09, 0x09, 0xe3, 0xe7, 0x10, 0x1c, 0x10, 0xbc, - 0x70, 0x47, 0x00, 0x28, 0x01, 0xd0, 0x00, 0x20, 0xc0, 0x43, 0x07, 0xb4, - 0x02, 0x48, 0x02, 0xa1, 0x40, 0x18, 0x02, 0x90, 0x03, 0xbd, 0xc0, 0x46, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x29, 0xf0, 0xd0, 0x03, 0xb5, 0xff, 0xf7, - 0xb9, 0xff, 0x0e, 0xbc, 0x42, 0x43, 0x89, 0x1a, 0x18, 0x47, 0xc0, 0x46, - 0x70, 0x47, 0xc0, 0x46, 0x70, 0xb5, 0x0e, 0x4b, 0x0e, 0x4d, 0x00, 0x24, - 0xed, 0x1a, 0xad, 0x10, 0x1e, 0x1c, 0xac, 0x42, 0x04, 0xd0, 0xa3, 0x00, - 0xf3, 0x58, 0x98, 0x47, 0x01, 0x34, 0xf8, 0xe7, 0x00, 0xf0, 0x32, 0xf9, - 0x08, 0x4b, 0x09, 0x4d, 0x00, 0x24, 0xed, 0x1a, 0xad, 0x10, 0x1e, 0x1c, - 0xac, 0x42, 0x04, 0xd0, 0xa3, 0x00, 0xf3, 0x58, 0x98, 0x47, 0x01, 0x34, - 0xf8, 0xe7, 0x70, 0xbd, 0x74, 0x00, 0x00, 0x20, 0x74, 0x00, 0x00, 0x20, - 0x74, 0x00, 0x00, 0x20, 0x98, 0x00, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, - 0x01, 0x1c, 0x18, 0x68, 0x00, 0xf0, 0x76, 0xf8, 0x08, 0xbd, 0xc0, 0x46, - 0x70, 0x00, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, 0x01, 0x1c, 0x18, 0x68, - 0x00, 0xf0, 0x24, 0xf8, 0x08, 0xbd, 0xc0, 0x46, 0x70, 0x00, 0x00, 0x20, - 0x30, 0xb5, 0x00, 0x23, 0x93, 0x42, 0x08, 0xd0, 0xc5, 0x5c, 0x01, 0x33, - 0xcc, 0x18, 0x01, 0x3c, 0x24, 0x78, 0xa5, 0x42, 0xf6, 0xd0, 0x28, 0x1b, - 0x00, 0xe0, 0x00, 0x20, 0x30, 0xbd, 0x10, 0xb5, 0x00, 0x23, 0x93, 0x42, - 0x03, 0xd0, 0xcc, 0x5c, 0xc4, 0x54, 0x01, 0x33, 0xf9, 0xe7, 0x10, 0xbd, - 0x03, 0x1c, 0x82, 0x18, 0x93, 0x42, 0x02, 0xd0, 0x19, 0x70, 0x01, 0x33, - 0xfa, 0xe7, 0x70, 0x47, 0x30, 0xb5, 0x00, 0x29, 0x40, 0xd0, 0x04, 0x39, - 0x0b, 0x68, 0x00, 0x2b, 0x00, 0xda, 0xc9, 0x18, 0x1e, 0x4a, 0x13, 0x68, - 0x14, 0x1c, 0x00, 0x2b, 0x02, 0xd1, 0x4b, 0x60, 0x11, 0x60, 0x33, 0xe0, - 0x99, 0x42, 0x0f, 0xd2, 0x08, 0x68, 0x0a, 0x18, 0x9a, 0x42, 0x05, 0xd1, - 0x13, 0x68, 0x52, 0x68, 0xc0, 0x18, 0x08, 0x60, 0x4a, 0x60, 0x00, 0xe0, - 0x4b, 0x60, 0x21, 0x60, 0x24, 0xe0, 0x8a, 0x42, 0x03, 0xd8, 0x13, 0x1c, - 0x5a, 0x68, 0x00, 0x2a, 0xf9, 0xd1, 0x1d, 0x68, 0x5c, 0x19, 0x8c, 0x42, - 0x0b, 0xd1, 0x09, 0x68, 0x69, 0x18, 0x58, 0x18, 0x19, 0x60, 0x90, 0x42, - 0x14, 0xd1, 0x14, 0x68, 0x52, 0x68, 0x09, 0x19, 0x19, 0x60, 0x5a, 0x60, - 0x0e, 0xe0, 0x8c, 0x42, 0x02, 0xd9, 0x0c, 0x23, 0x03, 0x60, 0x09, 0xe0, - 0x08, 0x68, 0x0c, 0x18, 0x94, 0x42, 0x03, 0xd1, 0x14, 0x68, 0x52, 0x68, - 0x00, 0x19, 0x08, 0x60, 0x4a, 0x60, 0x59, 0x60, 0x30, 0xbd, 0xc0, 0x46, - 0xe8, 0x0c, 0x00, 0x20, 0x70, 0xb5, 0x03, 0x23, 0xcd, 0x1c, 0x9d, 0x43, - 0x08, 0x35, 0x06, 0x1c, 0x0c, 0x2d, 0x01, 0xd2, 0x0c, 0x25, 0x01, 0xe0, - 0x00, 0x2d, 0x3f, 0xdb, 0x8d, 0x42, 0x3d, 0xd3, 0x20, 0x4b, 0x1c, 0x68, - 0x1a, 0x1c, 0x21, 0x1c, 0x00, 0x29, 0x13, 0xd0, 0x08, 0x68, 0x43, 0x1b, - 0x0d, 0xd4, 0x0b, 0x2b, 0x02, 0xd9, 0x0b, 0x60, 0xcc, 0x18, 0x1e, 0xe0, - 0x8c, 0x42, 0x02, 0xd1, 0x63, 0x68, 0x13, 0x60, 0x1a, 0xe0, 0x48, 0x68, - 0x60, 0x60, 0x0c, 0x1c, 0x16, 0xe0, 0x0c, 0x1c, 0x49, 0x68, 0xe9, 0xe7, - 0x14, 0x4c, 0x20, 0x68, 0x00, 0x28, 0x03, 0xd1, 0x30, 0x1c, 0x00, 0xf0, - 0x25, 0xf8, 0x20, 0x60, 0x30, 0x1c, 0x29, 0x1c, 0x00, 0xf0, 0x20, 0xf8, - 0x43, 0x1c, 0x15, 0xd0, 0xc4, 0x1c, 0x03, 0x23, 0x9c, 0x43, 0x84, 0x42, - 0x0a, 0xd1, 0x25, 0x60, 0x20, 0x1c, 0x0b, 0x30, 0x07, 0x22, 0x23, 0x1d, - 0x90, 0x43, 0xc3, 0x1a, 0x0b, 0xd0, 0x5a, 0x42, 0xe2, 0x50, 0x08, 0xe0, - 0x21, 0x1a, 0x30, 0x1c, 0x00, 0xf0, 0x0a, 0xf8, 0x01, 0x30, 0xee, 0xd1, - 0x0c, 0x23, 0x33, 0x60, 0x00, 0x20, 0x70, 0xbd, 0xe8, 0x0c, 0x00, 0x20, - 0xe4, 0x0c, 0x00, 0x20, 0x38, 0xb5, 0x07, 0x4c, 0x00, 0x23, 0x05, 0x1c, - 0x08, 0x1c, 0x23, 0x60, 0x00, 0xf0, 0x2a, 0xf8, 0x43, 0x1c, 0x03, 0xd1, - 0x23, 0x68, 0x00, 0x2b, 0x00, 0xd0, 0x2b, 0x60, 0x38, 0xbd, 0xc0, 0x46, - 0xf0, 0x0c, 0x00, 0x20, 0xc9, 0xb2, 0x03, 0x78, 0x00, 0x2b, 0x03, 0xd0, - 0x8b, 0x42, 0x04, 0xd0, 0x01, 0x30, 0xf8, 0xe7, 0x00, 0x29, 0x00, 0xd0, - 0x18, 0x1c, 0x70, 0x47, 0x30, 0xb5, 0x03, 0x1c, 0x00, 0x2a, 0x07, 0xd0, - 0x0c, 0x78, 0x01, 0x33, 0x5d, 0x1e, 0x01, 0x3a, 0x2c, 0x70, 0x01, 0x31, - 0x00, 0x2c, 0xf5, 0xd1, 0x9a, 0x18, 0x93, 0x42, 0x03, 0xd0, 0x00, 0x21, - 0x19, 0x70, 0x01, 0x33, 0xf9, 0xe7, 0x30, 0xbd, 0x09, 0x4a, 0x13, 0x68, - 0x00, 0x2b, 0x0c, 0xd0, 0x18, 0x18, 0x69, 0x46, 0x88, 0x42, 0x02, 0xd8, - 0x10, 0x60, 0x18, 0x1c, 0x70, 0x47, 0x05, 0x4b, 0x0c, 0x22, 0x01, 0x20, - 0x1a, 0x60, 0x40, 0x42, 0xf8, 0xe7, 0x03, 0x4b, 0x13, 0x60, 0xef, 0xe7, - 0xec, 0x0c, 0x00, 0x20, 0xf0, 0x0c, 0x00, 0x20, 0xf4, 0x0c, 0x00, 0x20, - 0xf8, 0xb5, 0xc0, 0x46, 0xf8, 0xbc, 0x08, 0xbc, 0x9e, 0x46, 0x70, 0x47, - 0xf8, 0xb5, 0xc0, 0x46, 0xf8, 0xbc, 0x08, 0xbc, 0x9e, 0x46, 0x70, 0x47, - 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x2e, 0x42, 0x49, 0x4e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x22, 0x00, 0x00, - 0x2d, 0x22, 0x00, 0x00, 0x59, 0x23, 0x00, 0x00, 0x85, 0x22, 0x00, 0x00, - 0x99, 0x22, 0x00, 0x00, 0x57, 0x22, 0x00, 0x00, 0x2f, 0x00, 0x7c, 0x3c, - 0x3e, 0x5e, 0x2b, 0x3d, 0x3f, 0x2f, 0x5b, 0x5d, 0x3b, 0x2c, 0x2a, 0x22, - 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x34, 0x00, 0x00, 0xdd, 0x40, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x04, 0x00, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x04, 0x01, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x01, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x01, 0x01, 0x01, 0x01, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x05, 0x00, 0x05, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x05, 0x01, 0x05, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x03, 0x01, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x10, 0x00, 0xff, 0xff, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x06, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x07, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x04, 0x01, 0x04, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x91, 0x44, 0x00, 0x00, 0xdd, 0x40, 0x00, 0x00, - 0x73, 0x44, 0x00, 0x00, 0x87, 0x44, 0x00, 0x00, 0x7d, 0x44, 0x00, 0x00, - 0x69, 0x44, 0x00, 0x00, 0x49, 0x44, 0x00, 0x00, 0x6d, 0x45, 0x00, 0x00, - 0x55, 0x44, 0x00, 0x00, 0x45, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf9, 0x45, 0x00, 0x00, 0x25, 0x46, 0x00, 0x00, - 0x0d, 0x46, 0x00, 0x00, 0x5d, 0x46, 0x00, 0x00, 0x41, 0x46, 0x00, 0x00, - 0x19, 0x46, 0x00, 0x00, 0xf5, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x40, 0x42, 0x0f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xdc, 0x56, 0x00, 0x00, 0xfc, 0x56, 0x00, 0x00, - 0x1c, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x56, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x20, 0xdd, 0x20, 0x00, 0x00, 0x05, 0x22, 0x00, 0x00, - 0xe9, 0x26, 0x00, 0x00, 0xb1, 0x2b, 0x00, 0x00, 0x5d, 0x38, 0x00, 0x00, - 0x8d, 0x3a, 0x00, 0x00, 0xf5, 0x3a, 0x00, 0x00, 0x81, 0x46, 0x00, 0x00, - 0x25, 0x49, 0x00, 0x00, 0xb5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/libraries/SDU/src/boot/zero.h b/libraries/SDU/src/boot/zero.h deleted file mode 100644 index c63fc65af..000000000 --- a/libraries/SDU/src/boot/zero.h +++ /dev/null @@ -1,1141 +0,0 @@ - 0x00, 0x80, 0x00, 0x20, 0x91, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0xe5, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x7d, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0xc5, 0x3a, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0xd5, 0x3a, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, - 0x79, 0x3b, 0x00, 0x00, 0x79, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0xb5, 0x06, 0x4c, 0x23, 0x78, 0x00, 0x2b, 0x07, 0xd1, 0x05, 0x4b, - 0x00, 0x2b, 0x02, 0xd0, 0x04, 0x48, 0x00, 0xe0, 0x00, 0xbf, 0x01, 0x23, - 0x23, 0x70, 0x10, 0xbd, 0xa0, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xd4, 0x54, 0x00, 0x00, 0x08, 0xb5, 0x08, 0x4b, 0x00, 0x2b, 0x03, 0xd0, - 0x07, 0x48, 0x08, 0x49, 0x00, 0xe0, 0x00, 0xbf, 0x07, 0x48, 0x03, 0x68, - 0x00, 0x2b, 0x03, 0xd0, 0x06, 0x4b, 0x00, 0x2b, 0x00, 0xd0, 0x98, 0x47, - 0x08, 0xbd, 0xc0, 0x46, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x54, 0x00, 0x00, - 0xa4, 0x00, 0x00, 0x20, 0x90, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0xb5, 0x33, 0x4c, 0xa5, 0x44, 0x01, 0xf0, 0x49, 0xfe, 0x02, 0xf0, - 0xfd, 0xfa, 0x01, 0x20, 0x01, 0xf0, 0x6c, 0xfd, 0x2f, 0x4d, 0x04, 0x21, - 0x28, 0x1c, 0x00, 0xf0, 0xe3, 0xf9, 0x00, 0x28, 0x44, 0xd0, 0x2d, 0x4e, - 0x28, 0x1c, 0x31, 0x1c, 0x00, 0xf0, 0xbc, 0xfa, 0x00, 0x28, 0x3d, 0xd0, - 0x29, 0x1c, 0x01, 0xa8, 0x32, 0x1c, 0x01, 0x23, 0x00, 0xf0, 0x5e, 0xfa, - 0x01, 0xa8, 0x00, 0xf0, 0xfc, 0xf8, 0x80, 0x21, 0x04, 0x1c, 0xc9, 0x01, - 0x88, 0x42, 0x2d, 0xd9, 0x01, 0xa8, 0x00, 0xf0, 0xe2, 0xf8, 0x22, 0x4a, - 0xc0, 0x21, 0xa7, 0x18, 0x21, 0x48, 0xc9, 0x01, 0x3a, 0x1c, 0x01, 0xf0, - 0xf9, 0xfb, 0xc0, 0x24, 0xe4, 0x01, 0x80, 0x22, 0x0a, 0xa9, 0x92, 0x00, - 0x01, 0xa8, 0x00, 0xf0, 0xcb, 0xf8, 0x80, 0x23, 0x21, 0x1c, 0x0a, 0xaa, - 0x9b, 0x00, 0x19, 0x48, 0x01, 0xf0, 0x92, 0xfb, 0x80, 0x22, 0x92, 0x00, - 0xa3, 0x18, 0x17, 0x4a, 0xa4, 0x18, 0xbc, 0x42, 0x01, 0xd2, 0x1c, 0x1c, - 0xe9, 0xe7, 0x01, 0x24, 0x01, 0xa8, 0x00, 0xf0, 0xe9, 0xf8, 0x00, 0x2c, - 0x06, 0xd0, 0x28, 0x1c, 0x31, 0x1c, 0x00, 0xf0, 0x8b, 0xfa, 0x01, 0xe0, - 0x00, 0x24, 0xf3, 0xe7, 0xc0, 0x23, 0xdb, 0x01, 0x1b, 0x68, 0x83, 0xf3, - 0x08, 0x88, 0x0c, 0x4b, 0xc0, 0x22, 0xd2, 0x01, 0x9a, 0x60, 0x0b, 0x4b, - 0x1b, 0x68, 0x18, 0x47, 0x00, 0x20, 0x8b, 0x23, 0x9b, 0x00, 0x9d, 0x44, - 0xf0, 0xbd, 0xc0, 0x46, 0xd4, 0xfd, 0xff, 0xff, 0xd4, 0x00, 0x00, 0x20, - 0xb8, 0x49, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xbc, 0x00, 0x00, 0x20, - 0x00, 0xa2, 0xff, 0xff, 0x00, 0xed, 0x00, 0xe0, 0x04, 0x60, 0x00, 0x00, - 0x08, 0xb5, 0x00, 0x21, 0x02, 0x48, 0x0a, 0x1c, 0x01, 0xf0, 0x3c, 0xfb, - 0x08, 0xbd, 0xc0, 0x46, 0xbc, 0x00, 0x00, 0x20, 0x13, 0xb5, 0x02, 0x68, - 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, 0x54, 0x68, 0x19, 0x1c, 0x01, 0x22, - 0xa0, 0x47, 0x16, 0xbd, 0x38, 0xb5, 0x04, 0x1c, 0x00, 0x6a, 0x00, 0x25, - 0xa8, 0x42, 0x02, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x0a, 0xe0, 0x45, 0x60, - 0x92, 0xb2, 0x01, 0xf0, 0x0b, 0xf8, 0x23, 0x6a, 0x5b, 0x68, 0x00, 0x2b, - 0x02, 0xd0, 0x01, 0x23, 0x63, 0x60, 0x28, 0x1c, 0x38, 0xbd, 0x00, 0x6a, - 0x08, 0xb5, 0x00, 0x28, 0x01, 0xd0, 0x00, 0xf0, 0x49, 0xfe, 0x08, 0xbd, - 0x13, 0xb5, 0x6c, 0x46, 0x07, 0x34, 0x21, 0x1c, 0x01, 0x22, 0x00, 0xf0, - 0x65, 0xfd, 0x01, 0x28, 0x01, 0xd1, 0x20, 0x78, 0x00, 0xe0, 0x01, 0x48, - 0x00, 0xb2, 0x16, 0xbd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x08, 0xb5, - 0x00, 0x28, 0x02, 0xd0, 0xff, 0xf7, 0xea, 0xff, 0x01, 0xe0, 0x01, 0x20, - 0x40, 0x42, 0x08, 0xbd, 0x38, 0xb5, 0x05, 0x1c, 0x00, 0x6a, 0x00, 0x28, - 0x0a, 0xd0, 0xff, 0xf7, 0xdf, 0xff, 0x04, 0x1c, 0x63, 0x1c, 0x05, 0xd0, - 0x28, 0x6a, 0x01, 0x69, 0x01, 0x39, 0x00, 0xf0, 0xed, 0xfd, 0x20, 0x1c, - 0x38, 0xbd, 0x00, 0x00, 0xf8, 0xb5, 0xfa, 0x23, 0x9b, 0x00, 0x83, 0x60, - 0x0d, 0x4b, 0x00, 0x25, 0x08, 0x33, 0x04, 0x1c, 0x45, 0x60, 0x03, 0x60, - 0x28, 0x20, 0x0f, 0x1c, 0x16, 0x1c, 0x02, 0xf0, 0x47, 0xfa, 0x20, 0x62, - 0xa8, 0x42, 0x0a, 0xd0, 0x39, 0x1c, 0x28, 0x22, 0x02, 0xf0, 0x63, 0xfa, - 0x20, 0x1c, 0x10, 0x30, 0x31, 0x1c, 0x0c, 0x22, 0x02, 0xf0, 0x28, 0xfb, - 0x25, 0x77, 0x20, 0x1c, 0xf8, 0xbd, 0xc0, 0x46, 0xc8, 0x49, 0x00, 0x00, - 0xfa, 0x22, 0x92, 0x00, 0x82, 0x60, 0x04, 0x4a, 0x00, 0x23, 0x08, 0x32, - 0x43, 0x60, 0x02, 0x60, 0x03, 0x62, 0x03, 0x74, 0x70, 0x47, 0xc0, 0x46, - 0xc8, 0x49, 0x00, 0x00, 0x00, 0x6a, 0x08, 0xb5, 0x00, 0x28, 0x01, 0xd0, - 0x00, 0xf0, 0x0a, 0xfd, 0x08, 0xbd, 0x00, 0x6a, 0x08, 0xb5, 0x00, 0x28, - 0x04, 0xd0, 0x00, 0xf0, 0xad, 0xfd, 0x43, 0x1e, 0x98, 0x41, 0xc0, 0xb2, - 0x08, 0xbd, 0x03, 0x6a, 0x00, 0x2b, 0x01, 0xd0, 0x18, 0x69, 0x01, 0xe0, - 0x01, 0x20, 0x40, 0x42, 0x70, 0x47, 0x00, 0x6a, 0x00, 0x28, 0x00, 0xd0, - 0xc0, 0x69, 0x70, 0x47, 0x38, 0xb5, 0x04, 0x1c, 0x00, 0x6a, 0x00, 0x28, - 0x0b, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0xf3, 0xff, 0x05, 0x1c, 0x20, 0x1c, - 0xff, 0xf7, 0xe7, 0xff, 0x02, 0x4b, 0x28, 0x1a, 0x98, 0x42, 0x00, 0xd9, - 0x18, 0x1c, 0x38, 0xbd, 0xff, 0x7f, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, - 0x00, 0x6a, 0x00, 0x28, 0x06, 0xd0, 0x00, 0xf0, 0xef, 0xfd, 0x20, 0x6a, - 0x02, 0xf0, 0xf4, 0xf9, 0x00, 0x23, 0x23, 0x62, 0x10, 0xbd, 0x00, 0x00, - 0x10, 0xb5, 0x0a, 0x1c, 0x0c, 0x49, 0x8a, 0xb0, 0x04, 0x1c, 0x00, 0x23, - 0x00, 0x91, 0x69, 0x46, 0x4b, 0x72, 0x01, 0x93, 0x21, 0x1c, 0x68, 0x46, - 0x01, 0x23, 0x00, 0xf0, 0x89, 0xfe, 0x04, 0x1c, 0x60, 0x1e, 0x84, 0x41, - 0xe4, 0xb2, 0x00, 0x2c, 0x02, 0xd0, 0x68, 0x46, 0x00, 0xf0, 0xd0, 0xfd, - 0x20, 0x1c, 0x0a, 0xb0, 0x10, 0xbd, 0xc0, 0x46, 0x08, 0x4a, 0x00, 0x00, - 0x08, 0xb5, 0x01, 0x23, 0x00, 0x2a, 0x05, 0xd0, 0x00, 0xf0, 0x22, 0xff, - 0x03, 0x1c, 0x58, 0x1e, 0x83, 0x41, 0xdb, 0xb2, 0x18, 0x1c, 0x08, 0xbd, - 0x38, 0xb5, 0x01, 0x22, 0x05, 0x1c, 0x0c, 0x1c, 0x01, 0xf0, 0x9c, 0xf9, - 0x02, 0x1c, 0x01, 0x20, 0x00, 0x2a, 0x03, 0xd1, 0x28, 0x1c, 0x21, 0x1c, - 0x01, 0xf0, 0x94, 0xf9, 0x38, 0xbd, 0xf0, 0xb5, 0x0c, 0x68, 0x03, 0x5d, - 0x2f, 0x3b, 0x5d, 0x42, 0x6b, 0x41, 0xe4, 0x18, 0x27, 0x1c, 0x0c, 0x37, - 0x23, 0x1c, 0xc5, 0x5c, 0x1e, 0x1b, 0x2f, 0x2d, 0x09, 0xd0, 0x00, 0x2d, - 0x07, 0xd0, 0x01, 0x33, 0x16, 0x1b, 0xf6, 0x18, 0x01, 0x3e, 0x35, 0x70, - 0xbb, 0x42, 0xf2, 0xd1, 0x0c, 0x26, 0x00, 0x24, 0x94, 0x55, 0xc2, 0x5c, - 0x2f, 0x3a, 0x54, 0x42, 0x62, 0x41, 0x9b, 0x18, 0x0b, 0x60, 0xc0, 0x5c, - 0x43, 0x1e, 0x98, 0x41, 0xc0, 0xb2, 0xf0, 0xbd, 0xf0, 0xb5, 0xa1, 0xb0, - 0x03, 0x90, 0x25, 0x48, 0x0d, 0x1c, 0x04, 0x92, 0x05, 0x93, 0x0c, 0xaa, - 0x00, 0x23, 0x16, 0xa9, 0x0d, 0x93, 0x0c, 0x90, 0x53, 0x72, 0x17, 0x93, - 0x16, 0x90, 0x4b, 0x72, 0x07, 0x93, 0x2c, 0x1c, 0x00, 0x92, 0x07, 0xa9, - 0x08, 0xaa, 0x03, 0x98, 0xff, 0xf7, 0xc3, 0xff, 0x01, 0x26, 0x02, 0x1c, - 0x72, 0x40, 0x01, 0x90, 0xd2, 0xb2, 0x20, 0x1c, 0x08, 0xa9, 0x05, 0x9b, - 0x04, 0x9f, 0xb8, 0x47, 0x00, 0x28, 0x07, 0xd1, 0xac, 0x42, 0x01, 0xd1, - 0x00, 0x20, 0x23, 0xe0, 0x20, 0x1c, 0x00, 0xf0, 0x5f, 0xfd, 0xf9, 0xe7, - 0x01, 0x9f, 0x00, 0x2f, 0x11, 0xd0, 0x33, 0x1c, 0x00, 0x98, 0x21, 0x1c, - 0x08, 0xaa, 0x00, 0xf0, 0x05, 0xfe, 0x06, 0x1c, 0xac, 0x42, 0x0f, 0xd0, - 0x20, 0x1c, 0x00, 0xf0, 0x4f, 0xfd, 0x00, 0x2e, 0xe8, 0xd0, 0x23, 0x1c, - 0x00, 0x9c, 0x00, 0x93, 0xd1, 0xe7, 0xac, 0x42, 0x02, 0xd0, 0x20, 0x1c, - 0x00, 0xf0, 0x44, 0xfd, 0x30, 0x1c, 0x03, 0xe0, 0x00, 0x28, 0xdb, 0xd0, - 0x16, 0xac, 0xf0, 0xe7, 0x21, 0xb0, 0xf0, 0xbd, 0x08, 0x4a, 0x00, 0x00, - 0x38, 0xb5, 0x0a, 0x1c, 0x01, 0x21, 0x04, 0x1c, 0x00, 0xf0, 0xd6, 0xf9, - 0x00, 0x28, 0x01, 0xd1, 0x00, 0x20, 0x0f, 0xe0, 0x25, 0x1c, 0x10, 0x35, - 0x28, 0x1c, 0x21, 0x1c, 0xff, 0xf7, 0x6c, 0xff, 0x00, 0x28, 0xf5, 0xd0, - 0x20, 0x1c, 0x38, 0x30, 0x29, 0x1c, 0x00, 0xf0, 0xe1, 0xfb, 0x43, 0x1e, - 0x98, 0x41, 0xc0, 0xb2, 0x38, 0xbd, 0x00, 0x00, 0x4b, 0x68, 0x43, 0x60, - 0x0a, 0x4b, 0x03, 0x60, 0x0b, 0x7a, 0x03, 0x72, 0x4b, 0x7a, 0x43, 0x72, - 0xcb, 0x68, 0xc3, 0x60, 0x0b, 0x69, 0x03, 0x61, 0x4b, 0x69, 0x43, 0x61, - 0x0b, 0x7e, 0x03, 0x76, 0xcb, 0x69, 0xc3, 0x61, 0x0b, 0x6a, 0x49, 0x6a, - 0x03, 0x62, 0x41, 0x62, 0x70, 0x47, 0xc0, 0x46, 0x08, 0x4a, 0x00, 0x00, - 0xf0, 0xb5, 0x9d, 0xb0, 0x05, 0x1c, 0x38, 0x31, 0x08, 0xa8, 0x02, 0x92, - 0x03, 0x93, 0xff, 0xf7, 0xdd, 0xff, 0x24, 0x4a, 0x12, 0xaf, 0x00, 0x23, - 0x02, 0x9c, 0x7b, 0x60, 0x12, 0x92, 0x7b, 0x72, 0x08, 0xae, 0x20, 0x1c, - 0x2f, 0x21, 0x02, 0xf0, 0xcf, 0xf9, 0x00, 0x28, 0x2e, 0xd0, 0x23, 0x78, - 0x2f, 0x2b, 0x01, 0xd1, 0x01, 0x34, 0xf4, 0xe7, 0x00, 0x1b, 0xc0, 0xb2, - 0x03, 0x1c, 0x0c, 0x28, 0x00, 0xd9, 0x0c, 0x23, 0xdb, 0xb2, 0x1a, 0x1c, - 0x21, 0x1c, 0x04, 0xa8, 0x01, 0x93, 0x02, 0xf0, 0xc7, 0xf9, 0x01, 0x9a, - 0x00, 0x23, 0x04, 0xa9, 0x38, 0x1c, 0x8b, 0x54, 0x00, 0xf0, 0xd4, 0xfc, - 0x38, 0x1c, 0x31, 0x1c, 0x04, 0xaa, 0x01, 0x23, 0x00, 0xf0, 0x7e, 0xfd, - 0x00, 0x28, 0x04, 0xd1, 0x0c, 0x4b, 0x68, 0x60, 0x2b, 0x60, 0x68, 0x72, - 0x10, 0xe0, 0x01, 0x9b, 0x30, 0x1c, 0xe4, 0x18, 0x00, 0xf0, 0xc2, 0xfc, - 0x33, 0x1c, 0x3e, 0x1c, 0x1f, 0x1c, 0xca, 0xe7, 0x02, 0x99, 0x03, 0x9a, - 0x64, 0x1a, 0x14, 0x60, 0x28, 0x1c, 0x31, 0x1c, 0xff, 0xf7, 0x98, 0xff, - 0x28, 0x1c, 0x1d, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0x08, 0x4a, 0x00, 0x00, - 0xf0, 0xb5, 0xa3, 0xb0, 0x05, 0x1c, 0x1f, 0x1c, 0x04, 0xa8, 0x03, 0xab, - 0x16, 0x1c, 0x01, 0x91, 0xff, 0xf7, 0xa2, 0xff, 0x03, 0x9b, 0xf6, 0x18, - 0x33, 0x78, 0x00, 0x2b, 0x07, 0xd1, 0x04, 0xa9, 0x18, 0xa8, 0xff, 0xf7, - 0x7f, 0xff, 0x28, 0x1c, 0x18, 0xa9, 0x1e, 0x4a, 0x34, 0xe0, 0x00, 0x23, - 0x0e, 0xac, 0x63, 0x60, 0x63, 0x72, 0x6b, 0x46, 0x19, 0x33, 0x1b, 0x4a, - 0x1b, 0x78, 0x0e, 0x92, 0x00, 0x2b, 0x03, 0xd1, 0x28, 0x1c, 0xff, 0xf7, - 0x55, 0xfe, 0x27, 0xe0, 0x02, 0x3b, 0x01, 0x2b, 0x09, 0xd8, 0x01, 0x99, - 0x20, 0x1c, 0x38, 0x31, 0x32, 0x1c, 0x3b, 0x1c, 0x00, 0xf0, 0x30, 0xfd, - 0x00, 0x28, 0x0b, 0xd1, 0xee, 0xe7, 0x20, 0x1c, 0x04, 0xa9, 0x32, 0x1c, - 0x3b, 0x1c, 0x00, 0xf0, 0x27, 0xfd, 0x00, 0x28, 0xe6, 0xd0, 0x04, 0xa8, - 0x00, 0xf0, 0x72, 0xfc, 0x06, 0x23, 0x1f, 0x42, 0x03, 0xd0, 0x20, 0x1c, - 0x15, 0x99, 0x00, 0xf0, 0xfd, 0xfb, 0x21, 0x1c, 0x18, 0xa8, 0xff, 0xf7, - 0x49, 0xff, 0x28, 0x1c, 0x18, 0xa9, 0x32, 0x1c, 0xff, 0xf7, 0x0a, 0xfe, - 0x28, 0x1c, 0x23, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, 0xe8, 0x49, 0x00, 0x00, - 0x08, 0x4a, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x1c, 0x08, 0x1c, 0x19, 0x1c, - 0x38, 0x31, 0x02, 0x4a, 0x00, 0x23, 0xff, 0xf7, 0xc7, 0xfe, 0x08, 0xbd, - 0x9d, 0x23, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x1c, 0x08, 0x1c, 0x19, 0x1c, - 0x38, 0x31, 0x02, 0x4a, 0x00, 0x23, 0xff, 0xf7, 0xbb, 0xfe, 0x08, 0xbd, - 0xd9, 0x23, 0x00, 0x00, 0x08, 0x4b, 0x02, 0x21, 0x19, 0x61, 0x19, 0x1c, - 0x00, 0x22, 0x30, 0x31, 0x0a, 0x70, 0x06, 0x49, 0x5a, 0x71, 0x9a, 0x71, - 0x9a, 0x72, 0x1a, 0x73, 0xda, 0x63, 0x99, 0x63, 0x41, 0x33, 0x1a, 0x70, - 0x70, 0x47, 0xc0, 0x46, 0xd4, 0x00, 0x00, 0x20, 0x08, 0x4a, 0x00, 0x00, - 0x08, 0xb5, 0x01, 0x1c, 0x01, 0x48, 0x01, 0xf0, 0xb1, 0xf9, 0x08, 0xbd, - 0x78, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x02, 0x48, 0xff, 0x21, 0x01, 0xf0, - 0xa9, 0xf9, 0x08, 0xbd, 0x78, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x01, 0x21, - 0x00, 0x79, 0x01, 0xf0, 0x3f, 0xfc, 0x05, 0x4b, 0x1a, 0x78, 0x00, 0x2a, - 0x04, 0xd0, 0x00, 0x22, 0x03, 0x48, 0x1a, 0x70, 0x01, 0xf0, 0x86, 0xf9, - 0x08, 0xbd, 0xc0, 0x46, 0x40, 0x01, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x10, 0xb5, 0x08, 0x4b, 0x04, 0x1c, 0x1a, 0x78, 0x00, 0x2a, 0x06, 0xd1, - 0x01, 0x22, 0x1a, 0x70, 0x05, 0x4b, 0x06, 0x48, 0x06, 0xcb, 0x01, 0xf0, - 0x57, 0xf9, 0x20, 0x79, 0x00, 0x21, 0x01, 0xf0, 0x1f, 0xfc, 0x10, 0xbd, - 0x40, 0x01, 0x00, 0x20, 0x38, 0x01, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x10, 0xb5, 0x83, 0x79, 0x04, 0x1c, 0x00, 0x2b, 0x0d, 0xd0, 0x23, 0x89, - 0x5a, 0x1c, 0x22, 0x81, 0x05, 0x4a, 0x93, 0x42, 0x02, 0xd8, 0xff, 0xf7, - 0xbf, 0xff, 0xf6, 0xe7, 0x20, 0x1c, 0xff, 0xf7, 0xc3, 0xff, 0x00, 0x23, - 0xa3, 0x71, 0x10, 0xbd, 0x01, 0x02, 0x00, 0x00, 0x00, 0xb5, 0x06, 0x29, - 0x03, 0xd9, 0x16, 0x23, 0x43, 0x71, 0x00, 0x20, 0x1c, 0xe0, 0x0f, 0x4b, - 0x05, 0x29, 0x13, 0xd8, 0x08, 0x1c, 0x00, 0x22, 0x01, 0xf0, 0x4a, 0xff, - 0x03, 0x05, 0x07, 0x09, 0x0b, 0x0d, 0x0b, 0x49, 0x08, 0xe0, 0x0b, 0x49, - 0x06, 0xe0, 0x0b, 0x49, 0x04, 0xe0, 0x0b, 0x49, 0x02, 0xe0, 0x0b, 0x49, - 0x00, 0xe0, 0x0b, 0x49, 0x19, 0x60, 0x02, 0xe0, 0x0a, 0x4a, 0x1a, 0x60, - 0x00, 0x22, 0x1a, 0x71, 0x5a, 0x71, 0x01, 0x20, 0x00, 0xbd, 0xc0, 0x46, - 0x38, 0x01, 0x00, 0x20, 0x00, 0x1b, 0xb7, 0x00, 0x00, 0x09, 0x3d, 0x00, - 0x80, 0x84, 0x1e, 0x00, 0x40, 0x42, 0x0f, 0x00, 0x20, 0xa1, 0x07, 0x00, - 0x90, 0xd0, 0x03, 0x00, 0x48, 0xe8, 0x01, 0x00, 0x38, 0xb5, 0x0c, 0x1c, - 0x01, 0xf0, 0xe4, 0xf9, 0x05, 0x1c, 0xff, 0xf7, 0x79, 0xff, 0xff, 0x28, - 0x08, 0xd0, 0x01, 0xf0, 0xdd, 0xf9, 0xab, 0xb2, 0x80, 0xb2, 0xc0, 0x1a, - 0xa0, 0x42, 0xf4, 0xdb, 0x00, 0x20, 0x00, 0xe0, 0x01, 0x20, 0x38, 0xbd, - 0xf8, 0xb5, 0x04, 0x1c, 0x0e, 0x1c, 0x17, 0x1c, 0xff, 0xf7, 0x9a, 0xff, - 0x20, 0x1c, 0xff, 0xf7, 0x7f, 0xff, 0x96, 0x21, 0x49, 0x00, 0x20, 0x1c, - 0xff, 0xf7, 0xde, 0xff, 0x40, 0x20, 0x30, 0x43, 0xff, 0xf7, 0x52, 0xff, - 0x18, 0x25, 0x38, 0x1c, 0xe8, 0x40, 0xc0, 0xb2, 0x08, 0x3d, 0xff, 0xf7, - 0x4b, 0xff, 0x2b, 0x1c, 0x08, 0x33, 0xf6, 0xd1, 0x95, 0x20, 0x00, 0x2e, - 0x03, 0xd0, 0x87, 0x20, 0x08, 0x2e, 0x00, 0xd0, 0xff, 0x20, 0xff, 0xf7, - 0x3f, 0xff, 0x00, 0x25, 0xff, 0xf7, 0x44, 0xff, 0x43, 0xb2, 0xe0, 0x72, - 0x00, 0x2b, 0x04, 0xda, 0xff, 0x2d, 0x02, 0xd0, 0x01, 0x35, 0xed, 0xb2, - 0xf4, 0xe7, 0xf8, 0xbd, 0xf7, 0xb5, 0x00, 0x25, 0x02, 0x71, 0x05, 0x73, - 0x85, 0x72, 0x85, 0x71, 0x45, 0x71, 0x04, 0x1c, 0x01, 0x91, 0x01, 0xf0, - 0x97, 0xf9, 0x01, 0x21, 0x87, 0xb2, 0x20, 0x79, 0x01, 0xf0, 0x16, 0xfb, - 0x01, 0x21, 0x20, 0x79, 0x01, 0xf0, 0x72, 0xfb, 0x43, 0x4e, 0x30, 0x1c, - 0x01, 0xf0, 0x7a, 0xf8, 0x42, 0x4b, 0x43, 0x49, 0x1d, 0x71, 0x5d, 0x71, - 0x19, 0x60, 0x30, 0x1c, 0x5a, 0x68, 0x01, 0xf0, 0x99, 0xf8, 0x0a, 0x25, - 0x01, 0x3d, 0xff, 0x20, 0xed, 0xb2, 0xff, 0xf7, 0x0b, 0xff, 0x00, 0x2d, - 0xf8, 0xd1, 0x30, 0x1c, 0x01, 0xf0, 0xaa, 0xf8, 0x20, 0x1c, 0xff, 0xf7, - 0x27, 0xff, 0x00, 0x21, 0x20, 0x1c, 0x0a, 0x1c, 0xff, 0xf7, 0x9a, 0xff, - 0x06, 0x1c, 0xe0, 0x72, 0x01, 0x28, 0x09, 0xd0, 0x01, 0xf0, 0x68, 0xf9, - 0xc0, 0x1b, 0xfa, 0x23, 0x80, 0xb2, 0xdb, 0x00, 0x98, 0x42, 0xee, 0xd9, - 0x01, 0x23, 0x3c, 0xe0, 0xd5, 0x22, 0x20, 0x1c, 0x08, 0x21, 0x52, 0x00, - 0xff, 0xf7, 0x86, 0xff, 0x04, 0x23, 0x18, 0x42, 0x01, 0xd0, 0x26, 0x73, - 0x0b, 0xe0, 0x1e, 0x1c, 0xff, 0xf7, 0xea, 0xfe, 0x01, 0x3e, 0xf6, 0xb2, - 0xe0, 0x72, 0x00, 0x2e, 0xf8, 0xd1, 0x02, 0x23, 0xaa, 0x28, 0x26, 0xd1, - 0x23, 0x73, 0x26, 0x7b, 0x02, 0x3e, 0x73, 0x42, 0x5e, 0x41, 0xb6, 0x07, - 0x37, 0x21, 0x00, 0x22, 0x20, 0x1c, 0xff, 0xf7, 0x6b, 0xff, 0x32, 0x1c, - 0x20, 0x1c, 0x29, 0x21, 0xff, 0xf7, 0x66, 0xff, 0x02, 0x1c, 0xe0, 0x72, - 0x09, 0xd0, 0x01, 0xf0, 0x35, 0xf9, 0xc0, 0x1b, 0xfa, 0x23, 0x80, 0xb2, - 0xdb, 0x00, 0x98, 0x42, 0xea, 0xd9, 0x08, 0x23, 0x09, 0xe0, 0x23, 0x7b, - 0x02, 0x2b, 0x19, 0xd1, 0x20, 0x1c, 0x3a, 0x21, 0xff, 0xf7, 0x52, 0xff, - 0x00, 0x28, 0x05, 0xd0, 0x06, 0x23, 0x63, 0x71, 0x20, 0x1c, 0xff, 0xf7, - 0xbf, 0xfe, 0x15, 0xe0, 0xff, 0xf7, 0xb4, 0xfe, 0xc0, 0x23, 0x18, 0x40, - 0x98, 0x42, 0x01, 0xd1, 0x03, 0x23, 0x23, 0x73, 0xff, 0xf7, 0xac, 0xfe, - 0xff, 0xf7, 0xaa, 0xfe, 0xff, 0xf7, 0xa8, 0xfe, 0x20, 0x1c, 0xff, 0xf7, - 0xad, 0xfe, 0x20, 0x1c, 0x01, 0x99, 0xff, 0xf7, 0xeb, 0xfe, 0x05, 0x1c, - 0x28, 0x1c, 0xfe, 0xbd, 0x78, 0x07, 0x00, 0x20, 0x38, 0x01, 0x00, 0x20, - 0x90, 0xd0, 0x03, 0x00, 0x38, 0xb5, 0x04, 0x1c, 0x01, 0xf0, 0xfc, 0xf8, - 0x05, 0x1c, 0xff, 0xf7, 0x91, 0xfe, 0xe0, 0x72, 0xff, 0x28, 0x0a, 0xd1, - 0x01, 0xf0, 0xf4, 0xf8, 0xab, 0xb2, 0x80, 0xb2, 0xc0, 0x1a, 0x96, 0x23, - 0x5b, 0x00, 0x98, 0x42, 0xf1, 0xdd, 0x0f, 0x23, 0x02, 0xe0, 0xfe, 0x28, - 0x06, 0xd0, 0x0d, 0x23, 0x20, 0x1c, 0x63, 0x71, 0xff, 0xf7, 0x84, 0xfe, - 0x00, 0x20, 0x00, 0xe0, 0x01, 0x20, 0x38, 0xbd, 0xf8, 0xb5, 0x04, 0x1c, - 0x0f, 0x1c, 0x15, 0x1c, 0x1e, 0x1e, 0x45, 0xd0, 0x9a, 0x18, 0x80, 0x23, - 0x9b, 0x00, 0x9a, 0x42, 0x42, 0xdc, 0x83, 0x79, 0x00, 0x2b, 0x05, 0xd0, - 0x02, 0x68, 0x91, 0x42, 0x02, 0xd1, 0x03, 0x89, 0xab, 0x42, 0x16, 0xd9, - 0x23, 0x7b, 0x27, 0x60, 0x03, 0x2b, 0x00, 0xd0, 0x7f, 0x02, 0x3a, 0x1c, - 0x20, 0x1c, 0x11, 0x21, 0xff, 0xf7, 0xee, 0xfe, 0x07, 0x1e, 0x02, 0xd0, - 0x03, 0x23, 0x63, 0x71, 0x2a, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0xba, 0xff, - 0x00, 0x28, 0x25, 0xd0, 0x01, 0x23, 0x27, 0x81, 0xa3, 0x71, 0x23, 0x89, - 0xab, 0x42, 0x05, 0xd2, 0xff, 0xf7, 0x48, 0xfe, 0x23, 0x89, 0x01, 0x33, - 0x23, 0x81, 0xf6, 0xe7, 0x06, 0x9d, 0x06, 0x9a, 0xab, 0x1a, 0x9b, 0xb2, - 0xb3, 0x42, 0x04, 0xd2, 0xff, 0xf7, 0x3c, 0xfe, 0x28, 0x70, 0x01, 0x35, - 0xf5, 0xe7, 0x23, 0x89, 0xa2, 0x7a, 0xf3, 0x18, 0x9b, 0xb2, 0x23, 0x81, - 0x00, 0x2a, 0x02, 0xd0, 0x06, 0x4a, 0x93, 0x42, 0x02, 0xd9, 0x20, 0x1c, - 0xff, 0xf7, 0x60, 0xfe, 0x01, 0x20, 0x03, 0xe0, 0x20, 0x1c, 0xff, 0xf7, - 0x2f, 0xfe, 0x00, 0x20, 0xf8, 0xbd, 0xc0, 0x46, 0xff, 0x01, 0x00, 0x00, - 0x07, 0xb5, 0x80, 0x23, 0x00, 0x92, 0x9b, 0x00, 0x00, 0x22, 0xff, 0xf7, - 0xa3, 0xff, 0x0e, 0xbd, 0x70, 0xb5, 0x05, 0x1c, 0x08, 0x1c, 0x16, 0x1c, - 0xff, 0xf7, 0x0c, 0xfe, 0x00, 0x24, 0x30, 0x5d, 0xff, 0xf7, 0x08, 0xfe, - 0x01, 0x34, 0x80, 0x23, 0x9b, 0x00, 0x9c, 0x42, 0xf7, 0xd1, 0xff, 0x20, - 0xff, 0xf7, 0x00, 0xfe, 0xff, 0x20, 0xff, 0xf7, 0xfd, 0xfd, 0xff, 0xf7, - 0x03, 0xfe, 0x1f, 0x23, 0xe8, 0x72, 0x03, 0x40, 0x01, 0x20, 0x05, 0x2b, - 0x05, 0xd0, 0x11, 0x23, 0x28, 0x1c, 0x6b, 0x71, 0xff, 0xf7, 0x00, 0xfe, - 0x00, 0x20, 0x70, 0xbd, 0x70, 0xb5, 0x0b, 0x1c, 0x04, 0x1c, 0x16, 0x1c, - 0x00, 0x29, 0x01, 0xd1, 0x12, 0x23, 0x28, 0xe0, 0x02, 0x7b, 0x03, 0x2a, - 0x00, 0xd0, 0x4b, 0x02, 0x20, 0x1c, 0x18, 0x21, 0x1a, 0x1c, 0xff, 0xf7, - 0x79, 0xfe, 0x05, 0x1e, 0x01, 0xd0, 0x04, 0x23, 0x1b, 0xe0, 0x20, 0x1c, - 0xfe, 0x21, 0x32, 0x1c, 0xff, 0xf7, 0xc2, 0xff, 0x00, 0x28, 0x15, 0xd0, - 0x96, 0x21, 0x20, 0x1c, 0x89, 0x00, 0xff, 0xf7, 0x55, 0xfe, 0x00, 0x28, - 0x01, 0xd1, 0x15, 0x23, 0x0b, 0xe0, 0x20, 0x1c, 0x0d, 0x21, 0x2a, 0x1c, - 0xff, 0xf7, 0x60, 0xfe, 0x00, 0x28, 0x03, 0xd1, 0xff, 0xf7, 0xc8, 0xfd, - 0x00, 0x28, 0x06, 0xd0, 0x14, 0x23, 0x63, 0x71, 0x20, 0x1c, 0xff, 0xf7, - 0xc9, 0xfd, 0x00, 0x20, 0x03, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0xc4, 0xfd, - 0x01, 0x20, 0x70, 0xbd, 0x03, 0x4b, 0x04, 0x4a, 0x1a, 0x60, 0x00, 0x22, - 0x5a, 0x71, 0x1a, 0x71, 0x70, 0x47, 0xc0, 0x46, 0x38, 0x01, 0x00, 0x20, - 0x00, 0x09, 0x3d, 0x00, 0x02, 0x1c, 0x10, 0xb5, 0x0c, 0x32, 0x04, 0x1c, - 0x01, 0x21, 0x40, 0x6a, 0x00, 0xf0, 0x24, 0xfd, 0x00, 0x28, 0x0a, 0xd0, - 0x23, 0x6a, 0x01, 0x20, 0x00, 0x2b, 0x06, 0xd1, 0xe3, 0x68, 0x22, 0x7a, - 0x23, 0x62, 0x80, 0x23, 0x5b, 0x42, 0x13, 0x43, 0x23, 0x72, 0x10, 0xbd, - 0x70, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xe6, 0xff, 0x00, 0x28, 0x01, 0xd1, - 0x00, 0x20, 0x1b, 0xe0, 0x63, 0x6a, 0xe6, 0x68, 0x1a, 0x7c, 0x02, 0x3e, - 0x96, 0x40, 0x5a, 0x69, 0x1d, 0x79, 0xb6, 0x18, 0x00, 0x2d, 0x08, 0xd0, - 0x70, 0x1e, 0x40, 0x19, 0x00, 0xf0, 0x4c, 0xfc, 0x00, 0x28, 0xed, 0xd0, - 0x01, 0x3d, 0xed, 0xb2, 0xf4, 0xe7, 0x63, 0x6a, 0x01, 0x20, 0x1a, 0x7c, - 0x80, 0x23, 0x9b, 0x00, 0x93, 0x40, 0xe2, 0x69, 0xd3, 0x18, 0xe3, 0x61, - 0x70, 0xbd, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, 0x40, 0x69, 0x00, 0xf0, - 0x13, 0xfc, 0x00, 0x28, 0x03, 0xd0, 0x20, 0x7e, 0x01, 0x4b, 0x40, 0x01, - 0xc0, 0x18, 0x10, 0xbd, 0x50, 0x01, 0x00, 0x20, 0xf0, 0xb5, 0x00, 0x23, - 0x87, 0xb0, 0x07, 0x1c, 0x0e, 0x1c, 0x20, 0x22, 0xf2, 0x54, 0x01, 0x33, - 0x0b, 0x2b, 0xfa, 0xd1, 0x07, 0x21, 0x00, 0x25, 0x01, 0x91, 0x3c, 0x78, - 0x00, 0x2c, 0x2a, 0xd0, 0x2e, 0x2c, 0x06, 0xd1, 0x01, 0x9b, 0x0a, 0x2b, - 0x2b, 0xd0, 0x0a, 0x21, 0x08, 0x25, 0x01, 0x91, 0x1f, 0xe0, 0x02, 0xa8, - 0x14, 0x49, 0x10, 0x22, 0x01, 0xf0, 0x8b, 0xfd, 0x00, 0x23, 0x02, 0xa9, - 0xca, 0x5c, 0x00, 0x2a, 0x03, 0xd0, 0x01, 0x33, 0xa2, 0x42, 0xf8, 0xd1, - 0x19, 0xe0, 0x01, 0x9b, 0x9d, 0x42, 0x16, 0xd8, 0x23, 0x1c, 0x21, 0x3b, - 0x5d, 0x2b, 0x12, 0xd8, 0x22, 0x1c, 0x6b, 0x1c, 0x61, 0x3a, 0xdb, 0xb2, - 0x75, 0x19, 0x19, 0x2a, 0x01, 0xd8, 0x20, 0x3c, 0xe4, 0xb2, 0x2c, 0x70, - 0x1d, 0x1c, 0x01, 0x37, 0xd1, 0xe7, 0x30, 0x78, 0x20, 0x38, 0x43, 0x1e, - 0x98, 0x41, 0xc0, 0xb2, 0x00, 0xe0, 0x00, 0x20, 0x07, 0xb0, 0xf0, 0xbd, - 0xea, 0x49, 0x00, 0x00, 0x38, 0xb5, 0x42, 0x7a, 0x04, 0x1c, 0x0d, 0x1c, - 0x00, 0x2a, 0x01, 0xd0, 0x00, 0x20, 0x1f, 0xe0, 0x4b, 0x1c, 0xdb, 0x7f, - 0x10, 0x2b, 0x06, 0xd1, 0x02, 0x23, 0x43, 0x72, 0x02, 0x62, 0x4b, 0x8c, - 0x5b, 0x01, 0xc3, 0x61, 0x0c, 0xe0, 0x20, 0x2b, 0xf0, 0xd1, 0x03, 0x23, - 0x43, 0x72, 0x49, 0x6a, 0x22, 0x1c, 0x01, 0x62, 0x1c, 0x32, 0x28, 0x1c, - 0x00, 0xf0, 0x18, 0xfc, 0x00, 0x28, 0xe5, 0xd0, 0x00, 0x23, 0x01, 0x20, - 0x65, 0x62, 0x20, 0x72, 0xe3, 0x60, 0x23, 0x61, 0x63, 0x61, 0x23, 0x76, - 0x38, 0xbd, 0x00, 0x00, 0xf0, 0xb5, 0x43, 0x7a, 0x85, 0xb0, 0x04, 0x1c, - 0x0e, 0x1c, 0x03, 0x92, 0x00, 0x2b, 0x01, 0xd1, 0x3a, 0x48, 0x11, 0xe0, - 0x03, 0x7a, 0xd8, 0x07, 0xfa, 0xd5, 0xe2, 0x69, 0x20, 0x69, 0x03, 0x99, - 0x13, 0x1a, 0x99, 0x42, 0x01, 0xd9, 0x9b, 0xb2, 0x03, 0x93, 0x03, 0x99, - 0x02, 0x91, 0x02, 0x9b, 0x00, 0x2b, 0x04, 0xd1, 0x03, 0x99, 0x88, 0xb2, - 0x00, 0xb2, 0x05, 0xb0, 0xf0, 0xbd, 0x23, 0x69, 0x61, 0x7a, 0xdf, 0x05, - 0xff, 0x0d, 0x5a, 0x0a, 0x60, 0x6a, 0x02, 0x29, 0x02, 0xd1, 0x41, 0x6a, - 0x51, 0x18, 0x1b, 0xe0, 0x05, 0x79, 0x01, 0x3d, 0x2a, 0x40, 0xd5, 0xb2, - 0x00, 0x2f, 0x0d, 0xd1, 0x00, 0x2d, 0x0b, 0xd1, 0x00, 0x2b, 0x02, 0xd1, - 0x22, 0x6a, 0xe2, 0x60, 0x06, 0xe0, 0x22, 0x1c, 0xe1, 0x68, 0x0c, 0x32, - 0x00, 0xf0, 0xa0, 0xfb, 0x00, 0x28, 0xc9, 0xd0, 0x63, 0x6a, 0xe1, 0x68, - 0x1a, 0x7c, 0x02, 0x39, 0x5b, 0x69, 0x91, 0x40, 0xc9, 0x18, 0x49, 0x19, - 0x80, 0x22, 0x02, 0x9d, 0x92, 0x00, 0xd3, 0x1b, 0x9d, 0x42, 0x00, 0xdd, - 0x9d, 0xb2, 0x23, 0x7a, 0x58, 0x06, 0x01, 0xd4, 0x95, 0x42, 0x18, 0xd1, - 0x16, 0x4b, 0x1b, 0x68, 0x99, 0x42, 0x14, 0xd0, 0x15, 0x4b, 0x3a, 0x1c, - 0x18, 0x68, 0x00, 0x96, 0x2b, 0x1c, 0xff, 0xf7, 0x1f, 0xfe, 0x00, 0x28, - 0xa8, 0xd0, 0x76, 0x19, 0x01, 0xe0, 0xdf, 0x1b, 0xf6, 0x19, 0x21, 0x69, - 0x02, 0x9a, 0x4b, 0x19, 0x55, 0x1b, 0xad, 0xb2, 0x23, 0x61, 0x02, 0x95, - 0xab, 0xe7, 0x08, 0x1c, 0x00, 0x21, 0x00, 0xf0, 0x2b, 0xfb, 0x00, 0x28, - 0x96, 0xd0, 0x09, 0x4b, 0x32, 0x1c, 0xff, 0x18, 0x79, 0x19, 0x3b, 0x1c, - 0x8b, 0x42, 0xe8, 0xd0, 0x18, 0x78, 0x01, 0x33, 0x10, 0x70, 0x01, 0x32, - 0xf8, 0xe7, 0xc0, 0x46, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x73, 0xb5, 0x43, 0x7a, - 0x04, 0x1c, 0x01, 0x2b, 0x01, 0xd8, 0x00, 0x20, 0x16, 0xe0, 0x03, 0x69, - 0x6d, 0x46, 0x07, 0x35, 0xde, 0x05, 0x29, 0x1c, 0x01, 0x22, 0x36, 0x0f, - 0xff, 0xf7, 0x6a, 0xff, 0x01, 0x28, 0x01, 0xd1, 0x2b, 0x78, 0x00, 0xe0, - 0x05, 0x4b, 0x1b, 0xb2, 0x01, 0x33, 0xec, 0xd0, 0x23, 0x69, 0x70, 0x01, - 0x1f, 0x33, 0x23, 0x61, 0x02, 0x4b, 0xc0, 0x18, 0x76, 0xbd, 0xc0, 0x46, - 0xff, 0xff, 0x00, 0x00, 0x50, 0x01, 0x00, 0x20, 0x70, 0xb5, 0x04, 0x1c, - 0x40, 0x7a, 0x0d, 0x1c, 0x00, 0x28, 0x2a, 0xd0, 0xe2, 0x69, 0x91, 0x42, - 0x01, 0xd9, 0x00, 0x20, 0x25, 0xe0, 0x02, 0x28, 0x21, 0xd0, 0x00, 0x2d, - 0x01, 0xd1, 0xe5, 0x60, 0x1d, 0xe0, 0x62, 0x6a, 0x21, 0x69, 0x13, 0x7c, - 0x68, 0x1e, 0x09, 0x33, 0x4a, 0x1e, 0xd8, 0x40, 0xda, 0x40, 0x03, 0x1e, - 0x93, 0x42, 0x01, 0xd3, 0x00, 0x29, 0x02, 0xd1, 0x22, 0x6a, 0xe2, 0x60, - 0x00, 0xe0, 0x83, 0x1a, 0x1e, 0x1c, 0x00, 0x2e, 0x09, 0xd0, 0x22, 0x1c, - 0x60, 0x6a, 0xe1, 0x68, 0x0c, 0x32, 0x00, 0xf0, 0x07, 0xfb, 0x01, 0x3e, - 0x00, 0x28, 0xf4, 0xd1, 0x01, 0xe0, 0x25, 0x61, 0x01, 0x20, 0x70, 0xbd, - 0x38, 0xb5, 0x05, 0x1c, 0x40, 0x7a, 0x00, 0x28, 0x33, 0xd0, 0x2b, 0x7a, - 0x7f, 0x2b, 0x2d, 0xd9, 0x28, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x9a, 0xfe, - 0x04, 0x1e, 0x2a, 0xd0, 0x6b, 0x7a, 0x01, 0x2b, 0x07, 0xd8, 0x2b, 0x7f, - 0x03, 0x77, 0x6b, 0x7f, 0x43, 0x77, 0xab, 0x7f, 0x83, 0x77, 0xeb, 0x7f, - 0xc3, 0x77, 0x2b, 0x6a, 0x9a, 0xb2, 0x1b, 0x0c, 0x23, 0x75, 0x1b, 0x0a, - 0x63, 0x75, 0x0d, 0x4b, 0xa2, 0x76, 0x1b, 0x68, 0x12, 0x0a, 0xe2, 0x76, - 0x00, 0x2b, 0x0b, 0xd0, 0x20, 0x1c, 0x21, 0x1c, 0x18, 0x30, 0x16, 0x31, - 0x98, 0x47, 0x63, 0x7e, 0x22, 0x7e, 0x1b, 0x02, 0x13, 0x43, 0xa3, 0x74, - 0x1b, 0x0a, 0xe3, 0x74, 0x2a, 0x7a, 0x7f, 0x23, 0x13, 0x40, 0x2b, 0x72, - 0x00, 0xf0, 0x5c, 0xfa, 0xff, 0xe7, 0x38, 0xbd, 0x44, 0x01, 0x00, 0x20, - 0x10, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xc0, 0xff, 0x00, 0x28, 0x02, 0xd0, - 0x00, 0x23, 0x63, 0x72, 0x01, 0x20, 0x10, 0xbd, 0x73, 0xb5, 0x42, 0x7a, - 0x04, 0x1c, 0x0d, 0x1c, 0x00, 0x20, 0x01, 0x2a, 0x4b, 0xd1, 0x20, 0x7a, - 0x02, 0x23, 0x18, 0x40, 0x47, 0xd0, 0xe3, 0x69, 0x00, 0x20, 0x99, 0x42, - 0x43, 0xd8, 0x10, 0x1c, 0x00, 0x2b, 0x40, 0xd0, 0x20, 0x1c, 0x29, 0x1c, - 0x26, 0x69, 0xff, 0xf7, 0x71, 0xff, 0x00, 0x28, 0x25, 0xd0, 0x60, 0x6a, - 0x00, 0x2d, 0x06, 0xd1, 0x21, 0x6a, 0x00, 0xf0, 0x95, 0xfb, 0x00, 0x28, - 0x1d, 0xd0, 0x25, 0x62, 0x1d, 0xe0, 0xe1, 0x68, 0x01, 0xaa, 0x00, 0xf0, - 0x93, 0xfa, 0x00, 0x28, 0x15, 0xd0, 0x60, 0x6a, 0x01, 0x99, 0x43, 0x1c, - 0xdb, 0x7f, 0x10, 0x2b, 0x01, 0xd1, 0x12, 0x4b, 0x00, 0xe0, 0x12, 0x4b, - 0x99, 0x42, 0x0c, 0xd2, 0x00, 0xf0, 0x7e, 0xfb, 0x00, 0x28, 0x06, 0xd0, - 0x60, 0x6a, 0xe1, 0x68, 0x0e, 0x4a, 0x00, 0xf0, 0xcf, 0xfa, 0x00, 0x28, - 0x01, 0xd1, 0x00, 0x20, 0x11, 0xe0, 0x22, 0x7a, 0x80, 0x23, 0x5b, 0x42, - 0x13, 0x43, 0xe5, 0x61, 0x23, 0x72, 0x20, 0x1c, 0xff, 0xf7, 0x70, 0xff, - 0x00, 0x28, 0xf2, 0xd0, 0x29, 0x1e, 0xb1, 0x42, 0x00, 0xd9, 0x31, 0x1c, - 0x20, 0x1c, 0xff, 0xf7, 0x35, 0xff, 0x76, 0xbd, 0xf8, 0xff, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x38, 0xb5, 0x23, 0x4b, - 0x15, 0x1c, 0x4a, 0x01, 0xd3, 0x18, 0x04, 0x1c, 0xd8, 0x7a, 0x11, 0x22, - 0x10, 0x42, 0x04, 0xd0, 0x42, 0x22, 0x15, 0x42, 0x01, 0xd0, 0x00, 0x20, - 0x36, 0xe0, 0x1d, 0x4a, 0x21, 0x76, 0x12, 0x68, 0x62, 0x61, 0x5a, 0x7d, - 0x18, 0x7d, 0xd9, 0x7e, 0x12, 0x02, 0x02, 0x43, 0x98, 0x7e, 0x09, 0x02, - 0x12, 0x04, 0x01, 0x43, 0x11, 0x43, 0x21, 0x62, 0xd8, 0x7a, 0x18, 0x22, - 0x02, 0x40, 0x0c, 0xd1, 0x5a, 0x7f, 0x19, 0x7f, 0x12, 0x02, 0x0a, 0x43, - 0x99, 0x7f, 0xdb, 0x7f, 0x09, 0x04, 0x0a, 0x43, 0x1b, 0x06, 0x13, 0x43, - 0xe3, 0x61, 0x01, 0x23, 0x09, 0xe0, 0x10, 0x2a, 0xdb, 0xd1, 0x22, 0x1c, - 0x60, 0x6a, 0x1c, 0x32, 0x00, 0xf0, 0x5a, 0xfa, 0x00, 0x28, 0xd4, 0xd0, - 0x04, 0x23, 0x63, 0x72, 0x0f, 0x23, 0x00, 0x21, 0x2b, 0x40, 0x23, 0x72, - 0xe1, 0x60, 0x21, 0x61, 0x01, 0x20, 0x6a, 0x06, 0x02, 0xd5, 0x20, 0x1c, - 0xff, 0xf7, 0x60, 0xff, 0x38, 0xbd, 0xc0, 0x46, 0x50, 0x01, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x20, 0xf0, 0xb5, 0x45, 0x7a, 0x87, 0xb0, 0x04, 0x1c, - 0x0e, 0x1c, 0x01, 0x93, 0x00, 0x2d, 0x00, 0xd0, 0x86, 0xe0, 0x10, 0x1c, - 0x03, 0xa9, 0xff, 0xf7, 0xbb, 0xfd, 0x00, 0x28, 0x00, 0xd1, 0x80, 0xe0, - 0x72, 0x6a, 0x2f, 0x1c, 0x62, 0x62, 0xf5, 0x60, 0x35, 0x61, 0x33, 0x69, - 0xf2, 0x69, 0x93, 0x42, 0x26, 0xd2, 0xdb, 0x05, 0x1b, 0x0f, 0x30, 0x1c, - 0x00, 0x93, 0xff, 0xf7, 0x9f, 0xfe, 0x01, 0x1e, 0x6f, 0xd0, 0x03, 0x78, - 0x00, 0x2b, 0x01, 0xd0, 0xe5, 0x2b, 0x0b, 0xd1, 0x00, 0x2f, 0x04, 0xd1, - 0x00, 0x9b, 0x23, 0x76, 0x34, 0x4b, 0x1b, 0x68, 0x63, 0x61, 0x0b, 0x78, - 0x01, 0x27, 0x00, 0x2b, 0xe3, 0xd1, 0x0d, 0xe0, 0x03, 0xa8, 0x0b, 0x22, - 0x01, 0xf0, 0x2c, 0xfb, 0x00, 0x28, 0xdc, 0xd1, 0x01, 0x9a, 0x30, 0x23, - 0x13, 0x40, 0x30, 0x2b, 0x53, 0xd0, 0x20, 0x1c, 0x00, 0x99, 0x4b, 0xe0, - 0x01, 0x9a, 0x12, 0x23, 0x13, 0x40, 0x12, 0x2b, 0x4b, 0xd1, 0x00, 0x2f, - 0x06, 0xd0, 0x20, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x6f, 0xfd, 0x06, 0x1e, - 0x0a, 0xd1, 0x42, 0xe0, 0x73, 0x7a, 0x02, 0x2b, 0x3f, 0xd0, 0x30, 0x1c, - 0xff, 0xf7, 0x40, 0xfd, 0x00, 0x28, 0x3a, 0xd0, 0x1f, 0x4e, 0x27, 0x76, - 0x00, 0x21, 0x20, 0x22, 0x30, 0x1c, 0x01, 0xf0, 0x1d, 0xfb, 0x30, 0x1c, - 0x03, 0xa9, 0x0b, 0x22, 0x01, 0xf0, 0x0f, 0xfb, 0x1a, 0x4b, 0x1b, 0x68, - 0x00, 0x2b, 0x05, 0xd0, 0x30, 0x1c, 0x31, 0x1c, 0x10, 0x30, 0x0e, 0x31, - 0x98, 0x47, 0x06, 0xe0, 0x21, 0x22, 0x32, 0x74, 0xb3, 0x73, 0x28, 0x22, - 0x08, 0x23, 0x72, 0x74, 0xf3, 0x73, 0x73, 0x7c, 0x32, 0x7c, 0x1b, 0x02, - 0x13, 0x43, 0xff, 0x22, 0x1a, 0x40, 0x1b, 0x0a, 0xf3, 0x74, 0x73, 0x76, - 0xf3, 0x7b, 0xb2, 0x74, 0x32, 0x76, 0xb2, 0x7b, 0x1b, 0x02, 0x13, 0x43, - 0xb3, 0x75, 0x1b, 0x0a, 0xf3, 0x75, 0x00, 0xf0, 0x21, 0xf9, 0x00, 0x28, - 0x07, 0xd0, 0x21, 0x7e, 0x01, 0x9a, 0x20, 0x1c, 0xff, 0xf7, 0x26, 0xff, - 0x05, 0x1c, 0x00, 0xe0, 0x00, 0x25, 0x28, 0x1c, 0x07, 0xb0, 0xf0, 0xbd, - 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x44, 0x01, 0x00, 0x20, - 0x10, 0xb5, 0x00, 0x21, 0x04, 0x1c, 0xff, 0xf7, 0xbb, 0xfe, 0x00, 0x28, - 0x0b, 0xd0, 0x20, 0x1c, 0x01, 0x21, 0xff, 0xf7, 0x15, 0xfd, 0x00, 0x28, - 0x05, 0xd0, 0xe5, 0x23, 0x03, 0x70, 0x00, 0x23, 0x63, 0x72, 0x00, 0xf0, - 0xfb, 0xf8, 0x10, 0xbd, 0x10, 0xb5, 0x0a, 0x1c, 0x0a, 0x49, 0x8a, 0xb0, - 0x08, 0x31, 0x00, 0x23, 0x04, 0x1c, 0x00, 0x91, 0x69, 0x46, 0x4b, 0x72, - 0x01, 0x93, 0x68, 0x46, 0x21, 0x1c, 0x02, 0x23, 0xff, 0xf7, 0x42, 0xff, - 0x00, 0x28, 0x02, 0xd0, 0x68, 0x46, 0xff, 0xf7, 0xd7, 0xff, 0x0a, 0xb0, - 0x10, 0xbd, 0xc0, 0x46, 0x00, 0x4a, 0x00, 0x00, 0xf0, 0xb5, 0x43, 0x7a, - 0x87, 0xb0, 0x04, 0x1c, 0x0d, 0x1c, 0x03, 0x92, 0x01, 0x2b, 0x0d, 0xd1, - 0x03, 0x7a, 0x99, 0x07, 0x0a, 0xd5, 0x5a, 0x07, 0x0c, 0xd5, 0xe1, 0x69, - 0x22, 0x69, 0x8a, 0x42, 0x08, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0x06, 0xfe, - 0x00, 0x28, 0x03, 0xd1, 0x01, 0x23, 0x63, 0x60, 0x00, 0x20, 0xaa, 0xe0, - 0x03, 0x9b, 0x01, 0x93, 0x3b, 0xe0, 0x60, 0x6a, 0x73, 0x0a, 0x07, 0x79, - 0xf6, 0x05, 0x01, 0x3f, 0x1f, 0x40, 0xff, 0xb2, 0xf6, 0x0d, 0x00, 0x2f, - 0x36, 0xd0, 0x80, 0x22, 0x92, 0x00, 0x92, 0x1b, 0x01, 0x99, 0x92, 0xb2, - 0x0b, 0x1c, 0x91, 0x42, 0x00, 0xd9, 0x13, 0x1c, 0x9b, 0xb2, 0x02, 0x93, - 0x63, 0x6a, 0xe1, 0x68, 0x1a, 0x7c, 0x02, 0x39, 0x91, 0x40, 0x5a, 0x69, - 0x8b, 0x18, 0x02, 0x9a, 0xdf, 0x19, 0x80, 0x23, 0x9b, 0x00, 0x9a, 0x42, - 0x3f, 0xd1, 0x44, 0x4b, 0x19, 0x68, 0xb9, 0x42, 0x02, 0xd1, 0x01, 0x22, - 0x52, 0x42, 0x1a, 0x60, 0x41, 0x4b, 0x39, 0x1c, 0x18, 0x68, 0x2a, 0x1c, - 0xff, 0xf7, 0x22, 0xfc, 0x00, 0x28, 0xc7, 0xd0, 0x80, 0x22, 0x92, 0x00, - 0xad, 0x18, 0x01, 0x99, 0x02, 0x9a, 0x8b, 0x1a, 0x21, 0x69, 0x9b, 0xb2, - 0x01, 0x93, 0x8b, 0x18, 0x23, 0x61, 0x01, 0x9a, 0x26, 0x69, 0x00, 0x2a, - 0xbf, 0xd1, 0x49, 0xe0, 0x00, 0x2e, 0xc6, 0xd1, 0xe1, 0x68, 0x00, 0x29, - 0x03, 0xd1, 0x23, 0x6a, 0x00, 0x2b, 0x16, 0xd1, 0x0f, 0xe0, 0x05, 0xaa, - 0x00, 0xf0, 0xe2, 0xf8, 0x00, 0x28, 0x58, 0xd0, 0x62, 0x6a, 0x05, 0x9b, - 0x01, 0x32, 0xd2, 0x7f, 0x10, 0x2a, 0x01, 0xd1, 0x2c, 0x4a, 0x00, 0xe0, - 0x2c, 0x4a, 0x93, 0x42, 0x05, 0xd3, 0x20, 0x1c, 0xff, 0xf7, 0x3c, 0xfc, - 0x00, 0x28, 0xaa, 0xd1, 0x98, 0xe7, 0xe3, 0x60, 0xa7, 0xe7, 0x00, 0x2e, - 0x0f, 0xd1, 0x23, 0x69, 0xe1, 0x69, 0x8b, 0x42, 0x0b, 0xd3, 0x00, 0xf0, - 0x59, 0xf8, 0x00, 0x28, 0x8c, 0xd0, 0x1f, 0x4b, 0x01, 0x21, 0x1f, 0x60, - 0x21, 0x4b, 0x1a, 0x78, 0x0a, 0x43, 0x1a, 0x70, 0x06, 0xe0, 0x38, 0x1c, - 0x01, 0x21, 0x00, 0xf0, 0x75, 0xf8, 0x00, 0x28, 0x00, 0xd1, 0x7d, 0xe7, - 0x1c, 0x4b, 0x2a, 0x1c, 0xf6, 0x18, 0x02, 0x9b, 0xf1, 0x18, 0x33, 0x1c, - 0x8b, 0x42, 0x04, 0xd0, 0x10, 0x78, 0x01, 0x32, 0x18, 0x70, 0x01, 0x33, - 0xf8, 0xe7, 0x9e, 0x1b, 0xad, 0x19, 0xa8, 0xe7, 0xe1, 0x69, 0x23, 0x7a, - 0x8e, 0x42, 0x01, 0xd9, 0xe6, 0x61, 0x06, 0xe0, 0x12, 0x4a, 0x12, 0x68, - 0x00, 0x2a, 0x06, 0xd0, 0x03, 0x9a, 0x00, 0x2a, 0x03, 0xd0, 0x80, 0x22, - 0x52, 0x42, 0x13, 0x43, 0x23, 0x72, 0x23, 0x7a, 0x19, 0x07, 0x01, 0xd4, - 0x03, 0x98, 0x06, 0xe0, 0x20, 0x1c, 0xff, 0xf7, 0x8b, 0xfd, 0x00, 0x28, - 0x00, 0xd1, 0x51, 0xe7, 0xf6, 0xe7, 0x07, 0xb0, 0xf0, 0xbd, 0xc0, 0x46, - 0x00, 0x00, 0x00, 0x20, 0x4c, 0x01, 0x00, 0x20, 0xf8, 0xff, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x0f, 0x50, 0x03, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, - 0x44, 0x01, 0x00, 0x20, 0x07, 0xb5, 0x6b, 0x46, 0xd9, 0x71, 0x07, 0x33, - 0x19, 0x1c, 0x01, 0x22, 0xff, 0xf7, 0x22, 0xff, 0x0e, 0xbd, 0x00, 0x00, - 0xf8, 0xb5, 0x0f, 0x4f, 0x01, 0x20, 0x3b, 0x78, 0x00, 0x2b, 0x18, 0xd0, - 0x0d, 0x4e, 0x0e, 0x4b, 0x0e, 0x4d, 0x19, 0x68, 0x30, 0x68, 0x2a, 0x1c, - 0xff, 0xf7, 0x80, 0xfb, 0x00, 0x28, 0x0e, 0xd0, 0x0b, 0x4c, 0x21, 0x68, - 0x00, 0x29, 0x07, 0xd0, 0x30, 0x68, 0x2a, 0x1c, 0xff, 0xf7, 0x76, 0xfb, - 0x00, 0x28, 0x04, 0xd0, 0x00, 0x23, 0x23, 0x60, 0x00, 0x23, 0x3b, 0x70, - 0x01, 0x20, 0xf8, 0xbd, 0x50, 0x03, 0x00, 0x20, 0x4c, 0x01, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x48, 0x01, 0x00, 0x20, - 0x70, 0xb5, 0x0d, 0x4d, 0x04, 0x1c, 0x2b, 0x68, 0x0e, 0x1c, 0x83, 0x42, - 0x0e, 0xd0, 0xff, 0xf7, 0xcd, 0xff, 0x00, 0x28, 0x01, 0xd1, 0x00, 0x20, - 0x0d, 0xe0, 0x08, 0x4b, 0x21, 0x1c, 0x18, 0x68, 0x07, 0x4a, 0xff, 0xf7, - 0x25, 0xfb, 0x00, 0x28, 0xf5, 0xd0, 0x2c, 0x60, 0x05, 0x4b, 0x01, 0x20, - 0x1a, 0x78, 0x16, 0x43, 0x1e, 0x70, 0x70, 0xbd, 0x00, 0x00, 0x00, 0x20, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, - 0x10, 0xb5, 0x04, 0x1c, 0xff, 0xf7, 0xae, 0xff, 0x00, 0x28, 0x0f, 0xd0, - 0x00, 0x23, 0x08, 0x4a, 0x00, 0x21, 0x99, 0x54, 0x80, 0x22, 0x01, 0x33, - 0x92, 0x00, 0x93, 0x42, 0xf7, 0xd1, 0x05, 0x4b, 0x01, 0x20, 0x1c, 0x60, - 0x04, 0x4b, 0x1a, 0x78, 0x02, 0x43, 0x1a, 0x70, 0x10, 0xbd, 0xc0, 0x46, - 0x50, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, - 0xc3, 0x68, 0x70, 0xb5, 0x01, 0x33, 0x0c, 0x1c, 0x15, 0x1c, 0x99, 0x42, - 0x01, 0xd9, 0x00, 0x20, 0x21, 0xe0, 0x46, 0x1c, 0xf1, 0x7f, 0xc2, 0x69, - 0xe3, 0x09, 0x10, 0x29, 0x00, 0xd1, 0x23, 0x0a, 0x98, 0x18, 0x0d, 0x4b, - 0x1b, 0x68, 0x98, 0x42, 0x07, 0xd1, 0xf2, 0x7f, 0x0b, 0x4b, 0x10, 0x2a, - 0x09, 0xd1, 0xe4, 0xb2, 0x64, 0x00, 0x1b, 0x5b, 0x0b, 0xe0, 0x00, 0x21, - 0xff, 0xf7, 0x9e, 0xff, 0x00, 0x28, 0xf2, 0xd1, 0xe3, 0xe7, 0x7f, 0x22, - 0x14, 0x40, 0xa4, 0x00, 0x1b, 0x59, 0x1b, 0x01, 0x1b, 0x09, 0x2b, 0x60, - 0x01, 0x20, 0x70, 0xbd, 0x00, 0x00, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, - 0x73, 0xb5, 0x05, 0x1c, 0x01, 0x91, 0x16, 0x1c, 0x00, 0x24, 0x28, 0x1c, - 0x01, 0x99, 0x01, 0xaa, 0xff, 0xf7, 0xc6, 0xff, 0x00, 0x28, 0x10, 0xd0, - 0x2a, 0x7c, 0x80, 0x23, 0x9b, 0x00, 0x93, 0x40, 0xe4, 0x18, 0x6b, 0x1c, - 0xdb, 0x7f, 0x01, 0x9a, 0x10, 0x2b, 0x01, 0xd1, 0x03, 0x4b, 0x00, 0xe0, - 0x03, 0x4b, 0x9a, 0x42, 0xe9, 0xd3, 0x34, 0x60, 0x01, 0x20, 0x76, 0xbd, - 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, 0xf7, 0xb5, 0x05, 0x1c, - 0x0c, 0x1c, 0x01, 0x92, 0x01, 0x29, 0x32, 0xd9, 0xc3, 0x68, 0x00, 0x20, - 0x01, 0x33, 0x99, 0x42, 0x2e, 0xd8, 0x6f, 0x1c, 0xfa, 0x7f, 0xee, 0x69, - 0xcb, 0x09, 0x10, 0x2a, 0x00, 0xd1, 0x0b, 0x0a, 0x9e, 0x19, 0x14, 0x4b, - 0x1b, 0x68, 0x9e, 0x42, 0x08, 0xd1, 0xfa, 0x7f, 0x12, 0x4b, 0x10, 0x2a, - 0x0b, 0xd1, 0xe4, 0xb2, 0x01, 0x9a, 0x64, 0x00, 0x1a, 0x53, 0x0b, 0xe0, - 0x30, 0x1c, 0x00, 0x21, 0xff, 0xf7, 0x48, 0xff, 0x00, 0x28, 0xf0, 0xd1, - 0x12, 0xe0, 0x7f, 0x22, 0x14, 0x40, 0x01, 0x9a, 0xa4, 0x00, 0x1a, 0x51, - 0x09, 0x4b, 0x01, 0x20, 0x1a, 0x78, 0x02, 0x43, 0x1a, 0x70, 0x2b, 0x7e, - 0x83, 0x42, 0x05, 0xd9, 0xab, 0x68, 0xf6, 0x18, 0x05, 0x4b, 0x1e, 0x60, - 0x00, 0xe0, 0x00, 0x20, 0xfe, 0xbd, 0xc0, 0x46, 0x00, 0x00, 0x00, 0x20, - 0x50, 0x01, 0x00, 0x20, 0x50, 0x03, 0x00, 0x20, 0x48, 0x01, 0x00, 0x20, - 0xf0, 0xb5, 0x15, 0x68, 0x87, 0xb0, 0x06, 0x1c, 0x02, 0x91, 0x17, 0x1c, - 0x00, 0x2d, 0x03, 0xd0, 0x00, 0x21, 0x01, 0x35, 0x01, 0x91, 0x06, 0xe0, - 0x02, 0x9b, 0x05, 0x68, 0x01, 0x3b, 0x5a, 0x42, 0x53, 0x41, 0xdb, 0xb2, - 0x01, 0x93, 0xf2, 0x68, 0x00, 0x23, 0x01, 0x32, 0x03, 0x92, 0x2c, 0x1c, - 0x00, 0x93, 0x00, 0x99, 0xf2, 0x68, 0x91, 0x42, 0x21, 0xd2, 0x03, 0x9b, - 0x9c, 0x42, 0x01, 0xd9, 0x02, 0x24, 0x25, 0x1c, 0x30, 0x1c, 0x21, 0x1c, - 0x05, 0xaa, 0xff, 0xf7, 0x43, 0xff, 0x00, 0x28, 0x15, 0xd0, 0x05, 0x99, - 0x63, 0x1c, 0x00, 0x29, 0x01, 0xd0, 0x1d, 0x1c, 0x03, 0xe0, 0x02, 0x99, - 0x5a, 0x1b, 0x8a, 0x42, 0x04, 0xd0, 0x00, 0x9a, 0x1c, 0x1c, 0x01, 0x32, - 0x00, 0x92, 0xe0, 0xe7, 0x30, 0x1c, 0x21, 0x1c, 0x13, 0x4a, 0xff, 0xf7, - 0x7f, 0xff, 0x00, 0x28, 0x0b, 0xd1, 0x00, 0x20, 0x1d, 0xe0, 0x63, 0x1e, - 0x30, 0x1c, 0x19, 0x1c, 0x22, 0x1c, 0x00, 0x93, 0xff, 0xf7, 0x74, 0xff, - 0x00, 0x28, 0xf4, 0xd0, 0x00, 0x9c, 0xac, 0x42, 0xf3, 0xd8, 0x39, 0x68, - 0x00, 0x29, 0x06, 0xd1, 0x01, 0x99, 0x3d, 0x60, 0x00, 0x29, 0x09, 0xd0, - 0x01, 0x35, 0x35, 0x60, 0x06, 0xe0, 0x30, 0x1c, 0x2a, 0x1c, 0xff, 0xf7, - 0x61, 0xff, 0x00, 0x28, 0xf2, 0xd1, 0xe0, 0xe7, 0x01, 0x20, 0x07, 0xb0, - 0xf0, 0xbd, 0xc0, 0x46, 0xff, 0xff, 0xff, 0x0f, 0x02, 0x23, 0x37, 0xb5, - 0x05, 0x1c, 0x0c, 0x1c, 0x03, 0x60, 0x28, 0x1c, 0x21, 0x1c, 0x01, 0xaa, - 0xff, 0xf7, 0xfc, 0xfe, 0x00, 0x28, 0x12, 0xd0, 0x28, 0x1c, 0x21, 0x1c, - 0x00, 0x22, 0xff, 0xf7, 0x47, 0xff, 0x00, 0x28, 0x0b, 0xd0, 0x6b, 0x1c, - 0xdb, 0x7f, 0x01, 0x9c, 0x10, 0x2b, 0x01, 0xd1, 0x04, 0x4b, 0x00, 0xe0, - 0x04, 0x4b, 0x9c, 0x42, 0xe7, 0xd3, 0x01, 0x20, 0x00, 0xe0, 0x00, 0x20, - 0x3e, 0xbd, 0xc0, 0x46, 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, - 0xf8, 0xb5, 0x44, 0x4b, 0x04, 0x1c, 0x15, 0x1c, 0x19, 0x60, 0x29, 0xd0, - 0x04, 0x2a, 0x01, 0xd9, 0x00, 0x20, 0x7d, 0xe0, 0x00, 0x20, 0x01, 0x1c, - 0xff, 0xf7, 0x90, 0xfe, 0x00, 0x28, 0xf7, 0xd0, 0x2d, 0x01, 0x3d, 0x4b, - 0xa9, 0x35, 0xff, 0x35, 0x5d, 0x19, 0xaa, 0x79, 0xab, 0x1d, 0x50, 0x06, - 0xee, 0xd1, 0xea, 0x7c, 0xa9, 0x7c, 0x12, 0x02, 0x0a, 0x43, 0x29, 0x7d, - 0x09, 0x04, 0x0a, 0x43, 0x69, 0x7d, 0x09, 0x06, 0x0a, 0x43, 0x63, 0x2a, - 0xe2, 0xd9, 0xaa, 0x7b, 0xed, 0x7b, 0x2d, 0x02, 0x15, 0x43, 0x9a, 0x7a, - 0xdb, 0x7a, 0x12, 0x04, 0x15, 0x43, 0x1b, 0x06, 0x1d, 0x43, 0xd7, 0xd0, - 0x28, 0x1c, 0x00, 0x21, 0xff, 0xf7, 0x6a, 0xfe, 0x00, 0x28, 0xd1, 0xd0, - 0x2a, 0x4b, 0x19, 0x7b, 0xda, 0x7a, 0x09, 0x02, 0x11, 0x43, 0x80, 0x22, - 0x92, 0x00, 0x91, 0x42, 0xc8, 0xd1, 0x1a, 0x7c, 0x00, 0x2a, 0xc5, 0xd0, - 0xd9, 0x89, 0x00, 0x29, 0xc2, 0xd0, 0x59, 0x7b, 0x00, 0x29, 0xbf, 0xd0, - 0x22, 0x76, 0x00, 0x22, 0x21, 0x71, 0x22, 0x74, 0x22, 0x7c, 0x01, 0x20, - 0x90, 0x40, 0x81, 0x42, 0x04, 0xd0, 0x50, 0x1c, 0x20, 0x74, 0x07, 0x2a, - 0xf6, 0xd9, 0xb1, 0xe7, 0xd9, 0x8a, 0x00, 0x29, 0x00, 0xd1, 0x59, 0x6a, - 0xa1, 0x60, 0xd8, 0x89, 0x28, 0x18, 0xe0, 0x61, 0x1f, 0x69, 0x3e, 0x02, - 0x36, 0x0c, 0x66, 0x84, 0xb7, 0xb2, 0x1e, 0x7c, 0x71, 0x43, 0x0e, 0x18, - 0x13, 0x48, 0x79, 0x01, 0x09, 0x18, 0x49, 0x12, 0x71, 0x18, 0x66, 0x62, - 0x61, 0x61, 0x18, 0x7d, 0xde, 0x7c, 0x00, 0x02, 0x30, 0x43, 0x00, 0xd1, - 0x18, 0x6a, 0x6d, 0x1a, 0x28, 0x18, 0xd0, 0x40, 0x02, 0x1c, 0xe0, 0x60, - 0x0b, 0x48, 0x61, 0x1c, 0x82, 0x42, 0x01, 0xd8, 0x0c, 0x23, 0x07, 0xe0, - 0x09, 0x48, 0x82, 0x42, 0x01, 0xd8, 0x10, 0x23, 0x02, 0xe0, 0xdb, 0x6a, - 0x63, 0x62, 0x20, 0x23, 0xcb, 0x77, 0x01, 0x20, 0xf8, 0xbd, 0xc0, 0x46, - 0x4c, 0x01, 0x00, 0x20, 0x50, 0x01, 0x00, 0x20, 0xff, 0x01, 0x00, 0x00, - 0xf4, 0x0f, 0x00, 0x00, 0xf4, 0xff, 0x00, 0x00, 0x08, 0xb5, 0x05, 0x49, - 0x05, 0x4a, 0x06, 0x48, 0x00, 0xf0, 0x10, 0xf8, 0x05, 0x4b, 0x06, 0x49, - 0x00, 0x22, 0x1a, 0x70, 0x5a, 0x54, 0x08, 0xbd, 0x00, 0x4b, 0x00, 0x00, - 0x01, 0x04, 0x00, 0x00, 0x54, 0x03, 0x00, 0x20, 0x6c, 0x03, 0x00, 0x20, - 0x02, 0x04, 0x00, 0x00, 0x30, 0xb5, 0x09, 0x4c, 0x09, 0x4b, 0xa5, 0x68, - 0x6d, 0x03, 0x6d, 0x0f, 0xad, 0x00, 0xeb, 0x58, 0x03, 0x60, 0xa4, 0x68, - 0x01, 0x61, 0xa4, 0xb2, 0x44, 0x60, 0x5c, 0x43, 0x9b, 0x00, 0x84, 0x60, - 0xc3, 0x60, 0x42, 0x61, 0x30, 0xbd, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, - 0x00, 0x50, 0x00, 0x00, 0xf7, 0xb5, 0x1f, 0x4e, 0x80, 0x27, 0x75, 0x68, - 0x03, 0x33, 0x3d, 0x43, 0x9b, 0x08, 0x75, 0x60, 0x00, 0x2b, 0x34, 0xd0, - 0x1b, 0x4d, 0x35, 0x80, 0x35, 0x7d, 0xef, 0x07, 0xfc, 0xd5, 0x1d, 0x1c, - 0x5f, 0x1b, 0x01, 0x97, 0x07, 0x68, 0xbf, 0x08, 0xbc, 0x46, 0x01, 0x9f, - 0x67, 0x45, 0x1f, 0xd2, 0x00, 0x2d, 0x1d, 0xd0, 0x17, 0x78, 0x01, 0x3d, - 0x01, 0x97, 0xff, 0x27, 0xbc, 0x43, 0x01, 0x9f, 0x3c, 0x43, 0x57, 0x78, - 0x3f, 0x02, 0x01, 0x97, 0x0f, 0x4f, 0x3c, 0x40, 0x01, 0x9f, 0x3c, 0x43, - 0x97, 0x78, 0x3f, 0x04, 0xbc, 0x46, 0x0d, 0x4f, 0x3c, 0x40, 0xd7, 0x78, - 0xa4, 0xb2, 0x3f, 0x06, 0x00, 0x97, 0x67, 0x46, 0x3c, 0x43, 0x00, 0x9f, - 0x04, 0x32, 0x3c, 0x43, 0x10, 0xc1, 0xd7, 0xe7, 0x07, 0x4b, 0x33, 0x80, - 0x33, 0x7d, 0xdf, 0x07, 0xfc, 0xd5, 0x2b, 0x1c, 0xc8, 0xe7, 0xf7, 0xbd, - 0x00, 0x40, 0x00, 0x41, 0x44, 0xa5, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xff, 0x04, 0xa5, 0xff, 0xff, 0x04, 0x4b, 0x05, 0x4a, - 0x49, 0x08, 0xd9, 0x61, 0x1a, 0x80, 0x1a, 0x7d, 0xd1, 0x07, 0xfc, 0xd5, - 0x70, 0x47, 0xc0, 0x46, 0x00, 0x40, 0x00, 0x41, 0x02, 0xa5, 0xff, 0xff, - 0x70, 0xb5, 0x05, 0x1c, 0x0c, 0x1c, 0x16, 0x1c, 0xeb, 0x68, 0x28, 0x1c, - 0x21, 0x1c, 0x9e, 0x42, 0x05, 0xd9, 0xff, 0xf7, 0xe7, 0xff, 0xeb, 0x68, - 0xe4, 0x18, 0xf6, 0x1a, 0xf4, 0xe7, 0xff, 0xf7, 0xe1, 0xff, 0x70, 0xbd, - 0x43, 0x7a, 0x00, 0x2b, 0x04, 0xd1, 0x83, 0x72, 0xc3, 0x72, 0xc3, 0x60, - 0x01, 0x23, 0x43, 0x72, 0x70, 0x47, 0x30, 0xb5, 0x85, 0xb0, 0x04, 0x1c, - 0x02, 0xad, 0x00, 0x68, 0x02, 0x91, 0x03, 0x92, 0x00, 0xf0, 0x86, 0xfc, - 0x6b, 0x79, 0xe1, 0x79, 0x22, 0x7a, 0x00, 0x93, 0x20, 0x68, 0x00, 0x23, - 0x00, 0xf0, 0x20, 0xfd, 0x29, 0x79, 0x20, 0x68, 0x02, 0x9a, 0x00, 0xf0, - 0x49, 0xfc, 0x20, 0x68, 0x00, 0xf0, 0x6c, 0xfc, 0x05, 0xb0, 0x30, 0xbd, - 0x70, 0xb5, 0x04, 0x1c, 0x18, 0x26, 0xff, 0xf7, 0xd7, 0xff, 0x20, 0x79, - 0x33, 0x1c, 0x43, 0x43, 0x0d, 0x4d, 0x08, 0x21, 0xeb, 0x18, 0x59, 0x56, - 0x00, 0xf0, 0x16, 0xfb, 0xa0, 0x79, 0x33, 0x1c, 0x43, 0x43, 0x08, 0x21, - 0xeb, 0x18, 0x59, 0x56, 0x00, 0xf0, 0x0e, 0xfb, 0x60, 0x79, 0x08, 0x21, - 0x46, 0x43, 0xad, 0x19, 0x69, 0x56, 0x00, 0xf0, 0x07, 0xfb, 0x04, 0x4b, - 0x20, 0x1c, 0x06, 0xcb, 0xff, 0xf7, 0xc3, 0xff, 0x70, 0xbd, 0xc0, 0x46, - 0x20, 0x50, 0x00, 0x00, 0x70, 0x07, 0x00, 0x20, 0x07, 0xb5, 0x83, 0x7a, - 0x00, 0x91, 0x01, 0x92, 0x00, 0x2b, 0x0d, 0xd0, 0x9a, 0x07, 0x06, 0xd5, - 0xef, 0xf3, 0x10, 0x83, 0x5a, 0x42, 0x53, 0x41, 0xc3, 0x72, 0x72, 0xb6, - 0x04, 0xe0, 0xda, 0x07, 0x02, 0xd5, 0x82, 0x89, 0x03, 0x4b, 0x9a, 0x60, - 0x00, 0x99, 0x01, 0x9a, 0xff, 0xf7, 0xa5, 0xff, 0x07, 0xbd, 0xc0, 0x46, - 0x00, 0x18, 0x00, 0x40, 0x83, 0x7a, 0x00, 0x2b, 0x0b, 0xd0, 0x9a, 0x07, - 0x04, 0xd5, 0xc3, 0x7a, 0x00, 0x2b, 0x06, 0xd0, 0x62, 0xb6, 0x04, 0xe0, - 0xda, 0x07, 0x02, 0xd5, 0x82, 0x89, 0x01, 0x4b, 0xda, 0x60, 0x70, 0x47, - 0x00, 0x18, 0x00, 0x40, 0x08, 0xb5, 0x00, 0x68, 0x00, 0xf0, 0x23, 0xfc, - 0x08, 0xbd, 0x00, 0x00, 0x09, 0x4b, 0x0a, 0x4a, 0x0a, 0x49, 0x1a, 0x60, - 0x00, 0x22, 0x5a, 0x71, 0x1a, 0x71, 0x09, 0x4b, 0x19, 0x60, 0x16, 0x21, - 0x19, 0x71, 0x18, 0x21, 0x99, 0x71, 0x17, 0x21, 0x59, 0x71, 0x01, 0x21, - 0x5a, 0x72, 0xd9, 0x71, 0x1a, 0x72, 0x70, 0x47, 0x70, 0x07, 0x00, 0x20, - 0x00, 0x09, 0x3d, 0x00, 0x58, 0x08, 0x00, 0x20, 0x78, 0x07, 0x00, 0x20, - 0x08, 0xb5, 0x02, 0x48, 0x00, 0xf0, 0x0e, 0xfd, 0x08, 0xbd, 0xc0, 0x46, - 0xe8, 0x07, 0x00, 0x20, 0x08, 0xb5, 0x02, 0x48, 0x00, 0xf0, 0x06, 0xfd, - 0x08, 0xbd, 0xc0, 0x46, 0x88, 0x07, 0x00, 0x20, 0xf7, 0xb5, 0x16, 0x4f, - 0x16, 0x49, 0x38, 0x1c, 0x00, 0xf0, 0x46, 0xfb, 0x15, 0x49, 0x16, 0x48, - 0x00, 0xf0, 0x42, 0xfb, 0x15, 0x49, 0x16, 0x48, 0x00, 0xf0, 0x3e, 0xfb, - 0x15, 0x49, 0x16, 0x48, 0x00, 0xf0, 0x3a, 0xfb, 0x15, 0x49, 0x16, 0x48, - 0x00, 0xf0, 0x36, 0xfb, 0x15, 0x4d, 0x03, 0x26, 0x01, 0x24, 0x28, 0x1c, - 0x14, 0x49, 0x00, 0xf0, 0x2f, 0xfb, 0x39, 0x1c, 0x00, 0x96, 0x23, 0x1c, - 0x01, 0x94, 0x00, 0x22, 0x11, 0x48, 0x00, 0xf0, 0xb9, 0xfc, 0x00, 0x96, - 0x29, 0x1c, 0x01, 0x94, 0x1f, 0x22, 0x1e, 0x23, 0x0e, 0x48, 0x00, 0xf0, - 0xb1, 0xfc, 0xf7, 0xbd, 0x4c, 0x08, 0x00, 0x20, 0x00, 0x08, 0x00, 0x42, - 0x00, 0x0c, 0x00, 0x42, 0x50, 0x08, 0x00, 0x20, 0x00, 0x10, 0x00, 0x42, - 0x54, 0x08, 0x00, 0x20, 0x00, 0x14, 0x00, 0x42, 0x48, 0x08, 0x00, 0x20, - 0x00, 0x18, 0x00, 0x42, 0x58, 0x08, 0x00, 0x20, 0x5c, 0x08, 0x00, 0x20, - 0x00, 0x1c, 0x00, 0x42, 0xe8, 0x07, 0x00, 0x20, 0x88, 0x07, 0x00, 0x20, - 0xfe, 0xe7, 0x00, 0x00, 0x08, 0xb5, 0x03, 0x4b, 0x1b, 0x68, 0x00, 0x2b, - 0x00, 0xd0, 0x98, 0x47, 0x08, 0xbd, 0xc0, 0x46, 0x60, 0x08, 0x00, 0x20, - 0x38, 0xb5, 0x0f, 0x49, 0x0f, 0x4c, 0xa1, 0x42, 0x04, 0xd1, 0x00, 0xf0, - 0x4f, 0xf8, 0xfe, 0xf7, 0xb9, 0xfa, 0x0b, 0xe0, 0x0c, 0x4d, 0x8d, 0x42, - 0xf7, 0xd0, 0x00, 0x23, 0xca, 0x18, 0xe8, 0x18, 0xa2, 0x42, 0x04, 0xd2, - 0x00, 0x68, 0x04, 0x33, 0x10, 0x60, 0xf7, 0xe7, 0xfe, 0xe7, 0x90, 0x42, - 0xeb, 0xd0, 0x06, 0x4b, 0x06, 0x4a, 0x93, 0x42, 0xe7, 0xd2, 0x00, 0x22, - 0x04, 0xc3, 0xf9, 0xe7, 0x00, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x00, 0x20, - 0xd8, 0x54, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x20, 0x78, 0x08, 0x00, 0x20, - 0x08, 0xb5, 0x00, 0xf0, 0x26, 0xf8, 0x00, 0x28, 0x01, 0xd1, 0x00, 0xf0, - 0x17, 0xf8, 0x08, 0xbd, 0x01, 0x4b, 0x18, 0x68, 0x70, 0x47, 0xc0, 0x46, - 0x64, 0x08, 0x00, 0x20, 0x70, 0xb5, 0x04, 0x1e, 0x08, 0xd0, 0x05, 0x4b, - 0x1d, 0x68, 0x1e, 0x1c, 0x00, 0xf0, 0x12, 0xf8, 0x33, 0x68, 0x5b, 0x1b, - 0xa3, 0x42, 0xf9, 0xd3, 0x70, 0xbd, 0xc0, 0x46, 0x64, 0x08, 0x00, 0x20, - 0x08, 0xb5, 0x03, 0x4b, 0x1a, 0x68, 0x01, 0x32, 0x1a, 0x60, 0x00, 0xf0, - 0x6d, 0xfa, 0x08, 0xbd, 0x64, 0x08, 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, - 0x70, 0x47, 0x00, 0x00, 0x70, 0xb5, 0x4c, 0x4a, 0x1e, 0x21, 0x53, 0x68, - 0x02, 0x20, 0x8b, 0x43, 0x03, 0x43, 0x4a, 0x49, 0x53, 0x60, 0x8b, 0x69, - 0x08, 0x24, 0x23, 0x43, 0x8b, 0x61, 0x48, 0x4c, 0x48, 0x4b, 0x9c, 0x82, - 0x9c, 0x8a, 0x20, 0x43, 0x98, 0x82, 0x10, 0x1c, 0xda, 0x68, 0x94, 0x07, - 0xfc, 0xd5, 0x45, 0x4a, 0x01, 0x24, 0x14, 0x70, 0x14, 0x78, 0xe5, 0x07, - 0x04, 0xd5, 0x42, 0x4c, 0x64, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xf7, 0xdb, - 0x01, 0x24, 0x94, 0x60, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, - 0x3d, 0x4d, 0x3c, 0x4c, 0x65, 0x60, 0x54, 0x78, 0x64, 0xb2, 0x00, 0x2c, - 0xfb, 0xdb, 0x82, 0x25, 0x38, 0x4c, 0xed, 0x01, 0x65, 0x80, 0x54, 0x78, - 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, 0x9c, 0x8c, 0x80, 0x25, 0xac, 0x43, - 0x9c, 0x84, 0xdc, 0x68, 0xe6, 0x06, 0xfc, 0xd5, 0x33, 0x4d, 0x30, 0x4c, - 0xe5, 0x62, 0xdd, 0x68, 0x2e, 0x4c, 0xee, 0x06, 0xfb, 0xd5, 0xa5, 0x8c, - 0x30, 0x4e, 0x35, 0x43, 0xa5, 0x84, 0xdd, 0x68, 0x2a, 0x4c, 0xee, 0x06, - 0xfb, 0xd5, 0xa5, 0x8c, 0x02, 0x26, 0x35, 0x43, 0xa5, 0x84, 0xdc, 0x68, - 0x25, 0x06, 0xfc, 0xd5, 0x25, 0x4c, 0xe4, 0x68, 0x66, 0x06, 0xf8, 0xd5, - 0xdc, 0x68, 0xe5, 0x06, 0xfc, 0xd5, 0x00, 0x24, 0x94, 0x60, 0x54, 0x78, - 0x64, 0xb2, 0x00, 0x2c, 0xfb, 0xdb, 0x24, 0x4d, 0x1f, 0x4c, 0x65, 0x60, - 0x55, 0x78, 0x1e, 0x4c, 0x6d, 0xb2, 0x00, 0x2d, 0xfa, 0xdb, 0x1e, 0x6a, - 0x20, 0x4d, 0x35, 0x40, 0x80, 0x26, 0x76, 0x00, 0x35, 0x43, 0x1d, 0x62, - 0x1d, 0x6a, 0x80, 0x26, 0xb5, 0x43, 0x1d, 0x62, 0x03, 0x23, 0xa3, 0x60, - 0x1b, 0x4b, 0x63, 0x60, 0x53, 0x78, 0x5b, 0xb2, 0x00, 0x2b, 0xfb, 0xdb, - 0x00, 0x23, 0x0b, 0x72, 0x18, 0x4a, 0x4b, 0x72, 0x8b, 0x72, 0xcb, 0x72, - 0x17, 0x4b, 0xff, 0x21, 0x1a, 0x60, 0x17, 0x4b, 0x17, 0x4a, 0x1b, 0x68, - 0x12, 0x68, 0x5c, 0x01, 0xd2, 0x0e, 0x21, 0x40, 0x11, 0x43, 0x9a, 0x06, - 0x52, 0x0f, 0x12, 0x02, 0x0b, 0x1c, 0x13, 0x43, 0x12, 0x4a, 0x13, 0x85, - 0x43, 0x68, 0x80, 0x22, 0x13, 0x43, 0x43, 0x60, 0x70, 0xbd, 0xc0, 0x46, - 0x00, 0x40, 0x00, 0x41, 0x00, 0x04, 0x00, 0x40, 0x0c, 0x06, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x40, 0x01, 0x05, 0x01, 0x00, - 0xb8, 0x05, 0xff, 0x7d, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, - 0xff, 0xfc, 0xff, 0xff, 0x03, 0x06, 0x01, 0x00, 0x00, 0x6c, 0xdc, 0x02, - 0x04, 0x00, 0x00, 0x20, 0x24, 0x60, 0x80, 0x00, 0x20, 0x60, 0x80, 0x00, - 0x00, 0x40, 0x00, 0x42, 0x31, 0x4b, 0xfa, 0x21, 0x18, 0x68, 0x10, 0xb5, - 0x89, 0x00, 0x00, 0xf0, 0x5f, 0xfc, 0x2f, 0x4b, 0x01, 0x38, 0x98, 0x42, - 0x24, 0xd8, 0x2e, 0x4a, 0x2e, 0x4b, 0x50, 0x60, 0x18, 0x6a, 0xc0, 0x21, - 0x00, 0x02, 0x00, 0x0a, 0x09, 0x06, 0x01, 0x43, 0x19, 0x62, 0x00, 0x24, - 0x07, 0x21, 0x94, 0x60, 0x11, 0x60, 0x19, 0x6a, 0x80, 0x22, 0x09, 0x02, - 0x09, 0x0a, 0x12, 0x06, 0x0a, 0x43, 0x1a, 0x62, 0x25, 0x4b, 0xfc, 0x21, - 0x1a, 0x6a, 0x0a, 0x43, 0x1a, 0x62, 0x19, 0x6a, 0xfc, 0x22, 0x92, 0x01, - 0x0a, 0x43, 0x1a, 0x62, 0x19, 0x6a, 0xa0, 0x22, 0xd2, 0x02, 0x0a, 0x43, - 0x1a, 0x62, 0x00, 0xe0, 0xfe, 0xe7, 0x20, 0x1c, 0x00, 0x21, 0x01, 0x34, - 0x00, 0xf0, 0x70, 0xf8, 0x14, 0x2c, 0xf8, 0xd1, 0x1a, 0x4c, 0x63, 0x78, - 0x5b, 0xb2, 0x00, 0x2b, 0xfa, 0xdb, 0x19, 0x4b, 0x63, 0x80, 0x19, 0x4b, - 0x5a, 0x7e, 0xd2, 0x09, 0x01, 0x2a, 0xfa, 0xd0, 0xe4, 0x22, 0xd2, 0x00, - 0x9a, 0x80, 0x3f, 0x22, 0xda, 0x70, 0x59, 0x7e, 0x13, 0x4a, 0xc9, 0x09, - 0x01, 0x29, 0xfa, 0xd0, 0xc0, 0x23, 0x5b, 0x01, 0x00, 0x20, 0x13, 0x61, - 0x90, 0x70, 0x00, 0xf0, 0x23, 0xf8, 0x63, 0x78, 0x5b, 0xb2, 0x00, 0x2b, - 0xfb, 0xdb, 0x0d, 0x4a, 0x09, 0x4b, 0x5a, 0x80, 0x0c, 0x4b, 0xda, 0x79, - 0xd2, 0x09, 0x01, 0x2a, 0xfa, 0xd0, 0x41, 0x22, 0x5a, 0x70, 0x10, 0xbd, - 0x04, 0x00, 0x00, 0x20, 0xff, 0xff, 0xff, 0x00, 0x10, 0xe0, 0x00, 0xe0, - 0x00, 0xed, 0x00, 0xe0, 0x00, 0x04, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x40, - 0x1e, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x42, 0x21, 0x40, 0x00, 0x00, - 0x00, 0x48, 0x00, 0x42, 0x00, 0xb5, 0x14, 0x4a, 0x51, 0x7e, 0x13, 0x1c, - 0xc9, 0x09, 0x01, 0x29, 0xf9, 0xd0, 0x01, 0x38, 0x04, 0x28, 0x13, 0xd8, - 0x19, 0x69, 0x10, 0x4a, 0x0a, 0x40, 0x1a, 0x61, 0x5a, 0x78, 0x0f, 0x21, - 0x8a, 0x43, 0x00, 0xf0, 0xd1, 0xfb, 0x03, 0x05, 0x09, 0x07, 0x03, 0x00, - 0x01, 0x21, 0x02, 0xe0, 0x03, 0x21, 0x00, 0xe0, 0x02, 0x21, 0x0a, 0x43, - 0x5a, 0x70, 0x0a, 0xe0, 0x11, 0x69, 0xf0, 0x23, 0x1b, 0x05, 0x0b, 0x43, - 0x13, 0x61, 0x53, 0x78, 0x0f, 0x21, 0x8b, 0x43, 0x02, 0x21, 0x0b, 0x43, - 0x53, 0x70, 0x00, 0xbd, 0x00, 0x40, 0x00, 0x42, 0xff, 0xff, 0xff, 0xf0, - 0x10, 0xb5, 0x18, 0x24, 0x02, 0x1c, 0x20, 0x1c, 0x50, 0x43, 0x2a, 0x4b, - 0x18, 0x18, 0x00, 0x7a, 0x40, 0xb2, 0x01, 0x30, 0x4c, 0xd0, 0x03, 0x29, - 0x4a, 0xd8, 0x08, 0x1c, 0x21, 0x1c, 0x00, 0xf0, 0xa5, 0xfb, 0x02, 0x33, - 0x11, 0x21, 0x62, 0x43, 0x98, 0x56, 0x9a, 0x18, 0xc3, 0x01, 0x22, 0x48, - 0x52, 0x68, 0x1b, 0x18, 0x99, 0x18, 0x40, 0x31, 0x02, 0x20, 0x08, 0x70, - 0x01, 0x21, 0x91, 0x40, 0x59, 0x60, 0x35, 0xe0, 0x62, 0x43, 0x98, 0x56, - 0x1b, 0x49, 0x9a, 0x18, 0x52, 0x68, 0xc3, 0x01, 0x5b, 0x18, 0x99, 0x18, - 0x40, 0x31, 0x06, 0x20, 0x08, 0x70, 0x01, 0x21, 0x91, 0x40, 0x59, 0x60, - 0x99, 0x61, 0x25, 0xe0, 0x51, 0x43, 0x5a, 0x56, 0x13, 0x48, 0x59, 0x18, - 0x4b, 0x68, 0xd2, 0x01, 0x11, 0x18, 0xc8, 0x18, 0x40, 0x30, 0x06, 0x24, - 0x04, 0x70, 0x01, 0x20, 0x98, 0x40, 0x48, 0x60, 0x0e, 0x49, 0x52, 0x18, - 0x50, 0x60, 0x13, 0xe0, 0x51, 0x43, 0x5a, 0x56, 0x59, 0x18, 0x0a, 0x4b, - 0x49, 0x68, 0xd2, 0x01, 0xd2, 0x18, 0x53, 0x18, 0x40, 0x33, 0x18, 0x78, - 0x02, 0x24, 0x20, 0x43, 0x18, 0x70, 0x18, 0x78, 0x04, 0x24, 0xa0, 0x43, - 0x18, 0x70, 0x01, 0x23, 0x8b, 0x40, 0x93, 0x60, 0x10, 0xbd, 0xc0, 0x46, - 0x20, 0x50, 0x00, 0x00, 0x00, 0x44, 0x00, 0x41, 0x10, 0x44, 0x00, 0x41, - 0x18, 0x23, 0x58, 0x43, 0x13, 0x4a, 0xf0, 0xb5, 0x13, 0x18, 0x08, 0x24, - 0x1c, 0x57, 0x01, 0x34, 0x1f, 0xd0, 0x82, 0x56, 0x10, 0x4e, 0xd2, 0x01, - 0x5d, 0x68, 0x01, 0x24, 0x90, 0x19, 0x23, 0x1c, 0x86, 0x68, 0xab, 0x40, - 0x1e, 0x42, 0x0b, 0xd1, 0x0e, 0x1c, 0x77, 0x1e, 0xbe, 0x41, 0x40, 0x19, - 0x34, 0x40, 0x40, 0x30, 0xa5, 0x00, 0x04, 0x78, 0x04, 0x26, 0xb4, 0x43, - 0x2c, 0x43, 0x04, 0x70, 0x00, 0x29, 0x03, 0xd1, 0x05, 0x49, 0x52, 0x18, - 0x53, 0x60, 0x02, 0xe0, 0x02, 0x4e, 0x92, 0x19, 0x93, 0x61, 0xf0, 0xbd, - 0x20, 0x50, 0x00, 0x00, 0x00, 0x44, 0x00, 0x41, 0x10, 0x44, 0x00, 0x41, - 0x18, 0x22, 0x42, 0x43, 0xf8, 0xb5, 0x2d, 0x4d, 0x08, 0x24, 0xaa, 0x18, - 0x14, 0x57, 0x03, 0x1c, 0x62, 0x1c, 0x50, 0xd0, 0x48, 0x1c, 0x00, 0x24, - 0x0c, 0x28, 0x4c, 0xd8, 0x00, 0xf0, 0x16, 0xfb, 0x07, 0x1e, 0x1e, 0x1e, - 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x01, 0x24, - 0x64, 0x42, 0x40, 0xe0, 0x09, 0x29, 0x02, 0xd1, 0x18, 0x1c, 0x00, 0x21, - 0x03, 0xe0, 0x0a, 0x29, 0x04, 0xd1, 0x18, 0x1c, 0x02, 0x21, 0xff, 0xf7, - 0x4b, 0xff, 0x23, 0xe0, 0x00, 0x24, 0x0b, 0x29, 0x31, 0xd1, 0x18, 0x1c, - 0x01, 0x21, 0xff, 0xf7, 0x43, 0xff, 0x2c, 0xe0, 0x18, 0x22, 0x53, 0x43, - 0xea, 0x18, 0x52, 0x68, 0xeb, 0x56, 0x01, 0x20, 0x14, 0x1c, 0x04, 0x40, - 0x55, 0x08, 0xdb, 0x01, 0x00, 0x2c, 0x11, 0xd0, 0x12, 0x4c, 0x1b, 0x19, - 0x5d, 0x19, 0x30, 0x35, 0x2e, 0x78, 0x0c, 0x01, 0x0f, 0x21, 0x31, 0x40, - 0x21, 0x43, 0x9a, 0x18, 0xc9, 0xb2, 0x29, 0x70, 0x40, 0x32, 0x13, 0x78, - 0x18, 0x43, 0x10, 0x70, 0x00, 0x24, 0x0e, 0xe0, 0x09, 0x4e, 0x0f, 0x27, - 0x9b, 0x19, 0x5d, 0x19, 0x30, 0x35, 0x2e, 0x78, 0x9a, 0x18, 0xbe, 0x43, - 0x31, 0x43, 0xc9, 0xb2, 0x29, 0x70, 0x40, 0x32, 0x13, 0x78, 0x18, 0x43, - 0x10, 0x70, 0x20, 0x1c, 0xf8, 0xbd, 0xc0, 0x46, 0x20, 0x50, 0x00, 0x00, - 0x00, 0x44, 0x00, 0x41, 0xf7, 0xb5, 0x8a, 0x18, 0x06, 0x1c, 0x0d, 0x1c, - 0x01, 0x92, 0x0c, 0x1c, 0x01, 0x9b, 0x67, 0x1b, 0x9c, 0x42, 0x07, 0xd0, - 0x33, 0x68, 0x21, 0x78, 0x1b, 0x68, 0x30, 0x1c, 0x98, 0x47, 0x01, 0x34, - 0x00, 0x28, 0xf3, 0xd1, 0x38, 0x1c, 0xfe, 0xbd, 0x15, 0x4a, 0x13, 0x68, - 0x58, 0x1c, 0x25, 0xd0, 0x01, 0x3b, 0x13, 0x60, 0x00, 0x2b, 0x21, 0xd1, - 0x72, 0xb6, 0x12, 0x4a, 0x12, 0x4b, 0x04, 0x32, 0x9a, 0x42, 0x07, 0xd8, - 0xbf, 0xf3, 0x4f, 0x8f, 0x10, 0x4a, 0x11, 0x4b, 0xda, 0x60, 0xbf, 0xf3, - 0x4f, 0x8f, 0x11, 0xe0, 0x0f, 0x4b, 0x19, 0x7d, 0xc8, 0x07, 0xfb, 0xd5, - 0x18, 0x8b, 0x20, 0x21, 0xff, 0x31, 0x92, 0x08, 0x52, 0x00, 0x01, 0x43, - 0x19, 0x83, 0xda, 0x61, 0x0a, 0x4a, 0x1a, 0x80, 0x1a, 0x7d, 0xd1, 0x07, - 0xfc, 0xd5, 0xe5, 0xe7, 0xc0, 0x46, 0xfd, 0xe7, 0x70, 0x47, 0xc0, 0x46, - 0x08, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, - 0x04, 0x00, 0xfa, 0x05, 0x00, 0xed, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x41, - 0x02, 0xa5, 0xff, 0xff, 0x01, 0x60, 0x70, 0x47, 0xf7, 0xb5, 0x08, 0xac, - 0x26, 0x78, 0x04, 0x68, 0x9d, 0x1e, 0x27, 0x68, 0x6c, 0x1e, 0xa5, 0x41, - 0xec, 0xb2, 0x92, 0x07, 0x05, 0x68, 0x3a, 0x43, 0x27, 0x06, 0x3a, 0x43, - 0x2a, 0x60, 0x02, 0x68, 0x07, 0x25, 0x29, 0x40, 0x50, 0x68, 0xb5, 0x01, - 0x00, 0x2c, 0x00, 0xd0, 0x5c, 0x03, 0x29, 0x43, 0x01, 0x43, 0x0c, 0x43, - 0x54, 0x60, 0xf7, 0xbd, 0x30, 0xb5, 0x03, 0x68, 0xc0, 0x25, 0x1c, 0x68, - 0xad, 0x03, 0x12, 0x05, 0x2a, 0x40, 0x22, 0x43, 0xc0, 0x24, 0xa4, 0x02, - 0x09, 0x04, 0x21, 0x40, 0x11, 0x43, 0x19, 0x60, 0x03, 0x68, 0x5a, 0x68, - 0x14, 0x43, 0x5c, 0x60, 0x30, 0xbd, 0x03, 0x68, 0x01, 0x21, 0x1a, 0x68, - 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, 0x11, 0x68, 0x01, 0x23, 0x19, 0x42, - 0xfb, 0xd1, 0xd1, 0x69, 0x19, 0x42, 0xf8, 0xd1, 0x70, 0x47, 0x03, 0x68, - 0x02, 0x21, 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, 0xd3, 0x69, - 0x99, 0x07, 0xfc, 0xd4, 0x70, 0x47, 0x03, 0x68, 0x1a, 0x7e, 0xd1, 0x07, - 0x02, 0xd4, 0x1a, 0x7e, 0x91, 0x07, 0xfc, 0xd5, 0x70, 0x47, 0x03, 0x68, - 0x00, 0x22, 0x5a, 0x83, 0x70, 0x47, 0x03, 0x68, 0x18, 0x7e, 0x40, 0x07, - 0xc0, 0x0f, 0x70, 0x47, 0x03, 0x68, 0x18, 0x7e, 0xc0, 0x09, 0x70, 0x47, - 0x03, 0x68, 0x80, 0x22, 0x19, 0x7e, 0x52, 0x42, 0x0a, 0x43, 0x1a, 0x76, - 0x70, 0x47, 0x03, 0x68, 0x18, 0x8d, 0xc0, 0xb2, 0x70, 0x47, 0x03, 0x68, - 0x1a, 0x7e, 0x01, 0x20, 0x02, 0x42, 0xfb, 0xd0, 0x19, 0x85, 0x70, 0x47, - 0x70, 0xb5, 0x03, 0x68, 0x01, 0x26, 0x8d, 0x07, 0xed, 0x0f, 0x31, 0x40, - 0x1c, 0x68, 0x6d, 0x07, 0x09, 0x07, 0x29, 0x43, 0x21, 0x43, 0x19, 0x60, - 0x04, 0x68, 0x51, 0x00, 0x03, 0x48, 0x00, 0xf0, 0xff, 0xf9, 0x01, 0x38, - 0xc0, 0xb2, 0x20, 0x73, 0x70, 0xbd, 0xc0, 0x46, 0x00, 0x6c, 0xdc, 0x02, - 0x03, 0x68, 0x01, 0x21, 0x1a, 0x68, 0x0a, 0x43, 0x1a, 0x60, 0x02, 0x68, - 0x11, 0x68, 0x01, 0x23, 0x19, 0x42, 0xfb, 0xd1, 0xd1, 0x69, 0x19, 0x42, - 0xf8, 0xd1, 0x70, 0x47, 0x03, 0x68, 0x02, 0x21, 0x1a, 0x68, 0x0a, 0x43, - 0x1a, 0x60, 0x02, 0x68, 0xd3, 0x69, 0x99, 0x07, 0xfc, 0xd4, 0x70, 0x47, - 0x03, 0x68, 0xda, 0x69, 0x91, 0x07, 0xfc, 0xd4, 0x1a, 0x68, 0x02, 0x21, - 0x8a, 0x43, 0x1a, 0x60, 0x70, 0x47, 0x03, 0x68, 0x9a, 0x6a, 0x52, 0x0a, - 0x52, 0x02, 0x11, 0x43, 0x99, 0x62, 0x03, 0x68, 0x1a, 0x7e, 0x51, 0x07, - 0xfc, 0xd5, 0x98, 0x6a, 0xc0, 0xb2, 0x70, 0x47, 0x03, 0x68, 0x22, 0x4a, - 0x30, 0xb5, 0x93, 0x42, 0x11, 0xd0, 0x21, 0x4a, 0x93, 0x42, 0x11, 0xd0, - 0x20, 0x4a, 0x93, 0x42, 0x11, 0xd0, 0x20, 0x4a, 0x93, 0x42, 0x11, 0xd0, - 0x1f, 0x4a, 0x93, 0x42, 0x11, 0xd0, 0x1f, 0x4a, 0x93, 0x42, 0x30, 0xd1, - 0x0e, 0x23, 0x19, 0x22, 0x0d, 0xe0, 0x09, 0x23, 0x14, 0x22, 0x0a, 0xe0, - 0x0a, 0x23, 0x15, 0x22, 0x07, 0xe0, 0x0b, 0x23, 0x16, 0x22, 0x04, 0xe0, - 0x0c, 0x23, 0x17, 0x22, 0x01, 0xe0, 0x0d, 0x23, 0x18, 0x22, 0xdc, 0xb2, - 0x15, 0x49, 0x01, 0x20, 0x9b, 0x08, 0xa0, 0x40, 0x9b, 0x00, 0x08, 0x60, - 0x5b, 0x18, 0x03, 0x20, 0xc0, 0x21, 0x89, 0x00, 0x04, 0x40, 0x5d, 0x58, - 0xe0, 0x00, 0xff, 0x24, 0x84, 0x40, 0xa5, 0x43, 0x2c, 0x1c, 0xc0, 0x25, - 0x85, 0x40, 0x28, 0x1c, 0x20, 0x43, 0x58, 0x50, 0x80, 0x23, 0xdb, 0x01, - 0x1a, 0x43, 0x0a, 0x4b, 0x5a, 0x80, 0x5a, 0x78, 0x52, 0xb2, 0x00, 0x2a, - 0xfb, 0xdb, 0x30, 0xbd, 0x00, 0x08, 0x00, 0x42, 0x00, 0x0c, 0x00, 0x42, - 0x00, 0x10, 0x00, 0x42, 0x00, 0x14, 0x00, 0x42, 0x00, 0x18, 0x00, 0x42, - 0x00, 0x1c, 0x00, 0x42, 0x00, 0xe1, 0x00, 0xe0, 0x00, 0x0c, 0x00, 0x40, - 0xf8, 0xb5, 0x04, 0x1c, 0x15, 0x1c, 0x0e, 0x1c, 0x1f, 0x1c, 0xff, 0xf7, - 0xa3, 0xff, 0x20, 0x1c, 0xff, 0xf7, 0x1b, 0xff, 0xb1, 0x00, 0x1c, 0x22, - 0x0a, 0x40, 0x69, 0x07, 0x23, 0x68, 0x09, 0x0c, 0x0a, 0x43, 0x1a, 0x60, - 0x22, 0x68, 0x84, 0x23, 0x93, 0x75, 0x01, 0x2e, 0x1a, 0xd1, 0x08, 0x21, - 0x01, 0x2d, 0x00, 0xd1, 0x10, 0x21, 0x0c, 0x4b, 0x79, 0x43, 0x18, 0x68, - 0xc0, 0x00, 0x00, 0xf0, 0x53, 0xf9, 0x23, 0x68, 0x07, 0x21, 0x9a, 0x89, - 0x01, 0x40, 0xd2, 0x04, 0x49, 0x03, 0xd2, 0x0c, 0x0a, 0x43, 0x9a, 0x81, - 0x23, 0x68, 0x00, 0x04, 0xc2, 0x0c, 0x98, 0x89, 0x40, 0x0b, 0x40, 0x03, - 0x10, 0x43, 0x98, 0x81, 0xf8, 0xbd, 0xc0, 0x46, 0x04, 0x00, 0x00, 0x20, - 0xf7, 0xb5, 0x01, 0x93, 0x08, 0xab, 0x04, 0x1c, 0x1f, 0x78, 0x0d, 0x1c, - 0x16, 0x1c, 0xff, 0xf7, 0x3d, 0xff, 0x20, 0x1c, 0xff, 0xf7, 0x68, 0xff, - 0xbf, 0x07, 0x0c, 0x22, 0x17, 0x43, 0xc0, 0x22, 0x92, 0x03, 0x36, 0x05, - 0x16, 0x40, 0xc0, 0x22, 0x92, 0x02, 0x2d, 0x04, 0x23, 0x68, 0x3e, 0x43, - 0x01, 0x99, 0x15, 0x40, 0x35, 0x43, 0x07, 0x22, 0x1d, 0x60, 0x0a, 0x40, - 0x80, 0x21, 0x23, 0x68, 0x89, 0x02, 0x0a, 0x43, 0x5a, 0x60, 0xf7, 0xbd, - 0x01, 0x20, 0x70, 0x47, 0x08, 0xb5, 0x03, 0x68, 0x13, 0x22, 0xdb, 0x69, - 0x98, 0x47, 0x08, 0xbd, 0x10, 0xb5, 0x04, 0x1c, 0x00, 0x69, 0xff, 0xf7, - 0xbe, 0xfe, 0x20, 0x1c, 0x14, 0x30, 0x00, 0xf0, 0xdd, 0xf8, 0x10, 0xbd, - 0x08, 0xb5, 0x00, 0x69, 0xff, 0xf7, 0xcd, 0xfe, 0x08, 0xbd, 0x08, 0xb5, - 0x14, 0x30, 0x00, 0xf0, 0xe5, 0xf8, 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, - 0x00, 0xf0, 0xe6, 0xf8, 0x08, 0xbd, 0x08, 0xb5, 0x14, 0x30, 0x00, 0xf0, - 0xcd, 0xf8, 0x08, 0xbd, 0x08, 0xb5, 0x00, 0x69, 0xff, 0xf7, 0xd9, 0xfe, - 0x01, 0x20, 0x08, 0xbd, 0xf7, 0xb5, 0x1d, 0x1c, 0x08, 0xab, 0x1b, 0x78, - 0x04, 0x1c, 0x00, 0x93, 0x09, 0xab, 0x1b, 0x78, 0x16, 0x1c, 0x01, 0x93, - 0x00, 0x23, 0x43, 0x60, 0xfa, 0x23, 0x9b, 0x00, 0x83, 0x60, 0x09, 0x4b, - 0x0f, 0x1c, 0x08, 0x33, 0x03, 0x60, 0x14, 0x30, 0x00, 0xf0, 0x96, 0xf8, - 0x00, 0x9a, 0x23, 0x1c, 0x5c, 0x33, 0x27, 0x61, 0x9a, 0x70, 0x01, 0x9a, - 0x1e, 0x70, 0x5d, 0x70, 0x20, 0x1c, 0xda, 0x70, 0xfe, 0xbd, 0xc0, 0x46, - 0x40, 0x54, 0x00, 0x00, 0x10, 0xb5, 0x04, 0x1c, 0x00, 0x69, 0xff, 0xf7, - 0x9a, 0xfe, 0x00, 0x28, 0x07, 0xd0, 0x20, 0x69, 0xff, 0xf7, 0xa5, 0xfe, - 0x01, 0x1c, 0x20, 0x1c, 0x14, 0x30, 0x00, 0xf0, 0x84, 0xf8, 0x20, 0x69, - 0xff, 0xf7, 0x92, 0xfe, 0x00, 0x28, 0x05, 0xd0, 0x20, 0x69, 0xff, 0xf7, - 0x91, 0xfe, 0x20, 0x69, 0xff, 0xf7, 0x81, 0xfe, 0x10, 0xbd, 0xf0, 0x23, - 0x08, 0x1c, 0x18, 0x40, 0x30, 0x38, 0x43, 0x42, 0x58, 0x41, 0x70, 0x47, - 0xf0, 0x23, 0x1b, 0x01, 0x19, 0x40, 0x80, 0x23, 0x9b, 0x00, 0x99, 0x42, - 0x0c, 0xd0, 0xc0, 0x23, 0x9b, 0x00, 0x99, 0x42, 0x06, 0xd0, 0x80, 0x23, - 0x5b, 0x00, 0x05, 0x20, 0x99, 0x42, 0x04, 0xd0, 0x00, 0x20, 0x02, 0xe0, - 0x07, 0x20, 0x00, 0xe0, 0x06, 0x20, 0x70, 0x47, 0x0f, 0x23, 0x19, 0x40, - 0x01, 0x29, 0x05, 0xd0, 0x02, 0x39, 0x4b, 0x42, 0x4b, 0x41, 0x02, 0x20, - 0xc0, 0x1a, 0x00, 0xe0, 0x00, 0x20, 0x70, 0x47, 0xf0, 0xb5, 0x03, 0x1c, - 0x85, 0xb0, 0x03, 0x91, 0x5c, 0x33, 0x04, 0x1c, 0x18, 0x27, 0x18, 0x78, - 0x3b, 0x1c, 0x43, 0x43, 0x1b, 0x4e, 0x08, 0x21, 0xf3, 0x18, 0x59, 0x56, - 0x15, 0x1c, 0xff, 0xf7, 0x45, 0xfd, 0x23, 0x1c, 0x5d, 0x33, 0x18, 0x78, - 0x08, 0x21, 0x47, 0x43, 0xf6, 0x19, 0x71, 0x56, 0xff, 0xf7, 0x3c, 0xfd, - 0x01, 0x21, 0x0a, 0x1c, 0x03, 0x9b, 0x20, 0x69, 0xff, 0xf7, 0xf2, 0xfe, - 0x29, 0x1c, 0x20, 0x1c, 0xff, 0xf7, 0xba, 0xff, 0x29, 0x1c, 0x07, 0x1c, - 0x20, 0x1c, 0xff, 0xf7, 0xcb, 0xff, 0x29, 0x1c, 0x06, 0x1c, 0x20, 0x1c, - 0xff, 0xf7, 0xa9, 0xff, 0x39, 0x1c, 0x00, 0x90, 0x33, 0x1c, 0x20, 0x69, - 0x01, 0x22, 0xff, 0xf7, 0xd3, 0xfd, 0x23, 0x1c, 0x5f, 0x33, 0x19, 0x78, - 0x01, 0x3b, 0x1a, 0x78, 0x20, 0x69, 0xff, 0xf7, 0xe7, 0xfd, 0x20, 0x69, - 0xff, 0xf7, 0x05, 0xfe, 0x05, 0xb0, 0xf0, 0xbd, 0x20, 0x50, 0x00, 0x00, - 0x10, 0xb5, 0x00, 0x21, 0x40, 0x22, 0x04, 0x1c, 0x00, 0xf0, 0xde, 0xf8, - 0x00, 0x23, 0x20, 0x1c, 0x23, 0x64, 0x63, 0x64, 0x10, 0xbd, 0x02, 0x6c, - 0x10, 0xb5, 0x3f, 0x23, 0x54, 0x1c, 0x23, 0x40, 0x44, 0x6c, 0xa3, 0x42, - 0x01, 0xd0, 0x81, 0x54, 0x03, 0x64, 0x10, 0xbd, 0x00, 0x23, 0x03, 0x64, - 0x43, 0x64, 0x70, 0x47, 0x43, 0x6c, 0x02, 0x6c, 0x93, 0x42, 0x06, 0xd0, - 0xc2, 0x5c, 0x3f, 0x21, 0x01, 0x33, 0x0b, 0x40, 0x43, 0x64, 0x10, 0x1c, - 0x01, 0xe0, 0x01, 0x20, 0x40, 0x42, 0x70, 0x47, 0x02, 0x6c, 0x43, 0x6c, - 0xd0, 0x1a, 0x00, 0xd5, 0x40, 0x30, 0x70, 0x47, 0x43, 0x6c, 0x02, 0x6c, - 0x93, 0x42, 0x01, 0xd0, 0xc0, 0x5c, 0x01, 0xe0, 0x01, 0x20, 0x40, 0x42, - 0x70, 0x47, 0x00, 0x00, 0x02, 0xb4, 0x71, 0x46, 0x49, 0x08, 0x49, 0x00, - 0x09, 0x5c, 0x49, 0x00, 0x8e, 0x44, 0x02, 0xbc, 0x70, 0x47, 0xc0, 0x46, - 0x00, 0x29, 0x34, 0xd0, 0x01, 0x23, 0x00, 0x22, 0x10, 0xb4, 0x88, 0x42, - 0x2c, 0xd3, 0x01, 0x24, 0x24, 0x07, 0xa1, 0x42, 0x04, 0xd2, 0x81, 0x42, - 0x02, 0xd2, 0x09, 0x01, 0x1b, 0x01, 0xf8, 0xe7, 0xe4, 0x00, 0xa1, 0x42, - 0x04, 0xd2, 0x81, 0x42, 0x02, 0xd2, 0x49, 0x00, 0x5b, 0x00, 0xf8, 0xe7, - 0x88, 0x42, 0x01, 0xd3, 0x40, 0x1a, 0x1a, 0x43, 0x4c, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0x5c, 0x08, 0x22, 0x43, 0x8c, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0x9c, 0x08, 0x22, 0x43, 0xcc, 0x08, 0xa0, 0x42, - 0x02, 0xd3, 0x00, 0x1b, 0xdc, 0x08, 0x22, 0x43, 0x00, 0x28, 0x03, 0xd0, - 0x1b, 0x09, 0x01, 0xd0, 0x09, 0x09, 0xe3, 0xe7, 0x10, 0x1c, 0x10, 0xbc, - 0x70, 0x47, 0x00, 0x28, 0x01, 0xd0, 0x00, 0x20, 0xc0, 0x43, 0x07, 0xb4, - 0x02, 0x48, 0x02, 0xa1, 0x40, 0x18, 0x02, 0x90, 0x03, 0xbd, 0xc0, 0x46, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x29, 0xf0, 0xd0, 0x03, 0xb5, 0xff, 0xf7, - 0xb9, 0xff, 0x0e, 0xbc, 0x42, 0x43, 0x89, 0x1a, 0x18, 0x47, 0xc0, 0x46, - 0x70, 0x47, 0xc0, 0x46, 0x70, 0xb5, 0x0e, 0x4b, 0x0e, 0x4d, 0x00, 0x24, - 0xed, 0x1a, 0xad, 0x10, 0x1e, 0x1c, 0xac, 0x42, 0x04, 0xd0, 0xa3, 0x00, - 0xf3, 0x58, 0x98, 0x47, 0x01, 0x34, 0xf8, 0xe7, 0x00, 0xf0, 0x32, 0xf9, - 0x08, 0x4b, 0x09, 0x4d, 0x00, 0x24, 0xed, 0x1a, 0xad, 0x10, 0x1e, 0x1c, - 0xac, 0x42, 0x04, 0xd0, 0xa3, 0x00, 0xf3, 0x58, 0x98, 0x47, 0x01, 0x34, - 0xf8, 0xe7, 0x70, 0xbd, 0x70, 0x00, 0x00, 0x20, 0x70, 0x00, 0x00, 0x20, - 0x70, 0x00, 0x00, 0x20, 0x8c, 0x00, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, - 0x01, 0x1c, 0x18, 0x68, 0x00, 0xf0, 0x76, 0xf8, 0x08, 0xbd, 0xc0, 0x46, - 0x6c, 0x00, 0x00, 0x20, 0x08, 0xb5, 0x03, 0x4b, 0x01, 0x1c, 0x18, 0x68, - 0x00, 0xf0, 0x24, 0xf8, 0x08, 0xbd, 0xc0, 0x46, 0x6c, 0x00, 0x00, 0x20, - 0x30, 0xb5, 0x00, 0x23, 0x93, 0x42, 0x08, 0xd0, 0xc5, 0x5c, 0x01, 0x33, - 0xcc, 0x18, 0x01, 0x3c, 0x24, 0x78, 0xa5, 0x42, 0xf6, 0xd0, 0x28, 0x1b, - 0x00, 0xe0, 0x00, 0x20, 0x30, 0xbd, 0x10, 0xb5, 0x00, 0x23, 0x93, 0x42, - 0x03, 0xd0, 0xcc, 0x5c, 0xc4, 0x54, 0x01, 0x33, 0xf9, 0xe7, 0x10, 0xbd, - 0x03, 0x1c, 0x82, 0x18, 0x93, 0x42, 0x02, 0xd0, 0x19, 0x70, 0x01, 0x33, - 0xfa, 0xe7, 0x70, 0x47, 0x30, 0xb5, 0x00, 0x29, 0x40, 0xd0, 0x04, 0x39, - 0x0b, 0x68, 0x00, 0x2b, 0x00, 0xda, 0xc9, 0x18, 0x1e, 0x4a, 0x13, 0x68, - 0x14, 0x1c, 0x00, 0x2b, 0x02, 0xd1, 0x4b, 0x60, 0x11, 0x60, 0x33, 0xe0, - 0x99, 0x42, 0x0f, 0xd2, 0x08, 0x68, 0x0a, 0x18, 0x9a, 0x42, 0x05, 0xd1, - 0x13, 0x68, 0x52, 0x68, 0xc0, 0x18, 0x08, 0x60, 0x4a, 0x60, 0x00, 0xe0, - 0x4b, 0x60, 0x21, 0x60, 0x24, 0xe0, 0x8a, 0x42, 0x03, 0xd8, 0x13, 0x1c, - 0x5a, 0x68, 0x00, 0x2a, 0xf9, 0xd1, 0x1d, 0x68, 0x5c, 0x19, 0x8c, 0x42, - 0x0b, 0xd1, 0x09, 0x68, 0x69, 0x18, 0x58, 0x18, 0x19, 0x60, 0x90, 0x42, - 0x14, 0xd1, 0x14, 0x68, 0x52, 0x68, 0x09, 0x19, 0x19, 0x60, 0x5a, 0x60, - 0x0e, 0xe0, 0x8c, 0x42, 0x02, 0xd9, 0x0c, 0x23, 0x03, 0x60, 0x09, 0xe0, - 0x08, 0x68, 0x0c, 0x18, 0x94, 0x42, 0x03, 0xd1, 0x14, 0x68, 0x52, 0x68, - 0x00, 0x19, 0x08, 0x60, 0x4a, 0x60, 0x59, 0x60, 0x30, 0xbd, 0xc0, 0x46, - 0x6c, 0x08, 0x00, 0x20, 0x70, 0xb5, 0x03, 0x23, 0xcd, 0x1c, 0x9d, 0x43, - 0x08, 0x35, 0x06, 0x1c, 0x0c, 0x2d, 0x01, 0xd2, 0x0c, 0x25, 0x01, 0xe0, - 0x00, 0x2d, 0x3f, 0xdb, 0x8d, 0x42, 0x3d, 0xd3, 0x20, 0x4b, 0x1c, 0x68, - 0x1a, 0x1c, 0x21, 0x1c, 0x00, 0x29, 0x13, 0xd0, 0x08, 0x68, 0x43, 0x1b, - 0x0d, 0xd4, 0x0b, 0x2b, 0x02, 0xd9, 0x0b, 0x60, 0xcc, 0x18, 0x1e, 0xe0, - 0x8c, 0x42, 0x02, 0xd1, 0x63, 0x68, 0x13, 0x60, 0x1a, 0xe0, 0x48, 0x68, - 0x60, 0x60, 0x0c, 0x1c, 0x16, 0xe0, 0x0c, 0x1c, 0x49, 0x68, 0xe9, 0xe7, - 0x14, 0x4c, 0x20, 0x68, 0x00, 0x28, 0x03, 0xd1, 0x30, 0x1c, 0x00, 0xf0, - 0x25, 0xf8, 0x20, 0x60, 0x30, 0x1c, 0x29, 0x1c, 0x00, 0xf0, 0x20, 0xf8, - 0x43, 0x1c, 0x15, 0xd0, 0xc4, 0x1c, 0x03, 0x23, 0x9c, 0x43, 0x84, 0x42, - 0x0a, 0xd1, 0x25, 0x60, 0x20, 0x1c, 0x0b, 0x30, 0x07, 0x22, 0x23, 0x1d, - 0x90, 0x43, 0xc3, 0x1a, 0x0b, 0xd0, 0x5a, 0x42, 0xe2, 0x50, 0x08, 0xe0, - 0x21, 0x1a, 0x30, 0x1c, 0x00, 0xf0, 0x0a, 0xf8, 0x01, 0x30, 0xee, 0xd1, - 0x0c, 0x23, 0x33, 0x60, 0x00, 0x20, 0x70, 0xbd, 0x6c, 0x08, 0x00, 0x20, - 0x68, 0x08, 0x00, 0x20, 0x38, 0xb5, 0x07, 0x4c, 0x00, 0x23, 0x05, 0x1c, - 0x08, 0x1c, 0x23, 0x60, 0x00, 0xf0, 0x2a, 0xf8, 0x43, 0x1c, 0x03, 0xd1, - 0x23, 0x68, 0x00, 0x2b, 0x00, 0xd0, 0x2b, 0x60, 0x38, 0xbd, 0xc0, 0x46, - 0x74, 0x08, 0x00, 0x20, 0xc9, 0xb2, 0x03, 0x78, 0x00, 0x2b, 0x03, 0xd0, - 0x8b, 0x42, 0x04, 0xd0, 0x01, 0x30, 0xf8, 0xe7, 0x00, 0x29, 0x00, 0xd0, - 0x18, 0x1c, 0x70, 0x47, 0x30, 0xb5, 0x03, 0x1c, 0x00, 0x2a, 0x07, 0xd0, - 0x0c, 0x78, 0x01, 0x33, 0x5d, 0x1e, 0x01, 0x3a, 0x2c, 0x70, 0x01, 0x31, - 0x00, 0x2c, 0xf5, 0xd1, 0x9a, 0x18, 0x93, 0x42, 0x03, 0xd0, 0x00, 0x21, - 0x19, 0x70, 0x01, 0x33, 0xf9, 0xe7, 0x30, 0xbd, 0x09, 0x4a, 0x13, 0x68, - 0x00, 0x2b, 0x0c, 0xd0, 0x18, 0x18, 0x69, 0x46, 0x88, 0x42, 0x02, 0xd8, - 0x10, 0x60, 0x18, 0x1c, 0x70, 0x47, 0x05, 0x4b, 0x0c, 0x22, 0x01, 0x20, - 0x1a, 0x60, 0x40, 0x42, 0xf8, 0xe7, 0x03, 0x4b, 0x13, 0x60, 0xef, 0xe7, - 0x70, 0x08, 0x00, 0x20, 0x74, 0x08, 0x00, 0x20, 0x78, 0x08, 0x00, 0x20, - 0xf8, 0xb5, 0xc0, 0x46, 0xf8, 0xbc, 0x08, 0xbc, 0x9e, 0x46, 0x70, 0x47, - 0xf8, 0xb5, 0xc0, 0x46, 0xf8, 0xbc, 0x08, 0xbc, 0x9e, 0x46, 0x70, 0x47, - 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x2e, 0x42, 0x49, 0x4e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x19, 0x22, 0x00, 0x00, 0x2d, 0x22, 0x00, 0x00, 0x59, 0x23, 0x00, 0x00, - 0x85, 0x22, 0x00, 0x00, 0x99, 0x22, 0x00, 0x00, 0x57, 0x22, 0x00, 0x00, - 0x2f, 0x00, 0x7c, 0x3c, 0x3e, 0x5e, 0x2b, 0x3d, 0x3f, 0x2f, 0x5b, 0x5d, - 0x3b, 0x2c, 0x2a, 0x22, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x34, 0x00, 0x00, - 0xe1, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x03, 0x01, 0x03, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x03, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x04, 0x00, 0x04, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x04, 0x01, 0x04, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0xff, 0xff, 0xff, 0xff, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0b, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x03, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x01, 0x01, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x14, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x95, 0x44, 0x00, 0x00, 0xe1, 0x40, 0x00, 0x00, - 0x77, 0x44, 0x00, 0x00, 0x8b, 0x44, 0x00, 0x00, 0x81, 0x44, 0x00, 0x00, - 0x6d, 0x44, 0x00, 0x00, 0x4d, 0x44, 0x00, 0x00, 0x71, 0x45, 0x00, 0x00, - 0x59, 0x44, 0x00, 0x00, 0x49, 0x44, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x40, 0x42, 0x0f, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x74, 0x54, 0x00, 0x00, - 0x94, 0x54, 0x00, 0x00, 0xb4, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x70, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x20, 0xdd, 0x20, 0x00, 0x00, - 0x05, 0x22, 0x00, 0x00, 0xe9, 0x26, 0x00, 0x00, 0xb1, 0x2b, 0x00, 0x00, - 0x5d, 0x38, 0x00, 0x00, 0x8d, 0x3a, 0x00, 0x00, 0xe5, 0x3a, 0x00, 0x00, - 0xb5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 From 1a484a9759e9015d1a8b911dd78db22fcf11eea5 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 24 Jun 2017 06:35:18 +0000 Subject: [PATCH 097/124] Improved preprocessor check on missing CMSIS-Atmel --- bootloaders/zero/board_definitions.h | 2 +- bootloaders/zero/board_driver_usb.c | 2 +- bootloaders/zero/board_init.c | 2 +- bootloaders/zero/main.c | 2 +- bootloaders/zero/sam_ba_serial.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bootloaders/zero/board_definitions.h b/bootloaders/zero/board_definitions.h index f2ce2b14c..2657fe30e 100644 --- a/bootloaders/zero/board_definitions.h +++ b/bootloaders/zero/board_definitions.h @@ -108,7 +108,7 @@ #elif (SAML21 || SAMC21) #define BOOT_DOUBLE_TAP_ADDRESS (HSRAM_ADDR + HSRAM_SIZE - 4) #else - #error "board_definitions.h: Unsupported chip" + #error "board_definitions.h: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif #define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS)) diff --git a/bootloaders/zero/board_driver_usb.c b/bootloaders/zero/board_driver_usb.c index 15ee2aec8..ee66620b1 100644 --- a/bootloaders/zero/board_driver_usb.c +++ b/bootloaders/zero/board_driver_usb.c @@ -38,7 +38,7 @@ #elif (SAML21) #define GCM_USB (0x04U) #else - #error "board_driver_usb.c: Unsupported chip" + #error "board_driver_usb.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif diff --git a/bootloaders/zero/board_init.c b/bootloaders/zero/board_init.c index 69237989b..8e5eeefd7 100644 --- a/bootloaders/zero/board_init.c +++ b/bootloaders/zero/board_init.c @@ -43,7 +43,7 @@ extern uint32_t SystemCoreClock; #define GENERIC_CLOCK_MULTIPLEXER_FDPLL (0u) #define GENERIC_CLOCK_MULTIPLEXER_FDPLL96M_32K (1u) #else - #error "startup.c: Unsupported chip" + #error "startup.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif #if (SAMD || SAML21) diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 47acb7bd8..8b0adcb96 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -106,7 +106,7 @@ uint32_t* pulSketch_Start_Address; #elif (SAML21 || SAMC21) if (RSTC->RCAUSE.bit.POR) #else - #error "main.c: Unsupported chip" + #error "main.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif { diff --git a/bootloaders/zero/sam_ba_serial.c b/bootloaders/zero/sam_ba_serial.c index 5e1be8c99..8e87af0f4 100644 --- a/bootloaders/zero/sam_ba_serial.c +++ b/bootloaders/zero/sam_ba_serial.c @@ -70,7 +70,7 @@ void serial_open(void) MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 | MCLK_APBCMASK_SERCOM5 ; #endif #else - #error "sam_ba_serial.c: Unsupported chip" + #error "sam_ba_serial.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif /* Set GCLK_GEN0 as source for GCLK_ID_SERCOMx_CORE */ From b2462aba733d02ce90ffd764e6030bbf8de61366 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 24 Jun 2017 07:03:42 +0000 Subject: [PATCH 098/124] Added bootloader documentation for manually downloading CMSIS-Atmel --- bootloaders/zero/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index ef25211d1..04928d2f1 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -312,8 +312,16 @@ bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R For all builds and platforms you will need to have the Arduino IDE installed as well as the packages for both Arduino SAMD Boards and for MattairTech SAM M0+ Boards, which provides the needed dependencies (CMSIS, CMSIS-Atmel, and the compiler toolchain: arm-none-eabi-gcc), which can be installed using the -Arduino IDE Boards Manager. This project uses a Makefile, which is present in the root (zero) directory. -However, you will need a make program: +Arduino IDE Boards Manager. If you do not wish to install the MattairTech SAM M0+ Boards core, then the +arm-none-eabi-gcc, CMSIS, and openocd packages are included with the stock Arduino SAMD. However, you +will still need to download bossac (see above) and CMSIS-Atmel from MattairTech: + +* https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz + +Then install to ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel (or similar based on your OS) +and rename the folder in CMSIS-Atmel from CMSIS to 1.0.0-mattairtech-1. + +This project uses a Makefile, which is in the root zero directory. However, you will need a make program: #### Windows From 78f25ce9ea30c9d22ba8f92192b5db480be94c81 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Tue, 27 Jun 2017 20:41:41 +0000 Subject: [PATCH 099/124] Fixed BOOT_LOAD_PIN. Fixed Makefile for Windows. Added filename customization. --- bootloaders/zero/Makefile | 53 ++++++++++--------- bootloaders/zero/README.md | 19 ++++++- bootloaders/zero/SDCard/sdBootloader.c | 11 +++- .../board_definitions_Generic_D11C14A.h | 13 +++++ .../board_definitions_Generic_D11D14AM.h | 13 +++++ .../board_definitions_Generic_D11D14AS.h | 13 +++++ .../board_definitions_Generic_x21E.h | 13 +++++ .../board_definitions_Generic_x21G.h | 13 +++++ .../board_definitions_Generic_x21J.h | 13 +++++ .../board_definitions_MT_D11.h | 13 +++++ .../board_definitions_MT_D21E_rev_A.h | 13 +++++ .../board_definitions_MT_D21E_rev_B.h | 13 +++++ .../board_definitions_arduino_m0.h | 13 +++++ .../board_definitions_arduino_m0_pro.h | 13 +++++ .../board_definitions_arduino_mkr1000.h | 13 +++++ .../board_definitions_arduino_mkrzero.h | 13 +++++ .../board_definitions_arduino_zero.h | 13 +++++ .../board_definitions_genuino_mkr1000.h | 13 +++++ .../board_definitions_genuino_zero.h | 13 +++++ bootloaders/zero/main.c | 7 +-- 20 files changed, 264 insertions(+), 34 deletions(-) diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index 7633233b7..621602b6a 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -89,7 +89,7 @@ ifeq ($(OS),Windows_NT) else MODULE_PATH?=$(LOCALAPPDATA)/Arduino15/packages/$(CORE_VENDOR) MODULE_PATH_ARDUINO?=$(LOCALAPPDATA)/Arduino15/packages/arduino - RM=rm + RM=del SEP=\\ endif else @@ -110,8 +110,9 @@ else endif endif +PATHSEP=$(strip $(SEP)) ARM_GCC_PATH?=$(MODULE_PATH_ARDUINO)/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi- -BUILD_PATH=build +BUILD_DIR=build # ----------------------------------------------------------------------------- # Tools @@ -124,7 +125,7 @@ SIZE=$(ARM_GCC_PATH)size # Compiler options # eliminate PARANOIA define to save a tiny amount of code (~40B) CFLAGS_EXTRA=-D$(SDCARD) -D__$(MCU)__ -DBOARD_ID_$(BOARD_ID) -DPARANOIA -CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_PATH)/%.lst) +CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_DIR)/%.lst) ifdef DEBUG CFLAGS+=-g3 -O1 -DDEBUG=1 else @@ -177,8 +178,8 @@ SOURCES= \ sam_ba_serial.c endif -OBJECTS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.o)) -DEPS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.d)) +OBJECTS=$(addprefix $(BUILD_DIR)/, $(SOURCES:.c=.o)) +DEPS=$(addprefix $(BUILD_DIR)/, $(SOURCES:.c=.d)) ifneq "test$(AVRSTUDIO_EXE_PATH)" "test" AS_BUILD=copy_for_atmel_studio @@ -191,34 +192,34 @@ endif all: print_info $(SOURCES) $(BIN) $(HEX) $(AS_BUILD) -$(ELF): Makefile $(BUILD_PATH) $(OBJECTS) +$(ELF): Makefile $(BUILD_DIR) $(OBJECTS) @echo ---------------------------------------------------------- @echo Creating ELF binary - "$(CC)" -L. -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tlinker_scripts/$(LINKER_SCRIPT) -Wl,-Map,"$(BUILD_PATH)/$(NAME).map" -o "$(BUILD_PATH)/$(ELF)" -Wl,--start-group $(OBJECTS) -lm -Wl,--end-group - "$(NM)" "$(BUILD_PATH)/$(ELF)" >"$(BUILD_PATH)/$(NAME)_symbols.txt" - "$(SIZE)" --format=sysv -t -x $(BUILD_PATH)/$(ELF) + "$(CC)" -L. -L$(BUILD_DIR) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tlinker_scripts/$(LINKER_SCRIPT) -Wl,-Map,"$(BUILD_DIR)/$(NAME).map" -o "$(BUILD_DIR)/$(ELF)" -Wl,--start-group $(OBJECTS) -lm -Wl,--end-group + "$(NM)" "$(BUILD_DIR)/$(ELF)" >"$(BUILD_DIR)/$(NAME)_symbols.txt" + "$(SIZE)" --format=sysv -t -x $(BUILD_DIR)/$(ELF) $(BIN): $(ELF) @echo ---------------------------------------------------------- @echo Creating flash binary - "$(OBJCOPY)" -O binary $(BUILD_PATH)/$< $@ + "$(OBJCOPY)" -O binary $(BUILD_DIR)/$< $@ $(HEX): $(ELF) @echo ---------------------------------------------------------- @echo Creating flash binary - "$(OBJCOPY)" -O ihex $(BUILD_PATH)/$< $@ + "$(OBJCOPY)" -O ihex $(BUILD_DIR)/$< $@ -$(BUILD_PATH)/%.o: %.c +$(BUILD_DIR)/%.o: %.c @echo ---------------------------------------------------------- @echo Compiling $< to $@ "$(CC)" $(CFLAGS) $(CFLAGS_EXTRA) $(INCLUDES) $< -o $@ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -$(BUILD_PATH): +$(BUILD_DIR): @echo ---------------------------------------------------------- @echo Creating build folder - -mkdir $(BUILD_PATH) - -mkdir $(BUILD_PATH)/SDCard + -mkdir $(BUILD_DIR) + -mkdir $(BUILD_DIR)$(PATHSEP)SDCard print_info: @echo ---------------------------------------------------------- @@ -234,30 +235,30 @@ print_info: copy_for_atmel_studio: $(BIN) $(HEX) @echo ---------------------------------------------------------- @echo Atmel Studio detected, copying ELF to project root for debug - cp $(BUILD_PATH)/$(ELF) . + cp $(BUILD_DIR)$(PATHSEP)$(ELF) . clean_for_atmel_studio: @echo ---------------------------------------------------------- @echo Atmel Studio detected, cleaning ELF from project root - -$(RM) ./$(ELF) + -$(RM) .$(PATHSEP)$(ELF) clean: $(AS_CLEAN) @echo ---------------------------------------------------------- @echo Cleaning project -$(RM) $(BIN) -$(RM) $(HEX) - -$(RM) $(BUILD_PATH)/SDCard/*.* - -$(RM) $(BUILD_PATH)/*.* - -rmdir $(BUILD_PATH)/SDCard - -rmdir $(BUILD_PATH) + -$(RM) $(BUILD_DIR)$(PATHSEP)SDCard$(PATHSEP)*.* + -$(RM) $(BUILD_DIR)$(PATHSEP)*.* + -rmdir $(BUILD_DIR)$(PATHSEP)SDCard + -rmdir $(BUILD_DIR) mostly_clean: $(AS_CLEAN) @echo ---------------------------------------------------------- @echo Cleaning project except bin -$(RM) $(HEX) - -$(RM) $(BUILD_PATH)/SDCard/*.* - -$(RM) $(BUILD_PATH)/*.* - -rmdir $(BUILD_PATH)/SDCard - -rmdir $(BUILD_PATH) + -$(RM) $(BUILD_DIR)$(PATHSEP)SDCard$(PATHSEP)*.* + -$(RM) $(BUILD_DIR)$(PATHSEP)*.* + -rmdir $(BUILD_DIR)$(PATHSEP)SDCard + -rmdir $(BUILD_DIR) -.phony: print_info $(BUILD_PATH) +.phony: print_info $(BUILD_DIR) diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index 04928d2f1..e89f8d8d4 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -240,7 +240,7 @@ This driver is the same as the one used by the MattairTech SAM M0+ Core. 7. Click Tools->Burn Bootloader. Ignore any messages about not supporting shutdown or reset. 8. Continue with driver installation above. -A running sketch *may* interfere with the bootloader installation process. Be sure you are running the existing bootloader or using a blank chip. +**A running sketch *may* interfere with the bootloader installation process. Be sure you are running the existing bootloader or using a blank chip.** #### Bootloader Installation Using Another Tool (ie: Atmel Studio, openocd) @@ -479,6 +479,17 @@ binary file on the SD card already matches the installed firmware. In this case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. By default, SDCARD_AUTORUN_DISABLED is defined. +### SDCARD_FILENAME_PRIMARY +### SDCARD_FILENAME_SECONDARY + +Two different binary files can be loaded, depending on external pin settings. +By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be +overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. +If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be +loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is +loaded when PIN2 is enabled. If only one pin or no pin is configured, only +SDCARD_FILENAME_PRIMARY is loaded. + ### SAM_BA_INTERFACE Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or @@ -651,6 +662,10 @@ which will produce a binary named sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin ## Technical Details +**TTL Serial** + +The TX and RX pins are defined in the relevant board_definitions_* file. The baud rate is 115200 (8N1). + **Arduino IDE Auto-Reset** When the Arduino IDE initiates the bootloader, the following procedure is used: @@ -700,6 +715,8 @@ of the system stack. The applet in this case is a very simple word copy function applet has its own stack at the top of RAM, but the word copy applet uses little/none of this. The bossac tool is responsible for loading the applet. See Devices.h from the Bossa source. +**A running sketch *may* interfere with the bootloader installation process. Be sure you are running the existing bootloader or using a blank chip.** + ## License diff --git a/bootloaders/zero/SDCard/sdBootloader.c b/bootloaders/zero/SDCard/sdBootloader.c index d7a30f971..892ae8610 100644 --- a/bootloaders/zero/SDCard/sdBootloader.c +++ b/bootloaders/zero/SDCard/sdBootloader.c @@ -22,8 +22,15 @@ FATFS Fatfs; /* Petit-FatFs work area */ BYTE Buff[FLASH_PAGE_SIZE]; /* Page data buffer */ -char updateBin[] = "UPDATE.BIN"; -char update2Bin[] = "UPDATE2.BIN"; +#ifndef SDCARD_FILENAME_PRIMARY +#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +#endif +#ifndef SDCARD_FILENAME_SECONDARY +#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" +#endif + +char updateBin[] = SDCARD_FILENAME_PRIMARY; +char update2Bin[] = SDCARD_FILENAME_SECONDARY; uint8_t sdBootloader (uint8_t mode) { diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_D11C14A.h b/bootloaders/zero/board_definitions/board_definitions_Generic_D11C14A.h index 65ef5b4b9..7eb060274 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_D11C14A.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_D11C14A.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h index 54a560142..8f18962af 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AM.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h index 04eb0e033..8a8fbe01f 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_D11D14AS.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h b/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h index 1ace79979..527ea0bbe 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_x21E.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h b/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h index fc4d47032..5bd156502 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_x21G.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h b/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h index fdb72ae98..16843a4c2 100644 --- a/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h +++ b/bootloaders/zero/board_definitions/board_definitions_Generic_x21J.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_MT_D11.h b/bootloaders/zero/board_definitions/board_definitions_MT_D11.h index 95270cbf6..4fdc40eeb 100644 --- a/bootloaders/zero/board_definitions/board_definitions_MT_D11.h +++ b/bootloaders/zero/board_definitions/board_definitions_MT_D11.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h index caebf81eb..79e728629 100644 --- a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h +++ b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_A.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h index 0cd06538b..9a0ea5571 100644 --- a/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h +++ b/bootloaders/zero/board_definitions/board_definitions_MT_D21E_rev_B.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h b/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h index 97c7ac80b..237e6d7ed 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_m0.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h b/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h index 6a6986b4a..5a87e7ce0 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_m0_pro.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h b/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h index 042544117..72ef64abc 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_mkr1000.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h b/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h index d34d9e71c..0ca6b571c 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_mkrzero.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h b/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h index 219544909..acce186d3 100644 --- a/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h +++ b/bootloaders/zero/board_definitions/board_definitions_arduino_zero.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h b/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h index fd1ed6521..b7f219d01 100644 --- a/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h +++ b/bootloaders/zero/board_definitions/board_definitions_genuino_mkr1000.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h b/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h index a563ff51c..c798ef0bd 100644 --- a/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h +++ b/bootloaders/zero/board_definitions/board_definitions_genuino_zero.h @@ -38,7 +38,9 @@ * makefile (so it can be used with the build_all_bootloaders.sh script). * Size: ~2788B. Disabled by default. Available with 4KB bootloader. */ +#ifndef SDCARD_ENABLED //#define SDCARD_ENABLED +#endif /* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. * When setting SDCARD_SPI_PADx defines, consult the appropriate header file @@ -96,6 +98,17 @@ */ #define SDCARD_AUTORUN_DISABLED +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + /* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 8b0adcb96..427fb2239 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -82,16 +82,13 @@ uint32_t* pulSketch_Start_Address; } #if defined(BOOT_LOAD_PIN_ENABLED) - configPin(BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN, BOOT_LOAD_PIN_CONFIG); + pinConfig(BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN, BOOT_LOAD_PIN_CONFIG); /* Allow time for debouncing capacitor (if using a button) to charge (10ms) */ delayUs(10000UL); // Read the BOOT_LOAD_PIN status - volatile bool boot_en = isPinActive(BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN, BOOT_LOAD_PIN_POLARITY); - - // Check the bootloader enable condition - if (!boot_en) + if (isPinActive(BOOT_LOAD_PIN_PORT, BOOT_LOAD_PIN, BOOT_LOAD_PIN_POLARITY)) { // Stay in bootloader return; From 36654c5ba01191a27456ad862090e2ad0ad06c27 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 6 Jul 2017 02:16:27 +0000 Subject: [PATCH 100/124] Added support for up to 6 SERCOM on the L21E (32-pin). Added two additional timers to the C21E. --- boards.txt | 32 +++-- cores/arduino/USB/samd21_host.c | 2 +- cores/arduino/wiring.c | 11 +- variants/Generic_D11C14A/README.md | 4 +- variants/MT_D11/README.md | 3 +- variants/MT_D11/variant.h | 2 +- variants/MT_D21E/README.md | 3 +- variants/MT_D21E/variant.h | 10 +- variants/MT_D21E_revB/README.md | 69 +++++++++-- variants/MT_D21E_revB/variant.cpp | 182 ++++++++++++++++++++++------- variants/MT_D21E_revB/variant.h | 92 ++++++++++++++- 11 files changed, 337 insertions(+), 73 deletions(-) diff --git a/boards.txt b/boards.txt index 8d71bb7fc..bfda423a2 100644 --- a/boards.txt +++ b/boards.txt @@ -175,10 +175,26 @@ mattairtech_mt_d21e_revb.menu.serial.four_uart=FOUR_UART_NO_WIRE_NO_SPI mattairtech_mt_d21e_revb.menu.serial.four_uart.build.serialcom_uart=FOUR_UART mattairtech_mt_d21e_revb.menu.serial.four_uart.build.serialcom_wire=NO_WIRE mattairtech_mt_d21e_revb.menu.serial.four_uart.build.serialcom_spi=NO_SPI -mattairtech_mt_d21e_revb.menu.serial.no_uart=NO_UART_ONE_WIRE_TWO_SPI -mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_uart=NO_UART -mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e_revb.menu.serial.no_uart.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21e_revb.menu.serial.no_uart_one_wire_two_spi=NO_UART_ONE_WIRE_TWO_SPI +mattairtech_mt_d21e_revb.menu.serial.no_uart_one_wire_two_spi.build.serialcom_uart=NO_UART +mattairtech_mt_d21e_revb.menu.serial.no_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.no_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21e_revb.menu.serial.four_uart_one_wire_one_spi=FOUR_UART_ONE_WIRE_ONE_SPI (L21 only) +mattairtech_mt_d21e_revb.menu.serial.four_uart_one_wire_one_spi.build.serialcom_uart=FOUR_UART +mattairtech_mt_d21e_revb.menu.serial.four_uart_one_wire_one_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.four_uart_one_wire_one_spi.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.five_uart_no_wire_one_spi=FIVE_UART_NO_WIRE_ONE_SPI (L21 only) +mattairtech_mt_d21e_revb.menu.serial.five_uart_no_wire_one_spi.build.serialcom_uart=FIVE_UART +mattairtech_mt_d21e_revb.menu.serial.five_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +mattairtech_mt_d21e_revb.menu.serial.five_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +mattairtech_mt_d21e_revb.menu.serial.five_uart_one_wire_no_spi=FIVE_UART_ONE_WIRE_NO_SPI (L21 only) +mattairtech_mt_d21e_revb.menu.serial.five_uart_one_wire_no_spi.build.serialcom_uart=FIVE_UART +mattairtech_mt_d21e_revb.menu.serial.five_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e_revb.menu.serial.five_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +mattairtech_mt_d21e_revb.menu.serial.six_uart=SIX_UART_NO_WIRE_NO_SPI (L21 only) +mattairtech_mt_d21e_revb.menu.serial.six_uart.build.serialcom_uart=SIX_UART +mattairtech_mt_d21e_revb.menu.serial.six_uart.build.serialcom_wire=NO_WIRE +mattairtech_mt_d21e_revb.menu.serial.six_uart.build.serialcom_spi=NO_SPI mattairtech_mt_d21e_revb.menu.usb.cdc=CDC_ONLY mattairtech_mt_d21e_revb.menu.usb.cdc.build.usbcom=CDC_ONLY mattairtech_mt_d21e_revb.menu.usb.cdc.build.pid=0x0557 @@ -305,10 +321,10 @@ mattairtech_mt_d21e.menu.serial.four_uart=FOUR_UART_NO_WIRE_NO_SPI mattairtech_mt_d21e.menu.serial.four_uart.build.serialcom_uart=FOUR_UART mattairtech_mt_d21e.menu.serial.four_uart.build.serialcom_wire=NO_WIRE mattairtech_mt_d21e.menu.serial.four_uart.build.serialcom_spi=NO_SPI -mattairtech_mt_d21e.menu.serial.no_uart=NO_UART_ONE_WIRE_TWO_SPI -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_uart=NO_UART -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE -mattairtech_mt_d21e.menu.serial.no_uart.build.serialcom_spi=TWO_SPI +mattairtech_mt_d21e.menu.serial.no_uart_one_wire_two_spi=NO_UART_ONE_WIRE_TWO_SPI +mattairtech_mt_d21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_uart=NO_UART +mattairtech_mt_d21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_mt_d21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI mattairtech_mt_d21e.menu.usb.cdc=CDC_ONLY mattairtech_mt_d21e.menu.usb.cdc.build.usbcom=CDC_ONLY mattairtech_mt_d21e.menu.usb.cdc.build.pid=0x0557 diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index 33f71ef84..3522035d4 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "sam.h" #if (SAMD21 || SAML21) #include @@ -27,7 +28,6 @@ #include "WVariant.h" #include "USB_host.h" #include "samd21_host.h" -#include "sam.h" #include "wiring_digital.h" #include "wiring_private.h" diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index e9f9db0d9..40622e485 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -134,25 +134,30 @@ void init( void ) regAPBCMASK |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 | MCLK_APBCMASK_SERCOM5 ; regAPBCMASK |= MCLK_APBCMASK_TCC0 | MCLK_APBCMASK_TCC1 | MCLK_APBCMASK_TCC2 | MCLK_APBCMASK_TC0 | MCLK_APBCMASK_TC1 | MCLK_APBCMASK_TC2 | MCLK_APBCMASK_TC3 | MCLK_APBCMASK_TC4 ; #endif - + #if (SAML) regAPBCMASK |= MCLK_APBCMASK_DAC ; MCLK->APBDMASK.reg |= MCLK_APBDMASK_ADC; // On the SAML, ADC is on the low power bridge #elif (SAMC) regAPBCMASK |= MCLK_APBCMASK_ADC0 | MCLK_APBCMASK_ADC1 | MCLK_APBCMASK_DAC ; #endif - + MCLK->APBCMASK.reg |= regAPBCMASK ; #else #error "wiring.c: Unsupported chip" #endif - //Setup all pins (digital and analog) in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) + // Setup all pins (digital and analog) in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) for (uint32_t ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ ) { pinMode( ul, PIO_STARTUP ) ; } + // At least on the L21, pin A31 must be set as an input. It is possible that debugger probe detection is being falsely + // detected (even with a pullup on A31 (SWCLK)), which would change the peripheral mux of A31 to COM. + // This might not normally be a problem, but one strange effect is that Serial2 loses characters if pin A31 is not set as INPUT. + pinMode(31, INPUT); + // I/O mux table footnote for D21 and D11: enable pullups on PA24 and PA24 when using as GPIO to avoid excessive current // Errata: disable pull resistors on PA24 or PA25 manually before switching to peripheral // Errata: do not use continuous sampling (not enabled by default) on PA24 or PA25 diff --git a/variants/Generic_D11C14A/README.md b/variants/Generic_D11C14A/README.md index 1c099a321..44f087a81 100644 --- a/variants/Generic_D11C14A/README.md +++ b/variants/Generic_D11C14A/README.md @@ -20,8 +20,8 @@ SWDCLK TX1/MISO* 30 | A30 A31 | 31 * RX1/SS using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top left pin (A2). PIN_MAP_COMPACT uses less RAM. * When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. -* When using NO_UART_ONE_WIRE_ONE_SPI, use SPI on pins 4, 5, 14, and 15. - When using ONE_UART_NO_WIRE_ONE_SPI, use SPI on pins 8, 9, 30, and 31. +* When using ONE_UART_NO_WIRE_ONE_SPI, use SPI on pins 4, 5, 14, and 15. + When using NO_UART_ONE_WIRE_ONE_SPI, use SPI on pins 8, 9, 30, and 31. * Tone available on TC2. TC2 is not routed to pins in the D11C14A. * Leave pin A30 floating (or use external pullup) during reset. * DO NOT connect voltages higher than 3.3V! diff --git a/variants/MT_D11/README.md b/variants/MT_D11/README.md index 72b088338..68fceea34 100644 --- a/variants/MT_D11/README.md +++ b/variants/MT_D11/README.md @@ -24,7 +24,8 @@ BTN SS * * | A15 RST | left pin (A2). PIN_MAP_COMPACT uses less RAM. * When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. * Leave pin A30 floating (or use external pullup) during reset. -* Tone available on TC2. DO NOT connect voltages higher than 3.3V! +* DO NOT connect voltages higher than 3.3V! +* Tone available on TC2. ``` diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index defe780fa..bb0f807f7 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -388,4 +388,4 @@ extern Uart Serial2; #define Serial Serial1 #endif -#endif /* _VARIANT_ARDUINO_ZERO_ */ +#endif /* _VARIANT_MATTAIRTECH_MT_D11_ */ diff --git a/variants/MT_D21E/README.md b/variants/MT_D21E/README.md index 1ecc3be07..ef6a0beef 100644 --- a/variants/MT_D21E/README.md +++ b/variants/MT_D21E/README.md @@ -32,7 +32,8 @@ USB D+ TC51 | A25+ | | Vin | functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). * When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. * Leave pin A30 floating (or use external pullup) during reset. -* Tone available on TC5. DO NOT connect voltages higher than 3.3V! +* DO NOT connect voltages higher than 3.3V! +* Tone available on TC5. ``` ## Pins descriptions for the MattairTech MT-D21E diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index 740949fdd..b3e3148cd 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -294,9 +294,9 @@ static const uint8_t SCL1 = PIN_WIRE1_SCL; #define I2S_DEVICE 0 #define I2S_CLOCK_GENERATOR 3 -#define PIN_I2S_SD (9u) -#define PIN_I2S_SCK (1u) -#define PIN_I2S_FS (0u) +#define PIN_I2S_SD (7u) +#define PIN_I2S_SCK (10u) +#define PIN_I2S_FS (11u) #ifdef __cplusplus } @@ -320,6 +320,8 @@ extern SERCOM sercom3; extern Uart Serial1; extern Uart Serial2; +extern Uart Serial3; +extern Uart Serial4; #endif @@ -362,4 +364,4 @@ extern Uart Serial2; #define Serial Serial1 #endif -#endif /* _VARIANT_ARDUINO_ZERO_ */ +#endif /* _VARIANT_MATTAIRTECH_MT_D21E_ */ diff --git a/variants/MT_D21E_revB/README.md b/variants/MT_D21E_revB/README.md index 0484e1a51..7909bdc38 100644 --- a/variants/MT_D21E_revB/README.md +++ b/variants/MT_D21E_revB/README.md @@ -33,7 +33,7 @@ USB D+ (D/L)(+), CAN RX (C) TC51 25 | A25 | | Vin | L21 installed. 5V i functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). * When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. * Leave pin A30 floating (or use external pullup) during reset. -* Tone available on TC5. DO NOT connect voltages higher than 3.3V! +* Tone available on TC5. + This alternate function is enabled by default (+M functions enabled only when a memory device is installed). Thus, the associated header pin cannot be used. Solder jumpers @@ -46,6 +46,60 @@ Silkscreen Legend: Bottom: A circled pin means analog function ``` +## COM Arrangement When Using "L21 Only" Options + +The following applies only to the L21 and only when using menu options with (L21 only). +If using the L21 with the other options, use the above ASCII diagram. + +The additional options are: + +* FOUR_UART_ONE_WIRE_ONE_SPI +* FIVE_UART_NO_WIRE_ONE_SPI +* FIVE_UART_ONE_WIRE_NO_SPI +* SIX_UART_NO_WIRE_NO_SPI + +``` + ------------------- + | A0 RST | + | A1 Gnd | + | A2 Vbat | + | A3 A31 | + | A4 A30 | + | A5 NC | + | A6 NC | + | A7 A27 | CS (MEM) +TX3 | A8 A23 | SS/RX5 +RX3 | A9 A22 | MISO/TX5 +TX1 | A10 A19 | SCK +RX1 | A11 A18 | MOSI +TX2 | A14 A17 | SCL/RX5/RX6 +RX2 | A15 A16 | SDA/TX5/TX6 + | NC NC | + | NC NC | + | Vbus 3.3V| +USB/TX4 | A24 _____ Vcc | +USB/RX4 | A25 | | Vin | + | Gnd | USB | Gnd | + ------------------- + +* If the memory device is installed, it is connected to SPI (A18, A19, and A22). + If selecting an option without SPI, then A22 will become TX5. Be sure to keep the + memory device CS pin high. You can disconnect A27 from CS by desoldering J13. +* Serial4 is shared with the USB pins. Thus, USB cannot be used is using Serial4. Be + sure to disconnect the USB connector D- and D+ pins by desoldering J4 and J7. +* It is not necessary to use all serial instances, and they can be skipped. For + example, with the FIVE_UART_NO_WIRE_ONE_SPI option, USB can still be used by NOT + calling Serial4.begin(), thus not enabling the Serial4 peripheral. However, Serial5 + can still be used. +* Serial5 can be located either on pins A16/A17 or A22/A23. If SPI is enabled, then + Serial5 is on pins A16/A17, otherwise it is on pins A22/A23. +* SERCOM5 has low-power capabilities and can run in power domain PD0, at the expense + of DMA support and a few other features (see core README.md). It is available in two + locations only, A24/A25 and A22/A23. If SPI is enabled, then SERCOM5 is connected to + Serial4 on A24/A25 (must disable USB), otherwise, it uses Serial5 on A22/A23. +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +``` + ## Pins descriptions for the MattairTech MT-D21E (rev B) ``` @@ -70,7 +124,7 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 15 | A15 | PA15 | Xout, RX2/SCK1 | !EIC/EXTINT[15] SERCOM2/PAD[3] TC3/WO[1] !TCC0/WO[5] Xout 16 | A16 | PA16 | SDA/TX4 w/pullup | EIC/EXTINT[0] PTC/X[4] SERCOM1/PAD[0] SERCOM3/PAD[0] TCC2/WO[0] !TCC0/WO[6] 17 | A17 | PA17 | SCL/RX4 w/pullup | EIC/EXTINT[1] PTC/X[5] SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] !TCC0/WO[7] -18 | A18 | PA18 | SPI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] +18 | A18 | PA18 | MOSI | EIC/EXTINT[2] PTC/X[6] !SERCOM1/PAD[2] SERCOM3/PAD[2] !TC3/WO[0] !TCC0/WO[2] 19 | A19 | PA19 | SCK | EIC/EXTINT[3] PTC/X[7] !SERCOM1/PAD[3] SERCOM3/PAD[3] !TC3/WO[1] !TCC0/WO[3] 20 | --- | ---- | NOT A PIN | NOT A PIN 21 | --- | ---- | NOT A PIN | NOT A PIN @@ -95,6 +149,7 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * TC5(D21) is available on these pins otherwise. The tone library uses TC5. * A0 and A1 are by default connected to the 32.768KHz crystal. * Leave pin A30 floating (or use external pullup) during reset. +* This table does not list "L21 Only" COM configurations. ``` @@ -146,10 +201,10 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi * 14 pins can be configured with external interrupts. * **SERCOM** - * 4 SERCOM are available. - * Up to 4 UART instances - * Up to 2 SPI instances - * Up to 2 WIRE (I2C) instances + * 4 SERCOM are available (6 on the L21E). + * Up to 4 UART instances (6 on the L21E). + * Up to 2 SPI instances. + * Up to 2 WIRE (I2C) instances. * The WIRE pullup resistors are enabled by default. @@ -211,7 +266,7 @@ now calls pinPeripheral() with the desired mode. Note that this field is not use select between the two peripherals possible with each of the SERCOM and TIMER functions. PeripheralAttribute is now used for this. -### PeripheralAttribute: +### PeripheralAttribute This is an 8-bit bitfield used for various peripheral configuration. It is primarily used to select between the two peripherals possible with each of the SERCOM and TIMER functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. diff --git a/variants/MT_D21E_revB/variant.cpp b/variants/MT_D21E_revB/variant.cpp index fbccb2739..59de33806 100644 --- a/variants/MT_D21E_revB/variant.cpp +++ b/variants/MT_D21E_revB/variant.cpp @@ -36,39 +36,49 @@ const PinDescription g_APinDescription[]= { PORTA, 1, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 2..9 - Analog capable pins (DAC available on 2) - { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[0] / DAC - { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[1] - { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4, GCLK_CCL_NONE }, // ADC/AIN[4] + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // DAC + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_4, GCLK_CCL_NONE }, #if (SAMD || SAMC) - { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, // ADC/AIN[5] + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, #elif (SAML) { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_5, GCLK_CCL_NONE }, #endif - { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[6], LED + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH0, ADC_Channel6, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // LED #if (SAMD) - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, #elif (SAML) - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + #if defined(USE_SIX_SERCOM) + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, + #else + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel17, EXTERNAL_INT_9, GCLK_CCL_NONE }, + #endif #elif (SAMC) - { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ADC/AIN[7] - { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel10, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // TCC0/WO[0] - { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel11, EXTERNAL_INT_9, GCLK_CCL_NONE }, // TCC0/WO[1] + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC1_CH1, ADC_Channel7, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel10, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel11, EXTERNAL_INT_9, GCLK_CCL_NONE }, #endif // 10..11 - SERCOM/UART (Serial1) or Analog or Digital functions #if (SAMD) - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, #elif (SAML) - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] + #if defined(USE_SIX_SERCOM) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + #else + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel18, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel19, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + #endif #elif (SAMC) - { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel10, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TX: SERCOM0/PAD[2] - { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel11, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // RX: SERCOM0/PAD[3] + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel10, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH3, ADC_Channel11, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, #endif // 12..13 pins don't exist @@ -77,40 +87,69 @@ const PinDescription g_APinDescription[]= // 14..15 - SERCOM/UART (Serial2) or Digital functions #if (SAMD) - { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // TC3/WO[0], HOST_ENABLE - { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN -#elif (SAML || SAMC) - { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // TC3/WO[0], HOST_ENABLE - { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // TC3/WO[1], ATN + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ATN +#elif (SAML) + #if defined(USE_SIX_SERCOM) + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ATN + #else + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ATN + #endif +#elif (SAMC) + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, // HOST_ENABLE + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // ATN #endif // 16..17 SERCOM/I2C (Wire) or Serial4 or Digital functions -#if defined(FOUR_UART) - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // TX4: SERCOM3/PAD[0] - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // RX4: SERCOM3/PAD[1] +#if (defined(FOUR_UART) && !defined(USE_SIX_SERCOM)) + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, #else - { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // SDA: SERCOM1/PAD[0] - { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // SCL: SERCOM1/PAD[1] + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, #endif // 18..23 - SERCOM/SPI (SPI) or Digital functions (pins 20..21 do not exist) - { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // SPI MOSI: SERCOM3/PAD[2] (PIN_ATTR_SERCOM_ALT) - { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SPI SCK: SERCOM3/PAD[3] (PIN_ATTR_SERCOM_ALT) + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused #if (SAMD) - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SPI MISO: SERCOM3/PAD[0] - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // SPI SS: SERCOM3/PAD[1] -#elif (SAML || SAMC) - { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // SPI MISO: SERCOM3/PAD[0] - { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // SPI SS: SERCOM3/PAD[1] + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, +#elif (SAML) + #if (defined(USE_SIX_SERCOM) && !defined(ONE_SPI)) + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, + #else + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, + #endif +#elif (SAMC) + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH0, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC0_CH1, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, #endif // 24..26 - USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist #if (SAMD) { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP -#elif (SAML || SAMC) +#elif (SAML) + #if defined(USE_SIX_SERCOM) + #if defined(ONE_SPI) + { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + #else + { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + #endif + #else + { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + #endif +#elif (SAMC) { PORTA, 24, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM { PORTA, 25, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP #endif @@ -126,14 +165,16 @@ const PinDescription g_APinDescription[]= { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) - { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // TCC1/WO[0] / SWD CLK / TX3 - { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // TCC1/WO[1] / SWD IO / RX3 + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_10, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_11, GCLK_CCL_NONE }, // SWD IO } ; #if (SAMD) const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; -#elif (SAML21 || SAMC21) +#elif (SAML21) const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC4 } ; +#elif (SAMC21) +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC2, TC3, TC4 } ; #endif // Multi-serial objects instantiation @@ -146,6 +187,8 @@ SERCOM sercom4( SERCOM4 ) ; SERCOM sercom5( SERCOM5 ) ; #endif +// All microcontrollers support configurations with four SERCOM +#if !defined(USE_SIX_SERCOM) #if defined(ONE_UART) || defined(TWO_UART) || defined(THREE_UART) || defined(FOUR_UART) Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; @@ -181,3 +224,60 @@ void SERCOM3_Handler() Serial4.IrqHandler(); } #endif + +// In addition to the configurations using four SERCOMs, the L21E supports USE_SIX_SERCOM +#else +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM2_Handler() +{ + Serial1.IrqHandler(); +} + +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM4_Handler() +{ + Serial2.IrqHandler(); +} + +Uart Serial3( SERCOM_INSTANCE_SERIAL3, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX ) ; + +void SERCOM0_Handler() +{ + Serial3.IrqHandler(); +} + +Uart Serial4( SERCOM_INSTANCE_SERIAL4, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX ) ; + +#if defined(ONE_SPI) +void SERCOM5_Handler() +#else +void SERCOM3_Handler() +#endif +{ + Serial4.IrqHandler(); +} + +#if defined(FIVE_UART) || defined(SIX_UART) +Uart Serial5( SERCOM_INSTANCE_SERIAL5, PIN_SERIAL5_RX, PIN_SERIAL5_TX, PAD_SERIAL5_RX, PAD_SERIAL5_TX ) ; + +#if defined(ONE_SPI) +void SERCOM1_Handler() +#else +void SERCOM5_Handler() +#endif +{ + Serial5.IrqHandler(); +} +#endif + +#if defined(SIX_UART) +Uart Serial6( SERCOM_INSTANCE_SERIAL6, PIN_SERIAL6_RX, PIN_SERIAL6_TX, PAD_SERIAL6_RX, PAD_SERIAL6_TX ) ; + +void SERCOM1_Handler() +{ + Serial6.IrqHandler(); +} +#endif +#endif diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h index ced2e0281..72ed8ee03 100644 --- a/variants/MT_D21E_revB/variant.h +++ b/variants/MT_D21E_revB/variant.h @@ -198,6 +198,17 @@ static const uint8_t ATN = PIN_ATN; /* * Serial interfaces */ +#if ((defined(FOUR_UART) && (defined(ONE_SPI) || defined(ONE_WIRE))) || defined(FIVE_UART) || defined(SIX_UART)) + #if (SAML) + #define USE_SIX_SERCOM + #else + #error "variant.h: Only the L21E supports configurations with six SERCOM" + #endif +#endif + +// All microcontrollers support configurations with four SERCOM +#if !defined(USE_SIX_SERCOM) + // Serial1 #define PIN_SERIAL1_RX (11ul) #define PIN_SERIAL1_TX (10ul) @@ -230,6 +241,69 @@ static const uint8_t ATN = PIN_ATN; #define SERCOM_INSTANCE_SERIAL4 &sercom3 +// In addition to the configurations using four SERCOMs, the L21E supports USE_SIX_SERCOM +#else + +// Serial1 +#define PIN_SERIAL1_RX (11ul) +#define PIN_SERIAL1_TX (10ul) +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL1 &sercom2 + +// Serial2 +#define PIN_SERIAL2_RX (15ul) +#define PIN_SERIAL2_TX (14ul) +#define PAD_SERIAL2_TX (UART_TX_PAD_2) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL2 &sercom4 + +// Serial3 +#define PIN_SERIAL3_RX (9ul) +#define PIN_SERIAL3_TX (8ul) +#define PAD_SERIAL3_TX (UART_TX_PAD_0) +#define PAD_SERIAL3_RX (SERCOM_RX_PAD_1) + +#define SERCOM_INSTANCE_SERIAL3 &sercom0 + +// Serial4 +#define PIN_SERIAL4_RX (25ul) +#define PIN_SERIAL4_TX (24ul) +#define PAD_SERIAL4_TX (UART_TX_PAD_2) +#define PAD_SERIAL4_RX (SERCOM_RX_PAD_3) + +#if defined(ONE_SPI) + #define SERCOM_INSTANCE_SERIAL4 &sercom5 +#else + #define SERCOM_INSTANCE_SERIAL4 &sercom3 +#endif + +// Serial5 (L21 only) +#if defined(ONE_SPI) + #define PIN_SERIAL5_RX (17ul) + #define PIN_SERIAL5_TX (16ul) + #define PAD_SERIAL5_TX (UART_TX_PAD_0) + #define PAD_SERIAL5_RX (SERCOM_RX_PAD_1) + #define SERCOM_INSTANCE_SERIAL5 &sercom1 +#else + #define PIN_SERIAL5_RX (23ul) + #define PIN_SERIAL5_TX (22ul) + #define PAD_SERIAL5_TX (UART_TX_PAD_0) + #define PAD_SERIAL5_RX (SERCOM_RX_PAD_1) + #define SERCOM_INSTANCE_SERIAL5 &sercom5 +#endif + +// Serial6 (L21 only) +#define PIN_SERIAL6_RX (17ul) +#define PIN_SERIAL6_TX (16ul) +#define PAD_SERIAL6_TX (UART_TX_PAD_0) +#define PAD_SERIAL6_RX (SERCOM_RX_PAD_1) + +#define SERCOM_INSTANCE_SERIAL6 &sercom1 +#endif + /* * SPI Interfaces @@ -308,9 +382,9 @@ static const uint8_t SCL1 = PIN_WIRE1_SCL; #define I2S_DEVICE 0 #define I2S_CLOCK_GENERATOR 3 -#define PIN_I2S_SD (9u) -#define PIN_I2S_SCK (1u) -#define PIN_I2S_FS (0u) +#define PIN_I2S_SD (7u) +#define PIN_I2S_SCK (10u) +#define PIN_I2S_FS (11u) #ifdef __cplusplus } @@ -331,9 +405,19 @@ extern SERCOM sercom0; extern SERCOM sercom1; extern SERCOM sercom2; extern SERCOM sercom3; +#if (SAML) +extern SERCOM sercom4; +extern SERCOM sercom5; +#endif extern Uart Serial1; extern Uart Serial2; +extern Uart Serial3; +extern Uart Serial4; +#if (SAML) +extern Uart Serial5; +extern Uart Serial6; +#endif #endif @@ -391,4 +475,4 @@ extern Uart Serial2; #endif #endif -#endif /* _VARIANT_ARDUINO_ZERO_ */ +#endif /* _VARIANT_MATTAIRTECH_MT_D21E_REVB_ */ From b905dfc35f8beba868dcf339b419ec3834538c7d Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 6 Jul 2017 03:25:34 +0000 Subject: [PATCH 101/124] Removed the two non-existant timers from the C21E that were recently added --- variants/MT_D21E_revB/variant.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/variants/MT_D21E_revB/variant.cpp b/variants/MT_D21E_revB/variant.cpp index 59de33806..53f2425c6 100644 --- a/variants/MT_D21E_revB/variant.cpp +++ b/variants/MT_D21E_revB/variant.cpp @@ -171,10 +171,8 @@ const PinDescription g_APinDescription[]= #if (SAMD) const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ; -#elif (SAML21) +#else const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC4 } ; -#elif (SAMC21) -const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC2, TC3, TC4 } ; #endif // Multi-serial objects instantiation From 8d7a00f8757e622bade9c74ede5dc6fb57e441be Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 6 Jul 2017 04:22:43 +0000 Subject: [PATCH 102/124] Updated documentation --- CHANGELOG | 9 +- README.md | 390 ++++++++++++++++++---------------- cores/arduino/wiring_analog.h | 17 +- 3 files changed, 224 insertions(+), 192 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6ddec2c37..ff0831bbd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,12 +1,13 @@ -1.6.8-beta-b2 (in-progress): -* Added more Serial, SPI, and WIRE options +1.6.8-beta-b2: * Added SD Card firmware loading support to the bootloader (4KB and 8KB) * Removed SDU library, as the bootloader now supports SD cards directly -* Fixed auto-detection for Arduino Zero and M0 board variants +* Removed automatic page writes from bootloader (may have caused bricked board during development) * Fixed bootloader compilation on Windows -* Documentation updates +* Added more Serial, SPI, and WIRE instances to MT-D21E (rev A and B) +* Added support for up to 6 SERCOM on the L21E (32-pin) * Merged in changes from upstream SAMD CORE 1.6.15: * +* Documentation updates 1.6.8-beta-b1: * Fixed auto-reset not working on some versions of Windows diff --git a/README.md b/README.md index 8eff5976b..6b1bc822a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ -# MattairTech Arduino SAM M0+ Core +# MattairTech SAM M0+ Core for Arduino -This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain -Arduino support for SAM M0+ boards including the MattairTech MT-D21E and the MT-D11 -(see https://www.mattairtech.com/). It adds support for new devices like the L21, C21, and -D11. It also adds new clock sources, like a high speed crystal or internal oscillator. +The MattairTech SAM M0+ Core is a fork from arduino/ArduinoCore-samd on GitHub, which will +be used to maintain Arduino support for MattairTech branded boards (see +https://www.mattairtech.com/) as well as "Generic" boards. -This core is intended to be installed using Boards Manager (see below). To update from a -previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update. +* Supports the SAMD21, SAMD11, SAML21, and SAMC21. +* Supports four clock sources (two crystals, internal oscillator, and USB calibrated). +* USB CDC Bootloader with optional SDCard support + +*This core is intended to be installed using Boards Manager (see below). To update from a* +*previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update.* **Differences from Arduino in Versioning** The MattairTech version number does not correspond to either the IDE version or to the upstream ArduinoCore-samd version. See the @@ -16,6 +19,9 @@ CHANGELOG for details on which upstream commits have been merged in to the Matta ## What's New Beta (1.6.8-beta) **See Beta Builds section for installation instructions.** +**1.6.8-beta-b2:** + + **1.6.8-beta-b1:** * Fixed auto-reset not working on some versions of Windows * Documentation updates @@ -73,13 +79,14 @@ PWM Outputs | 18 | 14 | 14 | 8 (6 for 14-pin) Interrupts | 16 | 16 | 16 | 8 (7 for 14-pin) USB | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device SERCOM* | 6 | 6 | 4 (6 for L21) | 3 (2 for 14-pin) -UART (Serial)* | Up to 6 | Up to 6 | Up to 4 (up to 5 for L21) | Up to 2 +UART (Serial)* | Up to 6 | Up to 6 | Up to 4 (up to 6 for L21) | Up to 2 SPI* | Up to 3 | Up to 2 | Up to 2 | Up to 1 I2C (WIRE)* | Up to 3 | Up to 2 | Up to 2 | Up to 1 I2S | Present on the D21 only | Present on the D21 only | Present on the D21 only | Not present Voltage | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V I/O Pin Current | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | 7 mA -* Note that the maximum number of UART/SPI/I2C is the number of SERCOM. The number listed above for UART/SPI/I2C indicated how many are configurable through the Arduino IDE menu. + +*Note that the maximum number of UART/SPI/I2C is the number of SERCOM. The number listed above for UART/SPI/I2C indicated how many are configurable through the Arduino IDE menu.* @@ -96,7 +103,7 @@ README.md also now includes technical information on the new PinDescription tabl * [MattairTech Generic D11C14A](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/Generic_D11C14A/README.md) -* MattairTech x21J based board (coming June) +* MattairTech x21J based board (coming July) * MattairTech Generic D11D14AS (coming soon) @@ -186,12 +193,62 @@ and SRAM usage by allowing CDC to be disabled (or USB completely disabled). ## Clock Source -There are up to four clock source choices, depending on board variant and microcontroller. They are: +There are up to four clock source choices, depending on board features and microcontroller. Since currently +the cpu must run at 48MHz, the PLL or DFLL must be used (the SAMC can use OSC48M). * 32KHZ_CRYSTAL (default) + * Uses both XOSC32K and FDPLL96M + * High long-term accuracy, slow startup, medium current (PLL) + * HIGH_SPEED_CRYSTAL + * Uses both XOSC and FDPLL96M + * High accuracy, medium startup, high current (XOSC and PLL) + * INTERNAL_OSCILLATOR -* INTERNAL_USB_CALIBRATED_OSCILLATOR + * Uses DFLL48M in open-loop mode (SAMC uses OSC48M) + * Low accuracy, fast startup, medium-low current (low current with SAMC) + +* INTERNAL_USB_CALIBRATED_OSCILLATOR (not available with SAMC) + * Uses DFLL48M in closed-loop mode + * High accuracy, medium-fast startup, medium current + +### SAMD + +Source | Frequency Range | Supply Current (max.) | Startup Time typ. (max.) | Notes, jitter, accuracy, other differences +----------------|---------------------------------------|-----------------------|-------------------------------|-------------------------------------------------------- +XOSC | 0.4MHz-32MHz crystal | 307uA (552uA) AGC on | 5K-14K cycles (10K-48K) | up to 32MHz digital clock input, Supply current based on 16MHz crystal +XOSC32K | 32.768KHz typical crystal | 1.22uA (2.19uA) | 28K cycles (30K) | 32.768KHz typical digital clock input +OSC32K | 32.27-33.26KHz (28.50-34.74KHz) | 0.67uA (1.32uA) | 1 cycle (2 cycles) | +OSCULP32K | 31.29-34.57KHz (25.55-38.01KHz) | 0.125uA max. | 10 cycles | +OSC8M | 7.94-8.06MHz (7.80-8.16MHz) | 64uA | 2.1us (3us) | +FDPLL96M | 32KHz-2MHz in, 48MHz-96MHz out | 500uA (700uA) | Lock: 25us (50us) @ 2MHz in | 1.5% (2%) period jitter (32KHz in, 48MHz out), Lock: 1.3ms (2ms) @ 32KHz in +DFLL48M open | 47MHz-49MHz out | 403uA (453uA) | 8us (9us) | +DFLL48M closed | 0.73-33KHz in, 47.96-47.98MHz out | 425uA (482uA) | Lock: 200us (500us) | 0.42ns max. jitter + +### SAML + +Source | Frequency Range | Supply Current (max.) | Startup Time typ. (max.) | Notes, jitter, accuracy, other differences +----------------|---------------------------------------|-----------------------|-------------------------------|-------------------------------------------------------- +XOSC | 0.4MHz-32MHz crystal | 293uA (393uA) AGC on | 5K-14K cycles (10K-48K) | up to 24MHz digital clock input, Supply current based on 16MHz crystal +XOSC32K | 32.768KHz typical crystal | 0.311uA (2.19uA) | 25K cycles (82K) | 32.768KHz typical digital clock input (1MHz max.) +OSC32K | 32.57-33.05KHz (28.58-34.72KHz) | 0.54uA (1.10uA) | 1 cycle (2 cycles) | +OSCULP32K | 31.77-34.03KHz (26.29-38.39KHz) | Not Specified. | Not Specified | +OSC16M | 15.75-16.24MHz | 141uA (169uA) | 1.4us (3.1us) | Wake up time: 0.12us (0.25us) +FDPLL96M | 32KHz-2MHz in, 48MHz-96MHz out | 454uA (548uA) | Lock: 25us (35us) @ 2MHz in | 1.9% (4%) period jitter (32KHz in, 48MHz out), Lock: 1ms (2ms) @ 32KHz in +DFLL48M open | 46.6MHz-49MHz out | 286uA | 8.3us (9.1us) | +DFLL48M closed | 0.73-33KHz in, 47.96-47.98MHz out | 362uA | Lock: 200us (700us) | 0.51ns max. jitter + +### SAMC + +Source | Frequency Range | Supply Current (max.) | Startup Time typ. (max.) | Notes, jitter, accuracy, other differences +----------------|---------------------------------------|-----------------------|-------------------------------|-------------------------------------------------------- +XOSC | 0.4MHz-32MHz crystal | 429uA (699uA) AGC on | 6K-12K cycles (20K-48K) | up to 48MHz digital clock input, Supply current based on 16MHz crystal +XOSC32K | 32.768KHz typical crystal | 1.53uA (2.84uA) | 16K cycles (24K) | 32.768KHz typical digital clock input +OSC32K | 32.11-33.43KHz (25.55-37.36KHz) | 0.864uA (1.08uA) | 1 cycle (2 cycles) | +OSCULP32K | 30.96-34.57KHz (22.93-38.99KHz) | Not Specified. | Not Specified | +OSC48M | 47.04-48.96MHz | 87uA (174uA) | 22.5us (25.5us) | +FDPLL96M | 32KHz-2MHz in, 48MHz-96MHz out | 536uA (612uA) | Not Yet Specified | + ### External 32.768KHz Crystal @@ -228,7 +285,7 @@ will calibrate against the USB SOF signal. NVM_SW_CALIB_DFLL48M_FINE_VAL is the calibration value for DFLL open-loop mode. The coarse calibration value is loaded from NVM OTP (factory calibration values). -### Clock Generators +### Clock Generators Currently Used 0. MAIN (mcu) 1. XOSC (high speed crystal) @@ -239,52 +296,51 @@ NVM OTP (factory calibration values). ## Analog Reference -TODO: more info - -* D21 / D11 - * AR_INTERNAL1V0 - * AR_INTERNAL_INTVCC0 - * AR_INTERNAL_INTVCC1 - * AR_EXTERNAL_REFA - * AR_EXTERNAL_REFB - * AR_DEFAULT (this also uses 1/2 gain on each input) +* D21 + * AR_DEFAULT uses 1/2X gain on each input. + * The external reference should be between 1.0V and VDDANA-0.6V. * L21 - * AR_INTREF - * AR_INTERNAL_INTVCC0 - * AR_INTERNAL_INTVCC1 - * AR_EXTERNAL_REFA - * AR_EXTERNAL_REFB - * AR_INTERNAL_INTVCC2 - * AR_INTREF_1V0 - * AR_INTREF_1V1 - * AR_INTREF_1V2 - * AR_INTREF_1V25 - * AR_INTREF_2V0 - * AR_INTREF_2V2 - * AR_INTREF_2V4 - * AR_INTREF_2V5 * AR_DEFAULT = AR_INTERNAL_INTVCC2 - * AR_INTERNAL1V0 = AR_INTREF (Default INTREF for SAML is 1.0V) + * Both AR_INTREF and AR_INTERNAL1V0 has the same effect as AR_INTREF_1V0. + * The external reference should be between 1v and VDDANA-0.6v=2.7v. * C21 - * AR_INTREF - * AR_INTERNAL_INTVCC0 - * AR_INTERNAL_INTVCC1 - * AR_EXTERNAL_REFA - * AR_EXTERNAL_DAC - * AR_INTERNAL_INTVCC2 - * AR_INTREF_1V024 - * AR_INTREF_2V048 - * AR_INTREF_4V096 * AR_DEFAULT = AR_INTERNAL_INTVCC2 - * AR_INTERNAL1V0 = AR_INTREF (Default INTREF for SAMC is 1.024V) + * Both AR_INTREF and AR_INTERNAL1V0 has the same effect as AR_INTREF_1V024. + * The external reference should be between 1v and VDDANA-0.6v=2.7v. + +**Warning : The maximum reference voltage is Vcc (up to 3.6 volts for the SAMD/SAML, 5V for the SAMC)** + +### Reference Selection Table + +D21 / D11 | Volts | L21 | Volts | C21 | Volts +------------------------|------------|-----------------------|-----------|-----------------------|-------- +AR_DEFAULT | 1/2 VCC | AR_DEFAULT | VCC | AR_DEFAULT | VCC +AR_INTERNAL1V0 | 1.00V | AR_INTREF | 1.00V | AR_INTREF | 1.024V +AR_INTERNAL_INTVCC0 | 1/1.48 VCC | AR_INTREF_1V0 | 1.00V | AR_INTREF_1V024 | 1.024V +AR_INTERNAL_INTVCC1 | 1/2 VCC | AR_INTREF_1V1 | 1.10V | AR_INTREF_2V048 | 2.048V +AR_EXTERNAL_REFA | REFA | AR_INTREF_1V2 | 1.20V | AR_INTREF_4V096 | 4.096V +AR_EXTERNAL_REFB | REFB | AR_INTREF_1V25 | 1.25V | AR_INTERNAL1V0 | 1.024V + | | AR_INTREF_2V0 | 2.00V | AR_INTERNAL_INTVCC0 | 1/1.6 VCC + | | AR_INTREF_2V2 | 2.20V | AR_INTERNAL_INTVCC1 | 1/2 VCC + | | AR_INTREF_2V4 | 2.40V | AR_INTERNAL_INTVCC2 | VCC + | | AR_INTREF_2V5 | 2.50V | AR_EXTERNAL_REFA | REFA + | | AR_INTERNAL1V0 | 1.00V | AR_EXTERNAL_DAC | DAC + | | AR_INTERNAL_INTVCC0 | 1/1.6 VCC | | + | | AR_INTERNAL_INTVCC1 | 1/2 VCC | | + | | AR_INTERNAL_INTVCC2 | VCC | | + | | AR_EXTERNAL_REFA | REFA | | + | | AR_EXTERNAL_REFB | REFB | | + +### Common Settings -* Common - * AR_INTERNAL = AR_INTERNAL_INTVCC0 - * AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0 (2.23V only when Vcc = 3.3V) - * AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1 (1.65V only when Vcc = 3.3V) - * AR_EXTERNAL = AR_EXTERNAL_REFA +AR_INTERNAL = AR_INTERNAL_INTVCC0 +AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0 +AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1 +AR_EXTERNAL = AR_EXTERNAL_REFA + +*When using AR_INTERNAL2V23 or AR_INTERNAL1V65, these voltages are correct only when Vcc = 3.3V)* @@ -306,10 +362,11 @@ TODO: more info * On the L21, SERCOM5 is in a low power domain. The Fm+ and HS modes of I2C (wire) are not supported. * The SAML and SAMC have double-buffered TCs, which are supported in the core. * The CHANGE and RISING interrupt modes on pin A31 do not seem to work properly on the L21. -* When using pin A31 as UART RX, in Arduino, pinMode(31, INPUT_PULLUP) must be called before SerialX.begin(). * The L21 has two performance levels that affect power consumption. During powerup, the L21 starts at the lowest performance level (PL0). The startup code changes to the highest performance level (PL2) in order to support 48MHz and USB (among other things). * Two Flash Wait States are inserted for the L21 and C21 (the D21/D11 use one wait state). +* pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would + interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. ### SAMC21 @@ -326,6 +383,7 @@ TODO: more info ### SAMD11 * The D11D has three SERCOM. The D11C has two sercom (no sercom2). +* TONE: TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14 as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. * When USB is disabled, pullups will be enabled on PA24 and PA24 to avoid excessive current consumption (<1mA) due to floating pins. Note that it is not necessary to enable pull resistors on any other pins that are floating. Errata: Disable pull resistors on PA24 and PA25 manually before switching to a peripheral. @@ -339,21 +397,18 @@ TODO * TODO * Table summarizing which core files are modified and by how much +* Communications interfaces are mostly unchanged, including USB * Changes due to adding/changing features vs porting to new chip - -## Random Notes (TODO) - -* TONE: TC5 does not exist on the D11. Using TC2 instead (TC1 on the D11C14 as TC2 is not routed to pins). It will conflict with the 2 associated TC analogWrite() pins. -* D21: Enables wakeup capability on pin in case being used during sleep (WAKEUP always enabled on SAML and SAMC) * All pins (digital and analog) setup in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) * INEN enabled for both input and output (but not analog) * pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would -interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. + interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. * Pull resistors enabled only if pin attributes allow and only if pin is not configured as output. * Pull direction (pullup or pulldown) is now set with pinMode only (defaults to pullup if pinMode never called). + ## Serial Monitor To print to the Serial Monitor over USB, use 'Serial'. Serial refers to SerialUSB (Serial1 and Serial2 are UARTs). @@ -454,11 +509,9 @@ Vista, 7, 8, and 10. Note that the Windows 10 generic CDC drivers work as well. #### OS X -OS X support currently in beta (see below), the following instructions are only for 1.6.6-mtX and below. -1. Only the 256 KB chip variants work with the OS X version of the upload tool, bossac. -2. First, you will need to open boards.txt and change mattairtech_mt_d21e_bl8k.upload.tool to equal arduino:bossac. -3. Open platform.txt and change tools.bossac.path to equal{runtime.tools.bossac-1.6.1-arduino.path}. -4. No driver installation is needed. +*OS X support was added in version 1.6.7-beta-b0.* + +0. No driver installation is needed. 5. Plug in the board. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: * Click the "Network Preferences..." button, then click "Apply". * The board will show up as “Not Configuredâ€, but it will work fine. @@ -492,7 +545,7 @@ OS X support currently in beta (see below), the following instructions are only 1. In the Arduino IDE (1.6.7 or above), open File->Examples->01.Basics->Blink. 2. Change the three instances of '13' to 'LED_BUILTIN'. -3. Be sure the correct options are selected in the Tools menu (see AVR Core Installation above). +3. Be sure the correct options are selected in the Tools menu (see Core Installation above). 4. With the board plugged in, select the correct port from Tools->Port. 5. Click the Upload button. After compiling, the sketch should be transferred to the board. 6. Once the bootloader exits, the blink sketch should be running. @@ -519,26 +572,26 @@ In this case, the IDE will not notify the user of updates. ## SAM-BA USB CDC Bootloader (Arduino compatible) -The SAM-BA bootloader has both a CDC USB interface, and a UART interface. It is compatible with the Arduino IDE, or -it can be used with the Bossac tool standalone. With Arduino, auto-reset is supported (automatically runs the -bootloader while the sketch is running) as well as automatic return from reset. The SAM-BA bootloader described -here adds to the Arduino version, which in turn is based on the bootloader from Atmel. The Arduino version added -several features, including three new commands (Arduino Extended Capabilities) that increase upload speed. The -bootloader normally requires 8 KB FLASH, however, a 4 KB version can be used for the D11 chips. +This bootloader is based on the Arduino Zero bootloader which is a part of the Arduino SAMD core. It +provides a USB-CDC and/or TTL serial communications interface to a host running the bossac command +line firmware programming utility (or the Arduino IDE) running on Windows, Linux, or OS X. Optionally, +SD Card firmware loading is supported, using SDSC or SDHC cards with a FAT16 or FAT32 filesystem. +This version adds support for the D11, L21, and C21 microcontrollers. It also adds support for four +different clock sources (two external crystals and two internal oscillator options). There are +additional board definitions added, and binaries for most board/chip combinations are pre-built. -Bossac is a command line utility for uploading firmware to SAM-BA bootloaders. It runs on Windows. Linux, and OS X. -It is used by Arduino to upload firmware to SAM and SAM M0+ boards. The version described here adds to the -Arduino version (https://github.com/shumatech/BOSSA, Arduino branch), which in turn is a fork from the original -Bossa (http://www.shumatech.com/web/products/bossa). It adds support for more SAM M0+ chips (D21, L21, C21, and D11). +**See [bootloaders/zero/README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/README.md) for more technical information on the bootloader.** -Note that only the Arduino or Mattairtech versions of bossac are currently supported for SAM M0+ chips. -Neither the stock bossac (or Bossa) nor the Atmel SAM-BA upload tool will work. -Arduino Extended Capabilities: +### Features - * X: Erase the flash memory starting from ADDR to the end of flash. - * Y: Write the content of a buffer in SRAM into flash memory. - * Z: Calculate the CRC for a given area of memory. +* SAM-BA USB CDC and UART interfaces with optional terminal mode +* SD Card interface (both USB CDC and SD Card support fits in 8KB) +* Four different clock sources (two external crystals and two internal oscillator options) +* Arduino IDE auto-reset and double-tap reset button support +* Arduino extended commands for faster firmware loading +* Supports the D21, L21, C21, and D11 SAM M0+ chips +* Bossac command line utility for Windows, Linux, and OS X The bootloader can be started by: @@ -547,18 +600,17 @@ The bootloader can be started by: * Clicking 'Upload Sketch' in the Arduino IDE, which will automatically start the bootloader (when CDC is enabled). * If the application (sketch) area is blank, the bootloader will run. -Otherwise, it jumps to application and starts execution from there. The LED will light during bootloader execution. -Note that the 4KB bootloader does not support the Arduino Extended Capabilities. -However, BOOT_DOUBLE_TAP does fit into the SAMD11 4KB bootloader. +Otherwise, it jumps to application and starts execution from there. The LED will PWM fade during bootloader execution. -When the Arduino IDE initiates the bootloader, the following procedure is used: -1. The IDE opens and closes the USB serial port at a baud rate of 1200bps. This triggers a “soft erase†procedure. -2. The first row of application section flash memory is erased by the MCU. If it is interrupted for any reason, the erase procedure will likely fail. -3. The board is reset. The bootloader (which always runs first) detects the blank flah row, so bootloader operation resumes. -4. Opening and closing the port at a baud rate other than 1200bps will not erase or reset the SAM M0+. +### Bossac -**See [bootloaders/zero/README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/README.md) for more technical information on the bootloader.** +Bossac is a command line utility for uploading firmware to SAM-BA bootloaders. It runs on Windows. Linux, and OS X. +It is used by Arduino to upload firmware to SAM and SAM M0+ boards. The version described here adds to the +Arduino version (https://github.com/shumatech/BOSSA, Arduino branch), which in turn is a fork from the original +Bossa (http://www.shumatech.com/web/products/bossa). It adds support for more SAM M0+ chips (D21, L21, C21, and D11). +Note that only the Arduino or Mattairtech versions of bossac are currently supported for SAM M0+ chips. +Neither the stock bossac (or Bossa) nor the Atmel SAM-BA upload tool will work. ### Bootloader Firmware Installation @@ -574,87 +626,40 @@ When the Arduino IDE initiates the bootloader, the following procedure is used: 7. Click Tools->Burn Bootloader. Ignore any messages about not supporting shutdown or reset. 8. Continue with driver installation above. -A running sketch may interfere with the bootloader installation process. Be sure you are running the existing bootloader or using a blank chip. +A running sketch *may* interfere with the bootloader installation process. Be sure you are running the existing bootloader or using a blank chip. #### Bootloader Installation Using Another Tool (ie: Atmel Studio, openocd) -1. Download the bootloader from https://www.mattairtech.com/software/arduino/SAM-BA-bootloaders-zero-mattairtech.zip. -2. Unzip to any directory. Be sure that a bootloader is available for your particular MCU. -3. Follow the procedures for your upload tool to upload the firmware. - * Perform a chip erase first. Be sure no BOOTPROT bits are set. - * Install the binary file to 0x00000000 of the FLASH. - * You can optionally set the BOOTPROT bits to 8KB (or 4KB for the MT-D11). The Arduino installation method does not set these. - * You can optionally set the EEPROM bits or anything else. The Arduino installation method uses factory defaults. -4. Continue with driver installation above. +**See [bootloaders/zero/README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/README.md) for information.** ### Bootloader Binaries -The bootloaders/zero/binaries directory contains all of the SAM-BAm0+ -bootloaders built by the build_all_bootloaders.sh script. - -#### MattairTech Boards -MattairTech boards are all configured with only one interface: -SAM_BA_USBCDC_ONLY (except C21, which uses SAM_BA_UART_ONLY). -CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_INTERNAL_USB -(CLOCKCONFIG_INTERNAL for the C21). Only the main LED is defined. -BOOT_LOAD_PIN is not defined, but BOOT_DOUBLE_TAP_ENABLED is. +The bootloaders/zero/binaries directory contains the SAM-BA m0+ +bootloaders built by the build_all_bootloaders.sh script from +the 'MattairTech SAM M0+ Boards' Arduino core, which is available +at https://github.com/mattairtech/ArduinoCore-samd. Each board +and chip combination has two bootloaders available: -#### Arduino/Genuino Boards -Arduino/Genuino boards are all configured with both interfaces. -CLOCKCONFIG_CLOCK_SOURCE is set to CLOCKCONFIG_32768HZ_CRYSTAL. -All LEDs that are installed for each board are defined (and some -have LED_POLARITY_LOW_ON set). BOOT_LOAD_PIN is not defined, but -BOOT_DOUBLE_TAP_ENABLED is. +* SAM-BA interface only + * USB CDC only for all MattairTech boards + * Both USB CDC and UART for most Arduino boards + * The Generic board variants minimize external pin usage + * Only the SAM-BA interface pins are used (no crystal, LED, etc.) + * Filename is: sam_ba_$(BOARD_ID)_$(MCU) -#### Generic Boards -The generic boards are all configured to minimize external hardware -requirements. Only one interface is enabled: SAM_BA_USBCDC_ONLY -(except C21, which uses SAM_BA_UART_ONLY). CLOCKCONFIG_CLOCK_SOURCE -is set to CLOCKCONFIG_INTERNAL_USB (CLOCKCONFIG_INTERNAL for the C21), -so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not -defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin. +* SAM-BA interface and SD Card interface + * USB CDC only for all Arduino and most MattairTech boards + * No SAM-BA interface for the D11 chips + * All board variants define SDCARD_USE_PIN1 (except D11) + * The Generic board variants use the LED + * SDCARD_AUTORUN_DISABLED is defined + * Filename is: sam_ba_sdcard_$(BOARD_ID)_$(MCU) ### Using Bossac Standalone -TODO: Update https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip with new chips (L21 and C21). - -When using Bossac standalone, you will need to ensure that your application starts at 0x00002000 for 8 KB bootloaders, -and 0x00001000 for 4 KB bootloaders. This is because the bootloader resides at 0x00000000. This can be accomplished -by passing the following flag to the linker (typically LDFLAGS in your makefile; adjust for your bootloader size): - -``` -Wl,sectionstart=.text=0x2000 -``` - -You can also use a linker script. See the MattairTech SAM M0+ package for examples. -Be sure to generate and use a binary file. Many makefiles are set up to generate an elf, hex, and bin already. - -Download Bossac from: - -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) - -Linux 64 bit users can also download Bossa (GUI) and bossash (shell) from: - -* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) - -As an example, bossac will be used to upload the test firmware (blink sketch): - -1. Download firmware from https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip and unzip. -2. If you have not already installed the bootloader driver, see Driver Installation above. -3. Be sure there is a binary that matches your chip. On the command line (change the binary to match yours): - -``` -bossac.exe -d --port=COM5 -U true -i -e -w -v Blink_Demo_ATSAMD21E18A.bin -R -``` -4. On Linux --port might be /dev/ttyACM0. If the device is not found, remove the --port argument for auto-detection. -5. See http://manpages.ubuntu.com/manpages/vivid/man1/bossac.1.html for details. -6. The board should reset automatically and the sketch should be running. - +**See [bootloaders/zero/README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/README.md) for information on using Bossac standalone.** ## New PinDescription Table @@ -698,37 +703,64 @@ from the MT-D11 variant. -## Future Additions/Changes +## MattairTech Libraries + +### Available Now -### In-Progress -* Timer library (like TimerOne, plus input capture, plus ??) -* Drivers for MT-D21E optional memory devices (SRAM, FLASH, EEPROM) -* OS X support currently in beta testing +*Use Libraries Manager to install* + +* SRAM_23LC - Library for Microchip Technology Inc. 23LC (23LCV, 23A, 23K) SPI SRAM chips + * Byte and block transfers + +* EEPROM_CAT25 - Library for On Semiconductor CAT25 SPI EEPROM chips + * Byte, block, and page transfers + +### Under Development + +* ZeroTimers - 8/16/24/32 bit timer library with API based on TimerOne + * PWM + * interrupt + * Input capture + +* POWER_PAC1921 - Library for Microchip Technologies high-side power/current/voltage monitor with I2C and analog out +* SENSOR_LPS22HB - Library for ST MEMS nano pressure sensor / temperature sensor with I2C +* SENSOR_LSM6DS3H - Library for ST iNemo inertial module: 3D accelerometer / 3D gyroscope with I2C and interrupt +* FLASH_AT25 - Library for Adesto Technologies AT25 SPI serial FLASH devices ### Possible Future + +* Several I2C (Wire) sensor devices +* TFT LCD (CFAF128128B-0145T) +* IR decoder +* I2S DAC/AMP and I2S MEMS microphone +* Battery management IC +* XBee/Xbee Pro devices? + + +## Core Future Additions/Changes + +### Under Development + +* PlatformIO support +* Fix programming port for Arduino Zero and M0 board variants * Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) -* USB Host mode CDC ACM (partially complete; BSD-like license?) -* Features for lower power consumption (library?) + +### Possible Future + +* Features for lower power consumption (library?) Summer 2017? * Reliability and security enhancements -* Enhanced SD card library +* USB Host mode CDC ACM (partially complete; BSD-like license?) +* SD card library? Port of FatFS and/or Petit FatFS? * Optional use of single on-board LED as USB activity LED * MSC (Mass Storage) USB Device Class * Polyphonic tone * Wired-AND, Wired-OR for port pins * High-speed port pin access (IOBUS) -* Libraries for some hardware I plan on using: - * TFT LCD (CFAF128128B-0145T) - * Motor controller - * IR decoder - * I2S DAC/AMP and I2S MEMS microphone - * Battery management IC - * XBee/Xbee Pro devices - * RS485 - * Several I2C (Wire) sensor devices: - * Accelerometer/magnetometer (LSM303CTR) - * Barometer/altimeter (LPS22HBTR) - * Humidity/temperature - * Light/color sensor + +### Feature Requests + +Please use the GitHub Issue Tracker if you would like to request a feature. + ## ChangeLog diff --git a/cores/arduino/wiring_analog.h b/cores/arduino/wiring_analog.h index ac487b78a..c5844ba75 100644 --- a/cores/arduino/wiring_analog.h +++ b/cores/arduino/wiring_analog.h @@ -26,11 +26,10 @@ extern "C" { #endif /* - * \brief TODO Analog reference selection. - * For values <= 5, the actual register value is used. - * For values > 5 (SAML and SAMC only), the SUPC_VREF_SEL register value is: (ulMode - 6). - * Values for the Supply Controller (SUPC) reference on the L21 or C21. - * Used when AR_INTREF is selected as the reference. + * \brief Analog reference selection. + * For eAnalogReference values <= 5, the value is written to the REFSEL register. + * For values > 5 (SAML and SAMC only), 0 is written into the REFSEL register, and + * the SUPC_VREF_SEL (supply controller) register value is: (eAnalogReference - 6). */ typedef enum _eAnalogReference { @@ -42,7 +41,7 @@ typedef enum _eAnalogReference AR_EXTERNAL_REFB = 4, AR_DEFAULT = 5, // On the SAMD, this also uses 1/2 gain on each input #elif (SAML21) - AR_INTREF = 0, + AR_INTREF = 0, // This has the same effect as AR_INTREF_1V0 AR_INTERNAL_INTVCC0 = 1, AR_INTERNAL_INTVCC1 = 2, AR_EXTERNAL_REFA = 3, @@ -57,9 +56,9 @@ typedef enum _eAnalogReference AR_INTREF_2V4 = 12, AR_INTREF_2V5 = 13, AR_DEFAULT = AR_INTERNAL_INTVCC2, - AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAML is 1.0V + AR_INTERNAL1V0 = AR_INTREF, #elif (SAMC21) - AR_INTREF = 0, + AR_INTREF = 0, // This has the same effect as AR_INTREF_1V024 AR_INTERNAL_INTVCC0 = 1, AR_INTERNAL_INTVCC1 = 2, AR_EXTERNAL_REFA = 3, @@ -69,7 +68,7 @@ typedef enum _eAnalogReference AR_INTREF_2V048 = 7, AR_INTREF_4V096 = 8, AR_DEFAULT = AR_INTERNAL_INTVCC2, - AR_INTERNAL1V0 = AR_INTREF, // Default INTREF for SAMC is 1.024V + AR_INTERNAL1V0 = AR_INTREF, #else #error "wiring_analog.c: Unsupported chip" #endif From 9bb5076856e9d49a6166127be4dba01094726d4c Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Thu, 6 Jul 2017 08:03:08 +0000 Subject: [PATCH 103/124] Github doc fixup --- README.md | 86 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 8a20979fa..25cf63b50 100644 --- a/README.md +++ b/README.md @@ -207,21 +207,21 @@ and SRAM usage by allowing CDC to be disabled (or USB completely disabled). There are up to four clock source choices, depending on board features and microcontroller. Since currently the cpu must run at 48MHz, the PLL or DFLL must be used (the SAMC can use OSC48M). -* 32KHZ_CRYSTAL (default) - * Uses both XOSC32K and FDPLL96M - * High long-term accuracy, slow startup, medium current (PLL) +### 32KHZ_CRYSTAL (default) +* Uses both XOSC32K and FDPLL96M +* High long-term accuracy, slow startup, medium current (PLL) -* HIGH_SPEED_CRYSTAL - * Uses both XOSC and FDPLL96M - * High accuracy, medium startup, high current (XOSC and PLL) +### HIGH_SPEED_CRYSTAL +* Uses both XOSC and FDPLL96M +* High accuracy, medium startup, high current (XOSC and PLL) -* INTERNAL_OSCILLATOR - * Uses DFLL48M in open-loop mode (SAMC uses OSC48M) - * Low accuracy, fast startup, medium-low current (low current with SAMC) +### INTERNAL_OSCILLATOR +* Uses DFLL48M in open-loop mode (SAMC uses OSC48M) +* Low accuracy, fast startup, medium-low current (low current with SAMC) -* INTERNAL_USB_CALIBRATED_OSCILLATOR (not available with SAMC) - * Uses DFLL48M in closed-loop mode - * High accuracy, medium-fast startup, medium current +### INTERNAL_USB_CALIBRATED_OSCILLATOR (not available with SAMC) +* Uses DFLL48M in closed-loop mode +* High accuracy, medium-fast startup, medium current ### SAMD @@ -307,19 +307,19 @@ NVM OTP (factory calibration values). ## Analog Reference -* D21 - * AR_DEFAULT uses 1/2X gain on each input. - * The external reference should be between 1.0V and VDDANA-0.6V. +### D21 +* AR_DEFAULT uses 1/2X gain on each input. +* The external reference should be between 1.0V and VDDANA-0.6V. -* L21 - * AR_DEFAULT = AR_INTERNAL_INTVCC2 - * Both AR_INTREF and AR_INTERNAL1V0 has the same effect as AR_INTREF_1V0. - * The external reference should be between 1v and VDDANA-0.6v=2.7v. +### L21 +* AR_DEFAULT = AR_INTERNAL_INTVCC2 +* Both AR_INTREF and AR_INTERNAL1V0 has the same effect as AR_INTREF_1V0. +* The external reference should be between 1v and VDDANA-0.6v=2.7v. -* C21 - * AR_DEFAULT = AR_INTERNAL_INTVCC2 - * Both AR_INTREF and AR_INTERNAL1V0 has the same effect as AR_INTREF_1V024. - * The external reference should be between 1v and VDDANA-0.6v=2.7v. +### C21 +* AR_DEFAULT = AR_INTERNAL_INTVCC2 +* Both AR_INTREF and AR_INTERNAL1V0 has the same effect as AR_INTREF_1V024. +* The external reference should be between 1v and VDDANA-0.6v=2.7v. **Warning : The maximum reference voltage is Vcc (up to 3.6 volts for the SAMD/SAML, 5V for the SAMC)** @@ -333,16 +333,16 @@ AR_INTERNAL_INTVCC0 | 1/1.48 VCC | AR_INTREF_1V0 | 1.00V | AR_IN AR_INTERNAL_INTVCC1 | 1/2 VCC | AR_INTREF_1V1 | 1.10V | AR_INTREF_2V048 | 2.048V AR_EXTERNAL_REFA | REFA | AR_INTREF_1V2 | 1.20V | AR_INTREF_4V096 | 4.096V AR_EXTERNAL_REFB | REFB | AR_INTREF_1V25 | 1.25V | AR_INTERNAL1V0 | 1.024V - | | AR_INTREF_2V0 | 2.00V | AR_INTERNAL_INTVCC0 | 1/1.6 VCC - | | AR_INTREF_2V2 | 2.20V | AR_INTERNAL_INTVCC1 | 1/2 VCC - | | AR_INTREF_2V4 | 2.40V | AR_INTERNAL_INTVCC2 | VCC - | | AR_INTREF_2V5 | 2.50V | AR_EXTERNAL_REFA | REFA - | | AR_INTERNAL1V0 | 1.00V | AR_EXTERNAL_DAC | DAC - | | AR_INTERNAL_INTVCC0 | 1/1.6 VCC | | - | | AR_INTERNAL_INTVCC1 | 1/2 VCC | | - | | AR_INTERNAL_INTVCC2 | VCC | | - | | AR_EXTERNAL_REFA | REFA | | - | | AR_EXTERNAL_REFB | REFB | | +--- | | AR_INTREF_2V0 | 2.00V | AR_INTERNAL_INTVCC0 | 1/1.6 VCC +--- | | AR_INTREF_2V2 | 2.20V | AR_INTERNAL_INTVCC1 | 1/2 VCC +--- | | AR_INTREF_2V4 | 2.40V | AR_INTERNAL_INTVCC2 | VCC +--- | | AR_INTREF_2V5 | 2.50V | AR_EXTERNAL_REFA | REFA +--- | | AR_INTERNAL1V0 | 1.00V | AR_EXTERNAL_DAC | DAC +--- | | AR_INTERNAL_INTVCC0 | 1/1.6 VCC | | +--- | | AR_INTERNAL_INTVCC1 | 1/2 VCC | | +--- | | AR_INTERNAL_INTVCC2 | VCC | | +--- | | AR_EXTERNAL_REFA | REFA | | +--- | | AR_EXTERNAL_REFB | REFB | | ### Common Settings @@ -404,21 +404,17 @@ AR_EXTERNAL = AR_EXTERNAL_REFA TODO -## Differences Between MattairTech and Arduino Cores - -* TODO +## Differences Between MattairTech and Arduino Cores (TODO) * Table summarizing which core files are modified and by how much * Communications interfaces are mostly unchanged, including USB * Changes due to adding/changing features vs porting to new chip - * All pins (digital and analog) setup in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) * INEN enabled for both input and output (but not analog) * pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected. * Pull resistors enabled only if pin attributes allow and only if pin is not configured as output. * Pull direction (pullup or pulldown) is now set with pinMode only (defaults to pullup if pinMode never called). - * At least on the L21, pin A31 must be set as an input. It is possible that debugger probe detection is being falsely detected (even with a pullup on A31 (SWCLK)), which would change the peripheral mux of A31 to COM. This might not normally be a problem, but one strange effect is that Serial2 loses characters if pin A31 is not set as INPUT. @@ -839,6 +835,7 @@ This fork developed by Justin Mattair of MattairTech LLC. ``` Copyright (c) 2015 Arduino LLC. All right reserved. + Copyright (c) 2017 MattairTech 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 @@ -854,3 +851,16 @@ This fork developed by Justin Mattair of MattairTech LLC. License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ``` + +### Petit FatFS + +Petit FatFs module is an open source software to implement FAT file system to +small embedded systems. This is a free software and is opened for education, +research and commercial developments under license policy of following trems. + +Copyright (C) 2014, ChaN, all right reserved. + +* The Petit FatFs module is a free software and there is NO WARRANTY. +* No restriction on use. You can use, modify and redistribute it for + personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY. +* Redistributions of source code must retain the above copyright notice. From 7c28b408ff8adf44e06d24eafac84c395af90629 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 29 Sep 2017 12:04:18 +0000 Subject: [PATCH 104/124] Added MattairTech Xeno support (64-pin D21/L21/C21) --- CHANGELOG | 17 + README.md | 99 +++-- boards.txt | 172 ++++++++ bootloaders/zero/Makefile | 2 +- .../zero/binaries/sam_ba_Xeno_SAMC21J18A.bin | Bin 0 -> 3892 bytes .../zero/binaries/sam_ba_Xeno_SAMD21J18A.bin | Bin 0 -> 5192 bytes .../zero/binaries/sam_ba_Xeno_SAML21J18B.bin | Bin 0 -> 5128 bytes .../sam_ba_sdcard_Xeno_SAMC21J18A.bin | Bin 0 -> 6828 bytes .../sam_ba_sdcard_Xeno_SAMD21J18A.bin | Bin 0 -> 8116 bytes .../sam_ba_sdcard_Xeno_SAML21J18B.bin | Bin 0 -> 8056 bytes bootloaders/zero/board_definitions.h | 2 + .../board_definitions_Xeno.h | 277 ++++++++++++ bootloaders/zero/build_all_bootloaders.sh | 42 +- platform.txt | 2 +- variants/Xeno/README.md | 293 +++++++++++++ variants/Xeno/debug_scripts/SAMC21J15A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMC21J16A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMC21J17A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMC21J18A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMD21J15A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMD21J16A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMD21J17A.gdb | 31 ++ variants/Xeno/debug_scripts/SAMD21J18A.gdb | 31 ++ variants/Xeno/debug_scripts/SAML21J16B.gdb | 31 ++ variants/Xeno/debug_scripts/SAML21J17B.gdb | 31 ++ variants/Xeno/debug_scripts/SAML21J18B.gdb | 31 ++ .../gcc/16KB_Bootloader/flash_128KB.ld | 217 +++++++++ .../gcc/16KB_Bootloader/flash_256KB.ld | 217 +++++++++ .../gcc/16KB_Bootloader/flash_32KB.ld | 217 +++++++++ .../gcc/16KB_Bootloader/flash_64KB.ld | 217 +++++++++ .../gcc/8KB_Bootloader/flash_128KB.ld | 217 +++++++++ .../gcc/8KB_Bootloader/flash_256KB.ld | 217 +++++++++ .../gcc/8KB_Bootloader/flash_32KB.ld | 217 +++++++++ .../gcc/8KB_Bootloader/flash_64KB.ld | 217 +++++++++ .../gcc/No_Bootloader/flash_128KB.ld | 214 +++++++++ .../gcc/No_Bootloader/flash_256KB.ld | 214 +++++++++ .../gcc/No_Bootloader/flash_32KB.ld | 214 +++++++++ .../gcc/No_Bootloader/flash_64KB.ld | 214 +++++++++ variants/Xeno/openocd_scripts/SAMC21J15A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMC21J16A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMC21J17A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMC21J18A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMD21J15A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMD21J16A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMD21J17A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAMD21J18A.cfg | 30 ++ variants/Xeno/openocd_scripts/SAML21J16B.cfg | 30 ++ variants/Xeno/openocd_scripts/SAML21J17B.cfg | 30 ++ variants/Xeno/openocd_scripts/SAML21J18B.cfg | 30 ++ variants/Xeno/pins_arduino.h | 21 + variants/Xeno/variant.cpp | 215 +++++++++ variants/Xeno/variant.h | 412 ++++++++++++++++++ 52 files changed, 4746 insertions(+), 71 deletions(-) create mode 100755 bootloaders/zero/binaries/sam_ba_Xeno_SAMC21J18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_Xeno_SAMD21J18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_Xeno_SAML21J18B.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMC21J18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD21J18A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAML21J18B.bin create mode 100644 bootloaders/zero/board_definitions/board_definitions_Xeno.h create mode 100644 variants/Xeno/README.md create mode 100644 variants/Xeno/debug_scripts/SAMC21J15A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMC21J16A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMC21J17A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMC21J18A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMD21J15A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMD21J16A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMD21J17A.gdb create mode 100644 variants/Xeno/debug_scripts/SAMD21J18A.gdb create mode 100644 variants/Xeno/debug_scripts/SAML21J16B.gdb create mode 100644 variants/Xeno/debug_scripts/SAML21J17B.gdb create mode 100644 variants/Xeno/debug_scripts/SAML21J18B.gdb create mode 100644 variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_128KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_256KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_32KB.ld create mode 100644 variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_64KB.ld create mode 100644 variants/Xeno/openocd_scripts/SAMC21J15A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMC21J16A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMC21J17A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMC21J18A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMD21J15A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMD21J16A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMD21J17A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAMD21J18A.cfg create mode 100644 variants/Xeno/openocd_scripts/SAML21J16B.cfg create mode 100644 variants/Xeno/openocd_scripts/SAML21J17B.cfg create mode 100644 variants/Xeno/openocd_scripts/SAML21J18B.cfg create mode 100644 variants/Xeno/pins_arduino.h create mode 100644 variants/Xeno/variant.cpp create mode 100644 variants/Xeno/variant.h diff --git a/CHANGELOG b/CHANGELOG index c31fd80e7..f7293e594 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,20 @@ +1.6.16: (identical to beta version 1.6.8-beta-b3) +1.6.8-beta-b3: +* Changed version numbering to match Arduino SAMD core to indicate which upstream changes have been merged in. + Release version 1.6.7 then skips to 1.6.16. Beta version 1.6.8-beta-b3 became release version 1.6.16. +* Added MattairTech Xeno support (64-pin D21, L21, and C21) +* Merged in changes from upstream SAMD CORE 1.6.17 (not released yet): + * Fix changing trigger mode (RISING/FALLING/...) in attachInterrupt(..) during runtime. Thanks @joverbee + * Improved ISR response time. Thanks @joverbee +* Merged in changes from upstream SAMD CORE 1.6.16 2017.08.23: + * PWMs now can perform real 16-bit resolution if analogWriteResolution(16) is set. Thanks @Adminius + * USB CDC: fixed issue of available() getting stuck when receiving ZLP's + * Serial (UART) tx is now buffered. + * Updated Stream and Print class + * Native USB now supports USB Serial Number + * Fixed pgm_read_ptr compatibility macro. Thanks @nkrkv +* Documentation updates + 1.6.8-beta-b2: * Added SD Card firmware loading support to the bootloader (4KB and 8KB) * Removed SDU library, as the bootloader now supports SD cards directly diff --git a/README.md b/README.md index 25cf63b50..2abb06d0e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The MattairTech SAM M0+ Core is a fork from arduino/ArduinoCore-samd on GitHub, which will be used to maintain Arduino support for MattairTech branded boards (see -https://www.mattairtech.com/) as well as "Generic" boards. +https://www.mattairtech.com/) as well as for "Generic" boards. * Supports the SAMD21, SAMD11, SAML21, and SAMC21. * Supports four clock sources (two crystals, internal oscillator, and USB calibrated). @@ -11,14 +11,35 @@ https://www.mattairtech.com/) as well as "Generic" boards. *This core is intended to be installed using Boards Manager (see below). To update from a* *previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update.* -**Differences from Arduino in Versioning** The MattairTech version number does not -correspond to either the IDE version or to the upstream ArduinoCore-samd version. See the -CHANGELOG for details on which upstream commits have been merged in to the MattairTech core. +**New Version Numbering** The MattairTech version number will now track with the Arduino +version number, to better understand which upstream changes have been merged in. See the +CHANGELOG for details on upstream commits and MattairTech additions that have been merged. -## What's New Beta (1.6.8-beta) +## What's New - Release Version (1.6.16) + +* Changed version numbering to match Arduino SAMD core to indicate which upstream changes have been merged in. + Release version 1.6.7 then skips to 1.6.16. Beta version 1.6.8-beta-b3 became 1.6.16. +* Added MattairTech Xeno support (64-pin D21, L21, and C21) +* Merged in changes from upstream SAMD CORE 1.6.17 (not released yet): + * Fix changing trigger mode (RISING/FALLING/...) in attachInterrupt(..) during runtime. Thanks @joverbee + * Improved ISR response time. Thanks @joverbee +* Merged in changes from upstream SAMD CORE 1.6.16 2017.08.23: + * PWMs now can perform real 16-bit resolution if analogWriteResolution(16) is set. Thanks @Adminius + * USB CDC: fixed issue of available() getting stuck when receiving ZLP's + * Serial (UART) tx is now buffered. + * Updated Stream and Print class + * Native USB now supports USB Serial Number + * Fixed pgm_read_ptr compatibility macro. Thanks @nkrkv +* Documentation updates + + +## What's New - Beta Version (1.6.8-beta) **See Beta Builds section for installation instructions.** +**1.6.8-beta-b3:** +*Beta version 1.6.8-beta-b3 became release version 1.6.16. See above* + **1.6.8-beta-b2:** * Added SD Card firmware loading support to the bootloader (4KB and 8KB) * Removed SDU library, as the bootloader now supports SD cards directly @@ -57,47 +78,29 @@ CHANGELOG for details on which upstream commits have been merged in to the Matta * Merged in all changes from upstream through SAMD CORE 1.6.14 (April 2017) -## What's New Release (1.6.6) -**This is out of date, use the beta for now.** - -* 1.6.6-mt3: - * Fixes compilation with CDC_UART and CDC_ONLY settings - -* 1.6.6-mt2: - * Changes the default Communication setting to CDC_UART (from CDC_HID_UART) - -* 1.6.6-mt1: - * New documentation section 'Special Notes'. Please read! - * Updated ASCII pinouts to be more readable and less ambiguous. - * Updated the Signed driver for Windows (extras directory) (see CHANGELOG for details) - * Merged in changes from upstream (see CHANGELOG for details) - * Fix warnings about deprecated recipe.ar.pattern - * Merged in changes from upstream SAMD CORE 1.6.2 2015.11.03 (see CHANGELOG for details) - - ## Features Summary Feature | 21J (64 pin) | 21G (48 pin) | 21E (32 pin) | D11 (24, 20, or 14 pin) ----------------|---------------------------------------|---------------------------------------|---------------------------------------|--------------------------------------- -Board Variants | New board coming June, Generic 21J | Arduino Zero, Arduino M0, Generic 21G | MT-D21E, Generic 21E | MT-D11, Generic D11D14AM, Generic D11D14AS, Generic D11C14A +Board Variants | MattairTech Xeno, Generic 21J | Arduino Zero, Arduino M0, Generic 21G | MT-D21E, Generic 21E | MT-D11, Generic D11D14AM, Generic D11D14AS, Generic D11C14A Processor | 48 MHz 32-bit ARM Cortex M0+ | 48 MHz 32-bit ARM Cortex M0+ | 48 MHz 32-bit ARM Cortex M0+ | 48 MHz 32-bit ARM Cortex M0+ Flash Memory | Up to 256KB (L21/C21 have RWW) | Up to 256KB (L21/C21 have RWW) | Up to 256KB (L21/C21 have RWW) | 16 KB (4KB used by bootloader) SRAM | Up to 32KB (plus <=8KB LPSRAM on L21) | Up to 32KB (plus <=8KB LPSRAM on L21) | Up to 32KB (plus <=8KB LPSRAM on L21) | 4 KB Digital Pins | 52 (51 for L21) | 38 (37 for L21) | 26 (25 for L21) | 24-pin: 21, 20-pin: 17, 14-pin: 11 -Analog Inputs | 20 channels, 12-bit | 14 channels, 12-bit | 10 channels, 12-bit | 24-pin: 10, 20-pin: 8, 14-pin: 5 (12-bit) +Analog Inputs | 18 channels, 12-bit | 14 channels, 12-bit | 10 channels, 12-bit | 24-pin: 10, 20-pin: 8, 14-pin: 5 (12-bit) Analog Outputs | One 10-bit (two 12-bit on L21) | One 10-bit (two 12-bit on L21) | One 10-bit (two 12-bit on L21) | One 10-bit PWM Outputs | 18 | 14 | 14 | 8 (6 for 14-pin) Interrupts | 16 | 16 | 16 | 8 (7 for 14-pin) USB | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device and Host (not C21) | Full Speed Device SERCOM* | 6 | 6 | 4 (6 for L21) | 3 (2 for 14-pin) -UART (Serial)* | Up to 6 | Up to 6 | Up to 4 (up to 6 for L21) | Up to 2 -SPI* | Up to 3 | Up to 2 | Up to 2 | Up to 1 -I2C (WIRE)* | Up to 3 | Up to 2 | Up to 2 | Up to 1 +UART (Serial)* | Up to 3 (will add more later) | Up to 6 | Up to 4 (up to 6 for L21) | Up to 2 +SPI* | Up to 2 (will add more later) | Up to 2 | Up to 2 | Up to 1 +I2C (WIRE)* | Up to 2 (will add more later) | Up to 2 | Up to 2 | Up to 1 I2S | Present on the D21 only | Present on the D21 only | Present on the D21 only | Not present Voltage | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V (2.7V-5.5V for the C21) | 1.62V-3.63V I/O Pin Current | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA@5V | 7 mA -*Note that the maximum number of UART/SPI/I2C is the number of SERCOM. The number listed above for UART/SPI/I2C indicated how many are configurable through the Arduino IDE menu.* +*Note that the maximum number of UART/SPI/I2C is the number of SERCOM. The number listed above for UART/SPI/I2C indicated how many are currently configurable through the Arduino IDE menu.* @@ -106,6 +109,8 @@ I/O Pin Current | D21: 7mA, L21: 5mA, C21: 6mA@5V | D21: 7mA, L21: 5mA, C21: 6mA Pin configuration and peripheral assignment information is now in the README.md for each board variant. README.md also now includes technical information on the new PinDescription table format. +* [MattairTech Xeno (SAMx21Jxxx)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/Xeno/README.md) + * [MattairTech MT-D21E Rev B (SAMx21Exxx)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/MT_D21E_revB/README.md) * [MattairTech MT-D21E Rev A (SAMD21ExxA)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/MT_D21E/README.md) @@ -114,17 +119,15 @@ README.md also now includes technical information on the new PinDescription tabl * [MattairTech Generic D11C14A](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/Generic_D11C14A/README.md) -* MattairTech x21J based board (coming July) - -* MattairTech Generic D11D14AS (coming soon) +* MattairTech Generic D11D14AS (future) -* MattairTech Generic D11D14AM (coming soon) +* MattairTech Generic D11D14AM (future) -* MattairTech Generic x21E (coming soon) +* MattairTech Generic x21E (future) -* MattairTech Generic x21G (coming soon) +* MattairTech Generic x21G (future) -* MattairTech Generic x21J (coming soon) +* MattairTech Generic x21J (future) * [Arduino Zero (arduino.cc)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/arduino_zero/README.md) @@ -207,19 +210,19 @@ and SRAM usage by allowing CDC to be disabled (or USB completely disabled). There are up to four clock source choices, depending on board features and microcontroller. Since currently the cpu must run at 48MHz, the PLL or DFLL must be used (the SAMC can use OSC48M). -### 32KHZ_CRYSTAL (default) +#### 32KHZ_CRYSTAL (default) * Uses both XOSC32K and FDPLL96M * High long-term accuracy, slow startup, medium current (PLL) -### HIGH_SPEED_CRYSTAL +#### HIGH_SPEED_CRYSTAL * Uses both XOSC and FDPLL96M * High accuracy, medium startup, high current (XOSC and PLL) -### INTERNAL_OSCILLATOR +#### INTERNAL_OSCILLATOR * Uses DFLL48M in open-loop mode (SAMC uses OSC48M) * Low accuracy, fast startup, medium-low current (low current with SAMC) -### INTERNAL_USB_CALIBRATED_OSCILLATOR (not available with SAMC) +#### INTERNAL_USB_CALIBRATED_OSCILLATOR (not available with SAMC) * Uses DFLL48M in closed-loop mode * High accuracy, medium-fast startup, medium current @@ -346,10 +349,10 @@ AR_EXTERNAL_REFB | REFB | AR_INTREF_1V25 | 1.25V | AR_IN ### Common Settings -AR_INTERNAL = AR_INTERNAL_INTVCC0 -AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0 -AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1 -AR_EXTERNAL = AR_EXTERNAL_REFA +* AR_INTERNAL = AR_INTERNAL_INTVCC0 +* AR_INTERNAL2V23 = AR_INTERNAL_INTVCC0 +* AR_INTERNAL1V65 = AR_INTERNAL_INTVCC1 +* AR_EXTERNAL = AR_EXTERNAL_REFA *When using AR_INTERNAL2V23 or AR_INTERNAL1V65, these voltages are correct only when Vcc = 3.3V)* @@ -406,9 +409,8 @@ TODO ## Differences Between MattairTech and Arduino Cores (TODO) -* Table summarizing which core files are modified and by how much * Communications interfaces are mostly unchanged, including USB -* Changes due to adding/changing features vs porting to new chip +* All pins have high drive strength enabled by default * All pins (digital and analog) setup in STARTUP mode (enable INEN and set default pull direction to pullup (pullup will not be enabled)) * INEN enabled for both input and output (but not analog) * pinPeripheral now handles disabling the DAC (if active). Note that on the L21, the DAC output would @@ -419,6 +421,8 @@ TODO detected (even with a pullup on A31 (SWCLK)), which would change the peripheral mux of A31 to COM. This might not normally be a problem, but one strange effect is that Serial2 loses characters if pin A31 is not set as INPUT. So, the startup code calls pinMode(31, INPUT). +* Todo: Table summarizing which core files are modified and by how much +* Todo: List changes due to adding/changing features vs porting to new chip ## Serial Monitor @@ -754,12 +758,13 @@ from the MT-D11 variant. ### Under Development * PlatformIO support +* SAM D51 (M4F) support (pin compatible with D21, similar peripherals and pin mapping) * Fix programming port for Arduino Zero and M0 board variants * Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) ### Possible Future -* Features for lower power consumption (library?) Summer 2017? +* Features for lower power consumption (library?) Fall 2017? * Reliability and security enhancements * USB Host mode CDC ACM (partially complete; BSD-like license?) * SD card library? Port of FatFS and/or Petit FatFS? diff --git a/boards.txt b/boards.txt index bfda423a2..b4b421e0c 100644 --- a/boards.txt +++ b/boards.txt @@ -21,6 +21,178 @@ menu.serial=Serial Config menu.bootloader=Bootloader Size +# MattairTech Xeno +mattairtech_xeno.name=MattairTech Xeno +mattairtech_xeno.vid.0=0x16D0 +mattairtech_xeno.pid.0=0x0557 +mattairtech_xeno.vid.1=0x16D0 +mattairtech_xeno.pid.1=0x0856 +mattairtech_xeno.vid.2=0x16D0 +mattairtech_xeno.pid.2=0x0B41 +mattairtech_xeno.vid.3=0x16D0 +mattairtech_xeno.pid.3=0x0B40 +mattairtech_xeno.vid.4=0x16D0 +mattairtech_xeno.pid.4=0x0A0C +mattairtech_xeno.vid.5=0x16D0 +mattairtech_xeno.pid.5=0x0856 +mattairtech_xeno.build.mcu=cortex-m0plus +mattairtech_xeno.build.f_cpu=48000000L +mattairtech_xeno.build.usb_product="Xeno" +mattairtech_xeno.build.usb_manufacturer="MattairTech LLC" +mattairtech_xeno.build.board=SAMD_ZERO +mattairtech_xeno.build.core=arduino +mattairtech_xeno.build.variant=Xeno +mattairtech_xeno.build.variant_system_lib= +mattairtech_xeno.build.vid=0x16D0 +mattairtech_xeno.upload.protocol=sam-ba +mattairtech_xeno.bootloader.tool=arduino:openocd +mattairtech_xeno.menu.clock.crystal_32k=32KHZ_CRYSTAL +mattairtech_xeno.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +mattairtech_xeno.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +mattairtech_xeno.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +mattairtech_xeno.menu.clock.internal=INTERNAL_OSCILLATOR +mattairtech_xeno.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +mattairtech_xeno.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +mattairtech_xeno.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +mattairtech_xeno.menu.cpu.samd21j18a=SAMD21J18A +mattairtech_xeno.menu.cpu.samd21j18a.upload.maximum_size=253952 +mattairtech_xeno.menu.cpu.samd21j18a.build.extra_flags=-D__SAMD21J18A__ {build.usb_flags} +mattairtech_xeno.menu.cpu.samd21j18a.build.ldscript=flash_256KB.ld +mattairtech_xeno.menu.cpu.samd21j18a.build.openocdscript=openocd_scripts/SAMD21J18A.cfg +mattairtech_xeno.menu.cpu.samd21j18a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMD21J18A.bin +mattairtech_xeno.menu.cpu.samd21j17a=SAMD21J17A +mattairtech_xeno.menu.cpu.samd21j17a.upload.maximum_size=122880 +mattairtech_xeno.menu.cpu.samd21j17a.build.extra_flags=-D__SAMD21J17A__ {build.usb_flags} +mattairtech_xeno.menu.cpu.samd21j17a.build.ldscript=flash_128KB.ld +mattairtech_xeno.menu.cpu.samd21j17a.build.openocdscript=openocd_scripts/SAMD21J17A.cfg +mattairtech_xeno.menu.cpu.samd21j17a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMD21J17A.bin +mattairtech_xeno.menu.cpu.samd21j16a=SAMD21J16A +mattairtech_xeno.menu.cpu.samd21j16a.upload.maximum_size=57344 +mattairtech_xeno.menu.cpu.samd21j16a.build.extra_flags=-D__SAMD21J16A__ {build.usb_flags} +mattairtech_xeno.menu.cpu.samd21j16a.build.ldscript=flash_64KB.ld +mattairtech_xeno.menu.cpu.samd21j16a.build.openocdscript=openocd_scripts/SAMD21J16A.cfg +mattairtech_xeno.menu.cpu.samd21j16a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMD21J16A.bin +mattairtech_xeno.menu.cpu.samd21j15a=SAMD21J15A +mattairtech_xeno.menu.cpu.samd21j15a.upload.maximum_size=24576 +mattairtech_xeno.menu.cpu.samd21j15a.build.extra_flags=-D__SAMD21J15A__ {build.usb_flags} +mattairtech_xeno.menu.cpu.samd21j15a.build.ldscript=flash_32KB.ld +mattairtech_xeno.menu.cpu.samd21j15a.build.openocdscript=openocd_scripts/SAMD21J15A.cfg +mattairtech_xeno.menu.cpu.samd21j15a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMD21J15A.bin +mattairtech_xeno.menu.cpu.saml21j18b=SAML21J18B +mattairtech_xeno.menu.cpu.saml21j18b.upload.maximum_size=253952 +mattairtech_xeno.menu.cpu.saml21j18b.build.extra_flags=-D__SAML21J18B__ {build.usb_flags} +mattairtech_xeno.menu.cpu.saml21j18b.build.ldscript=flash_256KB.ld +mattairtech_xeno.menu.cpu.saml21j18b.build.openocdscript=openocd_scripts/SAML21J18B.cfg +mattairtech_xeno.menu.cpu.saml21j18b.bootloader.file=zero/binaries/sam_ba_Xeno_SAML21J18B.bin +mattairtech_xeno.menu.cpu.saml21j17b=SAML21J17B +mattairtech_xeno.menu.cpu.saml21j17b.upload.maximum_size=122880 +mattairtech_xeno.menu.cpu.saml21j17b.build.extra_flags=-D__SAML21J17B__ {build.usb_flags} +mattairtech_xeno.menu.cpu.saml21j17b.build.ldscript=flash_128KB.ld +mattairtech_xeno.menu.cpu.saml21j17b.build.openocdscript=openocd_scripts/SAML21J17B.cfg +mattairtech_xeno.menu.cpu.saml21j17b.bootloader.file=zero/binaries/sam_ba_Xeno_SAML21J17B.bin +mattairtech_xeno.menu.cpu.saml21j16b=SAML21J16B +mattairtech_xeno.menu.cpu.saml21j16b.upload.maximum_size=57344 +mattairtech_xeno.menu.cpu.saml21j16b.build.extra_flags=-D__SAML21J16B__ {build.usb_flags} +mattairtech_xeno.menu.cpu.saml21j16b.build.ldscript=flash_64KB.ld +mattairtech_xeno.menu.cpu.saml21j16b.build.openocdscript=openocd_scripts/SAML21J16B.cfg +mattairtech_xeno.menu.cpu.saml21j16b.bootloader.file=zero/binaries/sam_ba_Xeno_SAML21J16B.bin +mattairtech_xeno.menu.cpu.samc21j18a=SAMC21J18A +mattairtech_xeno.menu.cpu.samc21j18a.upload.maximum_size=253952 +mattairtech_xeno.menu.cpu.samc21j18a.build.extra_flags=-D__SAMC21J18A__ +mattairtech_xeno.menu.cpu.samc21j18a.build.ldscript=flash_256KB.ld +mattairtech_xeno.menu.cpu.samc21j18a.build.openocdscript=openocd_scripts/SAMC21J18A.cfg +mattairtech_xeno.menu.cpu.samc21j18a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMC21J18A.bin +mattairtech_xeno.menu.cpu.samc21j17a=SAMC21J17A +mattairtech_xeno.menu.cpu.samc21j17a.upload.maximum_size=122880 +mattairtech_xeno.menu.cpu.samc21j17a.build.extra_flags=-D__SAMC21J17A__ +mattairtech_xeno.menu.cpu.samc21j17a.build.ldscript=flash_128KB.ld +mattairtech_xeno.menu.cpu.samc21j17a.build.openocdscript=openocd_scripts/SAMC21J17A.cfg +mattairtech_xeno.menu.cpu.samc21j17a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMC21J17A.bin +mattairtech_xeno.menu.cpu.samc21j16a=SAMC21J16A +mattairtech_xeno.menu.cpu.samc21j16a.upload.maximum_size=57344 +mattairtech_xeno.menu.cpu.samc21j16a.build.extra_flags=-D__SAMC21J16A__ +mattairtech_xeno.menu.cpu.samc21j16a.build.ldscript=flash_64KB.ld +mattairtech_xeno.menu.cpu.samc21j16a.build.openocdscript=openocd_scripts/SAMC21J16A.cfg +mattairtech_xeno.menu.cpu.samc21j16a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMC21J16A.bin +mattairtech_xeno.menu.cpu.samc21j15a=SAMC21J15A +mattairtech_xeno.menu.cpu.samc21j15a.upload.maximum_size=24576 +mattairtech_xeno.menu.cpu.samc21j15a.build.extra_flags=-D__SAMC21J15A__ +mattairtech_xeno.menu.cpu.samc21j15a.build.ldscript=flash_32KB.ld +mattairtech_xeno.menu.cpu.samc21j15a.build.openocdscript=openocd_scripts/SAMC21J15A.cfg +mattairtech_xeno.menu.cpu.samc21j15a.bootloader.file=zero/binaries/sam_ba_Xeno_SAMC21J15A.bin +mattairtech_xeno.menu.bootloader.8kb=8KB_BOOTLOADER +mattairtech_xeno.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +mattairtech_xeno.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +mattairtech_xeno.menu.bootloader.8kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_xeno.menu.bootloader.8kb.upload.use_1200bps_touch=true +mattairtech_xeno.menu.bootloader.8kb.upload.wait_for_upload_port=true +mattairtech_xeno.menu.bootloader.8kb.upload.native_usb=true +mattairtech_xeno.menu.bootloader.16kb=16KB_BOOTLOADER +mattairtech_xeno.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +mattairtech_xeno.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +mattairtech_xeno.menu.bootloader.16kb.upload.tool=MattairTech_Arduino:bossac +mattairtech_xeno.menu.bootloader.16kb.upload.use_1200bps_touch=true +mattairtech_xeno.menu.bootloader.16kb.upload.wait_for_upload_port=true +mattairtech_xeno.menu.bootloader.16kb.upload.native_usb=true +mattairtech_xeno.menu.bootloader.0kb=NO_BOOTLOADER +mattairtech_xeno.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mattairtech_xeno.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mattairtech_xeno.menu.bootloader.0kb.upload.tool=arduino:openocd +mattairtech_xeno.menu.bootloader.0kb.upload.use_1200bps_touch=false +mattairtech_xeno.menu.bootloader.0kb.upload.wait_for_upload_port=false +mattairtech_xeno.menu.bootloader.0kb.upload.native_usb=false +mattairtech_xeno.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +mattairtech_xeno.menu.serial.one_uart.build.serialcom_uart=ONE_UART +mattairtech_xeno.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +mattairtech_xeno.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +mattairtech_xeno.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +mattairtech_xeno.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +mattairtech_xeno.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_xeno.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_xeno.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +mattairtech_xeno.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +mattairtech_xeno.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +mattairtech_xeno.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +mattairtech_xeno.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +mattairtech_xeno.menu.serial.two_uart.build.serialcom_uart=TWO_UART +mattairtech_xeno.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +mattairtech_xeno.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +mattairtech_xeno.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +mattairtech_xeno.menu.serial.three_uart.build.serialcom_uart=THREE_UART +mattairtech_xeno.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +mattairtech_xeno.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +mattairtech_xeno.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +mattairtech_xeno.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +mattairtech_xeno.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +mattairtech_xeno.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +mattairtech_xeno.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +mattairtech_xeno.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +mattairtech_xeno.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +mattairtech_xeno.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +mattairtech_xeno.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +mattairtech_xeno.menu.serial.no_uart.build.serialcom_uart=NO_UART +mattairtech_xeno.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +mattairtech_xeno.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +mattairtech_xeno.menu.usb.cdc=CDC_ONLY +mattairtech_xeno.menu.usb.cdc.build.usbcom=CDC_ONLY +mattairtech_xeno.menu.usb.cdc.build.pid=0x0557 +mattairtech_xeno.menu.usb.cdc_hid=CDC_HID +mattairtech_xeno.menu.usb.cdc_hid.build.usbcom=CDC_HID +mattairtech_xeno.menu.usb.cdc_hid.build.pid=0x0856 +mattairtech_xeno.menu.usb.withcdc=WITH_CDC +mattairtech_xeno.menu.usb.withcdc.build.usbcom=WITH_CDC +mattairtech_xeno.menu.usb.withcdc.build.pid=0x0B41 +mattairtech_xeno.menu.usb.hid=HID_ONLY +mattairtech_xeno.menu.usb.hid.build.usbcom=HID_ONLY +mattairtech_xeno.menu.usb.hid.build.pid=0x0B40 +mattairtech_xeno.menu.usb.nocdc=WITHOUT_CDC +mattairtech_xeno.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +mattairtech_xeno.menu.usb.nocdc.build.pid=0x0A0C +mattairtech_xeno.menu.usb.none=USB_DISABLED +mattairtech_xeno.menu.usb.none.build.usbcom=USB_DISABLED +mattairtech_xeno.menu.usb.none.build.pid=0x0856 + + # MattairTech MT-D21E (rev B) mattairtech_mt_d21e_revb.name=MattairTech MT-D21E (rev B) mattairtech_mt_d21e_revb.vid.0=0x16D0 diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index 1b2d0c3f9..0922d376a 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -25,7 +25,7 @@ SDCARD?=SDCARD_DISABLED # ----------------------------------------------------------------------------- # Boards definitions: -# MT_D21E_rev_A, MT_D21E_rev_B, MT_D11 +# Xeno, MT_D21E_rev_A, MT_D21E_rev_B, MT_D11 # arduino_zero, arduino_mkrzero, arduino_mkr1000, arduino_mkrfox1200, genuino_mkr1000, genuino_zero, arduino_m0, arduino_m0_pro # Generic_x21E, Generic_x21G, Generic_x21J, Generic_D11D14AM, Generic_D11D14AS, Generic_D11C14A BOARD_ID?=MT_D21E_rev_B diff --git a/bootloaders/zero/binaries/sam_ba_Xeno_SAMC21J18A.bin b/bootloaders/zero/binaries/sam_ba_Xeno_SAMC21J18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..1d34d96c43c5fb0a47a8dcf67d1afa9c553ddfe7 GIT binary patch literal 3892 zcmaJ^e|!^Fw!e2KX@2xq(iTY55zg()h;Wg>$9aGBC?1qYmFNewM%&56CNU&x;)FTbr3X#^6x#ym9@9oI*$TovO=w3iM;Q#wg`6vD~XwTIkWQwHK(;{-|BrS_vL`>sH zGCF{1S}^tJA!JkSQP~LTBYNPIF`Zu@P$hJJl2`j_Fp6T`b^88j?Oj<5=$Y>5nj*G< zjWvqMsh1`MEn<%Nf@L6V748XYY$nbqV$VR>C|JdWQ-5k)&?I`9XxJp&mK!IJ2~wg- ze38i;F!?p&(l9E^KAk6O%dk{igk)_|o zqbuEbwV9N#2QS`)eWCyI;@ONVmeNHtqcitlitb@F_Oi0 ztAI8{!$MuOwjBI1vmtvkud$hZ&0I5&;hV)aw;Fvdi!+0`&@7n6BRb7VW5CZF19~PY z8G@*A?lYaOe(+Nl)CbHQSbPd*_M%xx4_^v-Z|Pu1Ovnqq+0YYbiL5`S;+X&~fB<9# zv;9?(7Z{C{70hD0m@LUCXV(9QNyZQ@S=yOvr@n2{RAh2Pag^9Fq>;Orn**qjICL|f zii2gF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!Xww-BR1w-vk!QtFnRNSzGT6QzeJAheEZdx)-AvOz_(>5Ge7;N@=(zmd22O~ zt*l#GG+#UW%&was^sN8zwV%Y-B=7lb`d43;{Lj?Rw7#(qJ+^AqnA*w(^{0MzH0#FX zOGkPxz4Y?_J-cT&{nVc(PUNGO^ZFO6b~v6pw&=|Lm&Xs^=osw%c+cjKp9#)yxo_Fn z)mM!%>-)}4)st>z|M0}QhU4$_ckKP|tw%SMJga+R>7pOizd60FOr{QIOt>;rdHBS$ wU-!QI(ScL13~d{?eCnDXH?Dl7Yf^Zol$98-W`I6V3m4D~)C%oc>Hz%y7r0z*p8x;= literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_Xeno_SAMD21J18A.bin b/bootloaders/zero/binaries/sam_ba_Xeno_SAMD21J18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..6beceab18eb46e1f716c06fd54f3d18b33945b7d GIT binary patch literal 5192 zcmaJ^4OkTAzJF(CzgSR~4|R4Kadrk3Sj&agRP1!dU4z{nKqD<&(FUT5GvkO^*F4s7m-2?7r{QQ(db-iES^{P6e~@~*&vT#4!*AY? z|Nnj8|NH-Z_tqLjPtzlm1-J|F|NZ6siar_odyNQL!iGXtMh;_C&m#vO(Rq=APGKx7 zSy}{yXl=i1DF~UuCZH1$qu1oqIE-FG)W!ywMUln=Q%h_9&%Bkeu54(nB~1Hh-YlbR zQ*?}UuXm@m zS-d*AvKdWC>`0aM6R>E022%7HsS+-ixZ9d>iIQ>o<-wiJa+=)a#^F9X#wJ)mu2mol zc1Irig_&pu4t*(1h&rlqi;Xhb)m)Q%TqH>Eu4}AGVjq+^dn&)9dUo|fF{P-LzMBi` z4W5OZzdNUdjyABp;QdU2Z>Svu@6+U)p{jmWrqR3NK>fi zo_@MkYIz<*w5qDxo`|WF}p^x_4`9Ki$Jkm$=nB69uJvOOHjv8-$I@&+Ro-EFeH*q01it6d- z6YSiWEEFAWug6LfjoBzlFhLCSBoj#<>jta5hB0$C(7e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mO(&o7&k0OfG;-y4=7{ZBc75L6w-dive5L5) z*ITw6`D*XE=fn14F>4Y)g-ls0Ouq?u?nD%ad%)dLFgFfNAi9(?Oi-GYkmRXJ803>gxy- iQsZ>sq-I!b)UU-kt--Yhq4&U9;WbnR-x=B%{{9E$x#Ii) literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_Xeno_SAML21J18B.bin b/bootloaders/zero/binaries/sam_ba_Xeno_SAML21J18B.bin new file mode 100755 index 0000000000000000000000000000000000000000..c81908bb08eb878dc290365f617a598f26b182d7 GIT binary patch literal 5128 zcmaJ_3wRVowyx@)_k?8f06LQfX1W6;8I(x|Bm^JL3??(vNkjwIgUGB>>T^t*<$(*;N%_iNH8>@^C(y~q7 z>dol1`E_!28=8`GDMQvz!SUj3r0BCVBto9&?QA0?S|;Qd5-VHeEV( z>p>TMQy<4OIfx^mEk#LDN4GTEX_HeeFnK4%!j66QEvr-6`y|ep!SAV^Tf0O|FY9pJ z%7yg?-x6U-&2%ouS5cMXrvyONVlmmD!-XdvC16yj5X06mSs@_y-deU+ucWWLWFRg$ zXw)}m$WbS?w_xN@RdrVj>`iIyyHFou$y#5nj>kg1V3i3b-Dj1gl8)k;psX#L&ExFW z8rIMFTB}gss6ob$`YeM^o`X}NzB>lDu-$sQoZ+LTRyl6G{ui2`z+{OFt*P7|FN*7( zElC77ArHmJG5hhN6r&5pNwxu7d|9O3mzcXPQ{Kc_I6GKh=N#p?`0P@}QhP&^bBE8q z+1`K?6gk5T>bpzT?1*%TGaw2XP$t?O_MiuW%@tdZ5sj*e*^t_sb zx+ZHwQWFXCRSRpZK?@hEdIVpi2|aH&&?fk9@sfThp#w@noD_BO zVP{CpE7!ag5_L|EK32oQX&$QzL(E~OwYF6zV7yh@SBIHY?@%nvPAKcvx7OxKF8PvC zcY)?ZBF)>q{qd~QFvB)B``CK5|D2l1+r=>3l-xw@N9n#RRbzN|X%pzCaZjpjqm~0& z`wi8`yOyH94+hu`Nldd(r;R_J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X)MKBxJeHIA4zmXtnT^zK}(F0gi!)M{HB+!t$g!Vui~A-HSksUCd8 z^v2UL<3HPT@({WY;I{y~01g7wjzDPMNQ9O`!WF*nF1oA){-xKU(vry~6_Y1SK=Umb zXaPVyV&FL)m5nPw3#*nazOVVNyC=_IP=Bk&tjo&MO(hTdpPl_*d?I36Rk$&{?T!~8 zeS5F`>G21kZnV_jk@;H|2H5p6Bj-=z)_p?=5l{lT-QhD(Z!^k6rrLC!c&( zv^T9=SRZ=o$rbzWI(*yDvvQ}GjhmAn$$UnA^T)5gx%ip$t;v61@QnCa>&9KH{_*0O zZRzsZw`cuy_wlH88+xbY1g)E0;IEGSjz6%bz3oERk(Z_&qzX(Pc{P)C-hJ7P%xqa!<5!Dqp*YyAX!_4#JPk*ra^uv!F*t2WK{NDx* z;mth0B1 zRr|^A?sa=lJ@w)GF%KB;T)gOpn(b596f4x*>7##~uHO3D1K)K1{k6CH9~*q;n!6^h ym^bU*+uFv(rpuWF`I-fo^7IIqr=fYXXH?C-p==x*nsuc;+(gZQQ>7uo?|%Ro)5ydC literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD21J18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD21J18A.bin new file mode 100755 index 0000000000000000000000000000000000000000..d8f64bb02fee2b7a93123eea9435f52fe7ec5297 GIT binary patch literal 8116 zcmaJmYj_k@vgdTqE0aJb51?nJ6MCitOfnJj0E~dx>Bf*uC&*Jn2-pd%w-Zr@hinH0 z29Py~u8@d^01Cthh`1OTT*a&b+^bx5oer`lfNN*LjmomdMV%1B^sNrKpFi$*^QHPc zs?Ire>QvRKQ!}t0G4sp_-3?Fz@c;dl{R%$|>a&s&a)d3Vtb+Vj)hr@E5iu1b4ZV+9 zHt1+m5Mqq^3PvJi3)=usMy$oQ5`)58Ov*;v0=+2GG~L$LUi1s?V=!*jt+9?UQ^JUL z1!dXPkpW6cRyI-{t*&5Nz{EHtyMps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`I z@c6s*h`+k)T&b<*vU2q5+(+3L7yU&T44AfL?eg!x@3kjS z9+Usx|Lu2qDOTda{3Y(t63E-H|E%WbR$J3=UavgZb!PAT>eYV?)MWam(>k2?uQeZT zcwzoyOY2_bL!QUXyZ`<5CqEqh^NzE3%v?V?d3>(n^M`-DclVtqidVeZ__F<(!pFag zLfDEYeLx8lnZYpS*p9;Wc)(^vX_cj*s5m29isV>#@7>xaru{ckq@zOLS} z$WkynCHwmMFFtzj+H;p1Ix4o$dB<_&rL~Vga-r;L_?zkQi~ zEUru3QTpsNo8EZf?5ghI%^b_ZMv;VOCdFiR>lRI7ivzzB-fC)Vy>{^2>$kj5o!LCF>gsF6&XlX}p8OeH z+LB+_+`0an&_^#G+P&?u2Y$Hy>zuO*fBxt6_cQmUZPDGkVZoZrrTY2jUmkgL&*Oi5 z=I+5wk%=G9{rt@2|CzbVaD4n-_dfjaxZ>$|mi66#I`OAzm;Sov(zYkwI&ye^#XThk zX^Plw>o;vJJm}f@QPufdFQ;GoX?t(SJ4f2zdC0%Ca#r2=#_ud)$LrZGv!`B9y0Z4m z^1r>(wf)$|XHV~#{D^VwnyTB%4$N)JQK*yg8Q;!RSAO!yR~>(N`@O!WhM%ACz|2j{ z7H(M8I<<42oH&%OX@DsW{*i6I1ua`Nzi8=g`BS;lg=6(t6`2Vis38jGn{^PJX<0yh zCbD8(CIJ-#!um{%uu + +/* The SAM-BA interface, which is used with both USB CDC and UART (TTL + * serial), can operate in either binary (default) or terminal mode. If + * TERMINAL_MODE_ENABLED is defined, additional terminal handling code + * (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled + * in. To switch to terminal mode, type 'T#' (you should then see a prompt). + * Then, type 'V#' to show version information. See README.md for more commands. + * Size: ~228B. Enabled by default. Disable with 4KB bootloader. + */ +#define TERMINAL_MODE_ENABLED + +/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in. + * See "SD Card Bootloader" section. This define can also be set from the + * makefile (so it can be used with the build_all_bootloaders.sh script). + * Size: ~2788B. Disabled by default. Available with 4KB bootloader. + */ +#ifndef SDCARD_ENABLED +//#define SDCARD_ENABLED +#endif + +/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set. + * When setting SDCARD_SPI_PADx defines, consult the appropriate header file + * from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS- + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ + * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. + * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and + * associated pins are only initialized if either pin is active. + */ +#define SDCARD_SPI_SERCOM_INSTANCE 5 +#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 +#define SDCARD_SPI_PAD0 PINMUX_PB30D_SERCOM5_PAD0 +#define SDCARD_SPI_PAD1 PINMUX_UNUSED +#define SDCARD_SPI_PAD2 PINMUX_PB22D_SERCOM5_PAD2 +#define SDCARD_SPI_PAD3 PINMUX_PB23D_SERCOM5_PAD3 + +/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN + * must also be defined. PORT can be 0 (Port A) or 1 (Port B). + */ +#define SDCARD_SPI_CS_PORT (1) +#define SDCARD_SPI_CS_PIN (31) + +/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can + * optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must + * also be defined. See "SD Card External Pins" section for more information. PORT + * can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used. + */ +#define SDCARD_USE_PIN1 +#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN1_PORT (0) +#define SDCARD_PIN1_PIN (3) +#define SDCARD_PIN1_CONFIG INPUT_PULLUP + +//#define SDCARD_USE_PIN2 +#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW +#define SDCARD_PIN2_PORT (0) +#define SDCARD_PIN2_PIN (4) +#define SDCARD_PIN2_CONFIG INPUT_PULLUP + +/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH + * after programming will not occur, nor will the initial check to see if the + * FLASH contents are already the same as the file. + * Size: ~284B. By default, this is not defined, so verification will be enabled. + */ +//#define SDCARD_VERIFICATION_DISABLED + +/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not + * automatically run the firmware that was just installed. Instead, the LED will + * blink with status code LED_STATUS_SUCCESS. This option also applies when the + * binary file on the SD card already matches the installed firmware. In this + * case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES. + * By default, SDCARD_AUTORUN_DISABLED is defined. +*/ +#define SDCARD_AUTORUN_DISABLED + +/* Two different binary files can be loaded, depending on external pin settings. + * By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be + * overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY. + * If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be + * loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is + * loaded when PIN2 is enabled. If only one pin or no pin is configured, only + * SDCARD_FILENAME_PRIMARY is loaded. + */ +//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN" +//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN" + +/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or + * SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except + * when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21 + * lacks USB, so set to SAM_BA_UART_ONLY in this case. By default, + * SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21). + */ +#if (SAMC21) + #define SAM_BA_INTERFACE SAM_BA_UART_ONLY +#else + #define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY +#endif + +/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which + * SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one + * interface is used, then the pin acts as an enable. In both cases, the value of + * SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of + * PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and + * PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are + * enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP, + * or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the + * device is not selected/enabled. If no interface is selected by the pin, the LED + * will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE. + * Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined. + */ +//#define SAM_BA_INTERFACE_USE_PIN +#if (SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES) + // The pin functions as a toggle between the two interfaces + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_USBCDC_LOW +#else + // The pin functions as an enable for the compiled interface + #define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#endif +#define SAM_BA_INTERFACE_PIN_PORT (0) +#define SAM_BA_INTERFACE_PIN_PIN (5) +#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP + +/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands + * will become available which will speed up programming when using the Arduino + * IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders. + * Size: ~904B. This is defined and set to 1 by default (except with 4KB). + */ +#define ARDUINO_EXTENDED_CAPABILITIES 1 + +/* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to + * CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL, + * or CLOCKCONFIG_INTERNAL_USB. If CLOCKCONFIG_32768HZ_CRYSTAL or + * CLOCKCONFIG_HS_CRYSTAL is defined, then the PLL will be used. If + * CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must + * also be defined with the crystal frequency in Hertz. CLOCKCONFIG_INTERNAL + * uses the DFLL in open-loop mode, except with the C21 which lacks a DFLL, so + * the internal 48MHz RC oscillator is used instead. CLOCKCONFIG_INTERNAL_USB + * can be defined for the D21, D11, or L21. It will also use the DFLL in + * open-loop mode, except when connected to a USB port with data lines (and + * not suspended), where it will calibrate against the USB SOF signal. + */ +#ifndef CLOCKCONFIG_CLOCK_SOURCE + #if (SAMC21) + #define CLOCKCONFIG_CLOCK_SOURCE CLOCKCONFIG_INTERNAL + #else + #define CLOCKCONFIG_CLOCK_SOURCE CLOCKCONFIG_INTERNAL_USB + #endif +#endif + +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* Master clock frequency (also Fcpu frequency) */ +#define VARIANT_MCK (48000000ul) + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + +/* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and + * STRING_PRODUCT will be sent to the host. + * Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB). + */ +#define USB_VENDOR_STRINGS_ENABLED +#define STRING_MANUFACTURER "MattairTech LLC" +#define STRING_PRODUCT "Xeno" + +/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ +#define USB_VID_HIGH 0x16 +#define USB_VID_LOW 0xD0 +#define USB_PID_HIGH 0x05 +#define USB_PID_LOW 0x57 + +/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number. + * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting + * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: + * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * if not used. By default, this interface is not enabled (except with the C21). + */ +#define BOOT_USART_SERCOM_INSTANCE 4 +#define BOOT_USART_PAD_SETTINGS UART_RX_PAD1_TX_PAD0 +#define BOOT_USART_PAD3 PINMUX_UNUSED +#define BOOT_USART_PAD2 PINMUX_UNUSED +#define BOOT_USART_PAD1 PINMUX_PB09D_SERCOM4_PAD1 +#define BOOT_USART_PAD0 PINMUX_PB08D_SERCOM4_PAD0 + +/* + * If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly + * tapping two times on the reset button (within 1/2 second). + * Size: ~96B. Enabled by default. + */ +#define BOOT_DOUBLE_TAP_ENABLED + +/* + * If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected + * pin is active after reset. There is a 10ms delay before testing the pin to + * allow time for debouncing capacitors to charge (ie: button use). PORT can be 0 + * (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or + * PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN. + * Size: ~84B. Disabled by default. + */ +//#define BOOT_LOAD_PIN_ENABLED +#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW +#define BOOT_LOAD_PIN_PORT (1) +#define BOOT_LOAD_PIN (16) +#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP + +/* + * If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an + * "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader + * is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART). + * Size: ~160B. Enabled by default. + */ +#define BOARD_LED_FADE_ENABLED + +/* + * If the LED PORT is defined, then the LED on the associated pin is enabled. + * Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON. + * By default, only BOARD_LED is enabled. + */ +#define BOARD_LED_PORT (1) +#define BOARD_LED_PIN (2) +#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON + +//#define BOARD_LEDRX_PORT (0) +//#define BOARD_LEDRX_PIN (22) +//#define BOARD_LEDRX_POLARITY LED_POLARITY_HIGH_ON + +//#define BOARD_LEDTX_PORT (0) +//#define BOARD_LEDTX_PIN (23) +//#define BOARD_LEDTX_POLARITY LED_POLARITY_HIGH_ON + +#endif // _BOARD_DEFINITIONS_H_ diff --git a/bootloaders/zero/build_all_bootloaders.sh b/bootloaders/zero/build_all_bootloaders.sh index 824835eaf..b72c46f24 100755 --- a/bootloaders/zero/build_all_bootloaders.sh +++ b/bootloaders/zero/build_all_bootloaders.sh @@ -3,17 +3,9 @@ make clean # With SDCARD_DISABLED -BOARD_ID=arduino_zero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean - -BOARD_ID=genuino_zero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean - -BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean - -BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean - -BOARD_ID=arduino_mkrzero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean - -BOARD_ID=arduino_mkrfox1200 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAMD21J18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAML21J18B SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAMC21J18A SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A SDCARD=SDCARD_DISABLED make all mostly_clean @@ -66,22 +58,21 @@ BOARD_ID=Generic_D11D14AM MCU=SAMD11D14AM SDCARD=SDCARD_DISABLED make all mostly BOARD_ID=Generic_D11D14AS MCU=SAMD11D14AS SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=Generic_D11C14A MCU=SAMD11C14A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=arduino_zero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=genuino_zero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=arduino_mkrzero MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=arduino_mkrfox1200 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean + BOARD_ID=arduino_m0 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=arduino_m0_pro MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean # With SDCARD_ENABLED -BOARD_ID=arduino_zero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean - -BOARD_ID=genuino_zero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean - -BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean - -BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean - -BOARD_ID=arduino_mkrzero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean - -BOARD_ID=arduino_mkrfox1200 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAMD21J18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAML21J18B SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAMC21J18A SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A SDCARD=SDCARD_ENABLED make all mostly_clean @@ -134,6 +125,13 @@ BOARD_ID=Generic_D11D14AM MCU=SAMD11D14AM SDCARD=SDCARD_ENABLED make all mostly_ BOARD_ID=Generic_D11D14AS MCU=SAMD11D14AS SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=Generic_D11C14A MCU=SAMD11C14A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=arduino_zero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=genuino_zero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=arduino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=genuino_mkr1000 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=arduino_mkrzero MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=arduino_mkrfox1200 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean + BOARD_ID=arduino_m0 MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=arduino_m0_pro MCU=SAMD21G18A SDCARD=SDCARD_ENABLED make all mostly_clean diff --git a/platform.txt b/platform.txt index 5439983fb..9113b9d25 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=MattairTech SAM M0+ Boards -version=1.6.8 +version=1.6.16 # Compile variables # ----------------- diff --git a/variants/Xeno/README.md b/variants/Xeno/README.md new file mode 100644 index 000000000..97c8b0a3f --- /dev/null +++ b/variants/Xeno/README.md @@ -0,0 +1,293 @@ +# MattairTech Xeno (ATSAMx21Jxxx) + +``` +============================= MattairTech Xeno (ATSAMx21Jxxx) =========================== +Other COM PWM Analog INT Arduino* Arduino* INT Analog PWM COM Other +========================================================================================= + ------------------- + Board Variant: | (no external pin) | + B=Basic, S=Standard, A=Advanced | |-- B3 | 49 I O VBAT(L)/SDCD(+B) + M=Memory device installed | |-- B5 | 48 I INT1(+B) + | |-- B4 | 47 3SEN(+B) + | | +XBDS(B) O 0 | B0 RST | BOOT(+B) +MECS(+M) O 1 | B1 A31 | 31 RX1 SWDIO/XBDO(+B) +DAC0 O I 2 | A2 A30 | 30 SWDCLK(+B) +REFA(B) O 3 | A3 A28(D/C)| 28 SHCS(D/C) +3SVO(S)/REFB O 4 | A4 A27 | 27 I INT2 +DAC1(L) O 5 | A5 X34 (B2)| 34 O TC60~ LED(+B)/XBRT +CMVO(S) O 6 | B6 X33(B16)| 33 I INT0(+B)/BTN +ASEN(+A) O 7 | B7 X32(B17)| 32 I TC61~ MOPS(+S) + TX3 O I 8 | B8 A23 | 23 TC41~ + RX3 O I 9 | B9 A22 | 22 TC40~ +VHDV(A) MOSI1 O I 10 | A10 A21 | 21 TC71~ +VBDV(+A) SCK1 O I 11 | A11 A20 | 20 I TC70~ +XBCT(B) SDA1/MISO1 TCC20~ I 12 | A12 A19 | 19 TC31~ CMRI(S) + SCL1/SS1 TCC21~ I 13 | A13 A18 | 18 TC30~ TX1 XBDI(+B) +HSEN(A) TC50~ I 14 | B14 A17 | 17 SCL SCL(+B) +BKFS(+A) TC51~ 15 | B15 A16 | 16 SDA SDA(+B) + | Vaux 3.3V | +USB D- (D/L)+B, CAN TX (C) | A24 _____ VccL | ! VccL is 3.3V by default. +USB D+ (D/L)+B, CAN RX (C) | A25 | | VccH | DO NOT exceed 3.6V on VccL or + | Gnd | USB | Gnd | on any IO pin with the D21 or + Chip Variant: ------------------- L21 installed. 5V is allowed + D=D21, L=L21, C=C21 ONLY with the C21 installed. + 1------------------- By default, VccH is 5V. +MISO(+B) 43 (S43) | B30 Vcon | +SCK(+B) 44 (S44) | B23 SPI B22 | 45 (S45) MOSI(+B) +SHCS(D/C), SDCS(+B) 28, 46 (S46) | A28(B31) Gnd | + ------------------- + + 1------------------- +LVL_0(+S) TX2 O I 35 (L35) | A6 A7 | 36 (L36) I O RX2 LVL_1(+S) +LVL_2(+S) TCC12~ O NMI 37 (L37) | A8 LEVEL A9 | 38 (L38) O TCC13~ LVL_3(+S) + | VccH SHIFT VccH | + | Gnd Gnd | +MOTOR_B1(+S) TCC04~ 39 (M39) | B10 B11 | 40 (M40) TCC05~ MOTOR_B2(+S) +MOTOR_A1(+S) TCC06~ 41 (M41) | B12 MOTOR B13 | 42 (M42) TCC07~ MOTOR_A2(+S) + | Vmotor Gnd | + ------------------- + +* Most pins can be used for more than one function. The same port pin number printed on + the board is also used in Arduino (without the 'A') for all of the Arduino functions. + +* Different variants have different hardware installed onboard. The alternate functions + column shows for which board variant(s) the associated hardware is installed: B=Basic, + S=Standard, A=Advanced, and M=Memory device installed. The Advanced variant has all of + the hardware from the Standard, and the Standard has all of hardware from the Basic. + ++ This function is enabled by default depending on the variant indicated by the letter. + Thus, the associated header pin cannot be used. In most cases (except most +A pins), + solder jumpers can be used to enable or disable the alternate onboard function. + +~ TC3, TC4, TC5, TC6, TC7 on the D21 are instead TC4, TC0, TC1, TC2, TC3 on the L21/C21. + +Silkscreen Legend: + Top: A circle around pin is analog function, '~' is timer, small 'I' is interrupt + Bottom: A box around pin means 'Other' function enabled by default depending on variant +``` + + +# Pins descriptions for the MattairTech Xeno (ATSAMD21J/ATSAML21J/ATSAMC21J) +``` +===================================================================================================================================================== +Arduino | Port | Silk | IC | Peripheral functions | Board functions (Silk)Variant | Notes +--------|-------|-------|-------|---------------------------------------|-------------------------------|-------------------------------------------- +0 | B0 | B0 | 61 | ADC | XBee_DTR_SLEEP (XBDS)B | +1 | B1 | B1 | 62 | ADC | MEM_CS (MECS)+M | +2 | A2 | A2 | 3 | ADC / DAC0 / EXTINT:2 | | +3 | A3 | A3 | 4 | ADC / VREFA | REFA (REFA)B | +4 | A4 | A4 | 13 | ADC / VREFB / AC | 3.3Vsw_VOUT (3SVO)S | +5 | A5 | A5 | 14 | ADC / DAC1 (L) / AC | | +6 | B6 | B6 | 9 | ADC | CURR_MON_VOUT (CMVO)A | +7 | B7 | B7 | 10 | ADC | AUX_SW_EN (ASEN)+A | +8 | B8 | B8 | 11 | ADC / SERCOM4:0 / EXTINT:8 | TX3 | no I2C +9 | B9 | B9 | 12 | ADC / SERCOM4:1 / EXTINT:9 | RX3 | no I2C +10 | A10 | A10 | 19 | ADC / SERCOM2:2 / EXTINT:10 | VccH_DIVIDER (VHDV)A / MOSI1 | ADC on VDDIO +11 | A11 | A11 | 20 | ADC / SERCOM2:3 / EXTINT:11 | Vbus_DIVIDER (VBDV)+A / SCK1 | ADC on VDDIO +12 | A12 | A12 | 29 | SERCOM2:0 / TCC20 / EXTINT:12 | XBee_CTS (XBCT)B / SDA1 | also MISO1 +13 | A13 | A13 | 30 | SERCOM2:1 / TCC21 / EXTINT:13 | SCL1 | also SS1 +14 | B14 | B14 | 27 | SERCOM4:2 / TC5(TC1):0 / EXTINT:13 | HOST_SW_EN / USB_ID (HSEN)A | HOST_ENABLE (ID pin controls by default) +15 | B15 | B15 | 28 | SERCOM4:3 / TC5(TC1):1 | BUCK_FSW (BKFS)+A | +16 | A16 | A16 | 35 | SERCOM3:0 | I2C SDA (SDA)+B | 4.7Kohm pullup to VccL +17 | A17 | A17 | 36 | SERCOM3:1 | I2C SCL (SCL)+B | 4.7Kohm pullup to VccL +18 | A18 | A18 | 37 | SERCOM1:2 / TC3(TC4):0 | TX1 / XBee_Din (XBDI)+B | +19 | A19 | A19 | 38 | TC3(TC4):1 | CURR_MON_READINT (CMRI)S | +20 | A20 | A20 | 41 | SERCOM3:2 / TC7(TC3):0 / EXTINT:4 | | +21 | A21 | A21 | 42 | SERCOM3:3 / TC7(TC3):0 | | +22 | A22 | A22 | 43 | TC4(TC0):0 | | +23 | A23 | A23 | 44 | TC4(TC0):1 | | +24 | A24 | A24 | 45 | USB D- (D21/L21) / CAN TX (C21) | USB Micro D- (D-)+B | +25 | A25 | A25 | 46 | USB D+ (D21/L21) / CAN RX (C21) | USB Micro D+ (D+)+B | +26 | --- | --- | -- | NOT_A_PIN | NOT_A_PIN | +27 | A27 | A27 | 51 | EXTINT:15 | INT2 (INT2) | I2C_INT / XBee_ATTN +28 | A28 | A28 | 53 | A28 exists only on D21 and C21 | SPI_HEADER_CS (SHCS)+B | This is VDDCORE on the L21 +29 | --- | --- | -- | NOT_A_PIN | NOT_A_PIN | +30 | A30 | A30 | 57 | SWCLK | SWCLK+B | leave floating during reset +31 | A31 | A31 | 58 | SWDIO / SERCOM1:3 | RX1 / XBee_Dout (XBDO)+B | SWDIO enabled only when using external tool +32 | B17 | X32 | 40 | EXTINT:1 / TC6(TC2):1 | MOTOR_PS (MOPS)+S | +33 | B16 | X33 | 39 | EXTINT:0 | INT0 (INT0)+B | Button / XBee_BTN +34 | B2 | X34 | 63 | ADC / TC6(TC2):0 | LED (LED)+B / XBee_RTS (XBRT) | RTS and ASSOC LED can be used at same time +35 | A6 | L35 | 15 | ADC / SERCOM0:2 / EXTINT:6 | LVL_0 (L35)+S / TX2 | +36 | A7 | L36 | 16 | ADC / SERCOM0:3 / EXTINT:7 | LVL_1 (L36)+S / RX2 | +37 | A8 | L37 | 17 | ADC / SERCOM0:0 / TCC1:2 / EXTINT:NMI | LVL_2 (L37)+S | ADC on VDDIO +38 | A9 | L38 | 18 | ADC / SERCOM0:1 / TCC1:3 | LVL_3 (L38)+S | ADC on VDDIO +39 | B10 | M39 | 23 | TCC0:4 | MOTOR_B1 (M39)+S | Also maps to TCC0:0 +40 | B11 | M40 | 24 | TCC0:5 | MOTOR_B2 (M40)+S | Also maps to TCC0:1 +41 | B12 | M41 | 25 | TCC0:6 | MOTOR_A1 (M41)+S | Also maps to TCC0:2 +42 | B13 | M42 | 26 | TCC0:7 | MOTOR_A2 (M42)+S | Also maps to TCC0:3 +43 | B30 | S43 | 59 | SERCOM5:0 | SPI MISO (S43)+B | +44 | B23 | S44 | 50 | SERCOM5:3 | SPI SCK (S44)+B | +45 | B22 | S45 | 49 | SERCOM5:2 | SPI MOSI (S45)+B | +46 | B31 | S46 | 60 | SERCOM5:1 | SS / SD_CS (S46)+B | or SPI_HEADER_CS (SHCS) +47 | B4 | -- | 5 | | 3.3Vsw_EN (3SEN)+B | +48 | B5 | -- | 6 | EXTINT:5 | INT1 (INT1)+B | MOTOR_ERROR / IMU_INT / AUX_SW_ERROR +49 | B3 | -- | 64 | ADC / VBAT(L) / EXTINT:3 | VBAT / SD_CardDetect (SDCD)+B | +-- | RESETN| RST | 52 | RESET | RESET (BOOT)+B | Double-tap reset for bootloader entry +===================================================================================================================================================== + +* Most pins can be used for more than one function. The same port pin number printed on the board is also used in Arduino (without the 'A') + for all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), attachInterrupt(), etc.). +* Different variants have different hardware installed onboard. The alternate functions column shows for which board variant(s) the associated + hardware is installed: B=Basic, S=Standard, A=Advanced, and M=Memory device installed. The Advanced variant has all of the hardware that the + Standard and Basic have installed, and the Standard variant has all of the Basic hardware. ++ This function is enabled by default depending on the variant indicated by the letter. Thus, the associated header pin cannot be used. + In most cases (except most +A pins), solder jumpers can be used to enable or disable the alternate onboard function. +* TC timers shown are for the D21 (the TC timers in parentheses are for the L21 and C21). +* There is no header pin available for: A0 and A1 (32.768KHz crystal), A14 aand A15 (16MHz crystal), and B3, B4, & B5 (used by onboard hardware). +``` + + +## Board Configuration Notes + +* **Crystals** + * Either the 32.768KHz crystal or the 16MHz crystal can be used. These pins do not route to headers. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. + +* **LED (LED_BUILTIN)** + * Bring the pin HIGH to turn the LED on. + * The LED is enabled (solder jumper) by default. + +* **Button (BUTTON_BUILTIN)** + * Button is connected to the Reset pin by default, but can be connected to pin 33 (B16) via solder jumper J2. + * Pressing the button will bring the pin LOW. The pullup must be enabled first. + * A debouncing capacitor is connected, so delay reading the pin at least 10ms after turning on the pullup. + +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * When PER_ATTR_DRIVE_STRONG is set for the pin (enabled by default), each pin can source or sink a maximum of: + * **D21:** 7mA high, 10mA low + * **L21:** 5mA high, 6mA low (8 high drive pins: 10mA high, 12mA low) + * **C21:** 6mA high, 10mA low (2 high drive pins (A10, A11): 12mA high, 20mA low) + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + +* **Analog Inputs** + * Up to 18 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REFA. In this case, the capacitors should be enabled via solder jumper J33. + +* **DAC** + * D21/C21: One 10-bit 350Ksps analog output is available on pin 2. + * L21: Two 12-bit 1Msps analog outputs are available on pins 2 and 5. + +* **PWM** + * Up to 18 pins can be configured as PWM outputs. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. + +* **External Interrupts** + * Up to 16 pins can be configured with external interrupts. + +* **SERCOM** + * 6 SERCOM are available. + * Up to 3 UART instances. More in a future release. + * Up to 2 SPI instances. + * Up to 2 WIRE (I2C) instances. + * The WIRE pullup resistors are enabled by default. + + + +## PinDescription table format + +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +### Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +### Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** + +### Port +This is the port (ie: PORTA). + +### Pin +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/Xeno/debug_scripts/SAMC21J15A.gdb b/variants/Xeno/debug_scripts/SAMC21J15A.gdb new file mode 100644 index 000000000..e26cd21fb --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMC21J15A.gdb @@ -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 at91samc21j15" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMC21J16A.gdb b/variants/Xeno/debug_scripts/SAMC21J16A.gdb new file mode 100644 index 000000000..6851f6b22 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMC21J16A.gdb @@ -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 at91samc21j16" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMC21J17A.gdb b/variants/Xeno/debug_scripts/SAMC21J17A.gdb new file mode 100644 index 000000000..13dc5c5ed --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMC21J17A.gdb @@ -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 at91samc21j17" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMC21J18A.gdb b/variants/Xeno/debug_scripts/SAMC21J18A.gdb new file mode 100644 index 000000000..81ea4cca2 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMC21J18A.gdb @@ -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 at91samc21j18" -f target/at91samcXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMD21J15A.gdb b/variants/Xeno/debug_scripts/SAMD21J15A.gdb new file mode 100644 index 000000000..3e2147946 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMD21J15A.gdb @@ -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 at91samd21j15" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMD21J16A.gdb b/variants/Xeno/debug_scripts/SAMD21J16A.gdb new file mode 100644 index 000000000..45b07adf8 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMD21J16A.gdb @@ -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 at91samd21j16" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMD21J17A.gdb b/variants/Xeno/debug_scripts/SAMD21J17A.gdb new file mode 100644 index 000000000..bad81e6a4 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMD21J17A.gdb @@ -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 at91samd21j17" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAMD21J18A.gdb b/variants/Xeno/debug_scripts/SAMD21J18A.gdb new file mode 100644 index 000000000..12fd6a422 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAMD21J18A.gdb @@ -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 at91samd21j18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAML21J16B.gdb b/variants/Xeno/debug_scripts/SAML21J16B.gdb new file mode 100644 index 000000000..063110e68 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAML21J16B.gdb @@ -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 at91saml21j16" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAML21J17B.gdb b/variants/Xeno/debug_scripts/SAML21J17B.gdb new file mode 100644 index 000000000..d400b5be5 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAML21J17B.gdb @@ -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 at91saml21j17" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/debug_scripts/SAML21J18B.gdb b/variants/Xeno/debug_scripts/SAML21J18B.gdb new file mode 100644 index 000000000..2eb86f9f3 --- /dev/null +++ b/variants/Xeno/debug_scripts/SAML21J18B.gdb @@ -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 at91saml21j18" -f target/at91samlXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..c541d8cd0 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_128KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00020000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..a0b9f951f --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_256KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00040000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld new file mode 100644 index 000000000..5d8d047a9 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_32KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00008000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..3f7223790 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/16KB_Bootloader/flash_64KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00010000-0x4000 /* First 16KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x4000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..07940acbd --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_128KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00020000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..825aee666 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_256KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld new file mode 100644 index 000000000..0d3aaf7a9 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_32KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00008000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..1c36f57e1 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/8KB_Bootloader/flash_64KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00010000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x2000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_128KB.ld b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_128KB.ld new file mode 100644 index 000000000..941e0adee --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_128KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_256KB.ld b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_256KB.ld new file mode 100644 index 000000000..865514cbb --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_256KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_32KB.ld b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_32KB.ld new file mode 100644 index 000000000..407777c80 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_32KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_64KB.ld b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_64KB.ld new file mode 100644 index 000000000..6f3d4d3e8 --- /dev/null +++ b/variants/Xeno/linker_scripts/gcc/No_Bootloader/flash_64KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Xeno/openocd_scripts/SAMC21J15A.cfg b/variants/Xeno/openocd_scripts/SAMC21J15A.cfg new file mode 100644 index 000000000..1627bc1d1 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMC21J15A.cfg @@ -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 at91samc21j15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMC21J16A.cfg b/variants/Xeno/openocd_scripts/SAMC21J16A.cfg new file mode 100644 index 000000000..f023da3f7 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMC21J16A.cfg @@ -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 at91samc21j16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMC21J17A.cfg b/variants/Xeno/openocd_scripts/SAMC21J17A.cfg new file mode 100644 index 000000000..ab42301f6 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMC21J17A.cfg @@ -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 at91samc21j17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMC21J18A.cfg b/variants/Xeno/openocd_scripts/SAMC21J18A.cfg new file mode 100644 index 000000000..6405303fe --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMC21J18A.cfg @@ -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 at91samc21j18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samcXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMD21J15A.cfg b/variants/Xeno/openocd_scripts/SAMD21J15A.cfg new file mode 100644 index 000000000..62eaa7f81 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMD21J15A.cfg @@ -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 at91samd21j15 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMD21J16A.cfg b/variants/Xeno/openocd_scripts/SAMD21J16A.cfg new file mode 100644 index 000000000..8126a24ba --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMD21J16A.cfg @@ -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 at91samd21j16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMD21J17A.cfg b/variants/Xeno/openocd_scripts/SAMD21J17A.cfg new file mode 100644 index 000000000..4888424cf --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMD21J17A.cfg @@ -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 at91samd21j17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAMD21J18A.cfg b/variants/Xeno/openocd_scripts/SAMD21J18A.cfg new file mode 100644 index 000000000..083166bd0 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAMD21J18A.cfg @@ -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 at91samd21j18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAML21J16B.cfg b/variants/Xeno/openocd_scripts/SAML21J16B.cfg new file mode 100644 index 000000000..9d2a32500 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAML21J16B.cfg @@ -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 at91saml21j16 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAML21J17B.cfg b/variants/Xeno/openocd_scripts/SAML21J17B.cfg new file mode 100644 index 000000000..9791acb19 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAML21J17B.cfg @@ -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 at91saml21j17 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/Xeno/openocd_scripts/SAML21J18B.cfg b/variants/Xeno/openocd_scripts/SAML21J18B.cfg new file mode 100644 index 000000000..acf8883a6 --- /dev/null +++ b/variants/Xeno/openocd_scripts/SAML21J18B.cfg @@ -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 at91saml21j18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samlXX.cfg] diff --git a/variants/Xeno/pins_arduino.h b/variants/Xeno/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/Xeno/pins_arduino.h @@ -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" + diff --git a/variants/Xeno/variant.cpp b/variants/Xeno/variant.cpp new file mode 100644 index 000000000..70f4f9774 --- /dev/null +++ b/variants/Xeno/variant.cpp @@ -0,0 +1,215 @@ +/* + 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 +*/ + +/* + * Modified 4 June 2017 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +const PinDescription g_APinDescription[]= +{ + // 0..11 - Analog capable pins +#if (SAMD || SAML) + { PORTB, 0, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTB, 1, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#elif (SAMC) + { PORTB, 0, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTB, 1, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#else + #error "variant.cpp: Unsupported chip" +#endif + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#if (SAMD || SAMC) + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#elif (SAML) + { PORTA, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#endif +#if (SAMD || SAML) + { PORTB, 6, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel14, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTB, 7, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel15, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTB, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel2, EXTERNAL_INT_8, GCLK_CCL_NONE }, + { PORTB, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel3, EXTERNAL_INT_9, GCLK_CCL_NONE }, + #if (SAMD) + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel18, EXTERNAL_INT_10, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel19, EXTERNAL_INT_11, GCLK_CCL_NONE }, + #else + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel18, EXTERNAL_INT_10, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel19, EXTERNAL_INT_11, GCLK_CCL_NONE }, + #endif +#elif (SAMC) + { PORTB, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel8, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTB, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel9, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTB, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel4, EXTERNAL_INT_8, GCLK_CCL_NONE }, + { PORTB, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel5, EXTERNAL_INT_9, GCLK_CCL_NONE }, + { PORTA, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel10, EXTERNAL_INT_10, GCLK_CCL_NONE }, + { PORTA, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel11, EXTERNAL_INT_11, GCLK_CCL_NONE }, +#endif + + // 12..Digital functions + { PORTA, 12, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH0, No_ADC_Channel, EXTERNAL_INT_12, GCLK_CCL_NONE }, + { PORTA, 13, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC2_CH1, No_ADC_Channel, EXTERNAL_INT_13, GCLK_CCL_NONE }, +#if (SAMD) + { PORTB, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC5_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, + { PORTB, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC5_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#elif (SAML) + { PORTB, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, + { PORTB, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#elif (SAMC) + { PORTB, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_14, GCLK_CCL_NONE }, + { PORTB, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TC1_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#endif + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + +#if (SAMD) + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_COM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 20, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TC7_CH0, No_ADC_Channel, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TC7_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#elif (SAML || SAMC) + { PORTA, 18, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC4_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 19, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC4_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 20, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC3_CH0, No_ADC_Channel, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 21, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC3_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC0_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC0_CH1, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#endif + + // 24..26 - USB_NEGATIVE and USB_POSITIVE, pin 26 does not exist + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + + // 27..29 - Digital functions + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_15, GCLK_CCL_NONE }, +#if (SAMD || SAMC) + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, +#elif (SAML) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused +#endif + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + + // 30..31 Digital functions / Debug interface (SWD CLK and SWD IO) + { PORTA, 30, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD IO + + // 32..34 - X pins +#if (SAMD) + { PORTB, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT|PIN_ATTR_COM), TC6_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // X32 + { PORTB, 16, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // X33 + { PORTB, 2, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC6_CH0, ADC_Channel10, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // X34, LED +#elif (SAML || SAMC) + { PORTB, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_1, GCLK_CCL_NONE }, // X32 + { PORTB, 16, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, // X33 + #if (SAML) + { PORTB, 2, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC2_CH0, ADC_Channel10, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // X34, LED + #elif (SAMC) + { PORTB, 2, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TC2_CH0, ADC_Channel2, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // X34, LED + #endif +#endif + + // 35..38 - Level Shifter Header + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_6, GCLK_CCL_NONE }, // L35 +#if (SAMD) + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_7, GCLK_CCL_NONE }, // L36 + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT|PIN_ATTR_COM), TCC1_CH2, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // L37 + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_COM), TCC1_CH3, ADC_Channel17, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // L38 +#elif (SAML) + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_7, GCLK_CCL_NONE }, // L36 + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC1_CH2, ADC_Channel16, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // L37 + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC1_CH3, ADC_Channel17, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // L38 +#elif (SAMC) + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel7, EXTERNAL_INT_7, GCLK_CCL_NONE }, // L36 + { PORTA, 8, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC1_CH2, ADC_Channel10, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, // L37 + { PORTA, 9, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_STD|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC1_CH3, ADC_Channel11, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // L38 +#endif + + // 39..42 - Motor Controller Header + { PORTB, 10, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH4, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // M39 + { PORTB, 11, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH5, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // M40 + { PORTB, 12, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH6, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // M41 + { PORTB, 13, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH7, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // M42 + + // 43..46 - SPI Header + { PORTB, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // S43 + { PORTB, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // S44 + { PORTB, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // S45 + { PORTB, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // S46 + + // 47..49 - No header pins + { PORTB, 4, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // 47 + { PORTB, 5, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_5, GCLK_CCL_NONE }, // 48 +#if (SAMD || SAML) + { PORTB, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel11, EXTERNAL_INT_3, GCLK_CCL_NONE }, // 49 +#elif (SAMC) + { PORTB, 3, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_ADC_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel3, EXTERNAL_INT_3, GCLK_CCL_NONE }, // 49 +#endif +} ; + +#if (SAMD) +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5, TC6, TC7 } ; +#elif (SAMC || SAML) +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC0, TC1, TC2, TC3, TC4 } ; +#endif + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; +SERCOM sercom3( SERCOM3 ) ; +SERCOM sercom4( SERCOM4 ) ; +SERCOM sercom5( SERCOM5 ) ; + +#if defined(ONE_UART) || defined(TWO_UART) || defined(THREE_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM1_Handler() +{ + Serial1.IrqHandler(); +} +#endif + +#if defined(TWO_UART) || defined(THREE_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM0_Handler() +{ + Serial2.IrqHandler(); +} +#endif + +#if defined(THREE_UART) +Uart Serial3( SERCOM_INSTANCE_SERIAL3, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX ) ; + +void SERCOM4_Handler() +{ + Serial3.IrqHandler(); +} +#endif diff --git a/variants/Xeno/variant.h b/variants/Xeno/variant.h new file mode 100644 index 000000000..afed681b9 --- /dev/null +++ b/variants/Xeno/variant.h @@ -0,0 +1,412 @@ +/* + 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 +*/ + +/* + * Modified 4 June 2017 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + +#ifndef _VARIANT_MATTAIRTECH_XENO_ +#define _VARIANT_MATTAIRTECH_XENO_ + +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + +/*---------------------------------------------------------------------------- + * Clock Configuration + *----------------------------------------------------------------------------*/ + +/** Master clock frequency (also Fcpu frequency) */ +#define VARIANT_MCK (48000000ul) + +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" +#include "sam.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define NUM_PIN_DESCRIPTION_ENTRIES (50u) + +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT +#define NUM_ANALOG_INPUTS (18u) + +#if (SAMD || SAMC) +#define NUM_ANALOG_OUTPUTS (1u) +#elif (SAML) +#define NUM_ANALOG_OUTPUTS (2u) +#else +#error "variant.h: Unsupported chip" +#endif + +#define analogInputToDigitalPin(p) (p) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +/* LEDs + * None of these defines are currently used by the core. + * The Xeno onboard LED is on pin 34. + * The RX and TX LEDs are not present. + * You may optionally add them to any free pins. + */ +#define PIN_LED_13 (34u) +#define PIN_LED_RXL (22u) +#define PIN_LED_TXL (23u) +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + +/* Buttons + * Note that Button is connected to Reset by default. + * A solder jumper can be changed to route Button B to pin 33 instead. + * There is a debouncing capacitor connected, so delay reading the pin for + * at least 45ms after turning on the pullup to allow the capacitor to charge. + */ +#define BUTTON (33u) +#define BUTTON_BUILTIN BUTTON + + +/* + * Analog pins + */ +#define PIN_A0 (0ul) +#define PIN_A1 (1ul) +#define PIN_A2 (2ul) +#define PIN_A3 (3ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A6 (6ul) +#define PIN_A7 (7ul) +#define PIN_A8 (8ul) +#define PIN_A9 (9ul) +#define PIN_A10 (10ul) +#define PIN_A11 (11ul) +#define PIN_A34 (34ul) +#define PIN_A35 (35ul) +#define PIN_A36 (36ul) +#define PIN_A37 (37ul) +#define PIN_A38 (38ul) +#define PIN_A49 (49ul) +#define PIN_DAC0 (2ul) +#if (SAML) +#define PIN_DAC1 (5ul) +#endif + +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +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 A34 = PIN_A34; +static const uint8_t A35 = PIN_A35; +static const uint8_t A36 = PIN_A36; +static const uint8_t A37 = PIN_A37; +static const uint8_t A38 = PIN_A38; +static const uint8_t A49 = PIN_A49; +static const uint8_t DAC0 = PIN_DAC0; +#if (SAML) +static const uint8_t DAC1 = PIN_DAC1; +#endif + +#define ADC_RESOLUTION 12 + +// #define REMAP_ANALOG_PIN_ID(pin) if ( pin < A0 ) pin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#define REFA_PIN (3ul) +#define REFB_PIN (4ul) + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#if (SAMD || SAMC) +#define PIN_ATN (28ul) +#elif (SAML) +#define PIN_ATN (21ul) +#endif +static const uint8_t ATN = PIN_ATN; + + +/* + * Serial interfaces + */ +// Serial1 +#define PIN_SERIAL1_RX (31ul) +#define PIN_SERIAL1_TX (18ul) +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL1 &sercom1 + +// Serial2 +#define PIN_SERIAL2_RX (36ul) +#define PIN_SERIAL2_TX (35ul) +#define PAD_SERIAL2_TX (UART_TX_PAD_2) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) + +#define SERCOM_INSTANCE_SERIAL2 &sercom0 + +// Serial3 +#define PIN_SERIAL3_RX (9ul) +#define PIN_SERIAL3_TX (8ul) +#define PAD_SERIAL3_TX (UART_TX_PAD_0) +#define PAD_SERIAL3_RX (SERCOM_RX_PAD_1) + +#define SERCOM_INSTANCE_SERIAL3 &sercom4 + + +/* + * SPI Interfaces + */ +#if defined(TWO_SPI) +#define SPI_INTERFACES_COUNT 2 +#elif defined(THREE_SPI) +#define SPI_INTERFACES_COUNT 3 +#else +#define SPI_INTERFACES_COUNT 1 +#endif + +#define PIN_SPI_MISO (43u) +#define PIN_SPI_MOSI (45u) +#define PIN_SPI_SCK (44u) +#define PIN_SPI_SS (46u) +#define PERIPH_SPI sercom5 +#define PAD_SPI_TX SPI_PAD_2_SCK_3 +#define PAD_SPI_RX SERCOM_RX_PAD_0 + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + +#define PIN_SPI1_MISO (12u) +#define PIN_SPI1_MOSI (10u) +#define PIN_SPI1_SCK (11u) +#define PIN_SPI1_SS (13u) +#define PERIPH_SPI1 sercom2 +#define PAD_SPI1_TX SPI_PAD_2_SCK_3 +#define PAD_SPI1_RX SERCOM_RX_PAD_0 + +static const uint8_t SS1 = PIN_SPI1_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI1 = PIN_SPI1_MOSI ; +static const uint8_t MISO1 = PIN_SPI1_MISO ; +static const uint8_t SCK1 = PIN_SPI1_SCK ; + + +/* + * Wire Interfaces + */ +#if defined(TWO_WIRE) +#define WIRE_INTERFACES_COUNT 2 +#elif defined(THREE_WIRE) +#define WIRE_INTERFACES_COUNT 3 +#else +#define WIRE_INTERFACES_COUNT 1 +#endif + +#define PIN_WIRE_SDA (16u) +#define PIN_WIRE_SCL (17u) +#define PERIPH_WIRE sercom3 +#define WIRE_IT_HANDLER SERCOM3_Handler + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +#define PIN_WIRE1_SDA (12u) +#define PIN_WIRE1_SCL (13u) +#define PERIPH_WIRE1 sercom2 +#define WIRE1_IT_HANDLER SERCOM2_Handler + +static const uint8_t SDA1 = PIN_WIRE1_SDA; +static const uint8_t SCL1 = PIN_WIRE1_SCL; + + +/* + * USB + */ +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +#define PIN_USB_HOST_ENABLE (14ul) +#define PIN_USB_HOST_ENABLE_VALUE 0 + +/* + * I2S Interfaces + */ +#define I2S_INTERFACES_COUNT 1 + +#define I2S_DEVICE 0 +#define I2S_CLOCK_GENERATOR 3 +#define PIN_I2S_SD (19u) +#define PIN_I2S_SCK (10u) +#define PIN_I2S_FS (11u) + +#ifdef __cplusplus +} +#endif + + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; +extern SERCOM sercom3; +extern SERCOM sercom4; +extern SERCOM sercom5; + +extern Uart Serial1; +extern Uart Serial2; +extern Uart Serial3; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#if (!SAMC) + #define SERIAL_PORT_USBVIRTUAL SerialUSB +#endif +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#if (SAMC) + #define SERIAL_PORT_MONITOR Serial2 +#else + #define SERIAL_PORT_MONITOR Serial1 +#endif + +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#if (SAMC) + #define SERIAL_PORT_HARDWARE Serial2 + #define SERIAL_PORT_HARDWARE_OPEN Serial2 +#else + #define SERIAL_PORT_HARDWARE Serial1 + #define SERIAL_PORT_HARDWARE_OPEN Serial1 +#endif + +// The Xeno does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. +#if (SAMC) + #define Serial Serial1 +#else + // When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. + #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) + #define Serial SerialUSB + #else + #define Serial Serial1 + #endif +#endif + +#endif /* _VARIANT_MATTAIRTECH_XENO_ */ From b180f33c30db65e9573884e6ce3b23230950226d Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 6 Oct 2017 23:16:35 +0000 Subject: [PATCH 105/124] fixed wrong location for call to mapResolution(), doc updates --- README.md | 8 ++++---- bootloaders/zero/README.md | 8 +++++--- cores/arduino/wiring_analog.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c77de64f2..6fdb5f80a 100644 --- a/README.md +++ b/README.md @@ -527,10 +527,10 @@ Vista, 7, 8, and 10. Note that the Windows 10 generic CDC drivers work as well. *OS X support was added in version 1.6.7-beta-b0.* 0. No driver installation is needed. -5. Plug in the board. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: +1. Plug in the board. You may get a dialog box asking if you wish to open the “Network Preferencesâ€: * Click the "Network Preferences..." button, then click "Apply". * The board will show up as “Not Configuredâ€, but it will work fine. -5. Continue with SAM M0+ Core Installation below. +2. Continue with SAM M0+ Core Installation below. ### SAM M0+ Core Installation @@ -539,14 +539,14 @@ Vista, 7, 8, and 10. Note that the Windows 10 generic CDC drivers work as well. * To update from a previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update. -1. The MattairTech SAM M0+ Core requires Arduino 1.6.7 or above (including 1.8.x). +1. The MattairTech SAM M0+ Core requires Arduino IDE 1.6.7 or above (including 1.8.x). 2. In the Arduino IDE, click File->Preferences. 3. Click the button next to Additional Boards Manager URLs. 4. Add https://www.mattairtech.com/software/arduino/package_MattairTech_index.json. 5. Save preferences, then open the Boards Manager. 6. Install the Arduino SAMD Boards package. Use version 1.6.2 or higher. 7. Install the MattairTech SAM M0+ Boards package. -8. Close Boards Manager, then click Tools->Board->MattairTech MT-D21E (or MT-D11). +8. Close Boards Manager, then click Tools->Board->(choose board). 9. Select the MCU with the now visible Tools->Microcontroller menu (if present). 10. If you do not already have the bootloader or blink sketch installed, see SAM-BA USB CDC Bootloader below. 11. Plug in the board. The blink sketch should be running. diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index c5e272a62..51a0e3a8c 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -254,13 +254,15 @@ This driver is the same as the one used by the MattairTech SAM M0+ Core. 4. Continue with driver installation above. -### Bossac Utility Installation +### Bossac Utility -This version of the bootloader requires bossac (1.7.0-mattairtech-1) from the package "MattairTech SAM M0+ Boards". -If using the Arduino IDE to upload firmware, then download the core. +This version of the bootloader requires bossac (1.7.0-mattairtech-1) or above. **See the MattairTech SAM M0+ Core [README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/README.md) "Driver Installation" for installation instructions.).** +#### Bossac Utility Installation + +If using the Arduino IDE to upload firmware, then this will be installed automatically when intalling the core. If using Bossac standalone, download bossac directly at: * https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 93e32e87e..58c90f97e 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -354,6 +354,8 @@ void analogWrite(uint32_t pin, uint32_t value) timerIndex = (uint8_t)(((uint32_t)TCCx - (uint32_t)TCC0) >> 10); } + value = mapResolution(value, _writeResolution, 16); + if (!tcEnabled[timerIndex]) { tcEnabled[timerIndex] = true; @@ -365,8 +367,6 @@ void analogWrite(uint32_t pin, uint32_t value) while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); #endif - value = mapResolution(value, _writeResolution, 16); - // Set PORT if ( TCx ) { From 76de5a4a8a602c54c5b23e3ac46353327e794438 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 24 Nov 2017 10:25:09 +0000 Subject: [PATCH 106/124] Added SAM D51 (m4f) support to bootloader --- bootloaders/zero/Makefile | 25 +- bootloaders/zero/README.md | 50 ++- bootloaders/zero/SDCard/mmcbbp.c | 22 +- bootloaders/zero/SDCard/sdBootloader.c | 2 +- bootloaders/zero/binaries/README.md | 2 +- .../sam_ba_Generic_D11C14A_SAMD11C14A.bin | Bin 3872 -> 3904 bytes .../sam_ba_Generic_D11D14AM_SAMD11D14AM.bin | Bin 3872 -> 3904 bytes .../sam_ba_Generic_D11D14AS_SAMD11D14AS.bin | Bin 3872 -> 3904 bytes .../sam_ba_Generic_x21E_SAMC21E15A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21E_SAMC21E16A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21E_SAMC21E17A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21E_SAMC21E18A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21E_SAMD21E15A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21E_SAMD21E16A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21E_SAMD21E17A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21E_SAMD21E18A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21E_SAML21E15B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21E_SAML21E16B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21E_SAML21E17B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21E_SAML21E18B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21G_SAMC21G15A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21G_SAMC21G16A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21G_SAMC21G17A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21G_SAMC21G18A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21G_SAMD21G15A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21G_SAMD21G16A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21G_SAMD21G17A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21G_SAMD21G18A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21G_SAML21G16B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21G_SAML21G17B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21G_SAML21G18B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21J_SAMC21J15A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21J_SAMC21J16A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21J_SAMC21J17A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21J_SAMC21J18A.bin | Bin 3720 -> 3720 bytes .../sam_ba_Generic_x21J_SAMD21J15A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21J_SAMD21J16A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21J_SAMD21J17A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21J_SAMD21J18A.bin | Bin 5028 -> 5028 bytes .../sam_ba_Generic_x21J_SAML21J16B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21J_SAML21J17B.bin | Bin 4964 -> 4964 bytes .../sam_ba_Generic_x21J_SAML21J18B.bin | Bin 4964 -> 4964 bytes .../binaries/sam_ba_MT_D11_SAMD11D14AM.bin | Bin 4036 -> 4068 bytes .../sam_ba_MT_D21E_rev_A_SAMD21E17A.bin | Bin 5204 -> 5204 bytes .../sam_ba_MT_D21E_rev_A_SAMD21E18A.bin | Bin 5204 -> 5204 bytes .../sam_ba_MT_D21E_rev_B_SAMC21E18A.bin | Bin 3888 -> 3888 bytes .../sam_ba_MT_D21E_rev_B_SAMD21E17A.bin | Bin 5196 -> 5200 bytes .../sam_ba_MT_D21E_rev_B_SAMD21E18A.bin | Bin 5196 -> 5200 bytes .../sam_ba_MT_D21E_rev_B_SAML21E18B.bin | Bin 5132 -> 5136 bytes .../zero/binaries/sam_ba_Xeno_SAMC21J18A.bin | Bin 3892 -> 3892 bytes .../zero/binaries/sam_ba_Xeno_SAMD21J18A.bin | Bin 5192 -> 5196 bytes .../zero/binaries/sam_ba_Xeno_SAMD51J20A.bin | Bin 0 -> 5216 bytes .../zero/binaries/sam_ba_Xeno_SAML21J18B.bin | Bin 5128 -> 5132 bytes .../binaries/sam_ba_arduino_m0_SAMD21G18A.bin | Bin 5196 -> 5196 bytes .../sam_ba_arduino_m0_pro_SAMD21G18A.bin | Bin 6304 -> 6304 bytes .../sam_ba_arduino_mkr1000_SAMD21G18A.bin | Bin 6192 -> 6288 bytes .../sam_ba_arduino_mkrfox1200_SAMD21G18A.bin | Bin 6292 -> 6292 bytes .../sam_ba_arduino_mkrzero_SAMD21G18A.bin | Bin 6296 -> 6296 bytes .../sam_ba_arduino_zero_SAMD21G18A.bin | Bin 6288 -> 6288 bytes .../sam_ba_genuino_mkr1000_SAMD21G18A.bin | Bin 6288 -> 6288 bytes .../sam_ba_genuino_zero_SAMD21G18A.bin | Bin 6288 -> 6288 bytes ...m_ba_sdcard_Generic_D11C14A_SAMD11C14A.bin | Bin 4044 -> 4076 bytes ...ba_sdcard_Generic_D11D14AM_SAMD11D14AM.bin | Bin 4044 -> 4076 bytes ...ba_sdcard_Generic_D11D14AS_SAMD11D14AS.bin | Bin 4044 -> 4076 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E15A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E16A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E17A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAMD21E18A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E15B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E16B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E17B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21E_SAML21E18B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G16A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G17A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G15A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G16A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G17A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAMD21G18A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21G_SAML21G16B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21G_SAML21G17B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21G_SAML21G18B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J16A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J17A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin | Bin 6820 -> 6820 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J16A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J17A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAMD21J18A.bin | Bin 8116 -> 8116 bytes .../sam_ba_sdcard_Generic_x21J_SAML21J16B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21J_SAML21J17B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_Generic_x21J_SAML21J18B.bin | Bin 8056 -> 8056 bytes .../sam_ba_sdcard_MT_D11_SAMD11D14AM.bin | Bin 4044 -> 4076 bytes ...sam_ba_sdcard_MT_D21E_rev_A_SAMD21E17A.bin | Bin 8128 -> 8128 bytes ...sam_ba_sdcard_MT_D21E_rev_A_SAMD21E18A.bin | Bin 8128 -> 8128 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAMC21E18A.bin | Bin 6820 -> 6820 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin | Bin 8116 -> 8120 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin | Bin 8116 -> 8120 bytes ...sam_ba_sdcard_MT_D21E_rev_B_SAML21E18B.bin | Bin 8056 -> 8060 bytes .../sam_ba_sdcard_Xeno_SAMC21J18A.bin | Bin 6828 -> 6828 bytes .../sam_ba_sdcard_Xeno_SAMD21J18A.bin | Bin 8116 -> 8120 bytes .../sam_ba_sdcard_Xeno_SAMD51J20A.bin | Bin 0 -> 8000 bytes .../sam_ba_sdcard_Xeno_SAML21J18B.bin | Bin 8056 -> 8060 bytes .../sam_ba_sdcard_arduino_m0_SAMD21G18A.bin | Bin 8120 -> 8120 bytes ...am_ba_sdcard_arduino_m0_pro_SAMD21G18A.bin | Bin 8124 -> 8124 bytes ...m_ba_sdcard_arduino_mkr1000_SAMD21G18A.bin | Bin 8048 -> 8108 bytes ...a_sdcard_arduino_mkrfox1200_SAMD21G18A.bin | Bin 8112 -> 8112 bytes ...m_ba_sdcard_arduino_mkrzero_SAMD21G18A.bin | Bin 8112 -> 8112 bytes .../sam_ba_sdcard_arduino_zero_SAMD21G18A.bin | Bin 8108 -> 8108 bytes ...m_ba_sdcard_genuino_mkr1000_SAMD21G18A.bin | Bin 8108 -> 8108 bytes .../sam_ba_sdcard_genuino_zero_SAMD21G18A.bin | Bin 8108 -> 8108 bytes bootloaders/zero/board_definitions.h | 63 ++- .../board_definitions_MT_D21E_rev_B.h | 8 +- .../board_definitions_Xeno.h | 45 +- bootloaders/zero/board_driver_usb.c | 34 +- bootloaders/zero/board_init.c | 407 ++++++++++++++---- bootloaders/zero/board_startup.c | 60 ++- bootloaders/zero/build_all_bootloaders.sh | 2 + .../linker_scripts/bootloader_sam_m4f_1MB.ld | 225 ++++++++++ .../bootloader_sam_m4f_256KB.ld | 225 ++++++++++ .../bootloader_sam_m4f_512KB.ld | 225 ++++++++++ bootloaders/zero/main.c | 4 +- bootloaders/zero/sam_ba_monitor.c | 2 +- bootloaders/zero/sam_ba_serial.c | 24 +- bootloaders/zero/util.c | 55 ++- 131 files changed, 1325 insertions(+), 155 deletions(-) create mode 100755 bootloaders/zero/binaries/sam_ba_Xeno_SAMD51J20A.bin create mode 100755 bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD51J20A.bin create mode 100644 bootloaders/zero/linker_scripts/bootloader_sam_m4f_1MB.ld create mode 100644 bootloaders/zero/linker_scripts/bootloader_sam_m4f_256KB.ld create mode 100644 bootloaders/zero/linker_scripts/bootloader_sam_m4f_512KB.ld diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index 0922d376a..2aebe77dd 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -42,10 +42,14 @@ BOARD_ID?=MT_D21E_rev_B # SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A # SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A # SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS +# SAMD51G: SAMD51G18A, SAMD51G19A +# SAMD51J: SAMD51J18A, SAMD51J19A, SAMD51J20A +# SAMD51N: SAMD51N19A, SAMD51N20A +# SAMD51P: SAMD51P19A, SAMD51P20A MCU?=SAMD21E18A -# Note that the makefile can be invoked with values that override the above two settings. -# For example: BOARD_ID=Generic_D11C14A MCU=SAMD11C14A make +# Note that the makefile can be invoked with values that override the above settings. +# For example: BOARD_ID=Generic_D11C14A MCU=SAMD11C14A SDCARD=SDCARD_DISABLED make # End Config ############################### @@ -55,6 +59,12 @@ else NAME=sam_ba_$(BOARD_ID)_$(MCU) endif +ifeq ($(findstring 20,$(MCU)),20) +FLASHSIZE=1MB +endif +ifeq ($(findstring 19,$(MCU)),19) +FLASHSIZE=512KB +endif ifeq ($(findstring 18,$(MCU)),18) FLASHSIZE=256KB endif @@ -71,7 +81,13 @@ ifeq ($(findstring 14,$(MCU)),14) FLASHSIZE=16KB endif +ifeq ($(findstring D51,$(MCU)),D51) +LINKER_SCRIPT?=bootloader_sam_m4f_$(FLASHSIZE).ld +MCPU=cortex-m4 +else LINKER_SCRIPT?=bootloader_sam_m0p_$(FLASHSIZE).ld +MCPU=cortex-m0plus +endif # CORE_VENDOR?=arduino CORE_VENDOR?=MattairTech_Arduino @@ -125,7 +141,8 @@ SIZE=$(ARM_GCC_PATH)size # Compiler options # eliminate PARANOIA define to save a tiny amount of code (~40B) CFLAGS_EXTRA=-D$(SDCARD) -D__$(MCU)__ -DBOARD_ID_$(BOARD_ID) -DPARANOIA -CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_DIR)/%.lst) +CFLAGS=-mthumb -mcpu=$(MCPU) -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_DIR)/%.lst) + ifdef DEBUG CFLAGS+=-g3 -O1 -DDEBUG=1 else @@ -141,7 +158,7 @@ INCLUDES=-I"$(MODULE_PATH_ARDUINO)/tools/CMSIS/4.5.0/CMSIS/Include/" -I"$(MODULE # ----------------------------------------------------------------------------- # Linker options -LDFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all +LDFLAGS=-mthumb -mcpu=$(MCPU) -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all LDFLAGS+=-Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols --specs=nano.specs --specs=nosys.specs # ----------------------------------------------------------------------------- diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index 51a0e3a8c..9ad074249 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -4,8 +4,8 @@ This bootloader is based on the Arduino Zero bootloader which is a part of the A provides a USB-CDC and/or TTL serial communications interface to a host running the bossac command line firmware programming utility (or the Arduino IDE) running on Windows, Linux, or OS X. Optionally, SD Card firmware loading is supported, using SDSC or SDHC cards with a FAT16 or FAT32 filesystem. -This version adds support for the D11, L21, and C21 microcontrollers. It also adds support for four -different clock sources (two external crystals and two internal oscillator options). There are +This version adds support for the D11, L21, C21, and D51 microcontrollers. It also adds support for +four different clock sources (two external crystals and two internal oscillator options). There are additional board definitions added, and binaries for most board/chip combinations are pre-built. ## Features @@ -15,7 +15,7 @@ additional board definitions added, and binaries for most board/chip combination * Four different clock sources (two external crystals and two internal oscillator options) * Arduino IDE auto-reset and double-tap reset button support * Arduino extended commands for faster firmware loading -* Supports the D21, L21, C21, and D11 SAM M0+ chips +* Supports the D21, L21, C21, and D11 SAM M0+ chips. Also supports D51 M4F chips. * Bossac command line utility for Windows, Linux, and OS X @@ -150,6 +150,20 @@ For more information on SAM-BA, see (especially pages 10 and 11): http://www.atmel.com/Images/Atmel-42438-SAM-BA-Overview-and-Customization-Process_ApplicationNote_AT09423.pdf +## D51 Clock Configuration + +The D51 can run at either 120MHz or 48MHz. When running at 120MHz, +two or three additional clock generators are used. Two of these +generate 48MHz and 96MHz. The USB peripheral can only run at 48MHz, +and many peripherals (ie: SERCOM) have a limit of 100MHz, so these +generators are used for them. Because 120MHz cannot be divided down +to 48MHz or 96MHz using the GCLK dividers, the second PLL is used. +Thus, with all clock source configurations, when the cpu runs at +120MHz both PLLs are enabled. When the cpu runs at 48MHz, only the +first PLL is enabled and only when using an external crystal. Use +48MHz to reduce power consumption. + + ## Bootloader Binaries The bootloaders/zero/binaries directory contains the SAM-BA m0+ @@ -256,7 +270,7 @@ This driver is the same as the one used by the MattairTech SAM M0+ Core. ### Bossac Utility -This version of the bootloader requires bossac (1.7.0-mattairtech-1) or above. +This version of the bootloader requires bossac (1.7.0-mattairtech-2) or above. **See the MattairTech SAM M0+ Core [README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/README.md) "Driver Installation" for installation instructions.).** @@ -265,22 +279,22 @@ This version of the bootloader requires bossac (1.7.0-mattairtech-1) or above. If using the Arduino IDE to upload firmware, then this will be installed automatically when intalling the core. If using Bossac standalone, download bossac directly at: -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz (Windows 32 bit and 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz (Linux 32 bit) -* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz (OS X 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-mingw32.tar.gz (Windows 32 bit and 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-x86_64-linux-gnu.tar.gz (Linux 64 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-i686-linux-gnu.tar.gz (Linux 32 bit) +* https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-x86_64-apple-darwin.tar.gz (OS X 64 bit) Linux 64 bit users can also download Bossa (GUI) and bossash (shell) from: -* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz (Linux 64 bit) +* https://www.mattairtech.com/software/arduino/Bossa-1.7.0-mattairtech-2-x86_64-linux-gnu.tar.gz (Linux 64 bit) Note that the SAM-BA tools from Atmel will not work, and the version of bossac from the Arduino -SAMD Core currently does not support the L21, C21, or D11 (but it does support the D21). +SAMD Core currently only supports the D21. #### Using Bossac Standalone -TODO: Update https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip with new chips (L21 and C21). +TODO: Update https://www.mattairtech.com/software/SAM-BA-bootloader-test-firmware.zip with new chips (L21, C21 and D51). When using Bossac standalone, you will need to ensure that your application starts at 0x00002000 for 8 KB bootloaders, and 0x00001000 for 4 KB bootloaders. This is because the bootloader resides at 0x00000000. This can be accomplished @@ -318,10 +332,10 @@ Arduino IDE Boards Manager. If you do not wish to install the MattairTech SAM M0 arm-none-eabi-gcc, CMSIS, and openocd packages are included with the stock Arduino SAMD. However, you will still need to download bossac (see above) and CMSIS-Atmel from MattairTech: -* https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz +* https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz Then install to ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel (or similar based on your OS) -and rename the folder in CMSIS-Atmel from CMSIS to 1.0.0-mattairtech-1. +and rename the folder in CMSIS-Atmel from CMSIS to 1.0.0-mattairtech-2. This project uses a Makefile, which is in the root zero directory. However, you will need a make program: @@ -373,6 +387,10 @@ allow the build_all_bootloaders.sh script to select SD Card support. * SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A * SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A * SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS +* SAMD51G: SAMD51G18A, SAMD51G19A +* SAMD51J: SAMD51J18A, SAMD51J19A, SAMD51J20A +* SAMD51N: SAMD51N19A, SAMD51N20A +* SAMD51P: SAMD51P19A, SAMD51P20A ### Board Configuration @@ -538,7 +556,7 @@ CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must also be defined with the crystal frequency in Hertz. CLOCKCONFIG_INTERNAL uses the DFLL in open-loop mode, except with the C21 which lacks a DFLL, so the internal 48MHz RC oscillator is used instead. CLOCKCONFIG_INTERNAL_USB -can be defined for the D21, D11, or L21. It will also use the DFLL in +can be defined for the D21, D11, L21, or D51. It will also use the DFLL in open-loop mode, except when connected to a USB port with data lines (and not suspended), where it will calibrate against the USB SOF signal. @@ -546,6 +564,7 @@ not suspended), where it will calibrate against the USB SOF signal. If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must also be defined with the external crystal frequency in Hertz. +Current MattairTech boards use 16MHz (12MHz or 24MHz on future boards). ### PLL_FRACTIONAL_ENABLED @@ -566,7 +585,8 @@ characteristics. ### VARIANT_MCK -Master clock frequency (also Fcpu frequency), set to 48000000ul only for now. +Master clock frequency (also Fcpu frequency), set to 48000000ul for all MCUs, +except the D51, which can be either 48000000ul or 120000000ul. ### NVM_SW_CALIB_DFLL48M_FINE_VAL diff --git a/bootloaders/zero/SDCard/mmcbbp.c b/bootloaders/zero/SDCard/mmcbbp.c index 90c17fccf..fd1450db2 100644 --- a/bootloaders/zero/SDCard/mmcbbp.c +++ b/bootloaders/zero/SDCard/mmcbbp.c @@ -34,8 +34,11 @@ void setBaud (uint32_t baud) while(SDCARD_SPI_MODULE->SPI.SYNCBUSY.bit.ENABLE); //Synchronous arithmetic - SDCARD_SPI_MODULE->SPI.BAUD.reg = ((VARIANT_MCK / (2 * baud)) - 1); - + #if (SAMD51 && (VARIANT_MCK == 120000000ul)) + SDCARD_SPI_MODULE->SPI.BAUD.reg = ((96000000ul / (2 * baud)) - 1); // Use 96MHz SERCOM clock (100MHz maximum) when cpu running at 120MHz + #else + SDCARD_SPI_MODULE->SPI.BAUD.reg = ((VARIANT_MCK / (2 * baud)) - 1); + #endif SDCARD_SPI_MODULE->SPI.CTRLA.bit.ENABLE = 1; while(SDCARD_SPI_MODULE->SPI.SYNCBUSY.bit.ENABLE); @@ -65,6 +68,13 @@ inline void init_spi (void) #elif (SAMC21G) || (SAMC21J) MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 | MCLK_APBCMASK_SERCOM5 ; #endif +#elif (SAMD51) + MCLK->APBAMASK.reg |= MCLK_APBAMASK_SERCOM0 | MCLK_APBAMASK_SERCOM1 ; + MCLK->APBBMASK.reg |= MCLK_APBBMASK_SERCOM2 | MCLK_APBBMASK_SERCOM3 ; + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM4 | MCLK_APBDMASK_SERCOM5 ; + #if (SAMD51N) || (SAMD51P) + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM6 | MCLK_APBDMASK_SERCOM7 ; + #endif #else #error "mmcbbp.c: Unsupported microcontroller" #endif @@ -79,8 +89,12 @@ inline void init_spi (void) #if (SAMD21 || SAMD11) GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( SDCARD_SPI_PER_CLOCK_INDEX ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); waitForSync(); -#elif (SAML21 || SAMC21) - GCLK->PCHCTRL[SDCARD_SPI_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); +#elif (SAML21 || SAMC21 || SAMD51) + #if (SAMD51 && (VARIANT_MCK == 120000000ul)) + GCLK->PCHCTRL[SDCARD_SPI_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK6 ); // Use 96MHz SERCOM clock (100MHz maximum) when cpu running at 120MHz + #else + GCLK->PCHCTRL[SDCARD_SPI_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + #endif waitForSync(); #else #error "mmcbbp.c: Unsupported microcontroller" diff --git a/bootloaders/zero/SDCard/sdBootloader.c b/bootloaders/zero/SDCard/sdBootloader.c index 892ae8610..483825d0a 100644 --- a/bootloaders/zero/SDCard/sdBootloader.c +++ b/bootloaders/zero/SDCard/sdBootloader.c @@ -104,7 +104,7 @@ bool flashVerify (void) pf_read(Buff, FLASH_PAGE_SIZE, &br); /* Load a page data */ if (br) { - for (uint8_t i=0; iDm&qpeWlmEDq&y#&gD041JQ_xxJM5^zU_iM2^AM5ZIT z4cfTQNr_xy6@}DIe=HxU6wp2rtz6O7kGfClm-9l&S)y(uceIl7N?%hYA%S}7OTAK{ z;H{p2t}98@e4@Fei=dB!THsutZT$;J#)bcS!xo;p}X-mhEOWA{qD4 zdPmm{W=zf+m+%&`ni_b6d^gQoPjxw#mvwcNTr!W~>*TTdhwWZhyc(1jR&`Y&EA&Hp z3_7}cx|+7kVOPP4kOd(w2YLpONz1x-u(3^V^-7tJ0TlDP8tSjy4?y;A+rWC+ z=~}O^DfXC&wo$abOv!~;`|I34s+py;t?cJRm8(zXBq delta 585 zcmXwzQD{?R2G>|+#zLXk4Hi}` zn0^lhi&zMeZ7*#ZLCJ(zFA)?mqQ<~6dMFBfiR+qjJ3@V&-}#^KJOA%+s;&i>xw#jF z8+w4t$do>B>D~_jS-ku|*RejAKXI76&QEwT<+G$ld2-say(11oy|yESMJcL4-AWTA zNksaNOptHX&y>g<-C(w+Q)Q2&h*8-+!iA#osO%E&gcz}1FD8v{Yv|zF#RTyLQi04@ zR=@6$Vwu=7c-0MiL~$2qX{b1(sq0#&g>==49_0q~s z<212MngM5mFot>x8KySwQ2(!8w$?Ufn>th?YU=r>TB)9ippz{dB;qD>q-2+^==n?& zT(`~A6f&LYFfkzPE3=XI?=G6>`pFZz%Gr8<{{healZFq1>~|i;-sY~(X?Lb7ZGWR| ziWr=N(~R$1w8eFiHEQF%L|F;)Zy4JHT--)_>Y6%H|QG}9H5`f7ybe??84Xp diff --git a/bootloaders/zero/binaries/sam_ba_Generic_D11D14AM_SAMD11D14AM.bin b/bootloaders/zero/binaries/sam_ba_Generic_D11D14AM_SAMD11D14AM.bin index 6d68b1169453155c44d175eab49003daddd6f6f8..c0d4c4b5f9016682758624a6c0fab607cae7d0ca 100755 GIT binary patch delta 593 zcmXwzUuaTM9LLYO{<(Vn)5I*9H@nwMDm&qpeWlmEDq&y#&gD041JQ_xxJM5^zU_iM2^AM5ZIT z4cfTQNr_xy6@}DIe=HxU6wp2rtz6O7kGfClm-9l&S)y(uceIl7N?%hYA%S}7OTAK{ z;H{p2t}98@e4@Fei=dB!THsutZT$;J#)bcS!xo;p}X-mhEOWA{qD4 zdPmm{W=zf+m+%&`ni_b6d^gQoPjxw#mvwcNTr!W~>*TTdhwWZhyc(1jR&`Y&EA&Hp z3_7}cx|+7kVOPP4kOd(w2YLpONz1x-u(3^V^-7tJ0TlDP8tSjy4?y;A+rWC+ z=~}O^DfXC&wo$abOv!~;`|I34s+py;t?cJRm8(zXBq delta 585 zcmXwzQD{?R2G>|+#zLXk4Hi}` zn0^lhi&zMeZ7*#ZLCJ(zFA)?mqQ<~6dMFBfiR+qjJ3@V&-}#^KJOA%+s;&i>xw#jF z8+w4t$do>B>D~_jS-ku|*RejAKXI76&QEwT<+G$ld2-say(11oy|yESMJcL4-AWTA zNksaNOptHX&y>g<-C(w+Q)Q2&h*8-+!iA#osO%E&gcz}1FD8v{Yv|zF#RTyLQi04@ zR=@6$Vwu=7c-0MiL~$2qX{b1(sq0#&g>==49_0q~s z<212MngM5mFot>x8KySwQ2(!8w$?Ufn>th?YU=r>TB)9ippz{dB;qD>q-2+^==n?& zT(`~A6f&LYFfkzPE3=XI?=G6>`pFZz%Gr8<{{healZFq1>~|i;-sY~(X?Lb7ZGWR| ziWr=N(~R$1w8eFiHEQF%L|F;)Zy4JHT--)_>Y6%H|QG}9H5`f7ybe??84Xp diff --git a/bootloaders/zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin b/bootloaders/zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin index d6952faefd3f19ac983ce8bc9d8a0da05a7d2465..f7984a8e69806be56a19ed49a62710a9c84959d1 100755 GIT binary patch delta 594 zcmXwzUuaTM9LLYO{<(Vn)5I*9X7_rDTr%joRWKN|q%n47(Oc+4PLi%sv<#L#jQJ3( zl@IA5SVZIyf&~kj-JsT%5D`&9L4(*577@{#5pu6hx&3a`fzSDV&+q#^hf@yJ0?zg} z#LgQLDgrl+MVD_oLg*G8{;xaWr;3An@#kVX3|sLsZV($j>iX5CVn;bKo<|Ly zjN=Rz$Qzu-O(IYWxJ)*vFVm{rBj&ld6gtL4V}slhW{qWdtPGVoOxJWw5fgZrv|)FE~!2eVVzm24-g64AJe z*4mn8Fk^DsIFC1p)l|pp>i_@% delta 586 zcmXwze`r!s6vxkf{&@BjOU%uj*?T&u?R2G5W(W1&#&1q&+{ zOz$5Bi&zMeZU3}o1SJz<{S!e!BWesBqd$rQ|B2_C@;X9Y&gXp3z2|!mr{-F4nOl2- zzo7-Vj7(_@mY)3pki*OWa~%ycLQz1v{)JV=)ws(XPXw-N3upmZdXjo~2 zB#A)ZkxBB6`k6ABqZ`cDbh_dZWg#lLN4Zcm9+h0eoe(2*>cynNZ4Dh9TTBqoV0tk7 zmDR30#8@`A3|?i!9+BOpSsE(MsLHz9B|0S8Q#2Qud9a2`6IOA1qUec1r~6hd%`!Nt zGy}b=vZ_9hL*r@FC|*H*+~4HFM$r-P&!jR-nV*?-6^0=QTFfTI0K>g;8RS>oHDEO~ zuYE*nv`@E5eo$7Q-y^kory!}yIeJeYB=hu({=4x-+kfkbbbDD<*64fo89R<1Rk^fs z(=bgeDKp?q;Kxx?U3DI!6V|AU#4JWq+n!VXwG10WMyh*WnjG7hsTBq0Fo>R;s5{u delta 33 mcmeB>?U3DI!6V{Tnx|l707Qo742A|)1}0WUCYybDY?uI%FbC8C diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E16A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E16A.bin index 64e9d62a071a2e51b9325a088e0e6ba15ae1f713..5bed8ee1b5e7fae645fe6174c20f50de2b0e33ba 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww6?U3DI!6WQdnx|l707Qo742A|)1}0WUo4t8#nE;7~2cG}{ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E17A.bin index 6473527f026e713b6a5678609e98f9a1d88dd8f8..88f11ffabb4216f322f18e15837b015cf7d8b67d 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww6?U3DI!6WQdnx|l707Qo742A|)1}0WUo4t8#nE;7~2cG}{ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMC21E18A.bin index c3422322068a96ceb47e4d7f4a5b20df5c37b98f..e4c5c2402ed097b2777a3fb57c70cb38b0bdf07a 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww6?U3DI!6WQdnx|l707Qo742A|)1}0WUo4t8#nE;7~2cG}{ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E15A.bin index df0b2ffecefc095577690daca5bb160c2863f267..e4bd732330657ed2194581ba95d9c6eb57b46e7d 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^bmFZ?_!A>Rsj|d0! delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZk878WC8$<`3K+t diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E16A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E16A.bin index d3be23bf90782948ac520e522073fa60a6500368..a285e70165687fda77f53bcf2b063e716d441d79 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^bmFZ?_!A>Rsj|d0! delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZk878WC8$<`3K+t diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E17A.bin index 1c379d56499eaefd79800f39fbd6b0b9ca7720fd..255f91e11b16c9843e89bdc3ea8da6f18918efcf 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^bmFZ?_!A>Rsj|d0! delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZk878WC8$<`3K+t diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAMD21E18A.bin index 52b86be3ce2297e2e8b4dc98888816c170c45aa1..122d5caf79f6445e33fb6b0a42f4b10da1404c90 100755 GIT binary patch delta 33 ocmZ3YzC?WkhoFdGewl)ik%Ezdp*e%0k(H^bm8s=s8Nm)F0G9*^E&u=k delta 33 ncmZ3YzC?WkhoFd8X`X_S0T3CQGZ-3J8JJiZ8Elpj>|g=_m9hvD diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E15B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21E_SAML21E15B.bin index 5e7cf2d348e21c814ef221f325b46160ef087406..4ebf8235b6e0d323e64b2bc0b94d10c3ff8f686f 100755 GIT binary patch delta 39 vcmaE&_C#&N6Gldb%}*I0^9lRqmnj$-DHs_Tnll(0S(%zy8En2S(8&Y<9N-M3 delta 39 tcmaE&_C#&N6Gldv%}*I0^9g&E<|!B%0Fj|NgQ0?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww_a!$Ce2Iihl>M delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0X?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww_a!$Ce2Iihl>M delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0X?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww_a!$Ce2Iihl>M delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0X?U3DI!6WRKU#4JWq+n!VXwG10WMyh*Ww_a!$Ce2Iihl>M delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0X|g=_mD~s! diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G16A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G16A.bin index 8fbc1b2823728ebce3c70a33c7bedcba6580fc71..d59f6a7e59e6618ca662053f6f15b788dec4f88f 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^LmBD6d!A>Rsj`9ca delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZI%}7WC8$<{|Dg! diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G17A.bin index 347bbb707443dcb7844be925e6b977e2919f9a4b..1ba4cbc2e8d7b592c172bc41202c8a35221f3e2b 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^LmBD6d!A>Rsj`9ca delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZI%}7WC8$<{|Dg! diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAMD21G18A.bin index 3af67184ce848208a4dddffba844db19ce0d45c1..460450df5e498c457af5ebe30d565632bb5eceb5 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^LmBD6d!A>Rsj`9ca delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZI%}7WC8$<{|Dg! diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G16B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21G_SAML21G16B.bin index 77de884064128c459978deba023dee1d701f362f..5ef547df0bd3c8f1f90d8e6808b011235a389a1b 100755 GIT binary patch delta 39 vcmaE&_C#&N6Gldb%}*I0^9lRqmnj$-DHs_Tnll(0S(%zy8E(EU(8&Y<9OewA delta 39 tcmaE&_C#&N6Gldv%}*I0^9g&E<|!B%0Fj|NgQ09ZUcxC=A5_ diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J15A.bin index 8d25e8a459b72dba1cb93826e651d2f1d166da9d..fc54057880ec4e71c8920ecdc75cceb7a126ec6f 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*WwhCw$Ce2IiiHQT delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0V}o4t8#nE;8B2cZA} diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J16A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J16A.bin index 5046e0f611665896771719edecc80213f2dd98d0..e70f2ab88291a68ba6d2723b234364bc3048e683 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*WwhCw$Ce2IiiHQT delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0V}o4t8#nE;8B2cZA} diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J17A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J17A.bin index 799e0ecbdbba1fecdd5c9b468b63811f1defce95..a754ffcd9855dae1eba0fc58aa1c0ffb5028928c 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*WwhCw$Ce2IiiHQT delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0V}o4t8#nE;8B2cZA} diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J18A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMC21J18A.bin index 4ebbc22797ebc6703b279bae151daf784169b8d2..1a7462e020ab408e3073a52b17356073ef0bdd3d 100755 GIT binary patch delta 32 ncmeB>?U3DI!6WRKU#4JWq+n!VXwG10WMyh*WwhCw$Ce2IiiHQT delta 32 lcmeB>?U3DI!6WQdnx|l707Qo742A|)1}0V}o4t8#nE;8B2cZA} diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMD21J15A.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAMD21J15A.bin index 7612033472c38cdc952a927976c674e3d370e245..026b7e1ec3be4e449c4e36774393ad3f3620806d 100755 GIT binary patch delta 32 ncmZ3YzC?WkhoG=uewl)ik%Ezdp*e%0k(H^LmEmS-!A>Rsj`#=h delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZRsj`#=h delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZRsj`#=h delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZRsj`#=h delta 32 mcmZ3YzC?WkhoG=mX`X_S0T3CQGZ-3J8JJiZZosA9ZUcxQVh%h diff --git a/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAML21J17B.bin b/bootloaders/zero/binaries/sam_ba_Generic_x21J_SAML21J17B.bin index 8731d94f1e5df92c869e8954b5ce3c1b0d5286de..8d811daa234f6ab65d04940e90d9e47f7a92a258 100755 GIT binary patch delta 39 vcmaE&_C#&N6Gldb%}*I0^9lRqmnj$-DHs_Tnll(0S(%zy8E(EU(8&Y<9OewA delta 39 tcmaE&_C#&N6Gldv%}*I0^9g&E<|!B%0Fj|NgQ0&g)&fx@mJZ+|+w_31>@i8zZz9)hfa}W-k#;q&1T6f=CvaQsN>X zGAx?sC8!q}7AgcP6G}#bMNdIdy(mFZ5WOvWxYzyR^jp+{58vM;egTcm|3J zt&$WuNH20DgweO$B3Yu>Okbyre7BmB9o+!c5 z;P{qM_eoNR#)nqHr*C&eGoIWm?4^<1G}Avam)fRflsW4h_YmxnT+*q2OU@}nQ0u;C zxmgZ()%**VPeAdx(X3uYUH2NEOHHc%h>|oZYgl+{H2!TY84UxCYFi?lo=g|g)wDr> z)U^w&!kDR^P!m5-rs)FznQYNp^)s$#6(~-Y%!Q^rukukP!Sq;Fa?2Xi5792+D7i^f z!cXy0)qmTo&8#wgnGTy*gu|F&`k6Jyt|_v+*9Kq)ki4iZh|@+NTRM6^l!Y&~)VYcY zmB>s#UC|3KPew5+;A_M~?vq8QX2(o{{<64Q^|CbHiirjeq^7(OtxZ=;)FbXE_voPL z=-w`Y^57W%PSX7Dec0SAo7_(KXrVS>N7Z@Pn*W3>5+X}UMg`V>It|K`lw5;j+Uepw6klb zK0}e0^l1p0#vAjs3bmJYR=!2_xub3yVr8G&pS_-)&;HD2u-Os7A^I7*idX3`pfC!Fk5Zcc+)}@iKd}8jmpYdg;*KV4F%CdH0#w| z#Iu2&tlz^lg`9^tx+oAFWkzXNcQ!jz-9io`7g%AaZOViYM$h{sJ2q#cBWm diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_A_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_A_SAMD21E17A.bin index ef01630b3217fb0d75b9997e4fa2579920432ace..5cccdd80a9234a4d06c481b7ecbafa4c5bc0062c 100755 GIT binary patch delta 33 ocmcbjaYbXp4nYyW{4xb2BLyP^Lvsd0BP&x=D^tVGX9PQ#0J#zg=l}o! delta 33 ncmcbjaYbXp4nYyG(mVwt10XUqXD~FdGBB|+u-tq`u!9KzxEKlB diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_A_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_A_SAMD21E18A.bin index d4702ccf7fea01b02112cfdb9880c45aee044478..6b13fe35919a45d2575fb5818e18ffbbcf582f1e 100755 GIT binary patch delta 33 ocmcbjaYbXp4nYyW{4xb2BLyP^Lvsd0BP&x=D^sJ*X9PQ#0J#_m=>Px# delta 33 ncmcbjaYbXp4nYyG(mVwt10XUqXD~FdGBB|+G}wGbu!9Kzx9JJf diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMC21E18A.bin index 1e0b59614595db218b44a5758017794d221b2951..84dc9a8c41eb735bcedc015d3fa1d3fea378998e 100755 GIT binary patch delta 33 ncmdlWw?S^h10E5-{4xb2BLyP^Lvsd0BP&x=Alm$e$A$?2v5*Oh delta 33 ncmdlWw?S^h10E5t(mVwt10XUqXD~FdGBB|+G~4`z$A$?2uyYA_ diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E17A.bin index b775aa60f14de025931e49b7e6184e2b4006a5db..0512e9375bd4bec67da7648a8c696f269496af2b 100755 GIT binary patch delta 134 zcmX@3aY1833gerJsoIQhHcr%MW&E)DAZs!!W5Z@uZfi!yDVq~{xLFvlOwJV$*WDn< zz;F|YHv#coAl?GR2Y~n_5KmxWP&f;uF9PvpAih3%qd+v{o5{R_IV=h;Muw9s1T5KmxWP&f&s&jRszAig|#qd+v{i^;r#Ig@Jz&4s;6^AwB> VfXL9C!O+0Uz{JXM^KrpWCIADrB%J^N diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAMD21E18A.bin index f6b08a4d66b14f848834861d4095d6cee12b226b..858eca6f11f54a959e187599f9ef91b385fe239b 100755 GIT binary patch delta 134 zcmX@3aY1833gerJsoIQhHcr%MW&E)DAZs!!W5Z@uZfi!yDVq~{xLFvlOwJV$*WDn< zz;F|YHv#coAl?GR2Y~n_5KmxWP&f;uF9PvpAih3%qd+v{o5{R_IV=h;Muw9s1T5KmxWP&f&s&jRszAig|#qd+v{i^;r#Ig@Jz&4s;6^AwB> VfXL9C!O+0Uz{JXM^KrpWCIADrB%J^N diff --git a/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E18B.bin b/bootloaders/zero/binaries/sam_ba_MT_D21E_rev_B_SAML21E18B.bin index 711db2ce06248d7652234ab2bc29bb329b700fc8..4ecf17ebeb00a11e8f98858af31a090f49294172 100755 GIT binary patch delta 142 zcmeCtn4mEsg>lWqRBgsJ8z;VIWK`H(%f!vhxM6cAYcwmP!{(=4){KlHn-zJuSs15G z))f%fEf8d2mkcfeR82dG~=4dX9aRt6nu;f jCtC`di}>Z2DHs_k7#SFvGZ-3KnVMRenrv|g=_bcrJj delta 137 zcmbQB(W5aTg>l8iRBgr;8z;VIWR%%l%f!vhxMp)FYcwmP&E}_E){Kk+n-zJuSr{iw z))f%f%@Jf^mT5ce=JD4Yb+XMy-U5MQ3WRUn%2#biOjWEKS%Bg4rhf)*lv d`DF@5MhZp-hUN^0MpmY#Rwm|~4+wTJ0RYrRC8huX delta 130 zcmX@3aYAE43geTBsoIQBHcr%MWqh&uAZt1+W5s4oZfi!yp3SK|+$@Y|CKn2b>#h)F zV7LgxtAO|_5U&B^9YA~#hnDiF>1WU`=O^5hCZ3lXoB;eQd<|(qzrAQPz2OcQBx>7Rir5*rapv8 zTi1ZHLJLc2VHH`Q%ldrM@S@9NHx=X|PklDUt|0nI7u`y`tkcHQp&w+=l3D)LJugG(VL&C|DL^gY8Nk2(tpi@&6u%niK?OqUu&k8!JC2jAuAMA? zCyscGrhV!TFG42Ceq4tT6_&Hcc6qV9M3T#k2~O88V~O^b#Z~id(B)0*1F% zB4Pe$RxuLnqcpn+*77?O64sBF3H5G+U(zu6r1pNlM!>M^QKLu8;X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86-;|zSZJ9&d<5d-A{O8qICjR#6r(fs1o!r6g zEIGJu>$@9z9{FLZZlQhdeKUR2UQPVz`>!vJe`bv2zq9I9|0}`WM*{!TK5$4Cz2k$W zgEhUp`Vcy4yKEwt-R5L`k9&_dv^0+${_@x_PGy|icKMNbJHAUBw{+X*yV90FyXJw7 z{o#+__}$*^FKiet`*u!G%IUw%JC*fXT7Z0P)8eYEm9nCXZ;rmV|HVJ-d$e!s$gOAY z`QqHHp}Tg=k4}H^vCW%rVdgzhdf}iVyjeER#2m)`#F z;MtwCwkXzDtzK06`aKPEVi_N(GQVG#c=)p|m)hR>W8}gs;;S<@+_m-orJEjUo*P;i zohHnbGJr~hf8?$I3Qxk_kZy>#C&4c(OiDpn7Tgjf)EQZp9AUC73}Fgc13{rg5(!DF c1Y?CPfIB6EO9ToIBrCk+*1@+>>cihZ0FCI1pa1{> literal 0 HcmV?d00001 diff --git a/bootloaders/zero/binaries/sam_ba_Xeno_SAML21J18B.bin b/bootloaders/zero/binaries/sam_ba_Xeno_SAML21J18B.bin index c81908bb08eb878dc290365f617a598f26b182d7..71feed89595e61c8700d432081bee89a774d34ce 100755 GIT binary patch delta 142 zcmeCs=+T&v!nk5$sy5?_jT2upGAeAYW#VRLT(h~8HJ+8xX7fufYevR^&8j@yEQ}K- z8w!Z)<_Iz{OaMh1rF42DKlrlwXV7MmLcJD31p^diat delta 137 zcmeCt=+Kyu!nkB&sy5@2jT2upGRkbOW#VRLT(P;6HJ+8xV)IKbYeq(&&8j@yEQ~#q z4F$w?GXxnJCIWF55Kjf-93ZX$;zl5zz`&r;3Zy%MxEqN3CzlFDGcK8YQ6PD;g`kCq cS81MtkpU1Hnll(0SQ(gD85(VF5$s?B0H-e@ng9R* diff --git a/bootloaders/zero/binaries/sam_ba_arduino_m0_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_arduino_m0_SAMD21G18A.bin index 564906554f1d909a4d990a5e95015ac7c124dbcf..7e5a6d6f7b932d05b7cc71f8adedd3c145c4ab6b 100755 GIT binary patch delta 33 ocmX@3aYkdq20;tF%^muv_r diff --git a/bootloaders/zero/binaries/sam_ba_arduino_mkr1000_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_arduino_mkr1000_SAMD21G18A.bin index 342c88f00fbbc988af3ac522cbc4c139993951e4..e202db26291f0a83772f429e666fb95ab9a42734 100755 GIT binary patch delta 886 zcmXYvYe*DP6vxkx{O6o==iUdtA^*@O zro}qkx|~_*9X{BA>%)-=LN?Kj%xOpWz-EO<0U=MAWh`#hc82 z88Qpmz#*5!2G{l*#BtouXG^3)e3nK`&j_W<%r%V9OGDaNvc&j1lT zL6Q>XqO_niN~2hDh3rg=a{V@4eXXyMg)UY(|HB&B#akUUQc~_!ys=JQz5S>Eu^m4{4gwo)<*My@J4uJGLTPLBk2 zII>U`tr~y^QwoR9T+kr%Ma$1D8Gy#QX~+Z@p>8HcFmnPkA25S1fcX%ln~V_5$ADjd z_LzkqvjA*?&82BbKR2KO|3D0}CUtcUww~0ilch(VcqCZ}zTz;gh5$d-+wB++Vr>ksY))phKiE;od*1L*&0g2O-_8N9LXGs@K)p-Ld zsnt~{y>G9qKAj`Hb8;%=Wq@a~>*0`PomZ*lh@h)U`q|EsXLP~7sx6%3xzfpkE1I;1 z%^c4aW3?L^h}YXqDPHk&4Y)s>GjLum`p=h5I>ILOIWc~b_BlKxLQgu{Z0~TUYdGK2 z#0!VrKv?>wL?j;it>k^EtO7^I7I9=LGKdtc8T_OYbKg;`QGcQWstp;!d@-sEVG&OS zb-H%4m$brZ&ueac7lWD$*E95}i!Hvdy%L<;O16&}{-}58u&bAh(Ro)r8KE9`AG5L| zamxLP*;(!Y@FU&GQRK>hO`>jf14NL$$SvdvvY7?gUIuU+Z+yp*<9r~%2YmjG;14vf O-_RUrO581vGk*a;M;)2~ delta 789 zcmW-eZAep57{{M;uXA_qs=K=^=epJ1orcYX%_Ji#&Dmz&1reDurCpTx@JU-G$IiEuoWRD#UjKcibWspy3=mYg7Z6np6CDPJm+wR{o}sj zUCbx*$ezv2T*b&4FYXhgj|kyuBhx|l(VNU!CZD4@<`j8FkF$?SZ`@qeL_FVeuRZsf zlM%>%&DHk`s@S}(hxLqMy_hRk3;lU|*7TBGrPalom{bJ~7QY*0)UN)nNvPEqVt{DMJxkOzEq?xgi=Div*(1kfFW(+cULMy`mgu??pPhC3Qo4XT;q* ztymaKiM_Zap!9%pFJe|)IPm8xWVh!WYLQYTxng5cS-KMvRj45;qPSwNemLzlr9g)4 zfDYM=zPh}=A8Nm+A-iJ@YL-(3oj!Elqk}1cACQ4o*lWu`<`s)IfINtB2}3)9qmnw8 zv?WZcDeQ?D+O9QOaz_o#yGD<3&7_Y$;8v_R*8D>?(d(0jc9)J=Cd^wgWN3l-{*pl= zv^oGdJg)(@3aOzB)=lC}-kd3f4y>}M#BFGMsFknW@FY*<@;-Hmz# i`GTy70GIHC+b^D%>wUQVjo|m~^fm1CHO9GhL(D&wSp^*c diff --git a/bootloaders/zero/binaries/sam_ba_arduino_mkrfox1200_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_arduino_mkrfox1200_SAMD21G18A.bin index b34315b9e3fa582594a9dcd29e5ba025eee4fa90..bf54b8ae9b3d2e8d1baa40eb7556784e574de8ce 100755 GIT binary patch delta 33 ocmbPYIK^Hq)$ diff --git a/bootloaders/zero/binaries/sam_ba_arduino_mkrzero_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_arduino_mkrzero_SAMD21G18A.bin index 195074f256cc7e7336c3b1ded5b1cea524428d85..eb92c57dc61e38759236e75719634f26c84b8026 100755 GIT binary patch delta 33 ocmbPXIKyzmA5js%{4xb2BLyP^Lvsd0BP&xgDQ82|tP delta 33 ncmbPXIKyzmA5jsn(mVwt10XUqXD~FdGBB|+u-Ggh*1-e-usaC_ diff --git a/bootloaders/zero/binaries/sam_ba_arduino_zero_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_arduino_zero_SAMD21G18A.bin index fb022cbc4c8d718cb94311e506b505411b18dc06..b8d663f03a603e3e65782c6dfee6b767ffcfadac 100755 GIT binary patch delta 33 ocmbPWIKgnk7f}(v{4xb2BLyP^Lvsd0BP&xgDj|3;qg4?lxKAQJ*t&%{)1ATjY^eag@8 z&kwjUxBxYI-_E$j_WNpqJCM)8;P7Lsrgwv4RECB>mvdA?REC^lmot+hh`l?LLrK_K z*>86uqq1>qs19A5M-j`^n?Q>n)XFTU1-Lx9D%tkIBCoW!eA#`Tw7pjd8L#(?Z4rn|CrTWn`Q^ zIiAIt(Pr{u7Dqj^8E*t&csx0ATjY^eaO%6 z&kwjUxG*>}dEd^s#rFGZfjf}T!QfD^RoS~iF)BmJm&-XSAu2;ovCElB5yW1d$)P0d zEbF&Akx|*Wz_{WTJIhrm@92u?O$^%KZ%g}7CZaAaTsk~}~Rbf8K?14F}Zt{Mh*=E>$v3mF$|zR9$dk@5EAdKPC! zpUH<=92vDIv$CplivRni(7^EjyYOaHR!>gGw#oH;#*878H}jb?zTW(jkC_nwpGIk~ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11D14AM_SAMD11D14AM.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11D14AM_SAMD11D14AM.bin index c349e2e00df8b1877310db7b9c1efebcd5eb132e..8cefe0b89e89e8193ff5bb6d33cfcfc407d92cf0 100755 GIT binary patch delta 326 zcmX>j|3;qg4?lxKAQJ*t&%{)1ATjY^eag@8 z&kwjUxBxYI-_E$j_WNpqJCM)8;P7Lsrgwv4RECB>mvdA?REC^lmot+hh`l?LLrK_K z*>86uqq1>qs19A5M-j`^n?Q>n)XFTU1-Lx9D%tkIBCoW!eA#`Tw7pjd8L#(?Z4rn|CrTWn`Q^ zIiAIt(Pr{u7Dqj^8E*t&csx0ATjY^eaO%6 z&kwjUxG*>}dEd^s#rFGZfjf}T!QfD^RoS~iF)BmJm&-XSAu2;ovCElB5yW1d$)P0d zEbF&Akx|*Wz_{WTJIhrm@92u?O$^%KZ%g}7CZaAaTsk~}~Rbf8K?14F}Zt{Mh*=E>$v3mF$|zR9$dk@5EAdKPC! zpUH<=92vDIv$CplivRni(7^EjyYOaHR!>gGw#oH;#*878H}jb?zTW(jkC_nwpGIk~ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11D14AS_SAMD11D14AS.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_D11D14AS_SAMD11D14AS.bin index 0326c5a04f5c5b5e3b6858410f6c3cc7f6d995be..26611fa363559f8a50557fb17358cb47834bfd34 100755 GIT binary patch delta 326 zcmX>j|3;qg4?lxKAQJ*t&%{)1ATjY^eag@8 z&kwjUxBxYI-_E$j_WNpqJCM)8;P7Lsrgwv4RECB>mvdA?REC^lmot+hh`l?LLrK_K z*>86uqq1>qs19A5M-j`^n?Q>n)XFTU1-Lx9D%tkIBCoW!eA#`Tw7pjd8L#(?Z4rn|CrTWn`Q^ zIiAIt(Pr{u7Dqj^8E*t&csx0ATjY^eaO%6 z&kwjUxG*>}dEd^s#rFGZfjf}T!QfD^RoS~iF)BmJm&-XSAu2;ovCElB5yW1d$)P0d zEbF&Akx|*Wz_{WTJIhrm@92u?O$^%KZ%g}7CZaAaTsk~}~Rbf8K?14F}Zt{Mh*=E>$v3mF$|zR9$dk@5EAdKPC! zpUH<=92vDIv$CplivRni(7^EjyYOaHR!>gGw#oH;#*878H}jb?zTW(jkC_nwpGIk~ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E15A.bin index 338266a2ca79604e4c601c6d8e86d4eb7c151848..58f3a4052320fb0f1c2bbb2f4bf01c97286cab5e 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UOe{7BNQ5u}00rR-KL7v# delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jXY;%A_2onGdvI}Vd diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E16A.bin index a6ab6abaadec1da0c91cb97962fbe6e4b6878997..a718a1d03eff07d530e41792b0edee4225581e43 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UOe{ACNQ5u}00rj@KmY&$ delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jXd~<+A2onGdxC?3k diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E17A.bin index b73a20a4127e76e2b3c431c05f3e79b5b6adcdad..bd8bf2d1adaed0cf55f5b23103aafa0d7fb48cc2 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UObs>%NQ5u}00p=UH~;_u delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jXVsn5*2onGdz6)yr diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMC21E18A.bin index 0287ace262970442f47952a3fd4f235c9ea2103b..3e03b061ded76710d38ce5eafd58c9bbbec17ed4 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UObs>%NQ5u}00p=UH~;_u delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jXVsn5*2onGdz6)yr diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAMD21E15A.bin index 252623f865e90fe61fd57e02569ff662f4360215..11c1fb564a5bcd54e322f9bdeec79a2ef4e135b4 100755 GIT binary patch delta 40 wcmdmDzr}vTGIqwo0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0oX#FAD&kd|r(k3NM26-Jh6Yv!rd9^Vn{UW0U;+S= CE)Mko diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E16B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E16B.bin index 2c657dbfddc5c3506ea7270cf6e8470e799b3f69..5194a2e5a2ef9d3381cc213465c1460bd029d31e 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{Wol++Vz&8)%mO9= Di~kPL delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!rd9?fn{UW0U;+S= CG!FIv diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E17B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E17B.bin index bc47f8bc52c337cc71ccacf682e219dfcc8980e0..bc6bbaea62eb328a45f5de6704e45c9e4e69e0ab 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{Wol++V!ru?%mO9= Dj0FzS delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!ra-j$hRgyc0FpWm A_W%F@ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E18B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21E_SAML21E18B.bin index e23f135c608310881d6e7364e15acb726199576e..308f2717e2c3ae0badd4a4362faa8e4f72e3f28b 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{Wol++VzK##%mO9= Dj0+CZ delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!rd9@Kn{UW0U;+S= CKo0l- diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G15A.bin index 64da336d16016a3e8bc567df5245014ebd3fdb49..7984f6ffd4d15a88f2f33dbf3b136304008ce2e3 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UOwBh3NQ5u}00rU;KL7v# delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jnbaQ}22onGdvkPee diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G16A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G16A.bin index 9f09b2f67efd274841cff5501fbfd9462c247b35..32207320ad68ce472c31962f4fbc58a1638c5d69 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UOf5DCNQ5u}00rm^KmY&$ delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jnY;%A_2onGdxeICl diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G17A.bin index 1c2256e96e8e3e731592b1be7fc4f87023837f2d..dfee15a75f575499f32787b1b0de96342a969ae8 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UOf5DCNQ5u}00rm^KmY&$ delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jnY;%A_2onGdxeICl diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMC21G18A.bin index 72cc008828bbcc6767ef2ad89938ad67dba2ca11..69f457e72531ab389e21af5799aeaeae3908c7b1 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?UOf5GDNQ5u}00r&~K>z>% delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jnd~<+A2onGdzYA*s diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAMD21G15A.bin index 690dfe8a31bf5212ca2268772c12e664f865d407..7d6bbc2b1a9e074c159f97408de2412ab29ffe0e 100755 GIT binary patch delta 40 wcmdmDzr}vTGIqwk^lez delta 40 ucmdmDzr}vTGIqw>o0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0h($ delta 40 ucmdmDzr}vTGIqw>o0qdkii&uZ<|!B%0Fj|NgQ0oX#FAD&kd|r(k3NM26-Jh6Yv!rdEc=n{UW0U;+S= CH4gRw diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G17B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G17B.bin index 22c7b037cd09f3ab33ca8c771df52525d34a97bd..fe3cce90cd35dcfd190ab2937af12d0ae7ee000f 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{Wol++YP$J`%mO9= Di~tVM delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!rdEc=n{UW0U;+S= CH4gRw diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G18B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21G_SAML21G18B.bin index 9c04d4738b90ef47bdb6f6e97d2a4939bfdb7e8f..fce3b5b3302e79b3fcf85f9f0c32a399f3fbf3f3 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{WoiaQn{UW0U;+S) C1`g2x delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!rdEa~n{UW0U;+S= CI}Y~% diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J15A.bin index 1dc8d3364115798faf3100e553e863b1ad67499d..c6797f965c3635626b9e711a5fc49b2d619f5e49 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?V49qqMNQ5u}00qJeIsgCw delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jfWOIN-2onGdvfXL9C!O+0Uz|_jfWOIN-2onGdvfXL9C!O+0Uz|_jfbaQ}22onGdx(jLm diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMC21J18A.bin index 0a7b7f8efed15e6a46989d677f050eee8415e157..c76d7026cee2cb165a168c00a799d6d1192d01ed 100755 GIT binary patch delta 40 wcmZ2ty2Nxt5)0$(&B-h`g+=`G%M^@^6pRcE%^3`htW3?V3@kPWNQ5u}00qtqJOBUy delta 40 ucmZ2ty2Nxt5)0$)&B-h`g+;td^AwB>fXL9C!O+0Uz|_jfY;%A_2onGdzzb^t diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAMD21J15A.bin index 7e47350631f9c8846e3c86ae7b69f19f0b839931..39497992243cc643abdc2d6bdbeab1ac65bb7d31 100755 GIT binary patch delta 40 wcmdmDzr}vTGIqwo0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0o0qdkii&uZ<|!B%0Fj|NgQ0oX#FAD&kd|r(k3NM26-Jh6Yv!rdCFVn{UW0U;+S= CFb?$q diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J17B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J17B.bin index bf46e00312c9ffb0185e88e73306cf697a9986ef..b11c060dc58d3eb281419ce5dbd768659ee7b87b 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{Wom9^V6yp!%mO9= Di{K8+ delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!rdCEqn{UW0U;+S= CHV*ax diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J18B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Generic_x21J_SAML21J18B.bin index 71aaef5ec33dd1c7fe1ddd8d1b25ee57a89142af..cb6a8398988fa4e854a8b6fb481ee714a885d67d 100755 GIT binary patch delta 47 zcmexi_rq?(3?@c}%`=(KvM|oxoX#FAD&m)4reI{GU}Ruu&R}R{Wom9^V7mE+%mO9= Di{=i@ delta 47 zcmexi_rq?(3?@dI%`=(KvM}D>oX#FAD&kd|r(k3NM26-Jh6Yv!rdCGAn{UW0U;+S= CJP!8& diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D11_SAMD11D14AM.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D11_SAMD11D14AM.bin index c349e2e00df8b1877310db7b9c1efebcd5eb132e..8cefe0b89e89e8193ff5bb6d33cfcfc407d92cf0 100755 GIT binary patch delta 326 zcmX>j|3;qg4?lxKAQJ*t&%{)1ATjY^eag@8 z&kwjUxBxYI-_E$j_WNpqJCM)8;P7Lsrgwv4RECB>mvdA?REC^lmot+hh`l?LLrK_K z*>86uqq1>qs19A5M-j`^n?Q>n)XFTU1-Lx9D%tkIBCoW!eA#`Tw7pjd8L#(?Z4rn|CrTWn`Q^ zIiAIt(Pr{u7Dqj^8E*t&csx0ATjY^eaO%6 z&kwjUxG*>}dEd^s#rFGZfjf}T!QfD^RoS~iF)BmJm&-XSAu2;ovCElB5yW1d$)P0d zEbF&Akx|*Wz_{WTJIhrm@92u?O$^%KZ%g}7CZaAaTsk~}~Rbf8K?14F}Zt{Mh*=E>$v3mF$|zR9$dk@5EAdKPC! zpUH<=92vDIv$CplivRni(7^EjyYOaHR!>gGw#oH;#*878H}jb?zTW(jkC_nwpGIk~ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_A_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_A_SAMD21E17A.bin index d13db9e7111eb76d99dd7cb18c2c0c9621c2b98f..a9d7ac6a9bbaed84da1a9a307741c05d012ab7e0 100755 GIT binary patch delta 40 wcmX?Lf53jjI(Ej{o7c0)ii-HV!Z delta 40 ucmX?Lf53jjI(Ej}o7c0)ii&uZ<|!B%0Fj|NgQ0fXL9C!O+0Uz{JYbVsn5*2onGd*b8p} diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E17A.bin index 8187c0b03b4be4f012895b8c719f31db09c3a17c..d0f393e79d80d0f08f0955c68d71c07b19b3c658 100755 GIT binary patch delta 143 zcmdmDzr%h)3Zu=$RBc9^jT60D867s?Wj)ErID7MQc3nQk3!ATsS~D^}*(@l|&BCZM zSyozHmqC_+K@*6XfLIrZS%6poh$Vq|4FiLMERa?NVr3v!pPVQi&1kcEuQU%Mi-L=h k;pCGt<|2OiWeP?{3PuKo<_v~LR;FfF#ul4JWEU_20JJL~EdT%j delta 138 zcmdmCzr}t+3ZuouRBc9!jT60D8ErP-Wj)Erczg45c3nQkGn=o9S~D^}*eoc{&BCZK zSyozH_m2z%gQ_e8!#^Oc38Wc-m_mcv3ajF598#s fGUg&)rFjZQ20&zJ&R}R@Wnf}uYPMNIb^#Lr(P1D@ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAMD21E18A.bin index 03dbd7ef3d14663afedfbbfd221f05dec04c747d..70a6bf3f5465b8efeb2b17cddac5f16bda40e98f 100755 GIT binary patch delta 143 zcmdmDzr%h)3Zu=$RBc9^jT60D867s?Wj)ErID7MQc3nQk3!ATsS~D^}*(@l|&BCZM zSyozHmqC_+K@*6XfLIrZS%6poh$Vq|4FiLMERa?NVr3v!pPVQi&1kcEuQU%Mi-L=h k;pCGt<|2OiWeP?{3PuKo<_v~LR;FfF#ul4JWEU_20JJL~EdT%j delta 138 zcmdmCzr}t+3ZuouRBc9!jT60D8ErP-Wj)Erczg45c3nQkGn=o9S~D^}*eoc{&BCZK zSyozH_m2z%gQ_e8!#^Oc38Wc-m_mcv3ajF598#s fGUg&)rFjZQ20&zJ&R}R@Wnf}uYQ9-Qb^#Lr(Ptn~ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAML21E18B.bin b/bootloaders/zero/binaries/sam_ba_sdcard_MT_D21E_rev_B_SAML21E18B.bin index ce3d4b5ab0f61830786a85897a212f2ea55d0db4..ee5a7a9c283d18b25bff4d82fd62e6fe81de47c7 100755 GIT binary patch delta 153 zcmexi_s4ER3KN6;#564+xp5L36QjcBnM~Zwj4Yd%vL0k)oV_`n-H?xQ%I2A(){KlR zHeVIvW?_6W`Jt4!?hzRVhPOa`42VAh@d+Tl0>pQLcnt%C!b2ea6o{V#@$1Q|($P!| uvYVTvxfxj$e2fey_sW=y_~n-=7#S%T85o)~7#dlbnpqiJZoVP2fC&IQX({Uf delta 148 zcmexk_rq>N3ez9CiD_Cua^oa6CPtafGnu%V85uS&Wj)Bqczbg?yCEOrgv~QWtr;1Y zY`!YS&BFL(@ow;v+zO0f=t`@frpOg}XrdArLI2NQ5u}00}Y+S^xk5 delta 40 ucmZ2uy2f-v5)0$)&B-heg+;td^AwB>fXL9C!O+0Uz{JYbbaRA62onGhHVcdZ diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD21J18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD21J18A.bin index d8f64bb02fee2b7a93123eea9435f52fe7ec5297..37d9dacc7a84d0a2acae15e70f14b2995037e5fe 100755 GIT binary patch delta 160 zcmdmDzr%h)3Zu=$RBc9^jT60D867s?Wj)ErID7MQc2hpa3!CqXS~D^}*(@o}&El#e z%fP_H%%C6u#A}!s6gYtNMg|522B5em5HkU>E)cT-u>cTD0`VH4yeyDb1Y%_%R-c?H w9nEO7`KUBABa4EIk>TVMG8V#q`DF@5MhZp-hUN^0MpmX~R>qr!Wfw9509alikpKVy delta 155 zcmdmCzr}t+3ZuouRBc9!jT60D8ErP-Wj)Erczg45c2hpaGn?;Gl0|qu_zF)0m@4PX;~na2V&*P rnbOgW7MqVsGc!&;BV!@#Rhp+@WB^2l<_v}gRt6?krkllO7cv0=Z$BZm diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD51J20A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_Xeno_SAMD51J20A.bin new file mode 100755 index 0000000000000000000000000000000000000000..a95951f7eee4024317b7ac580f361185bfae209b GIT binary patch literal 8000 zcmZ8G4_s7bw%>Q}oj?53;g34Z5ZsxIHZp1hqeWsh&Wu;!l9*Z{(e4GYy_g$=S&hCn z2e23Z+f~Uzls4tnYOR}$JMFSYLz-J{wL62dVb*ipwk2_UT|k^G$lP}>P`mH(l5SHW^fQ2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Sa?>`$zQ$oBzxG{F)7~ zaRJNoaR>hA>%WZr`rMx0)pu^1lRVR={_N=+j~#gEx9lUo+xn~Ym-An^9F6t2efG`= z?-zbu_MgJ9ybf)pp0F_apM3P~#h+h&>t^AOnuGDjt(_y~7m9zk^`#AUhL!R5#VI-C zm%jKoIQGi5Er-f>6`VG_`TE8ep8b2txeD_`fUq_v9^drmcFW>Y+^o zfsbE1c3{WzPmGj)J+C+E+}{?S&3-klo_cKa^6Kn0D)*&djsEW73%`H)$NkSmZ~I`$ zXXob(-MLSFa^}O2J^l0ycHu)M7k~QEw3~Na{qW$`9XmVUJnk-AU#RxpE_Ca!XdCj| zEkFCX;?jNBGRJQ2>N|A$&DPUT6|X73Ys1W~gYhB5shs_b7mQE;cH@`#fBHt(t`pz1 zeY9uJvzm?770XJFE@_+>$#^d@>$`j9NB{EdN3ez9CiD_Cua^oa6CPtafGnu%V85uS&Wj)Bqczbg?yComvgv|>@tr;1Y zY`!bT&Eon*hJk^HnL$ASh}SSNC~yGj4Gatl2Y}))f%p&*zXjqWKzsp+Zvycep!{7R z{Sb&B1M&08y3)~1e`GdyNi#7{o*-i(;#HcbU}OM9hUN^0237_pR;DJK@5n4*0swMt BEY$!2 diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_arduino_m0_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_arduino_m0_SAMD21G18A.bin index da6366e6c793b67837eb62d5cc40a5a0372cc634..9f8ec856d5bc14ef8af5f27d38717d5ee7a17d73 100755 GIT binary patch delta 40 wcmdmCzr%jRI(Ej{o7c04ii-HVHa-cR=BJGBtT@N2jVH}OsC9DIQ{s6{v=Pt(m5RqK}5jBg;khaWP7upUFx zZ8$AYm^zJcOMX|z(52CWfZ${!0@)G#!#ontC4^H#uU~>8xAJQR1W>xVr#fPbLEhF1 z6|Y#5;iZG&*>;%riRBru=s%&WpYlG@+hdV#Y?{V(@BI!goDk1S_HJDr{yX&C8@|S$ zp=ZVZK~I?P0sH$!;bMv}rix1{i%L2|LkvGBa>yYTc_?0wt0Q?16?u51s}J(??Q9xk z>vPtyfj1yW^s&UDnQluMR6zyuj;J#R0$U2;K=w)=WZ&nv*CD5?O8)zLs*6+s*Z`SE z18Cij1Fr7+Wrlmi0B{_%nKK}>N|QbS+#JD_(A0nqvdej^DQQj^!^VhL)Ko?1kVn$g zm)KX?25Eeu@@MJ3oG@M`-CEJrARe$RGbxhM)DN1Ms7qW_Q!n zw*vmUm#5YXxX7_a*L6yicPLIV&&O?3@T!eLoK^VB~P#qU!9 delta 670 zcmXYtT}TvB7>3U`>+FnwxUM;_yT^5Q%rs5ejfG6KXe}jYyU4p1j8*#?DnjT7s|)ig zBLeMQs9_{X7lJq2v=Y*icX`ppN+^UAq9k=TrztVtn;#n9V#y-G%SY?m6%P_@uxH&kjPdM5+ZqKi;@yh_~?4{5L9tPqQ zxTilA&+xFOe<~Ing+2Qr3S%vl80XlQ>-z8^)s?K&JhV32O~tgWltuWJkze8{>zIvq zXr3Y^f;c!V|`VszdIHWTw7A|x%>jRv!FxiCkF*(IxbUh+!^2$+Z@Tt z)EQ8yZNACQM5GmBH1CzFc}gDj4$f*ao$M-6Nj;=N@zxIdhDhUXn#jbsoh8P{?B8vW zZS#Bf+xAi?x`gbIO%`-}d}nQ9B(h@4mE=`ES`)X-pSDZ`nq_XV0rx2guvhLMg>8GG z(R%IiYui-WR9Qm!f*H&Ft)D+I45g!#BCf^E%+RjWu!)!){84j92{88 z?^QV7ViE6J=LR-iV%#p( w7kz#RXUYlLM=B*k+K~(Ybp-V;{#N&$oAS{hj?gg@3bqErt>NQ(QPm9h5129GBme*a diff --git a/bootloaders/zero/binaries/sam_ba_sdcard_arduino_mkrfox1200_SAMD21G18A.bin b/bootloaders/zero/binaries/sam_ba_sdcard_arduino_mkrfox1200_SAMD21G18A.bin index 78a872195887f4ccc97781c215202e221093e230..304f8f8eae603c1db7f34d6531059bfe39be955f 100755 GIT binary patch delta 40 wcmdmBzrlXPJa)#}o9DB~ii-H/include/ + * Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/sam/include/ * .h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h. * When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and * associated pins are only initialized if either pin is active. */ #define SDCARD_SPI_SERCOM_INSTANCE 5 -#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 -#define SDCARD_SPI_PAD0 PINMUX_PB30D_SERCOM5_PAD0 -#define SDCARD_SPI_PAD1 PINMUX_UNUSED -#define SDCARD_SPI_PAD2 PINMUX_PB22D_SERCOM5_PAD2 -#define SDCARD_SPI_PAD3 PINMUX_PB23D_SERCOM5_PAD3 +#if (SAMD51) + #define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD3_TX_PAD0_SCK_PAD1 + #define SDCARD_SPI_PAD0 PINMUX_PA23D_SERCOM5_PAD0 + #define SDCARD_SPI_PAD1 PINMUX_PA22D_SERCOM5_PAD1 + #define SDCARD_SPI_PAD2 PINMUX_UNUSED + #define SDCARD_SPI_PAD3 PINMUX_PA21C_SERCOM5_PAD3 +#else + #define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3 + #define SDCARD_SPI_PAD0 PINMUX_PB30D_SERCOM5_PAD0 + #define SDCARD_SPI_PAD1 PINMUX_UNUSED + #define SDCARD_SPI_PAD2 PINMUX_PB22D_SERCOM5_PAD2 + #define SDCARD_SPI_PAD3 PINMUX_PB23D_SERCOM5_PAD3 +#endif /* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN * must also be defined. PORT can be 0 (Port A) or 1 (Port B). @@ -160,7 +168,7 @@ * also be defined with the crystal frequency in Hertz. CLOCKCONFIG_INTERNAL * uses the DFLL in open-loop mode, except with the C21 which lacks a DFLL, so * the internal 48MHz RC oscillator is used instead. CLOCKCONFIG_INTERNAL_USB - * can be defined for the D21, D11, or L21. It will also use the DFLL in + * can be defined for the D21, D11, L21, or D51. It will also use the DFLL in * open-loop mode, except when connected to a USB port with data lines (and * not suspended), where it will calibrate against the USB SOF signal. */ @@ -179,7 +187,7 @@ /* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in - * a more accurate 48MHz output frequency at the expense of increased jitter. + * a more accurate output frequency at the expense of increased jitter. */ //#define PLL_FRACTIONAL_ENABLED @@ -192,8 +200,15 @@ */ //#define PLL_FAST_STARTUP -/* Master clock frequency (also Fcpu frequency) */ +/* Master clock frequency (also Fcpu frequency). With the D51, + * this can be either 120000000ul or 48000000ul. See README.md. + */ +#if (SAMD51) +#define VARIANT_MCK (120000000ul) +//#define VARIANT_MCK (48000000ul) +#else #define VARIANT_MCK (48000000ul) +#endif /* The fine calibration value for DFLL open-loop mode is defined here. * The coarse calibration value is loaded from NVM OTP (factory calibration values). @@ -206,7 +221,15 @@ */ #define USB_VENDOR_STRINGS_ENABLED #define STRING_MANUFACTURER "MattairTech LLC" -#define STRING_PRODUCT "Xeno" +#if (SAMD21) + #define STRING_PRODUCT "Xeno D21" +#elif (SAML21) + #define STRING_PRODUCT "Xeno L21" +#elif (SAMC21) + #define STRING_PRODUCT "Xeno C21" +#elif (SAMD51) + #define STRING_PRODUCT "Xeno D51" +#endif /* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */ #define USB_VID_HIGH 0x16 @@ -218,7 +241,7 @@ * See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting * BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie: * ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-1/ - * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED + * CMSIS/Device/ATMEL/sam/include/.h). Use PINMUX_UNUSED * if not used. By default, this interface is not enabled (except with the C21). */ #define BOOT_USART_SERCOM_INSTANCE 4 diff --git a/bootloaders/zero/board_driver_usb.c b/bootloaders/zero/board_driver_usb.c index ee66620b1..53c5bb970 100644 --- a/bootloaders/zero/board_driver_usb.c +++ b/bootloaders/zero/board_driver_usb.c @@ -22,14 +22,22 @@ #include "sam_ba_usb.h" #include "sam_ba_cdc.h" +#if (SAMD51) + #define NVM_CALIBRATION_ADDRESS NVMCTRL_SW0 + #define NVM_USB_PAD_TRANSN_POS (32) + #define NVM_USB_PAD_TRANSP_POS (37) + #define NVM_USB_PAD_TRIM_POS (42) +#else + #define NVM_CALIBRATION_ADDRESS NVMCTRL_OTP4 + #define NVM_USB_PAD_TRANSN_POS (45) + #define NVM_USB_PAD_TRANSP_POS (50) + #define NVM_USB_PAD_TRIM_POS (55) +#endif #define USB_PAD_TRANSN_REG_POS (6) -#define NVM_USB_PAD_TRANSN_POS (45) #define NVM_USB_PAD_TRANSN_SIZE (5) #define USB_PAD_TRANSP_REG_POS (0) -#define NVM_USB_PAD_TRANSP_POS (50) #define NVM_USB_PAD_TRANSP_SIZE (5) #define USB_PAD_TRIM_REG_POS (12) -#define NVM_USB_PAD_TRIM_POS (55) #define NVM_USB_PAD_TRIM_SIZE (3) /* Generic Clock Multiplexer IDs */ @@ -37,6 +45,8 @@ #define GCM_USB (0x06U) #elif (SAML21) #define GCM_USB (0x04U) +#elif (SAMD51) + #define GCM_USB (0x0AU) #else #error "board_driver_usb.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif @@ -75,24 +85,30 @@ void USB_Init(void) /* Enable USB clock */ #if (SAMD21 || SAMD11) PM->APBBMASK.reg |= PM_APBBMASK_USB; -#elif (SAML21) +#elif (SAML21 || SAMD51) MCLK->APBBMASK.reg |= MCLK_APBBMASK_USB; #endif /* Set up the USB DP/DN pins */ +#if (SAMD51) + pinMux(PINMUX_PA24H_USB_DM); + pinMux(PINMUX_PA25H_USB_DP); +#else pinMux(PINMUX_PA24G_USB_DM); pinMux(PINMUX_PA25G_USB_DP); +#endif /* ---------------------------------------------------------------------------------------------- * Put Generic Clock Generator 0 as source for Generic Clock Multiplexer 6 (USB reference) */ #if (SAMD21 || SAMD11) GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GCM_USB ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); - waitForSync(); +#elif (SAMD51 && (VARIANT_MCK == 120000000ul)) + GCLK->PCHCTRL[GCM_USB].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK5 ); // use 48MHz clock (required for USB) from GCLK5, which was setup in board_init.c #else GCLK->PCHCTRL[GCM_USB].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); - waitForSync(); #endif + waitForSync(); /* Reset */ #if defined(PARANOIA) @@ -104,7 +120,7 @@ void USB_Init(void) #endif /* Load Pad Calibration */ - pad_transn =(uint8_t)( *((uint32_t *)(NVMCTRL_OTP4) + pad_transn =(uint8_t)( *((uint32_t *)(NVM_CALIBRATION_ADDRESS) + (NVM_USB_PAD_TRANSN_POS / 32)) >> (NVM_USB_PAD_TRANSN_POS % 32)) & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); @@ -114,7 +130,7 @@ void USB_Init(void) pad_transn = 5; } - pad_transp =(uint8_t)( *((uint32_t *)(NVMCTRL_OTP4) + pad_transp =(uint8_t)( *((uint32_t *)(NVM_CALIBRATION_ADDRESS) + (NVM_USB_PAD_TRANSP_POS / 32)) >> (NVM_USB_PAD_TRANSP_POS % 32)) & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); @@ -124,7 +140,7 @@ void USB_Init(void) pad_transp = 29; } - pad_trim =(uint8_t)( *((uint32_t *)(NVMCTRL_OTP4) + pad_trim =(uint8_t)( *((uint32_t *)(NVM_CALIBRATION_ADDRESS) + (NVM_USB_PAD_TRIM_POS / 32)) >> (NVM_USB_PAD_TRIM_POS % 32)) & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); diff --git a/bootloaders/zero/board_init.c b/bootloaders/zero/board_init.c index 8e5eeefd7..08830fda9 100644 --- a/bootloaders/zero/board_init.c +++ b/bootloaders/zero/board_init.c @@ -29,59 +29,83 @@ extern uint32_t SystemCoreClock; */ // Constants for Clock generators -#define GENERIC_CLOCK_GENERATOR_MAIN (0u) -#define GENERIC_CLOCK_GENERATOR_XOSC (1u) -#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT (D21/D11) */ -#define GENERIC_CLOCK_GENERATOR_OSC_HS (3u) +#define GENERIC_CLOCK_GENERATOR_MAIN (0u) /* This is 48MHz (either 48MHz or 120MHz for D51) */ +#define GENERIC_CLOCK_GENERATOR_XOSC (1u) /* High speed crystal */ +#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT (D21 and D11 only) */ +#define GENERIC_CLOCK_GENERATOR_OSC_HS (3u) /* 8MHz internal RC oscillator (D21, D11, and L21 only) */ +#define GENERIC_CLOCK_GENERATOR_DFLL (4u) /* Used by D51 for 48MHz DFLL output (only used when cpu is 120MHz) */ +#define GENERIC_CLOCK_GENERATOR_48MHz (5u) /* Used by D51 for USB or any peripheral that has a 60MHz maximum peripheral clock (only used when cpu is 120MHz) */ +#define GENERIC_CLOCK_GENERATOR_96MHz (6u) /* Used by D51 for any peripheral that has a 100MHz maximum peripheral clock (only used when cpu is 120MHz) */ // Constants for Clock multiplexers -#if (SAMD || SAML21) +#if (SAMD21 || SAMD11 || SAML21) #define GENERIC_CLOCK_MULTIPLEXER_DFLL (0u) #define GENERIC_CLOCK_MULTIPLEXER_FDPLL (1u) - #define GENERIC_CLOCK_MULTIPLEXER_FDPLL96M_32K (2u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL_32K (2u) +#elif (SAMD51) + #define GENERIC_CLOCK_MULTIPLEXER_DFLL (0u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL_0 (1u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL_1 (2u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL_0_32K (3u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL_1_32K (3u) #elif (SAMC21) #define GENERIC_CLOCK_MULTIPLEXER_FDPLL (0u) - #define GENERIC_CLOCK_MULTIPLEXER_FDPLL96M_32K (1u) + #define GENERIC_CLOCK_MULTIPLEXER_FDPLL_32K (1u) #else #error "startup.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif -#if (SAMD || SAML21) +#if (SAMD21 || SAMD11 || SAML21 || SAMD51) void waitForDFLL( void ) { -#if (SAMD) +#if (SAMD21 || SAMD11) while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) == 0 ); -#elif (SAML21) +#elif (SAML21 || SAMD51) while ( (OSCCTRL->STATUS.reg & OSCCTRL_STATUS_DFLLRDY) == 0 ); #endif } #endif -#if (SAML21 || SAMC21) +#if (SAML21 || SAMC21 || SAMD51) void waitForPLL( void ) { +#if (SAMD51) + while ( OSCCTRL->Dpll[0].DPLLSYNCBUSY.reg & OSCCTRL_DPLLSYNCBUSY_MASK ); + while ( OSCCTRL->Dpll[1].DPLLSYNCBUSY.reg & OSCCTRL_DPLLSYNCBUSY_MASK ); +#else while ( OSCCTRL->DPLLSYNCBUSY.reg & OSCCTRL_DPLLSYNCBUSY_MASK ); +#endif } #endif void board_init( void ) { /* - * Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21) + * Disable automatic NVM write operations (errata reference 13134, applies to D21/D11/L21, but not C21 or D51) + * Disable NVM cache on D51 (errata). Will be re-enabled after reset at and of programming. */ +#if (SAMD51) + NVMCTRL->CTRLA.reg = (NVMCTRL_CTRLA_CACHEDIS0 | NVMCTRL_CTRLA_CACHEDIS1 | NVMCTRL_CTRLA_WMODE_MAN | NVMCTRL_CTRLA_AUTOWS); +#else NVMCTRL->CTRLB.bit.MANW = 1; +#endif - /* Set 1 Flash Wait State for 48MHz (2 for the L21 and C21), cf tables 20.9 and 35.27 in SAMD21 Datasheet */ -#if (SAMD) + /* Set 1 Flash Wait State for 48MHz (2 for the L21 and C21), cf tables 20.9 and 35.27 in SAMD21 Datasheet + * The D51 runs at 120MHz with 5 wait states (automatic) + */ +#if (SAMD21 || SAMD11) NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_HALF_Val ; // one wait state #elif (SAML21 || SAMC21) NVMCTRL->CTRLB.reg |= NVMCTRL_CTRLB_RWS_DUAL ; // two wait states +#elif (SAMD51) + // automatic wait states handled above (I had problems using read-modify-write on NVMCTRL->CTRLA.reg here after disabling caches above (errata)) + //NVMCTRL->CTRLA.bit.RWS = 5 ; // 5 wait states #endif /* Turn on the digital interface clock */ -#if (SAMD) +#if (SAMD21 || SAMD11) PM->APBAMASK.reg |= PM_APBAMASK_GCLK ; -#elif (SAML21 || SAMC21) +#elif (SAML21 || SAMC21 || SAMD51) MCLK->APBAMASK.reg |= MCLK_APBAMASK_GCLK ; #endif @@ -95,11 +119,11 @@ void board_init( void ) /* ---------------------------------------------------------------------------------------------- * Software reset the GCLK module to ensure it is re-initialized correctly */ -#if (SAMD) +#if (SAMD21 || SAMD11) GCLK->CTRL.reg = GCLK_CTRL_SWRST ; while ( (GCLK->CTRL.reg & GCLK_CTRL_SWRST) && (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) ); /* Wait for reset to complete */ -#elif (SAML21 || SAMC21) +#elif (SAML21 || SAMC21 || SAMD51) GCLK->CTRLA.reg = GCLK_CTRLA_SWRST ; while ( (GCLK->CTRLA.reg & GCLK_CTRLA_SWRST) && (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK) ); /* Wait for reset to complete */ @@ -111,56 +135,117 @@ void board_init( void ) */ #if defined(PLL_FRACTIONAL_ENABLE) - #define DPLLRATIO_LDR 2928u - #define DPLLRATIO_LDRFRAC 11u + #if (SAMD51 && (VARIANT_MCK == 120000000ul)) + #define DPLLRATIO_LDR 3661u + #define DPLLRATIO_LDRFRAC 3u + #define DPLL1RATIO_LDR 2928u + #define DPLL1RATIO_LDRFRAC 22u + #else + #define DPLLRATIO_LDR 2928u + #if (SAMD51) + #define DPLLRATIO_LDRFRAC 22u + #else + #define DPLLRATIO_LDRFRAC 11u + #endif + #endif #else - #define DPLLRATIO_LDR 2929u - #define DPLLRATIO_LDRFRAC 0u + #if (SAMD51 && (VARIANT_MCK == 120000000ul)) + #define DPLLRATIO_LDR 3661u + #define DPLLRATIO_LDRFRAC 0u + #define DPLL1RATIO_LDR 2929u + #define DPLL1RATIO_LDRFRAC 0u + #else + #define DPLLRATIO_LDR 2929u + #define DPLLRATIO_LDRFRAC 0u + #endif #endif -#if (SAMD) - SYSCTRL->XOSC32K.reg = (SYSCTRL_XOSC32K_STARTUP( 0x6u ) | SYSCTRL_XOSC32K_XTALEN | SYSCTRL_XOSC32K_EN32K) ; - SYSCTRL->XOSC32K.bit.ENABLE = 1 ; /* separate call, as described in chapter 15.6.3 */ +#if (SAMD21 || SAMD11) + SYSCTRL->XOSC32K.reg = (SYSCTRL_XOSC32K_STARTUP( 0x6u ) | SYSCTRL_XOSC32K_XTALEN | SYSCTRL_XOSC32K_EN32K); + SYSCTRL->XOSC32K.bit.ENABLE = 1; /* separate call, as described in chapter 15.6.3 */ while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ - - SYSCTRL->DPLLRATIO.reg = ( SYSCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | SYSCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ - - SYSCTRL->DPLLCTRLB.reg = SYSCTRL_DPLLCTRLB_REFCLK(0) ; /* select 32KHz crystal input */ - - SYSCTRL->DPLLCTRLA.reg = SYSCTRL_DPLLCTRLA_ENABLE ; - + + SYSCTRL->DPLLRATIO.reg = ( SYSCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | SYSCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ); /* set PLL multiplier */ + + SYSCTRL->DPLLCTRLB.reg = SYSCTRL_DPLLCTRLB_REFCLK(0); /* select 32KHz crystal input */ + + SYSCTRL->DPLLCTRLA.reg = SYSCTRL_DPLLCTRLA_ENABLE; + while ( (SYSCTRL->DPLLSTATUS.reg & SYSCTRL_DPLLSTATUS_CLKRDY) != SYSCTRL_DPLLSTATUS_CLKRDY ); - + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz */ - GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENDIV_DIV(2) ) ; + GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENDIV_DIV(2) ); waitForSync(); GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); - + #elif (SAML21 || SAMC21) - OSC32KCTRL->XOSC32K.reg = (OSC32KCTRL_XOSC32K_STARTUP( 0x4u ) | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_EN1K) ; - OSC32KCTRL->XOSC32K.bit.ENABLE = 1 ; - + OSC32KCTRL->XOSC32K.reg = (OSC32KCTRL_XOSC32K_STARTUP( 0x4u ) | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_EN1K); + OSC32KCTRL->XOSC32K.bit.ENABLE = 1; + while ( (OSC32KCTRL->STATUS.reg & OSC32KCTRL_STATUS_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ - - OSCCTRL->DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ + + OSCCTRL->DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ); /* set PLL multiplier */ waitForPLL(); - - OSCCTRL->DPLLCTRLB.reg = OSCCTRL_DPLLCTRLB_REFCLK(0) ; /* select 32KHz crystal input */ - + + OSCCTRL->DPLLCTRLB.reg = OSCCTRL_DPLLCTRLB_REFCLK(0); /* select 32KHz crystal input */ + OSCCTRL->DPLLPRESC.reg = 0; waitForPLL(); - - OSCCTRL->DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE ; + + OSCCTRL->DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE; waitForPLL(); - + while ( (OSCCTRL->DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_CLKRDY) != OSCCTRL_DPLLSTATUS_CLKRDY ); - + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz */ GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); + +#elif (SAMD51) + // Use high gain for 32.768KHz crystal + OSC32KCTRL->XOSC32K.reg = (OSC32KCTRL_XOSC32K_STARTUP( 0x4u ) | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_EN1K | OSC32KCTRL_XOSC32K_CGM_HS); + OSC32KCTRL->XOSC32K.bit.ENABLE = 1; + + while ( (OSC32KCTRL->STATUS.reg & OSC32KCTRL_STATUS_XOSC32KRDY) == 0 ); /* Wait for oscillator stabilization */ + + OSCCTRL->Dpll[0].DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ); /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->Dpll[0].DPLLCTRLB.reg = (OSCCTRL_DPLLCTRLB_REFCLK(1) | OSCCTRL_DPLLCTRLB_LBYPASS); /* select 32KHz crystal input, must use LBYPASS (see errata) */ + + OSCCTRL->Dpll[0].DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE; + waitForPLL(); + + while ( (OSCCTRL->Dpll[0].DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_LOCK) != OSCCTRL_DPLLSTATUS_LOCK ); + + /* If the CPU will run at 120MHz using the first PLL, setup the second PLL to generate 96MHz, which is divided down to 48MHz for use by USB, etc. */ + #if (VARIANT_MCK == 120000000ul) + OSCCTRL->Dpll[1].DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLL1RATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLL1RATIO_LDRFRAC) ); /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->Dpll[1].DPLLCTRLB.reg = (OSCCTRL_DPLLCTRLB_REFCLK(1) | OSCCTRL_DPLLCTRLB_LBYPASS); /* select 32KHz crystal input, must use LBYPASS (see errata) */ + + OSCCTRL->Dpll[1].DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE; + waitForPLL(); + + while ( (OSCCTRL->Dpll[1].DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_LOCK) != OSCCTRL_DPLLSTATUS_LOCK ); + + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_96MHz].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DPLL1 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_48MHz].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL1 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Switch Generic Clock Generator 0 to PLL. The CPU will run at 120MHz. */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DPLL0 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + #else + /* Switch Generic Clock Generator 0 to PLL. The CPU will run at 48MHz. */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL0 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + #endif #endif #elif defined(CLOCKCONFIG_CLOCK_SOURCE) && (CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_HS_CRYSTAL) @@ -168,8 +253,14 @@ void board_init( void ) * Enable XOSC clock (External on-board high speed crystal oscillator) */ -#if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL)) - #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 4000000UL and 32000000UL" +#if (SAMD51) + #if ((HS_CRYSTAL_FREQUENCY_HERTZ < 8000000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 48000000UL)) + #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 8000000UL and 48000000UL" + #endif +#else + #if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL)) + #error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 400000UL and 32000000UL" + #endif #endif #if defined(PLL_FAST_STARTUP) @@ -182,119 +273,191 @@ void board_init( void ) #define HS_CRYSTAL_DIVISOR 32000UL #endif +// All floating point math done by C preprocessor #define HS_CRYSTAL_DIVIDER (HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVISOR) -#define DPLLRATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) +#if (SAMD51 && (VARIANT_MCK == 120000000ul)) + #define DPLLRATIO_FLOAT (120000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) + #define DPLL1RATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) +#else + #define DPLLRATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) +#endif #if defined(PLL_FRACTIONAL_ENABLED) #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT - #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) + #if (SAMD51) + #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 32.0) + #if (VARIANT_MCK == 120000000ul) + #define DPLL1RATIO_LDRFRAC (uint8_t)((DPLL1RATIO_FLOAT - (uint16_t)DPLL1RATIO_FLOAT) * 32.0) + #endif + #else + #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) + #endif #else #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT #define DPLLRATIO_LDRFRAC 0 + #if (SAMD51 && (VARIANT_MCK == 120000000ul)) + #define DPLL1RATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLL1RATIO_LDRFRAC 0 + #endif #endif -#if (SAMD) +#if (SAMD21 || SAMD11) SYSCTRL->XOSC.reg = (SYSCTRL_XOSC_STARTUP( 0x8u ) | SYSCTRL_XOSC_GAIN( 0x4u ) | SYSCTRL_XOSC_XTALEN | SYSCTRL_XOSC_ENABLE) ; // startup time is 8ms while ( (SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_XOSCRDY) == 0 ); /* Wait for oscillator stabilization */ SYSCTRL->XOSC.reg |= SYSCTRL_XOSC_AMPGC ; // set only after startup time - + /* Connect GCLK1 to XOSC and set prescaler */ GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_XOSC ) | GCLK_GENDIV_DIV(HS_CRYSTAL_DIVIDER) ) ; // Set divider for generic clock generator 1 waitForSync(); GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_XOSC ) | GCLK_GENCTRL_SRC_XOSC | GCLK_GENCTRL_GENEN ); waitForSync(); - + /* Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 1 (FDPLL reference) */ GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( GENERIC_CLOCK_MULTIPLEXER_FDPLL ) | GCLK_CLKCTRL_GEN_GCLK1 | GCLK_CLKCTRL_CLKEN ); waitForSync(); - + /* Configure PLL */ SYSCTRL->DPLLRATIO.reg = ( SYSCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | SYSCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ - + SYSCTRL->DPLLCTRLB.reg = SYSCTRL_DPLLCTRLB_REFCLK(2) ; /* select GCLK input */ - + SYSCTRL->DPLLCTRLA.reg = SYSCTRL_DPLLCTRLA_ENABLE ; - + while ( (SYSCTRL->DPLLSTATUS.reg & SYSCTRL_DPLLSTATUS_CLKRDY) != SYSCTRL_DPLLSTATUS_CLKRDY ); - + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz */ GCLK->GENDIV.reg = ( GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENDIV_DIV(2) ) ; waitForSync(); GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); - + #elif (SAML21 || SAMC21) OSCCTRL->XOSCCTRL.reg = (OSCCTRL_XOSCCTRL_STARTUP( 0x8u ) | OSCCTRL_XOSCCTRL_GAIN( 0x4u ) | OSCCTRL_XOSCCTRL_XTALEN | OSCCTRL_XOSCCTRL_ENABLE) ; // startup time is 8ms while ( (OSCCTRL->STATUS.reg & OSCCTRL_STATUS_XOSCRDY) == 0 ); /* Wait for oscillator stabilization */ OSCCTRL->XOSCCTRL.reg |= OSCCTRL_XOSCCTRL_AMPGC ; // set only after startup time - + /* Connect GCLK1 to XOSC and set prescaler */ GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_XOSC].reg = ( GCLK_GENCTRL_DIV(HS_CRYSTAL_DIVIDER) | GCLK_GENCTRL_SRC_XOSC | GCLK_GENCTRL_GENEN ); waitForSync(); - + /* Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 1 (FDPLL reference) */ GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK1 ); while ( (GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync - + /* Configure PLL */ OSCCTRL->DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ waitForPLL(); - + OSCCTRL->DPLLCTRLB.reg = OSCCTRL_DPLLCTRLB_REFCLK(2) ; /* select GCLK input */ - + OSCCTRL->DPLLPRESC.reg = 0; waitForPLL(); - + OSCCTRL->DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE ; waitForPLL(); - + while ( (OSCCTRL->DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_CLKRDY) != OSCCTRL_DPLLSTATUS_CLKRDY ); - + /* Switch Generic Clock Generator 0 to PLL. Divide by two and the CPU will run at 48MHz */ GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); + +#elif (SAMD51) + OSCCTRL->XOSCCTRL[0].reg = (OSCCTRL_XOSCCTRL_STARTUP( 0x8u ) | OSCCTRL_XOSCCTRL_IPTAT(3) | OSCCTRL_XOSCCTRL_IMULT(4) | OSCCTRL_XOSCCTRL_XTALEN | OSCCTRL_XOSCCTRL_ENABLE) ; // startup time is 8ms + while ( (OSCCTRL->STATUS.reg & OSCCTRL_STATUS_XOSCRDY0) == 0 ); /* Wait for oscillator stabilization */ + + OSCCTRL->XOSCCTRL[0].reg |= OSCCTRL_XOSCCTRL_ENALC | OSCCTRL_XOSCCTRL_LOWBUFGAIN ; // Enable automatic loop compensation + + /* Connect GCLK1 to XOSC and set prescaler */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_XOSC].reg = ( GCLK_GENCTRL_DIV(HS_CRYSTAL_DIVIDER) | GCLK_GENCTRL_SRC_XOSC0 | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 1 (FDPLL reference) */ + GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_0].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK1 ); + while ( (GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_0].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync + + /* Configure PLL */ + OSCCTRL->Dpll[0].DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLLRATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLLRATIO_LDRFRAC) ) ; /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->Dpll[0].DPLLCTRLB.reg = (OSCCTRL_DPLLCTRLB_REFCLK_GCLK | OSCCTRL_DPLLCTRLB_LBYPASS) ; /* select GCLK input, must use LBYPASS (see errata) */ + + OSCCTRL->Dpll[0].DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE ; + waitForPLL(); + + while ( (OSCCTRL->Dpll[0].DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_LOCK) != OSCCTRL_DPLLSTATUS_LOCK ); + + /* If the CPU will run at 120MHz using the first PLL, setup the second PLL to generate 96MHz, which is divided down to 48MHz for use by USB, etc. */ + #if (VARIANT_MCK == 120000000ul) + GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_1].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK1 ); + while ( (GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_1].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync + + /* Configure PLL */ + OSCCTRL->Dpll[1].DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(DPLL1RATIO_LDR) | OSCCTRL_DPLLRATIO_LDRFRAC(DPLL1RATIO_LDRFRAC) ); /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->Dpll[1].DPLLCTRLB.reg = (OSCCTRL_DPLLCTRLB_REFCLK_GCLK | OSCCTRL_DPLLCTRLB_LBYPASS) ; /* select GCLK input, must use LBYPASS (see errata) */ + + OSCCTRL->Dpll[1].DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE; + waitForPLL(); + + while ( (OSCCTRL->Dpll[1].DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_LOCK) != OSCCTRL_DPLLSTATUS_LOCK ); + + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_96MHz].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DPLL1 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_48MHz].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL1 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Switch Generic Clock Generator 0 to PLL. The CPU will run at 120MHz. */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DPLL0 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + #else + /* Switch Generic Clock Generator 0 to PLL. The CPU will run at 48MHz. */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL0 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + #endif #endif #elif defined(CLOCKCONFIG_CLOCK_SOURCE) && ((CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_INTERNAL) || (CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_INTERNAL_USB)) /* ---------------------------------------------------------------------------------------------- - * Enable DFLL48M clock (D21/L21) or RC oscillator (C21) + * Enable DFLL48M clock (D21/D11/L21/D51) or RC oscillator (C21) */ -#if (SAMD) +#if (SAMD21 || SAMD11) /* Remove the OnDemand mode, Bug http://avr32.icgroup.norway.atmel.com/bugzilla/show_bug.cgi?id=9905 */ SYSCTRL->DFLLCTRL.bit.ONDEMAND = 0 ; waitForDFLL(); - + /* Load NVM Coarse calibration value */ uint32_t calib = (*((uint32_t *) FUSES_DFLL48M_COARSE_CAL_ADDR) & FUSES_DFLL48M_COARSE_CAL_Msk) >> FUSES_DFLL48M_COARSE_CAL_Pos; SYSCTRL->DFLLVAL.reg = SYSCTRL_DFLLVAL_COARSE(calib) | SYSCTRL_DFLLVAL_FINE(512); - + /* Write full configuration to DFLL control register */ #if defined(CLOCKCONFIG_CLOCK_SOURCE) && (CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_INTERNAL_USB) SYSCTRL->DFLLMUL.reg = SYSCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value SYSCTRL_DFLLMUL_FSTEP( 0xA ) | // value from datasheet USB Characteristics SYSCTRL_DFLLMUL_MUL( 0xBB80 ) ; // 1KHz USB SOF signal (48MHz Fcpu / 1KHz SOF) - + SYSCTRL->DFLLCTRL.reg = SYSCTRL_DFLLCTRL_USBCRM | /* USB correction */ SYSCTRL_DFLLCTRL_MODE | /* Closed loop mode */ SYSCTRL_DFLLCTRL_CCDIS ; waitForDFLL(); #endif - + /* Enable the DFLL */ SYSCTRL->DFLLCTRL.reg |= SYSCTRL_DFLLCTRL_ENABLE ; waitForDFLL(); - + /* Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz */ GCLK->GENDIV.reg = GCLK_GENDIV_ID( GENERIC_CLOCK_GENERATOR_MAIN ) ; // Generic Clock Generator 0 waitForSync(); GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_MAIN ) | GCLK_GENCTRL_SRC_DFLL48M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); - + #elif (SAML21) /* Defines missing from CMSIS */ #ifndef FUSES_DFLL48M_COARSE_CAL_ADDR @@ -306,48 +469,117 @@ void board_init( void ) #ifndef FUSES_DFLL48M_COARSE_CAL_Msk #define FUSES_DFLL48M_COARSE_CAL_Msk (0x3Ful << FUSES_DFLL48M_COARSE_CAL_Pos) #endif - + OSCCTRL->DFLLCTRL.bit.ONDEMAND = 0 ; waitForDFLL(); - + /* Load NVM Coarse calibration value */ uint32_t calib = (*((uint32_t *) FUSES_DFLL48M_COARSE_CAL_ADDR) & FUSES_DFLL48M_COARSE_CAL_Msk) >> FUSES_DFLL48M_COARSE_CAL_Pos; OSCCTRL->DFLLVAL.reg = OSCCTRL_DFLLVAL_COARSE(calib) | OSCCTRL_DFLLVAL_FINE(512); - + /* Write full configuration to DFLL control register */ #if defined(CLOCKCONFIG_CLOCK_SOURCE) && (CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_INTERNAL_USB) OSCCTRL->DFLLMUL.reg = OSCCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value OSCCTRL_DFLLMUL_FSTEP( 0xA ) | // value from datasheet USB Characteristics OSCCTRL_DFLLMUL_MUL( 0xBB80 ) ; // 1KHz USB SOF signal (48MHz Fcpu / 1KHz SOF) - + OSCCTRL->DFLLCTRL.reg = OSCCTRL_DFLLCTRL_USBCRM | /* USB correction */ OSCCTRL_DFLLCTRL_MODE | /* Closed loop mode */ OSCCTRL_DFLLCTRL_CCDIS ; waitForDFLL(); #endif - + /* Enable the DFLL */ OSCCTRL->DFLLCTRL.reg |= OSCCTRL_DFLLCTRL_ENABLE ; waitForDFLL(); - + /* Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz */ GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DFLL48M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); waitForSync(); - + #elif (SAMC21) #if defined(CLOCKCONFIG_CLOCK_SOURCE) && (CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_INTERNAL_USB) #error "startup.c: CLOCKCONFIG_INTERNAL_USB setting invalid for C21 chips as they lack USB." #endif - + /* Change OSC48M divider to /1. CPU will run at 48MHz */ OSCCTRL->OSC48MDIV.reg = OSCCTRL_OSC48MDIV_DIV(0); while ( OSCCTRL->OSC48MSYNCBUSY.reg & OSCCTRL_OSC48MSYNCBUSY_OSC48MDIV ); + +#elif (SAMD51) + OSCCTRL->DFLLCTRLA.bit.ONDEMAND = 0 ; + waitForDFLL(); + + /* Write full configuration to DFLL control register */ + #if defined(CLOCKCONFIG_CLOCK_SOURCE) && (CLOCKCONFIG_CLOCK_SOURCE == CLOCKCONFIG_INTERNAL_USB) + OSCCTRL->DFLLMUL.reg = OSCCTRL_DFLLMUL_CSTEP( 31 ) | // Coarse step is 31, half of the max value + OSCCTRL_DFLLMUL_FSTEP( 0xA ) | // value from datasheet USB Characteristics + OSCCTRL_DFLLMUL_MUL( 0xBB80 ) ; // 1KHz USB SOF signal (48MHz Fcpu / 1KHz SOF) + + OSCCTRL->DFLLCTRLB.reg = OSCCTRL_DFLLCTRLB_USBCRM | /* USB correction */ + OSCCTRL_DFLLCTRLB_MODE | /* Closed loop mode */ + OSCCTRL_DFLLCTRLB_CCDIS ; + waitForDFLL(); + #endif + + /* Enable the DFLL */ + OSCCTRL->DFLLCTRLA.reg |= OSCCTRL_DFLLCTRLA_ENABLE ; + waitForDFLL(); + + /* If the CPU will run at 120MHz using the first PLL, setup the second PLL to generate 96MHz. */ + #if (VARIANT_MCK == 120000000ul) + /* Switch Generic Clock Generator 4 to DFLL48M and divide down to 2MHz (to be used as PLL input) */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_DFLL].reg = ( GCLK_GENCTRL_DIV(24) | GCLK_GENCTRL_SRC_DFLL | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Configure PLL0 */ + GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_0].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK4 ); + while ( (GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_0].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync + + OSCCTRL->Dpll[0].DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(59) | OSCCTRL_DPLLRATIO_LDRFRAC(0) ) ; /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->Dpll[0].DPLLCTRLB.reg = (OSCCTRL_DPLLCTRLB_REFCLK_GCLK | OSCCTRL_DPLLCTRLB_LBYPASS) ; /* select GCLK input, must use LBYPASS (see errata) */ + + OSCCTRL->Dpll[0].DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE ; + waitForPLL(); + + while ( (OSCCTRL->Dpll[0].DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_LOCK) != OSCCTRL_DPLLSTATUS_LOCK ); + + /* Configure PLL1 */ + GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_1].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK4 ); + while ( (GCLK->PCHCTRL[GENERIC_CLOCK_MULTIPLEXER_FDPLL_1].reg & GCLK_PCHCTRL_CHEN) != GCLK_PCHCTRL_CHEN ); // wait for sync + + OSCCTRL->Dpll[1].DPLLRATIO.reg = ( OSCCTRL_DPLLRATIO_LDR(47) | OSCCTRL_DPLLRATIO_LDRFRAC(0) ); /* set PLL multiplier */ + waitForPLL(); + + OSCCTRL->Dpll[1].DPLLCTRLB.reg = (OSCCTRL_DPLLCTRLB_REFCLK_GCLK | OSCCTRL_DPLLCTRLB_LBYPASS) ; /* select GCLK input, must use LBYPASS (see errata) */ + + OSCCTRL->Dpll[1].DPLLCTRLA.reg = OSCCTRL_DPLLCTRLA_ENABLE; + waitForPLL(); + + while ( (OSCCTRL->Dpll[1].DPLLSTATUS.reg & OSCCTRL_DPLLSTATUS_LOCK) != OSCCTRL_DPLLSTATUS_LOCK ); + + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_96MHz].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DPLL1 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_48MHz].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DFLL | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + + /* Switch Generic Clock Generator 0 to PLL. CPU will run at 120MHz */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DPLL0 | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + #else + /* Switch Generic Clock Generator 0 to DFLL. CPU will run at 48MHz */ + GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC_DFLL | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); + waitForSync(); + #endif + #endif #else #error "board_init.c: CLOCKCONFIG_CLOCK_SOURCE must be defined in the board_definitions file" #endif -#if (SAMD21) +#if (SAMD21 || SAMD11) /* Modify PRESCaler value of OSC8M to have 8MHz */ SYSCTRL->OSC8M.bit.PRESC = SYSCTRL_OSC8M_PRESC_0_Val ; // recent versions of CMSIS from Atmel changed the prescaler defines //SYSCTRL->OSC8M.bit.ONDEMAND = 0 ; @@ -358,7 +590,6 @@ void board_init( void ) GCLK->GENCTRL.reg = ( GCLK_GENCTRL_ID( GENERIC_CLOCK_GENERATOR_OSC_HS ) | GCLK_GENCTRL_SRC_OSC8M | GCLK_GENCTRL_GENEN ); waitForSync(); - #elif (SAML21) /* Note that after reset, the L21 starts with the OSC16M set to 4MHz, NOT the DFLL@48MHz as stated in some documentation. */ /* Modify FSEL value of OSC16M to have 8MHz */ @@ -372,12 +603,14 @@ void board_init( void ) SystemCoreClock=VARIANT_MCK; /* Set CPU and APB dividers before switching the CPU/APB clocks to the new clock source */ -#if (SAMD) +#if (SAMD21 || SAMD11) PM->CPUSEL.reg = PM_CPUSEL_CPUDIV_DIV1 ; PM->APBASEL.reg = PM_APBASEL_APBADIV_DIV1_Val ; PM->APBBSEL.reg = PM_APBBSEL_APBBDIV_DIV1_Val ; PM->APBCSEL.reg = PM_APBCSEL_APBCDIV_DIV1_Val ; #elif (SAML21 || SAMC21) MCLK->CPUDIV.reg = MCLK_CPUDIV_CPUDIV_DIV1 ; +#elif (SAMD51) + MCLK->CPUDIV.reg = MCLK_CPUDIV_DIV_DIV1 ; #endif } diff --git a/bootloaders/zero/board_startup.c b/bootloaders/zero/board_startup.c index 9a5315786..143be270d 100644 --- a/bootloaders/zero/board_startup.c +++ b/bootloaders/zero/board_startup.c @@ -28,15 +28,25 @@ struct ConstVectors void* pfnReset_Handler; void* pfnNMI_Handler; void* pfnHardFault_Handler; +#if (SAMD51) + void* pfnMemManage_Handler; + void* pfnBusFault_Handler; + void* pfnUsageFault_Handler; +#else void* pfnReservedM12; void* pfnReservedM11; void* pfnReservedM10; +#endif void* pfnReservedM9; void* pfnReservedM8; void* pfnReservedM7; void* pfnReservedM6; void* pfnSVC_Handler; +#if (SAMD51) + void* pfnDebugMon_Handler; +#else void* pfnReservedM4; +#endif void* pfnReservedM3; void* pfnPendSV_Handler; void* pfnSysTick_Handler; @@ -63,15 +73,25 @@ const struct ConstVectors exception_table = .pfnReset_Handler = (void*) Reset_Handler, .pfnNMI_Handler = (void*) NMI_Handler, .pfnHardFault_Handler = (void*) HardFault_Handler, +#if (SAMD51) + .pfnMemManage_Handler = (void*) MemManage_Handler, + .pfnBusFault_Handler = (void*) BusFault_Handler, + .pfnUsageFault_Handler = (void*) UsageFault_Handler, +#else .pfnReservedM12 = (void*) (0UL), /* Reserved */ .pfnReservedM11 = (void*) (0UL), /* Reserved */ .pfnReservedM10 = (void*) (0UL), /* Reserved */ +#endif .pfnReservedM9 = (void*) (0UL), /* Reserved */ .pfnReservedM8 = (void*) (0UL), /* Reserved */ .pfnReservedM7 = (void*) (0UL), /* Reserved */ .pfnReservedM6 = (void*) (0UL), /* Reserved */ .pfnSVC_Handler = (void*) SVC_Handler, +#if (SAMD51) + .pfnDebugMon_Handler = (void*) DebugMon_Handler, +#else .pfnReservedM4 = (void*) (0UL), /* Reserved */ +#endif .pfnReservedM3 = (void*) (0UL), /* Reserved */ .pfnPendSV_Handler = (void*) PendSV_Handler, .pfnSysTick_Handler = (void*) SysTick_Handler, @@ -106,18 +126,26 @@ void Reset_Handler( void ) } } - /* Change default QOS values to have the best performance and correct USB behaviour (applies to D21/D11). From startup_samd21.c from ASF 3.32. */ + /* Change default QOS values to have the best performance and correct USB behavior (applies to D21/D11). From startup_samd21.c from ASF 3.32. */ #if (SAMD21_SERIES || SAMD11_SERIES) SBMATRIX->SFR[SBMATRIX_SLAVE_HMCRAMC0].reg = 2; - + USB->DEVICE.QOSCTRL.bit.CQOS = 2; USB->DEVICE.QOSCTRL.bit.DQOS = 2; - + DMAC->QOSCTRL.bit.DQOS = 2; DMAC->QOSCTRL.bit.FQOS = 2; DMAC->QOSCTRL.bit.WRBQOS = 2; #endif +#if (SAMD51) + #if __FPU_USED + /* Enable FPU */ + SCB->CPACR |= (0xFu << 20); + __DSB(); + __ISB(); + #endif +#endif // board_init(); // will be done in main() after app check /* Initialize the C library */ @@ -151,3 +179,29 @@ void PendSV_Handler(void) __BKPT(2); while (1); } + +#if (SAMD51) +void MemManage_Handler(void) +{ + __BKPT(3); + while (1); +} + +void BusFault_Handler(void) +{ + __BKPT(4); + while (1); +} + +void UsageFault_Handler(void) +{ + __BKPT(6); + while (1); +} + +void DebugMon_Handler(void) +{ + __BKPT(7); + while (1); +} +#endif diff --git a/bootloaders/zero/build_all_bootloaders.sh b/bootloaders/zero/build_all_bootloaders.sh index b72c46f24..d09cbe6d9 100755 --- a/bootloaders/zero/build_all_bootloaders.sh +++ b/bootloaders/zero/build_all_bootloaders.sh @@ -6,6 +6,7 @@ make clean BOARD_ID=Xeno MCU=SAMD21J18A SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=Xeno MCU=SAML21J18B SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=Xeno MCU=SAMC21J18A SDCARD=SDCARD_DISABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAMD51J20A SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A SDCARD=SDCARD_DISABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A SDCARD=SDCARD_DISABLED make all mostly_clean @@ -73,6 +74,7 @@ BOARD_ID=arduino_m0_pro MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_cl BOARD_ID=Xeno MCU=SAMD21J18A SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=Xeno MCU=SAML21J18B SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=Xeno MCU=SAMC21J18A SDCARD=SDCARD_ENABLED make all mostly_clean +BOARD_ID=Xeno MCU=SAMD51J20A SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E17A SDCARD=SDCARD_ENABLED make all mostly_clean BOARD_ID=MT_D21E_rev_A MCU=SAMD21E18A SDCARD=SDCARD_ENABLED make all mostly_clean diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m4f_1MB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m4f_1MB.ld new file mode 100644 index 000000000..7944e544e --- /dev/null +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m4f_1MB.ld @@ -0,0 +1,225 @@ +/* + Copyright (c) 2014-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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __sketch_vectors_ptr + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + . = ORIGIN(FLASH); + + .vectors : + { + KEEP(*(.isr_vector)) + } > FLASH + + .text : + { + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + PROVIDE(__sketch_vectors_ptr = ORIGIN(FLASH) + LENGTH(FLASH)); + + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") +} diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m4f_256KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m4f_256KB.ld new file mode 100644 index 000000000..c3bac0aaa --- /dev/null +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m4f_256KB.ld @@ -0,0 +1,225 @@ +/* + Copyright (c) 2014-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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __sketch_vectors_ptr + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + . = ORIGIN(FLASH); + + .vectors : + { + KEEP(*(.isr_vector)) + } > FLASH + + .text : + { + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + PROVIDE(__sketch_vectors_ptr = ORIGIN(FLASH) + LENGTH(FLASH)); + + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") +} diff --git a/bootloaders/zero/linker_scripts/bootloader_sam_m4f_512KB.ld b/bootloaders/zero/linker_scripts/bootloader_sam_m4f_512KB.ld new file mode 100644 index 000000000..d66121d4e --- /dev/null +++ b/bootloaders/zero/linker_scripts/bootloader_sam_m4f_512KB.ld @@ -0,0 +1,225 @@ +/* + Copyright (c) 2014-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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000-0x0004 /* 4 bytes used by bootloader to keep data between resets */ +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __sketch_vectors_ptr + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + . = ORIGIN(FLASH); + + .vectors : + { + KEEP(*(.isr_vector)) + } > FLASH + + .text : + { + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + PROVIDE(__sketch_vectors_ptr = ORIGIN(FLASH) + LENGTH(FLASH)); + + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + __BinarySize = (SIZEOF(.vectors) + SIZEOF(.text) + SIZEOF(.data)); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + + /* Check if vectors + text + data exceeds bootloader FLASH limit */ + ASSERT(__BinarySize <= LENGTH(FLASH), "Bootloader exceeds 8KB (vectors + text + data). Please recompile with different options.") +} diff --git a/bootloaders/zero/main.c b/bootloaders/zero/main.c index 427fb2239..d2c9ed65b 100644 --- a/bootloaders/zero/main.c +++ b/bootloaders/zero/main.c @@ -26,7 +26,7 @@ #include "board_driver_led.h" #include "SDCard/sdBootloader.h" #include "util.h" -#if (SAMD21 || SAMD11 || SAML21) +#if (SAMD21 || SAMD11 || SAML21 || SAMD51) #include "sam_ba_usb.h" #include "sam_ba_cdc.h" #endif @@ -100,7 +100,7 @@ uint32_t* pulSketch_Start_Address; #if (SAMD21 || SAMD11) if (PM->RCAUSE.bit.POR) -#elif (SAML21 || SAMC21) +#elif (SAML21 || SAMC21 || SAMD51) if (RSTC->RCAUSE.bit.POR) #else #error "main.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." diff --git a/bootloaders/zero/sam_ba_monitor.c b/bootloaders/zero/sam_ba_monitor.c index 0d660f56d..58648cb76 100644 --- a/bootloaders/zero/sam_ba_monitor.c +++ b/bootloaders/zero/sam_ba_monitor.c @@ -22,7 +22,7 @@ #include "sam_ba_monitor.h" #include "sam_ba_serial.h" #include "board_driver_serial.h" -#if (SAMD21 || SAMD11 || SAML21) +#if (SAMD21 || SAMD11 || SAML21 || SAMD51) #include "board_driver_usb.h" #include "sam_ba_usb.h" #include "sam_ba_cdc.h" diff --git a/bootloaders/zero/sam_ba_serial.c b/bootloaders/zero/sam_ba_serial.c index 8e87af0f4..19e854a2b 100644 --- a/bootloaders/zero/sam_ba_serial.c +++ b/bootloaders/zero/sam_ba_serial.c @@ -69,6 +69,13 @@ void serial_open(void) #elif (SAMC21G) || (SAMC21J) MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM0 | MCLK_APBCMASK_SERCOM1 | MCLK_APBCMASK_SERCOM2 | MCLK_APBCMASK_SERCOM3 | MCLK_APBCMASK_SERCOM4 | MCLK_APBCMASK_SERCOM5 ; #endif +#elif (SAMD51) + MCLK->APBAMASK.reg |= MCLK_APBAMASK_SERCOM0 | MCLK_APBAMASK_SERCOM1 ; + MCLK->APBBMASK.reg |= MCLK_APBBMASK_SERCOM2 | MCLK_APBBMASK_SERCOM3 ; + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM4 | MCLK_APBDMASK_SERCOM5 ; + #if (SAMD51N) || (SAMD51P) + MCLK->APBDMASK.reg |= MCLK_APBDMASK_SERCOM6 | MCLK_APBDMASK_SERCOM7 ; + #endif #else #error "sam_ba_serial.c: Missing dependency or unsupported chip. Please install CMSIS-Atmel from MattairTech (see Prerequisites for Building in README.md)." #endif @@ -77,13 +84,22 @@ void serial_open(void) #if (SAMD21 || SAMD11) GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID( BOOT_USART_PER_CLOCK_INDEX ) | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_CLKEN ); waitForSync(); -#elif (SAML21 || SAMC21) - GCLK->PCHCTRL[BOOT_USART_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); +#elif (SAML21 || SAMC21 || SAMD51) + #if (SAMD51 && (VARIANT_MCK == 120000000ul)) + GCLK->PCHCTRL[BOOT_USART_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK6 ); // Use 96MHz SERCOM clock (100MHz maximum) when cpu running at 120MHz + #else + GCLK->PCHCTRL[BOOT_USART_PER_CLOCK_INDEX].reg = ( GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN_GCLK0 ); + #endif waitForSync(); #endif - /* Baud rate 115200 - clock 48MHz -> BAUD value-63018 */ - uart_basic_init(BOOT_USART_MODULE, 63018, BOOT_USART_PAD_SETTINGS); +#if (SAMD51 && (VARIANT_MCK == 120000000ul)) + /* Baud rate 115200 - clock 96MHz -> BAUD value-64278 */ + uart_basic_init(BOOT_USART_MODULE, 64278, BOOT_USART_PAD_SETTINGS); // Use 96MHz SERCOM clock (100MHz maximum) when cpu running at 120MHz +#else + /* Baud rate 115200 - clock 48MHz -> BAUD value-63018 */ + uart_basic_init(BOOT_USART_MODULE, 63018, BOOT_USART_PAD_SETTINGS); +#endif //Initialize flag b_sharp_received = false; diff --git a/bootloaders/zero/util.c b/bootloaders/zero/util.c index 46b382902..b3cf6c46e 100644 --- a/bootloaders/zero/util.c +++ b/bootloaders/zero/util.c @@ -25,12 +25,15 @@ extern uint32_t __sketch_vectors_ptr; // Exported value from linker script /* * The SAMD21 has a default 1MHz clock @ reset. * SAML21 and SAMC21 have a default 4MHz clock @ reset. - * It is switched to 48MHz in board_init.c + * SAMD51 has a default 48MHz clock @ reset. + * It is switched to 48MHz (optionally to 120MHz for SAMD51) in board_init.c */ #if (SAMD21 || SAMD11) #define CLOCK_DEFAULT 1000000ul #elif (SAML21 || SAMC21) #define CLOCK_DEFAULT 4000000ul +#elif (SAMD51) + #define CLOCK_DEFAULT 48000000ul #endif uint32_t SystemCoreClock=CLOCK_DEFAULT; @@ -39,20 +42,29 @@ void flashErase (uint32_t startAddress) // Syntax: X[ADDR]# // Erase the flash memory starting from ADDR to the end of flash. - // Note: the flash memory is erased in ROWS, that is in block of 4 pages. - // Even if the starting address is the last byte of a ROW the entire - // ROW is erased anyway. + // Note: the flash memory is erased in 4 page ROWS (16 page blocks for D51). + // Even if the starting address is the last byte of a ROW/block the + // entire ROW/block is erased anyway. uint32_t dst_addr = startAddress; // starting address while (dst_addr < FLASH_SIZE) { +#if (SAMD51) + // Execute "EB" Erase Block + NVMCTRL->ADDR.reg = dst_addr; // 8-bit hardware address + NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_CMDEX_KEY | NVMCTRL_CTRLB_CMD_EB; + while (NVMCTRL->STATUS.bit.READY == 0) + ; + dst_addr += FLASH_PAGE_SIZE * 16; // Skip a Block +#else // Execute "ER" Erase Row - NVMCTRL->ADDR.reg = dst_addr / 2; + NVMCTRL->ADDR.reg = dst_addr / 2; // 16-bit hardware address NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_ER; while (NVMCTRL->INTFLAG.bit.READY == 0) ; dst_addr += FLASH_PAGE_SIZE * 4; // Skip a ROW +#endif } } @@ -76,9 +88,15 @@ void flashWrite (uint32_t numBytes, uint32_t * buffer, uint32_t * ptr_data) while (size) { // Execute "PBC" Page Buffer Clear +#if (SAMD51) + NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_CMDEX_KEY | NVMCTRL_CTRLB_CMD_PBC; + while (NVMCTRL->STATUS.bit.READY == 0) + ; +#else NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_PBC; while (NVMCTRL->INTFLAG.bit.READY == 0) ; +#endif // Fill page buffer uint32_t i; @@ -88,10 +106,15 @@ void flashWrite (uint32_t numBytes, uint32_t * buffer, uint32_t * ptr_data) } // Execute "WP" Write Page - //NVMCTRL->ADDR.reg = ((uint32_t)dst_addr) / 2; +#if (SAMD51) + NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_CMDEX_KEY | NVMCTRL_CTRLB_CMD_WP; + while (NVMCTRL->STATUS.bit.READY == 0) + ; +#else NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_WP; while (NVMCTRL->INTFLAG.bit.READY == 0) ; +#endif // Advance to next page dst_addr += i; @@ -156,21 +179,33 @@ void delayUs (uint32_t delay) { /* The SAMD21 has a default 1MHz clock @ reset. * SAML21 and SAMC21 have a default 4MHz clock @ reset. - * It is switched to 48MHz in board_init.c + * SAMD51 has a default 48MHz clock @ reset. + * It is switched to 48MHz (optionally to 120MHz for SAMD51) in board_init.c. + * Note that the D51 CMCC cache is not used, and FLASH wait states limit access. */ uint32_t numLoops; if (SystemCoreClock == VARIANT_MCK) { +#if (SAMD51) + #if (VARIANT_MCK == 120000000ul) + numLoops = (12 * delay); + #else + numLoops = (9 * delay); + #endif +#else numLoops = (12 * delay); +#endif } else { #if (SAMD21 || SAMD11) numLoops = (delay >> 2); #elif (SAML21 || SAMC21) numLoops = delay; +#elif (SAMD51) + numLoops = (9 * delay); #endif } - for (uint32_t i=0; i < numLoops; i++) /* 10ms */ + for (uint32_t i=0; i < numLoops; i++) /* force compiler to not optimize this... */ __asm__ __volatile__(""); } @@ -185,9 +220,9 @@ void systemReset (void) void waitForSync (void) { - #if (SAMD) + #if (SAMD21 || SAMD11) while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY ); - #elif (SAML21 || SAMC21) + #elif (SAML21 || SAMC21 || SAMD51) while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); #endif } From 15e26fa0a081d1d06456700bd1541d743ad0d3f8 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 24 Nov 2017 10:30:00 +0000 Subject: [PATCH 107/124] Improve accuracy of HS crystal (fixed off-by-one calculation) --- bootloaders/zero/board_init.c | 6 +++--- cores/arduino/startup.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bootloaders/zero/board_init.c b/bootloaders/zero/board_init.c index 08830fda9..84b7f8eff 100644 --- a/bootloaders/zero/board_init.c +++ b/bootloaders/zero/board_init.c @@ -283,7 +283,7 @@ void board_init( void ) #endif #if defined(PLL_FRACTIONAL_ENABLED) - #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLLRATIO_LDR ((uint16_t)DPLLRATIO_FLOAT - 1) #if (SAMD51) #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 32.0) #if (VARIANT_MCK == 120000000ul) @@ -293,10 +293,10 @@ void board_init( void ) #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) #endif #else - #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLLRATIO_LDR ((uint16_t)DPLLRATIO_FLOAT - 1) #define DPLLRATIO_LDRFRAC 0 #if (SAMD51 && (VARIANT_MCK == 120000000ul)) - #define DPLL1RATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLL1RATIO_LDR ((uint16_t)DPLL1RATIO_FLOAT - 1) #define DPLL1RATIO_LDRFRAC 0 #endif #endif diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index 63e4d80e4..1a9bc312f 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -189,10 +189,10 @@ void SystemInit( void ) #define DPLLRATIO_FLOAT (96000000.0 / ((float)HS_CRYSTAL_FREQUENCY_HERTZ / HS_CRYSTAL_DIVIDER)) #if defined(PLL_FRACTIONAL_ENABLED) - #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLLRATIO_LDR ((uint16_t)DPLLRATIO_FLOAT - 1) #define DPLLRATIO_LDRFRAC (uint8_t)((DPLLRATIO_FLOAT - (uint16_t)DPLLRATIO_FLOAT) * 16.0) #else - #define DPLLRATIO_LDR (uint16_t)DPLLRATIO_FLOAT + #define DPLLRATIO_LDR ((uint16_t)DPLLRATIO_FLOAT - 1) #define DPLLRATIO_LDRFRAC 0 #endif From 2f448ead802a21e013adb44ac169d247ef02bb8a Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 24 Nov 2017 11:24:01 +0000 Subject: [PATCH 108/124] Fixed USB pad calibration values for L21 in bootloader and USB host mode --- bootloaders/zero/board_driver_usb.c | 5 ++++ cores/arduino/USB/samd21_host.c | 43 +++++++++++++++-------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/bootloaders/zero/board_driver_usb.c b/bootloaders/zero/board_driver_usb.c index 53c5bb970..7479dd493 100644 --- a/bootloaders/zero/board_driver_usb.c +++ b/bootloaders/zero/board_driver_usb.c @@ -27,6 +27,11 @@ #define NVM_USB_PAD_TRANSN_POS (32) #define NVM_USB_PAD_TRANSP_POS (37) #define NVM_USB_PAD_TRIM_POS (42) +#elif (SAML21) + #define NVM_CALIBRATION_ADDRESS NVMCTRL_OTP5 + #define NVM_USB_PAD_TRANSN_POS (13) + #define NVM_USB_PAD_TRANSP_POS (18) + #define NVM_USB_PAD_TRIM_POS (23) #else #define NVM_CALIBRATION_ADDRESS NVMCTRL_OTP4 #define NVM_USB_PAD_TRANSN_POS (45) diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index 3522035d4..b4d6b7cb4 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -44,17 +44,23 @@ __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EP extern void (*gpf_isr)(void); - -// NVM Software Calibration Area Mapping -// USB TRANSN calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRANSN_POS 45 -#define NVM_USB_PAD_TRANSN_SIZE 5 -// USB TRANSP calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRANSP_POS 50 -#define NVM_USB_PAD_TRANSP_SIZE 5 -// USB TRIM calibration value. Should be written to the USB PADCAL register. -#define NVM_USB_PAD_TRIM_POS 55 -#define NVM_USB_PAD_TRIM_SIZE 3 +#if (SAML21) + #define NVM_CALIBRATION_ADDRESS NVMCTRL_OTP5 + #define NVM_USB_PAD_TRANSN_POS (13) + #define NVM_USB_PAD_TRANSP_POS (18) + #define NVM_USB_PAD_TRIM_POS (23) +#else + #define NVM_CALIBRATION_ADDRESS NVMCTRL_OTP4 + #define NVM_USB_PAD_TRANSN_POS (45) + #define NVM_USB_PAD_TRANSP_POS (50) + #define NVM_USB_PAD_TRIM_POS (55) +#endif +#define USB_PAD_TRANSN_REG_POS (6) +#define NVM_USB_PAD_TRANSN_SIZE (5) +#define USB_PAD_TRANSP_REG_POS (0) +#define NVM_USB_PAD_TRANSP_SIZE (5) +#define USB_PAD_TRIM_REG_POS (12) +#define NVM_USB_PAD_TRIM_SIZE (3) /** * \brief Initialize the SAMD21 host driver. @@ -112,7 +118,7 @@ void UHD_Init(void) while (USB->HOST.SYNCBUSY.reg == USB_SYNCBUSY_ENABLE); /* Load Pad Calibration */ - pad_transn = (*((uint32_t *)(NVMCTRL_OTP4) // Non-Volatile Memory Controller + pad_transn = (*((uint32_t *)(NVM_CALIBRATION_ADDRESS) // Non-Volatile Memory Controller + (NVM_USB_PAD_TRANSN_POS / 32)) >> (NVM_USB_PAD_TRANSN_POS % 32)) & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); @@ -122,9 +128,7 @@ void UHD_Init(void) pad_transn = 5; } - USB->HOST.PADCAL.bit.TRANSN = pad_transn; - - pad_transp = (*((uint32_t *)(NVMCTRL_OTP4) + pad_transp = (*((uint32_t *)(NVM_CALIBRATION_ADDRESS) + (NVM_USB_PAD_TRANSP_POS / 32)) >> (NVM_USB_PAD_TRANSP_POS % 32)) & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); @@ -134,9 +138,7 @@ void UHD_Init(void) pad_transp = 29; } - USB->HOST.PADCAL.bit.TRANSP = pad_transp; - - pad_trim = (*((uint32_t *)(NVMCTRL_OTP4) + pad_trim = (*((uint32_t *)(NVM_CALIBRATION_ADDRESS) + (NVM_USB_PAD_TRIM_POS / 32)) >> (NVM_USB_PAD_TRIM_POS % 32)) & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); @@ -144,10 +146,9 @@ void UHD_Init(void) if (pad_trim == 0x7) // maximum value (7) { pad_trim = 3; - } - - USB->HOST.PADCAL.bit.TRIM = pad_trim; + } + USB->HOST.PADCAL.reg = (uint16_t)((pad_trim << USB_PAD_TRIM_REG_POS) | (pad_transn << USB_PAD_TRANSN_REG_POS) | (pad_transp << USB_PAD_TRANSP_REG_POS)); /* Set the configuration */ uhd_run_in_standby(); From 76b4aa9369081d02695f3fde82df1a660b16b094 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 24 Nov 2017 11:46:54 +0000 Subject: [PATCH 109/124] Made PIN_USB_HOST_ENABLE optional. Readme updates for MT-D11 and Generic D11C14A. --- cores/arduino/USB/samd21_host.c | 2 ++ variants/Generic_D11C14A/README.md | 20 ++++++++++---------- variants/Generic_D11C14A/variant.h | 7 ++++--- variants/MT_D11/README.md | 30 +++++++++++++++--------------- variants/MT_D11/variant.h | 7 ++++--- variants/MT_D21E/variant.h | 5 +++-- variants/MT_D21E_revB/variant.h | 5 +++-- variants/Xeno/variant.h | 5 +++-- variants/arduino_mzero/variant.h | 3 ++- variants/arduino_zero/variant.h | 3 ++- 10 files changed, 48 insertions(+), 39 deletions(-) diff --git a/cores/arduino/USB/samd21_host.c b/cores/arduino/USB/samd21_host.c index b4d6b7cb4..e994e729a 100644 --- a/cores/arduino/USB/samd21_host.c +++ b/cores/arduino/USB/samd21_host.c @@ -161,8 +161,10 @@ void UHD_Init(void) uhd_state = UHD_STATE_NO_VBUS; // Put VBUS on USB port +#if defined(PIN_USB_HOST_ENABLE) pinMode( PIN_USB_HOST_ENABLE, OUTPUT ); digitalWrite( PIN_USB_HOST_ENABLE, PIN_USB_HOST_ENABLE_VALUE ); +#endif uhd_enable_connection_int(); diff --git a/variants/Generic_D11C14A/README.md b/variants/Generic_D11C14A/README.md index 44f087a81..75159db05 100644 --- a/variants/Generic_D11C14A/README.md +++ b/variants/Generic_D11C14A/README.md @@ -6,8 +6,8 @@ Other COM PWM Analog INT Arduino* Arduino* INT Analog PWM C ========================================================================================= 1------------------- SCK*/RX2 TCC01 * * 5 | A5 A4 | 4 * * TCC00 MOSI*/TX2 REF - MOSI* TCC02 * 8 | A8 A2 | 2 * * DAC - SCK* TCC03 * 9 | A9 Vdd | + MOSI* TCC02 * 8 | A8 (XIN) A2 | 2 * * DAC + SCK* TCC03 * 9 | A9 (XOUT) Vdd | SDA/MISO* TC10 * NMI 14 | A14 Gnd | SCL/SS* TC11 * * 15 | A15 A25 | 25 USB/DP BOOT 28 | A28/RST A24 | 24 USB/DM @@ -15,10 +15,10 @@ SWDCLK TX1/MISO* 30 | A30 A31 | 31 * RX1/SS ------------------- * Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port - pin number printed on the board is also used in Arduino (but without the 'A') for all - of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). When - using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top - left pin (A2). PIN_MAP_COMPACT uses less RAM. + pin number printed on the chip above is also used in Arduino (but without the 'A') for + all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). + When using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the + top left pin (A5). PIN_MAP_COMPACT uses less RAM. * When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. * When using ONE_UART_NO_WIRE_ONE_SPI, use SPI on pins 4, 5, 14, and 15. When using NO_UART_ONE_WIRE_ONE_SPI, use SPI on pins 8, 9, 30, and 31. @@ -91,10 +91,10 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip ==================================================================================================================================== * Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port - pin number printed on the board is also used in Arduino (but without the 'A') for all - of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). When - using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the top - left pin (A2). PIN_MAP_COMPACT uses less RAM. + pin number printed on the chip above is also used in Arduino (but without the 'A') for + all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). + When using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the + top left pin (A5). PIN_MAP_COMPACT uses less RAM. * NOT A PIN means the Arduino pin number is not mapped to a physical pin. * Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). * The tone library uses TC2. TC2 is not routed to pins in the D11C14A (14-pin). diff --git a/variants/Generic_D11C14A/variant.h b/variants/Generic_D11C14A/variant.h index 1948e7e83..c43d96a68 100644 --- a/variants/Generic_D11C14A/variant.h +++ b/variants/Generic_D11C14A/variant.h @@ -296,16 +296,17 @@ static const uint8_t SCL = PIN_WIRE_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #if defined PIN_MAP_STANDARD #define PIN_USB_DM (24ul) #define PIN_USB_DP (25ul) -#define PIN_USB_HOST_ENABLE (14ul) +//#define PIN_USB_HOST_ENABLE (14ul) #elif defined PIN_MAP_COMPACT #define PIN_USB_DM (7ul) #define PIN_USB_DP (8ul) -#define PIN_USB_HOST_ENABLE (5ul) +//#define PIN_USB_HOST_ENABLE (5ul) #endif #define PIN_USB_HOST_ENABLE_VALUE HIGH diff --git a/variants/MT_D11/README.md b/variants/MT_D11/README.md index 68fceea34..dd2eff502 100644 --- a/variants/MT_D11/README.md +++ b/variants/MT_D11/README.md @@ -2,20 +2,20 @@ ``` =========================== MattairTech MT-D11 (ATsamD11D14AM) ========================== -Other COM PWM Analog INT Arduino* Arduino* INT PWM COM Other +Other COM PWM Analog INT Arduino* Arduino* INT PWM COM Other ========================================================================================= - ------------------- -DAC * | A2 | USB | Gnd | -REF * | A3 | | Vcc | - TCC00 * * | A4 ----- A31 | 31 * TC21 RX1 SWDIO - TCC01 * * | A5 A30 | 30 TC20 TX1 SWDCLK - TCC02 * | A6 A27 | 27 * - TCC03 * | A7 A23 | 23 SCL - MOSI / TX2 * * | A10 A22 | 22 * SDA - SCK / RX2 * | A11 A17 | 17 TC11 - MISO * NMI | A14 A16 | 16 * TC10 LED -BTN SS * * | A15 RST | BOOT - ------------------- + ------------------- +DAC * 2 | A2 | USB | Gnd | +REF * 3 | A3 | | Vcc | + TCC00 * * 4 | A4 ----- A31 | 31 * TC21 RX1 SWDIO + TCC01 * * 5 | A5 A30 | 30 TC20 TX1 SWDCLK + TCC02 * 6 | A6 A27 | 27 * + TCC03 * 7 | A7 A23 | 23 SCL + MOSI / TX2 * * 10 | A10 A22 | 22 * SDA + SCK / RX2 * 11 | A11 A17 | 17 TC11 + MISO * NMI 14 | A14 A16 | 16 * TC10 LED +BTN SS * * 15 | A15 RST | BOOT + ------------------- * Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port pin number printed on the board is also used in Arduino (but without the 'A') for all @@ -59,7 +59,7 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 20 | --- | ---- | NOT A PIN | NOT A PIN 21 | --- | ---- | NOT A PIN | NOT A PIN 22 | A22 | PA22 | I2C/SDA w/pullup | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] -23 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[0] !TC1/WO[1] !TCC0/WO[5] +23 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[5] 24 | --- | PA24 | USB_NEGATIVE | USB/DM 25 | --- | PA25 | USB_POSITIVE | USB/DP 26 | --- | ---- | NOT A PIN | NOT A PIN @@ -89,7 +89,7 @@ Arduino | Silk | Port | Alternate Function | Comments (! means not used with thi 10 | A16 | PA16 | LED | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] LED 11 | A17 | PA17 | HOST_ENABLE | !EIC/EXTINT[1] PTC/X[5] PTC/Y[11] !SERCOM1/PAD[3] !SERCOM2/PAD[3] TC1/WO[1] !TCC0/WO[7] HOST_ENABLE 12 | A22 | PA22 | I2C/SDA w/pullup | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] -13 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[0] !TC1/WO[1] !TCC0/WO[5] +13 | A23 | PA23 | I2C/SCL w/pullup | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[5] 14 | A27 | PA27 | | EIC/EXTINT[7] PTC/X[10] 15 | A30 | PA30 | TX1 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot 16 | A31 | PA31 | RX1 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO diff --git a/variants/MT_D11/variant.h b/variants/MT_D11/variant.h index bb0f807f7..5995938f4 100644 --- a/variants/MT_D11/variant.h +++ b/variants/MT_D11/variant.h @@ -310,17 +310,18 @@ static const uint8_t SCL = PIN_WIRE_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #if defined PIN_MAP_STANDARD #define PIN_USB_DM (24ul) #define PIN_USB_DP (25ul) -#define PIN_USB_HOST_ENABLE (17ul) +//#define PIN_USB_HOST_ENABLE (17ul) #elif defined PIN_MAP_COMPACT // USB pins not directly accessible using PIN_MAP_COMPACT #define PIN_USB_DM (0ul) #define PIN_USB_DP (0ul) -#define PIN_USB_HOST_ENABLE (0ul) +//#define PIN_USB_HOST_ENABLE (0ul) #endif #define PIN_USB_HOST_ENABLE_VALUE HIGH diff --git a/variants/MT_D21E/variant.h b/variants/MT_D21E/variant.h index b3e3148cd..4d14da5e9 100644 --- a/variants/MT_D21E/variant.h +++ b/variants/MT_D21E/variant.h @@ -280,11 +280,12 @@ static const uint8_t SCL1 = PIN_WIRE1_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #define PIN_USB_DM (24ul) #define PIN_USB_DP (25ul) -#define PIN_USB_HOST_ENABLE (14ul) +//#define PIN_USB_HOST_ENABLE (14ul) #define PIN_USB_HOST_ENABLE_VALUE HIGH /* diff --git a/variants/MT_D21E_revB/variant.h b/variants/MT_D21E_revB/variant.h index 72ed8ee03..04ef9649f 100644 --- a/variants/MT_D21E_revB/variant.h +++ b/variants/MT_D21E_revB/variant.h @@ -368,11 +368,12 @@ static const uint8_t SCL1 = PIN_WIRE1_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #define PIN_USB_DM (24ul) #define PIN_USB_DP (25ul) -#define PIN_USB_HOST_ENABLE (14ul) +//#define PIN_USB_HOST_ENABLE (14ul) #define PIN_USB_HOST_ENABLE_VALUE HIGH /* diff --git a/variants/Xeno/variant.h b/variants/Xeno/variant.h index afed681b9..fa75fe761 100644 --- a/variants/Xeno/variant.h +++ b/variants/Xeno/variant.h @@ -309,11 +309,12 @@ static const uint8_t SCL1 = PIN_WIRE1_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #define PIN_USB_DM (24ul) #define PIN_USB_DP (25ul) -#define PIN_USB_HOST_ENABLE (14ul) +//#define PIN_USB_HOST_ENABLE (14ul) #define PIN_USB_HOST_ENABLE_VALUE 0 /* diff --git a/variants/arduino_mzero/variant.h b/variants/arduino_mzero/variant.h index 72aa72ed0..b85c2525f 100644 --- a/variants/arduino_mzero/variant.h +++ b/variants/arduino_mzero/variant.h @@ -216,7 +216,8 @@ static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #define PIN_USB_DM (33ul) #define PIN_USB_DP (34ul) diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 115b7af6f..41a003c77 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -220,7 +220,8 @@ static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; /* - * USB + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. */ #define PIN_USB_DM (28ul) #define PIN_USB_DP (29ul) From 67f8b5985de5b2d28b0420b685e27fb770ba3029 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Fri, 24 Nov 2017 12:36:49 +0000 Subject: [PATCH 110/124] Added Generic D11D14AS (20-pin SOIC) variant. --- boards.txt | 85 ++++ variants/Generic_D11D14AS/README.md | 250 ++++++++++++ .../debug_scripts/SAMD11D14AS.gdb | 31 ++ .../gcc/4KB_Bootloader/flash_16KB.ld | 217 ++++++++++ .../gcc/No_Bootloader/flash_16KB.ld | 214 ++++++++++ .../openocd_scripts/SAMD11D14AS.cfg | 30 ++ variants/Generic_D11D14AS/pins_arduino.h | 21 + variants/Generic_D11D14AS/variant.cpp | 115 ++++++ variants/Generic_D11D14AS/variant.h | 369 ++++++++++++++++++ 9 files changed, 1332 insertions(+) create mode 100644 variants/Generic_D11D14AS/README.md create mode 100644 variants/Generic_D11D14AS/debug_scripts/SAMD11D14AS.gdb create mode 100644 variants/Generic_D11D14AS/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld create mode 100644 variants/Generic_D11D14AS/linker_scripts/gcc/No_Bootloader/flash_16KB.ld create mode 100644 variants/Generic_D11D14AS/openocd_scripts/SAMD11D14AS.cfg create mode 100644 variants/Generic_D11D14AS/pins_arduino.h create mode 100644 variants/Generic_D11D14AS/variant.cpp create mode 100644 variants/Generic_D11D14AS/variant.h diff --git a/boards.txt b/boards.txt index b4b421e0c..f594f3601 100644 --- a/boards.txt +++ b/boards.txt @@ -691,6 +691,91 @@ d11c14a.menu.usb.none.build.usbcom=USB_DISABLED d11c14a.menu.usb.none.build.pid=0x0856 +# Generic D11D14AS (SOIC-20) +d11d14as.name=Generic D11D14AS +d11d14as.vid.0=0x16D0 +d11d14as.pid.0=0x0557 +d11d14as.vid.1=0x16D0 +d11d14as.pid.1=0x0856 +d11d14as.vid.2=0x16D0 +d11d14as.pid.2=0x0B41 +d11d14as.vid.3=0x16D0 +d11d14as.pid.3=0x0B40 +d11d14as.vid.4=0x16D0 +d11d14as.pid.4=0x0A0C +d11d14as.vid.5=0x16D0 +d11d14as.pid.5=0x0856 +d11d14as.build.mcu=cortex-m0plus +d11d14as.build.f_cpu=48000000L +d11d14as.build.usb_product="D11D14AS" +d11d14as.build.usb_manufacturer="MattairTech LLC" +d11d14as.build.board=SAMD_ZERO +d11d14as.build.core=arduino +d11d14as.build.variant=Generic_D11D14AS +d11d14as.build.variant_system_lib= +d11d14as.build.vid=0x16D0 +d11d14as.upload.protocol=sam-ba +d11d14as.bootloader.tool=arduino:openocd +d11d14as.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11d14as.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11d14as.menu.clock.internal=INTERNAL_OSCILLATOR +d11d14as.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11d14as.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11d14as.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11d14as.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11d14as.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11d14as.build.extra_flags=-D__SAMD11D14AS__ {build.usb_flags} +d11d14as.build.ldscript=flash_16KB.ld +d11d14as.build.openocdscript=openocd_scripts/SAMD11D14AS.cfg +d11d14as.bootloader.file=zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin +d11d14as.menu.bootloader.4kb=4KB_BOOTLOADER +d11d14as.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11d14as.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11d14as.menu.bootloader.4kb.upload.tool=MattairTech_Arduino:bossac +d11d14as.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11d14as.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11d14as.menu.bootloader.4kb.upload.native_usb=true +d11d14as.menu.bootloader.4kb.upload.maximum_size=12288 +d11d14as.menu.bootloader.0kb=NO_BOOTLOADER +d11d14as.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11d14as.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11d14as.menu.bootloader.0kb.upload.tool=arduino:openocd +d11d14as.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11d14as.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11d14as.menu.bootloader.0kb.upload.native_usb=false +d11d14as.menu.bootloader.0kb.upload.maximum_size=16384 +d11d14as.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d11d14as.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11d14as.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11d14as.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11d14as.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.two_uart=TWO_UART_ONE_WIRE_NO_SPI +d11d14as.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11d14as.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11d14as.menu.usb.cdc=CDC_ONLY +d11d14as.menu.usb.cdc.build.usbcom=CDC_ONLY +d11d14as.menu.usb.cdc.build.pid=0x0557 +d11d14as.menu.usb.cdc_hid=CDC_HID +d11d14as.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11d14as.menu.usb.cdc_hid.build.pid=0x0856 +d11d14as.menu.usb.withcdc=WITH_CDC +d11d14as.menu.usb.withcdc.build.usbcom=WITH_CDC +d11d14as.menu.usb.withcdc.build.pid=0x0B41 +d11d14as.menu.usb.hid=HID_ONLY +d11d14as.menu.usb.hid.build.usbcom=HID_ONLY +d11d14as.menu.usb.hid.build.pid=0x0B40 +d11d14as.menu.usb.nocdc=WITHOUT_CDC +d11d14as.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11d14as.menu.usb.nocdc.build.pid=0x0A0C +d11d14as.menu.usb.none=USB_DISABLED +d11d14as.menu.usb.none.build.usbcom=USB_DISABLED +d11d14as.menu.usb.none.build.pid=0x0856 + + # MattairTech Core for Arduino/Genuino Zero (Autodetect Port) arduino_zero.name=Arduino/Genuino Zero (Autodetect Port) arduino_zero.bootloader.file=zero/binaries/sam_ba_arduino_zero_SAMD21G18A.bin diff --git a/variants/Generic_D11D14AS/README.md b/variants/Generic_D11D14AS/README.md new file mode 100644 index 000000000..ca09728b4 --- /dev/null +++ b/variants/Generic_D11D14AS/README.md @@ -0,0 +1,250 @@ +# Generic ATsamD11D14AS + +``` +===================================== ATsamD11D14AS =================================== +Other COM PWM Analog INT Arduino* Arduino* Analog INT PWM COM Other +========================================================================================= + 1------------------- + TCC01 * * 5 | A5 A4 | 4 * * TCC00 REFB + SS TCC02 * 6 | A6 A3 | 3 * REFA + MISO TCC03 * * 7 | A7 A2 | 2 * * DAC +Xin32/Xin 8 | A8 (XIN) Vdd | +Xout32/Xout 9 | A9 (XOUT) Gnd | + MOSI/TX2 * NMI 14 | A14 A25 | 25 USB D+ + SCK/RX2 TC11 * * 15 | A15 A24 | 24 USB D- + TC10 * 16 | A16 A31 | 31 * TC21 RX1 SWDIO + SDA * 22 | A22 A30 | 30 TC20 TX1 SWDCLK + SCL 23 | A23 RST/A28 | 28 BOOT + ------------------- + +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the chip above is also used in Arduino (but without the 'A') for + all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). + When using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the + top left pin (A5). PIN_MAP_COMPACT uses less RAM. +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +* Tone available on TC2. +* Leave pin A30 floating (or use external pullup) during reset. +* DO NOT connect voltages higher than 3.3V! +``` + + +## Pins descriptions for Generic ATsamD11D14AS + +### PIN_MAP_STANDARD +``` +============================================================================================================================================ +Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | ---- | NOT A PIN | NOT A PIN +1 | ---- | NOT A PIN | NOT A PIN +2 | PA02 | DAC | EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +4 | PA04 | REFB / TCC00 | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +5 | PA05 | TCC01 | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +6 | PA06 | SS (unused) / TCC02 | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] +7 | PA07 | MISO / TCC03 | EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] +8 | PA08 | Xin32 / Xin | Xin32 +9 | PA09 | Xout32 / Xout | Xout32 +10 | ---- | NOT A PIN | NOT A PIN +11 | ---- | NOT A PIN | NOT A PIN +12 | ---- | NOT A PIN | NOT A PIN +13 | ---- | NOT A PIN | NOT A PIN +14 | PA14 | MOSI / TX2 | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] +15 | PA15 | SCK / RX2 / TC11 | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] TC1/WO[1] !TCC0/WO[1] +16 | PA16 | TC10 | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] +17 | ---- | NOT A PIN | NOT A PIN +18 | ---- | NOT A PIN | NOT A PIN +19 | ---- | NOT A PIN | NOT A PIN +20 | ---- | NOT A PIN | NOT A PIN +21 | ---- | NOT A PIN | NOT A PIN +22 | PA22 | SDA | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] +23 | PA23 | SCL | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[5] +24 | PA24 | USB_NEGATIVE | USB/DM +25 | PA25 | USB_POSITIVE | USB/DP +26 | ---- | NOT A PIN | NOT A PIN +27 | ---- | NOT A PIN | NOT A PIN +28 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +29 | ---- | NOT A PIN | NOT A PIN +30 | PA30 | TX1 / TC20 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +31 | PA31 | RX1 / TC21 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO +============================================================================================================================================ +``` + +### PIN_MAP_COMPACT +``` +============================================================================================================================================ +Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | PA02 | DAC | EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +1 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +2 | PA04 | REFB / TCC00 | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +3 | PA05 | TCC01 | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +4 | PA06 | SS (unused) / TCC02 | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] +5 | PA07 | MISO / TCC03 | EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] +6 | PA08 | Xin32 / Xin | Xin32 +7 | PA09 | Xout32 / Xout | Xout32 +8 | PA14 | MOSI / TX2 | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] +9 | PA15 | SCK / RX2 / TC11 | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] TC1/WO[1] !TCC0/WO[1] +10 | PA16 | TC10 | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] +11 | PA22 | SDA | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] +12 | PA23 | SCL | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[5] +13 | PA24 | USB_NEGATIVE | USB/DM +14 | PA25 | USB_POSITIVE | USB/DP +15 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +16 | PA30 | TX1 / TC20 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +17 | PA31 | RX1 / TC21 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO +============================================================================================================================================ + +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the chip above is also used in Arduino (but without the 'A') for + all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). + When using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the + top left pin (A5). PIN_MAP_COMPACT uses less RAM. +* NOT A PIN means the Arduino pin number is not mapped to a physical pin. +* Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). +* The tone library uses TC2. +* Leave pin A30 floating (or use external pullup) during reset. +``` + + +## Board Configuration Notes + +* **Crystals** + * Either a 32.768KHz crystal or a high speed crystal can be used. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. + +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin, enabled by default). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + +* **Analog Inputs** + * 8 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REF. + +* **DAC** + * One analog output is available on pin 2. + * Provides a 10-bit voltage output with the analogWrite() function. + +* **PWM** + * 8 pins can be configured as PWM outputs. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. + +* **External Interrupts** + * 8 pins can be configured with external interrupts. + +* **SERCOM** + * 3 SERCOM are available. + * Up to 2 UART instances + * 1 SPI instance + * 1 WIRE (I2C) instance + + + +## PinDescription table format + +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +### Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +### Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** + +### Port +This is the port (ie: PORTA). + +### Pin +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/Generic_D11D14AS/debug_scripts/SAMD11D14AS.gdb b/variants/Generic_D11D14AS/debug_scripts/SAMD11D14AS.gdb new file mode 100644 index 000000000..1daf3ccc2 --- /dev/null +++ b/variants/Generic_D11D14AS/debug_scripts/SAMD11D14AS.gdb @@ -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 at91samd11d14as" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/Generic_D11D14AS/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld b/variants/Generic_D11D14AS/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld new file mode 100644 index 000000000..1e2d5f052 --- /dev/null +++ b/variants/Generic_D11D14AS/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x1000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Generic_D11D14AS/linker_scripts/gcc/No_Bootloader/flash_16KB.ld b/variants/Generic_D11D14AS/linker_scripts/gcc/No_Bootloader/flash_16KB.ld new file mode 100644 index 000000000..bd135b3dd --- /dev/null +++ b/variants/Generic_D11D14AS/linker_scripts/gcc/No_Bootloader/flash_16KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/Generic_D11D14AS/openocd_scripts/SAMD11D14AS.cfg b/variants/Generic_D11D14AS/openocd_scripts/SAMD11D14AS.cfg new file mode 100644 index 000000000..2b1d4c72f --- /dev/null +++ b/variants/Generic_D11D14AS/openocd_scripts/SAMD11D14AS.cfg @@ -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 at91samd11d14as +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/Generic_D11D14AS/pins_arduino.h b/variants/Generic_D11D14AS/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/Generic_D11D14AS/pins_arduino.h @@ -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" + diff --git a/variants/Generic_D11D14AS/variant.cpp b/variants/Generic_D11D14AS/variant.cpp new file mode 100644 index 000000000..992a3fc1b --- /dev/null +++ b/variants/Generic_D11D14AS/variant.cpp @@ -0,0 +1,115 @@ +/* + 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 +*/ + +/* + * Modified 23 November 2017 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +#if defined PIN_MAP_STANDARD +const PinDescription g_APinDescription[]= +{ + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SWD IO +} ; +#elif defined PIN_MAP_COMPACT +const PinDescription g_APinDescription[]= +{ + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SWD IO +} ; +#endif + +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TC1, TC2 } ; + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; + +#if defined(ONE_UART) || defined(TWO_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM1_Handler() +{ + Serial1.IrqHandler(); +} +#endif + +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM0_Handler() +{ + Serial2.IrqHandler(); +} +#endif diff --git a/variants/Generic_D11D14AS/variant.h b/variants/Generic_D11D14AS/variant.h new file mode 100644 index 000000000..bbf24d539 --- /dev/null +++ b/variants/Generic_D11D14AS/variant.h @@ -0,0 +1,369 @@ +/* + 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 +*/ + +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + +#ifndef _VARIANT_MATTAIRTECH_D11D14AS_ +#define _VARIANT_MATTAIRTECH_D11D14AS_ + +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + +/*---------------------------------------------------------------------------- + * Clock Configuration + *----------------------------------------------------------------------------*/ + +/** Master clock frequency (also Fcpu frequency) */ +#define VARIANT_MCK (48000000ul) + +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" +#include "sam.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#define PIN_MAP_STANDARD +//#define PIN_MAP_COMPACT + +#if defined PIN_MAP_STANDARD + #define NUM_PIN_DESCRIPTION_ENTRIES (32u) +#elif defined PIN_MAP_COMPACT + #define NUM_PIN_DESCRIPTION_ENTRIES (18u) +#else + #error "variant.h: You must set PIN_MAP_STANDARD or PIN_MAP_COMPACT" +#endif + +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT +#define NUM_ANALOG_INPUTS (8u) +#define NUM_ANALOG_OUTPUTS (1u) +#define analogInputToDigitalPin(p) (p) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +/* LEDs + * None of these defines are currently used by the core. + */ +#if defined PIN_MAP_STANDARD +#define PIN_LED_13 (16u) +#define PIN_LED_RXL (22u) +#define PIN_LED_TXL (23u) +#elif defined PIN_MAP_COMPACT +#define PIN_LED_13 (10u) +#define PIN_LED_RXL (11u) +#define PIN_LED_TXL (12u) +#endif + +#define PIN_LED PIN_LED_13 +#define PIN_LED2 PIN_LED_RXL +#define PIN_LED3 PIN_LED_TXL +#define LED_BUILTIN PIN_LED_13 + + +/* + * Analog pins + */ +#if defined PIN_MAP_STANDARD +#define PIN_A2 (2ul) +#define PIN_A3 (3ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A6 (6ul) +#define PIN_A7 (7ul) +#define PIN_A14 (14ul) +#define PIN_A15 (15ul) +#define PIN_DAC0 (2ul) +#elif defined PIN_MAP_COMPACT +#define PIN_A2 (0ul) +#define PIN_A3 (1ul) +#define PIN_A4 (2ul) +#define PIN_A5 (3ul) +#define PIN_A6 (4ul) +#define PIN_A7 (5ul) +#define PIN_A14 (8ul) +#define PIN_A15 (9ul) +#define PIN_DAC0 (0ul) +#endif + +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A6 = PIN_A6; +static const uint8_t A7 = PIN_A7; +static const uint8_t A14 = PIN_A14; +static const uint8_t A15 = PIN_A15; +static const uint8_t DAC0 = PIN_DAC0; + +#define ADC_RESOLUTION 12 + +#define REMAP_ANALOG_PIN_ID while(0) +// #define REMAP_ANALOG_PIN_ID if ( ulPin < A0 ) ulPin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#if defined PIN_MAP_STANDARD +#define REFA_PIN (3ul) +#define REFB_PIN (4ul) +#elif defined PIN_MAP_COMPACT +#define REFA_PIN (1ul) +#define REFB_PIN (2ul) +#endif + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#if defined PIN_MAP_STANDARD +#define PIN_ATN (6ul) +#elif defined PIN_MAP_COMPACT +#define PIN_ATN (4ul) +#endif +static const uint8_t ATN = PIN_ATN; + + +/* + * Serial interfaces + */ +// Serial1 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL1_RX (31ul) +#define PIN_SERIAL1_TX (30ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL1_RX (17ul) +#define PIN_SERIAL1_TX (16ul) +#endif + +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) +#define SERCOM_INSTANCE_SERIAL1 &sercom1 + +// Serial2 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL2_RX (15ul) +#define PIN_SERIAL2_TX (14ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL2_RX (9ul) +#define PIN_SERIAL2_TX (8ul) +#endif + +#define PAD_SERIAL2_TX (UART_TX_PAD_0) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1) +#define SERCOM_INSTANCE_SERIAL2 &sercom0 + + +/* + * SPI Interfaces + */ +#if defined(ONE_SPI) +#define SPI_INTERFACES_COUNT 1 +#else +#define SPI_INTERFACES_COUNT 0 +#endif + +#if defined PIN_MAP_STANDARD +#define PIN_SPI_MISO (7u) +#define PIN_SPI_MOSI (14u) +#define PIN_SPI_SCK (15u) +#define PIN_SPI_SS (6u) +#elif defined PIN_MAP_COMPACT +#define PIN_SPI_MISO (5u) +#define PIN_SPI_MOSI (8u) +#define PIN_SPI_SCK (9u) +#define PIN_SPI_SS (4u) +#endif + +#define PERIPH_SPI sercom0 +#define PAD_SPI_TX SPI_PAD_0_SCK_1 +#define PAD_SPI_RX SERCOM_RX_PAD_3 + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; + + +/* + * Wire Interfaces + */ +#if defined(ONE_WIRE) +#define WIRE_INTERFACES_COUNT 1 +#else +#define WIRE_INTERFACES_COUNT 0 +#endif + +#if defined PIN_MAP_STANDARD +#define PIN_WIRE_SDA (22u) +#define PIN_WIRE_SCL (23u) +#elif defined PIN_MAP_COMPACT +#define PIN_WIRE_SDA (11u) +#define PIN_WIRE_SCL (12u) +#endif + +#define PERIPH_WIRE sercom2 +#define WIRE_IT_HANDLER SERCOM2_Handler + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +/* + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. + */ +#if defined PIN_MAP_STANDARD +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +//#define PIN_USB_HOST_ENABLE (28ul) +#elif defined PIN_MAP_COMPACT +#define PIN_USB_DM (13ul) +#define PIN_USB_DP (14ul) +//#define PIN_USB_HOST_ENABLE (15ul) +#endif + +#define PIN_USB_HOST_ENABLE_VALUE HIGH + +#ifdef __cplusplus +} +#endif + + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; + +extern Uart Serial1; +extern Uart Serial2; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#define SERIAL_PORT_MONITOR Serial1 +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D11 does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. + +// When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) +#define Serial SerialUSB +#else +#define Serial Serial1 +#endif + +#endif /* _VARIANT_ARDUINO_ZERO_ */ From 1fb362806fec1646c238809ec8e0a22e2ce2978f Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 25 Nov 2017 09:02:34 +0000 Subject: [PATCH 111/124] Improved ISR response time. Thanks @joverbee --- cores/arduino/WInterrupts.c | 123 ++++++++++++++++++++++++------------ 1 file changed, 83 insertions(+), 40 deletions(-) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 56c846991..f1667890a 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -23,12 +23,16 @@ #include -static voidFuncPtr callbacksInt[EXTERNAL_NUM_INTERRUPTS]; +static voidFuncPtr ISRcallback[EXTERNAL_NUM_INTERRUPTS]; +static uint32_t ISRlist[EXTERNAL_NUM_INTERRUPTS]; +static uint32_t nints; // Stores total number of attached interrupts /* Configure I/O interrupt sources */ static void __initialize() { - memset(callbacksInt, 0, sizeof(callbacksInt)); + memset(ISRlist, 0, sizeof(ISRlist)); + memset(ISRcallback, 0, sizeof(ISRcallback)); + nints = 0; NVIC_DisableIRQ(EIC_IRQn); NVIC_ClearPendingIRQ(EIC_IRQn); @@ -86,47 +90,69 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) return; #endif - // Assign pin to EIC - if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) - return; + uint32_t inMask = 1 << in; // Enable wakeup capability on pin in case being used during sleep (WAKEUP always enabled on SAML and SAMC) #if (SAMD21 || SAMD11) - EIC->WAKEUP.reg |= (1 << in); + EIC->WAKEUP.reg |= (inMask); #endif - // Assign callback to interrupt - callbacksInt[in] = callback; + // Assign pin to EIC + if (pinPeripheral(pin, PIO_EXTINT) != RET_STATUS_OK) + return; - // Look for right CONFIG register to be addressed - if (in > EXTERNAL_INT_7) { - config = 1; - } else { - config = 0; - } + // Only store when there is really an ISR to call. + // This allow for calling attachInterrupt(pin, NULL, mode), we set up all needed register + // but won't service the interrupt, this way we also don't need to check it inside the ISR. + if (callback) + { + // Store interrupts to service in order of when they were attached + // to allow for first come first serve handler + uint32_t current = 0; + + // Check if we already have this interrupt + for (current=0; current EXTERNAL_INT_7) { + config = 1; + } else { + config = 0; + } - // Configure the interrupt mode - pos = (in - (8 * config)) << 2; // compute position (ie: 0, 4, 8, 12, ...) + // Configure the interrupt mode + pos = (in - (8 * config)) << 2; // compute position (ie: 0, 4, 8, 12, ...) -#if (SAML21 || SAMC21) - EIC->CTRLA.reg = 0; // disable EIC before changing CONFIG - while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } -#endif + #if (SAML21 || SAMC21) + EIC->CTRLA.reg = 0; // disable EIC before changing CONFIG + while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } + #endif - uint32_t regConfig = (~(EIC_CONFIG_SENSE0_Msk << pos) & EIC->CONFIG[config].reg); // copy register to variable, clearing mode bits - // insert new mode and write to register (the hardware numbering for the 5 interrupt modes is in reverse order to the arduino numbering, so using '5-mode'). - EIC->CONFIG[config].reg = (regConfig | ((5-mode) << pos)); + uint32_t regConfig = (~(EIC_CONFIG_SENSE0_Msk << pos) & EIC->CONFIG[config].reg); // copy register to variable, clearing mode bits + // insert new mode and write to register (the hardware numbering for the 5 interrupt modes is in reverse order to the arduino numbering, so using '5-mode'). + EIC->CONFIG[config].reg = (regConfig | ((5-mode) << pos)); -#if (SAML21 || SAMC21) - EIC->CTRLA.reg = EIC_CTRLA_ENABLE; // enable EIC - while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } -#endif + #if (SAML21 || SAMC21) + EIC->CTRLA.reg = EIC_CTRLA_ENABLE; // enable EIC + while (EIC->SYNCBUSY.reg & EIC_SYNCBUSY_MASK) { } + #endif + } // Clear the interrupt flag - EIC->INTFLAG.reg = (1 << in); + EIC->INTFLAG.reg = (inMask); // Enable the interrupt - EIC->INTENSET.reg = (1 << in); + EIC->INTENSET.reg = (inMask); } /* @@ -138,12 +164,29 @@ void detachInterrupt(uint32_t pin) if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; - EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(1 << in); + uint32_t inMask = 1 << in; + EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(inMask); // Disable wakeup capability on pin during sleep (WAKEUP always enabled on SAML and SAMC) #if (SAMD21 || SAMD11) - EIC->WAKEUP.reg &= ~(1 << in); + EIC->WAKEUP.reg &= ~(inMask); #endif + + // Remove callback from the ISR list + uint32_t current; + for (current=0; currentINTFLAG.reg & (1 << i)) != 0) + if ((EIC->INTFLAG.reg & ISRlist[i]) != 0) { - // Call the callback function if assigned - if (callbacksInt[i]) { - callbacksInt[i](); - } - + // Call the callback function + ISRcallback[i](); // Clear the interrupt - EIC->INTFLAG.reg = 1 << i; + EIC->INTFLAG.reg = ISRlist[i]; } } } From 8a0633164e2b6fe4d0bd493c72b3782cd80d019f Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 25 Nov 2017 09:03:26 +0000 Subject: [PATCH 112/124] Update documentation and templates --- CHANGELOG | 11 ++++ README.md | 38 ++++++++--- bootloaders/zero/README.md | 2 +- extras/package_index.json.Beta.template | 73 +++++++++++----------- extras/package_index.json.PR.template | 73 +++++++++++----------- extras/package_index.json.Release.template | 15 +++-- platform.txt | 2 +- 7 files changed, 128 insertions(+), 86 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index af6699539..480bf34b4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ +1.6.17-beta-b0: +* Added SAM D51 (m4f) support to bootloader +* Added Generic D11D14AS (20-pin SOIC) variant +* Made PIN_USB_HOST_ENABLE optional. Readme updates for MT-D11 and Generic D11C14A +* Fixed USB pad calibration values for L21 in bootloader and USB host mode +* Improve accuracy of HS crystal (fixed off-by-one calculation) +* fixed wrong location for call to mapResolution(), doc updates +* Documentation updates +* Merged in changes from upstream SAMD CORE 1.6.17 (not released yet) + * Improved ISR response time. Thanks @joverbee + 1.6.16 (release version, same as 1.6.16-beta-b0): 1.6.16-beta-b0: * Added MattairTech Xeno support (64-pin D21, L21, and C21) diff --git a/README.md b/README.md index 6fdb5f80a..991535725 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ https://www.mattairtech.com/) as well as for "Generic" boards. * Supports the SAMD21, SAMD11, SAML21, and SAMC21. * Supports four clock sources (two crystals, internal oscillator, and USB calibrated). -* USB CDC Bootloader with optional SDCard support +* USB CDC Bootloader with optional SDCard support. See [bootloaders/zero/README.md](https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/README.md). + +**SAMD51 support coming December** *This core is intended to be installed using Boards Manager (see below). To update from a* *previous version, click on MattairTech SAM M0+ Boards in Boards Manager, then click Update.* @@ -34,6 +36,18 @@ CHANGELOG for details on upstream commits and MattairTech additions that have be ## What's New - Beta Version (1.6.16-beta) **See Beta Builds section for installation instructions.** +**1.6.17-beta-b0:** +1.6.17-beta-b0: +* Added SAM D51 (m4f) support to bootloader +* Added Generic D11D14AS (20-pin SOIC) variant +* Made PIN_USB_HOST_ENABLE optional. Readme updates for MT-D11 and Generic D11C14A +* Fixed USB pad calibration values for L21 in bootloader and USB host mode +* Improve accuracy of HS crystal (fixed off-by-one calculation) +* fixed wrong location for call to mapResolution(), doc updates +* Documentation updates +* Merged in changes from upstream SAMD CORE 1.6.17 (not released yet) + * Improved ISR response time. Thanks @joverbee + **1.6.16-beta-b0:** *Beta version 1.6.16-beta-b0 became release version 1.6.16. See above* @@ -118,16 +132,24 @@ README.md also now includes technical information on the new PinDescription tabl * [MattairTech Generic D11C14A](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/Generic_D11C14A/README.md) -* MattairTech Generic D11D14AS (future) +* [MattairTech Generic D11D14AS](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/Generic_D11D14AS/README.md) * MattairTech Generic D11D14AM (future) -* MattairTech Generic x21E (future) +* MattairTech Generic x21E (soon) * MattairTech Generic x21G (future) * MattairTech Generic x21J (future) +* MattairTech Generic D51G (soon) + +* MattairTech Generic D51J (future) + +* MattairTech Generic D51N (future) + +* MattairTech Generic D51P (future) + * [Arduino Zero (arduino.cc)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/arduino_zero/README.md) * [Arduino M0 (arduino.org)](https://github.com/mattairtech/ArduinoCore-samd/tree/master/variants/arduino_mzero/README.md) @@ -756,22 +778,24 @@ from the MT-D11 variant. ### Under Development -* PlatformIO support * SAM D51 (M4F) support (pin compatible with D21, similar peripherals and pin mapping) +* PlatformIO support +* Features for lower power consumption (library?) Q1 2018? + * PM, clock system, SUPC, RTC, EVSYS, DMA, sleepwalking, battery backup +* Reliability and security enhancements (library?) 2018? + * MPU (C21, D51), WDT, PAC, cryptography (AES, PKCC, TRNG), ICM, RAMECC, cache config (determinism) * Fix programming port for Arduino Zero and M0 board variants * Reduce SRAM usage by USB endpoint buffers by only allocating endpoints actually used (D11 especially) ### Possible Future -* Features for lower power consumption (library?) Fall 2017? -* Reliability and security enhancements * USB Host mode CDC ACM (partially complete; BSD-like license?) * SD card library? Port of FatFS and/or Petit FatFS? * Optional use of single on-board LED as USB activity LED * MSC (Mass Storage) USB Device Class * Polyphonic tone * Wired-AND, Wired-OR for port pins -* High-speed port pin access (IOBUS) +* High-speed port pin access (IOBUS, m0+ only) ### Feature Requests diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index 9ad074249..d985a9538 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -258,7 +258,7 @@ This driver is the same as the one used by the MattairTech SAM M0+ Core. #### Bootloader Installation Using Another Tool (ie: Atmel Studio, openocd) -1. Download the bootloader from https://www.mattairtech.com/software/arduino/SAM-BA-bootloaders-zero-mattairtech.zip. +1. Download the bootloader from **https://www.mattairtech.com/software/arduino/SAM-BA-bootloaders-zero-mattairtech.zip**. 2. Unzip to any directory. Be sure that a bootloader is available for your particular MCU. 3. Follow the procedures for your upload tool to upload the firmware. * Perform a chip erase first. Be sure no BOOTPROT bits are set. diff --git a/extras/package_index.json.Beta.template b/extras/package_index.json.Beta.template index 86b11968c..0d294ce61 100644 --- a/extras/package_index.json.Beta.template +++ b/extras/package_index.json.Beta.template @@ -22,6 +22,7 @@ "checksum": "SHA-256:%%CHECKSUM%%", "size": "%%SIZE%%", "boards": [ + {"name": "Xeno"}, {"name": "MT-D21E"}, {"name": "MT-D21E_revB"}, {"name": "MT-D11"}, @@ -38,7 +39,7 @@ { "packager": "MattairTech_Arduino", "name": "bossac", - "version": "1.7.0-mattairtech-1" + "version": "1.7.0-mattairtech-2" }, { "packager": "arduino", @@ -53,7 +54,7 @@ { "packager": "MattairTech_Arduino", "name": "CMSIS-Atmel", - "version": "1.0.0-mattairtech-1" + "version": "1.0.0-mattairtech-2" }, { "packager": "arduino", @@ -66,69 +67,69 @@ "tools": [ { "name": "bossac", - "version": "1.7.0-mattairtech-1", + "version": "1.7.0-mattairtech-2", "systems": [ { "host": "i686-mingw32", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-mingw32.tar.gz", - "checksum": "SHA-256:1e1cf251fd4fd5260d9f000da5f2890b0f91c839fd1491af575f05339c0d136a", - "size": "324086" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-mingw32.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-mingw32.tar.gz", + "checksum": "SHA-256:63e982f8ed9749277e6251e1f94f15e57a98cddd6902ccf98d7b006e9fd6761c", + "size": "325268" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz", - "checksum": "SHA-256:788315e2f8814db77efd2d32fc660471dda8336fe9341c72b60fb3052a986ebc", - "size": "204696" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-x86_64-linux-gnu.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-x86_64-linux-gnu.tar.gz", + "checksum": "SHA-256:0d28b32bf10298a281472eeb8d3f2482adc251b276033e544196e5fd17c12111", + "size": "34223" }, { "host": "i686-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz", - "checksum": "SHA-256:07dcd2201831813e58e06ddc0c755c88754d2b766060626f8e51fc885dd6798c", - "size": "194636" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-i686-linux-gnu.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-i686-linux-gnu.tar.gz", + "checksum": "SHA-256:b0399e20e15125c7cae9571b5102d77e632642fe07e27b86b90e14b5fa5a4e09", + "size": "34170" }, { "host": "x86_64-apple-darwin", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz", - "checksum": "SHA-256:ca57765d7c7ef94e43d316658c8b3012d888501d10ec58bc38dc2aaa173edadf", - "size": "85071" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-x86_64-apple-darwin.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-x86_64-apple-darwin.tar.gz", + "checksum": "SHA-256:5a9125567ba2082f7791954cf7f717644decad5ab77392d9d35d0538ffe8ae76", + "size": "88668" } ] }, { "name": "CMSIS-Atmel", - "version": "1.0.0-mattairtech-1", + "version": "1.0.0-mattairtech-2", "systems": [ { "host": "i686-mingw32", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" }, { "host": "i686-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" }, { "host": "x86_64-apple-darwin", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" } ] } diff --git a/extras/package_index.json.PR.template b/extras/package_index.json.PR.template index 14c0d839c..9aa554844 100644 --- a/extras/package_index.json.PR.template +++ b/extras/package_index.json.PR.template @@ -22,6 +22,7 @@ "checksum": "SHA-256:%%CHECKSUM%%", "size": "%%SIZE%%", "boards": [ + {"name": "Xeno"}, {"name": "MT-D21E"}, {"name": "MT-D21E_revB"}, {"name": "MT-D11"}, @@ -38,7 +39,7 @@ { "packager": "MattairTech_Arduino", "name": "bossac", - "version": "1.7.0-mattairtech-1" + "version": "1.7.0-mattairtech-2" }, { "packager": "arduino", @@ -53,7 +54,7 @@ { "packager": "MattairTech_Arduino", "name": "CMSIS-Atmel", - "version": "1.0.0-mattairtech-1" + "version": "1.0.0-mattairtech-2" }, { "packager": "arduino", @@ -66,69 +67,69 @@ "tools": [ { "name": "bossac", - "version": "1.7.0-mattairtech-1", + "version": "1.7.0-mattairtech-2", "systems": [ { "host": "i686-mingw32", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-mingw32.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-mingw32.tar.gz", - "checksum": "SHA-256:1e1cf251fd4fd5260d9f000da5f2890b0f91c839fd1491af575f05339c0d136a", - "size": "324086" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-mingw32.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-mingw32.tar.gz", + "checksum": "SHA-256:63e982f8ed9749277e6251e1f94f15e57a98cddd6902ccf98d7b006e9fd6761c", + "size": "325268" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-x86_64-linux-gnu.tar.gz", - "checksum": "SHA-256:788315e2f8814db77efd2d32fc660471dda8336fe9341c72b60fb3052a986ebc", - "size": "204696" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-x86_64-linux-gnu.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-x86_64-linux-gnu.tar.gz", + "checksum": "SHA-256:0d28b32bf10298a281472eeb8d3f2482adc251b276033e544196e5fd17c12111", + "size": "34223" }, { "host": "i686-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-i686-linux-gnu.tar.gz", - "checksum": "SHA-256:07dcd2201831813e58e06ddc0c755c88754d2b766060626f8e51fc885dd6798c", - "size": "194636" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-i686-linux-gnu.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-i686-linux-gnu.tar.gz", + "checksum": "SHA-256:b0399e20e15125c7cae9571b5102d77e632642fe07e27b86b90e14b5fa5a4e09", + "size": "34170" }, { "host": "x86_64-apple-darwin", - "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz", - "archiveFileName": "bossac-1.7.0-mattairtech-1-x86_64-apple-darwin.tar.gz", - "checksum": "SHA-256:ca57765d7c7ef94e43d316658c8b3012d888501d10ec58bc38dc2aaa173edadf", - "size": "85071" + "url": "https://www.mattairtech.com/software/arduino/bossac-1.7.0-mattairtech-2-x86_64-apple-darwin.tar.gz", + "archiveFileName": "bossac-1.7.0-mattairtech-2-x86_64-apple-darwin.tar.gz", + "checksum": "SHA-256:5a9125567ba2082f7791954cf7f717644decad5ab77392d9d35d0538ffe8ae76", + "size": "88668" } ] }, { "name": "CMSIS-Atmel", - "version": "1.0.0-mattairtech-1", + "version": "1.0.0-mattairtech-2", "systems": [ { "host": "i686-mingw32", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" }, { "host": "i686-pc-linux-gnu", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" }, { "host": "x86_64-apple-darwin", - "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-1.tar.gz", - "checksum": "SHA-256:ab100e3336b61f23f10759a9f0d0ffef6dd2af0615b02428ada9027dea3dba15", - "size": "1386014" + "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", + "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", + "size": "2009341" } ] } diff --git a/extras/package_index.json.Release.template b/extras/package_index.json.Release.template index ae5f4677e..71a249821 100644 --- a/extras/package_index.json.Release.template +++ b/extras/package_index.json.Release.template @@ -7,9 +7,14 @@ "archiveFileName": "%%FILENAME%%", "checksum": "SHA-256:%%CHECKSUM%%", "size": "%%SIZE%%", - "boards": [ - {"name": "MT-D21E"}, - {"name": "MT-D11"} + "boards": [ + {"name": "Xeno"}, + {"name": "MT-D21E"}, + {"name": "MT-D21E_revB"}, + {"name": "MT-D11"}, + {"name": "Generic_D11C14A"}, + {"name": "arduino_zero"}, + {"name": "arduino_mzero"} ], "toolsDependencies": [ { @@ -20,7 +25,7 @@ { "packager": "MattairTech_Arduino", "name": "bossac", - "version": "1.7.0-mattairtech-1" + "version": "1.7.0-mattairtech-2" }, { "packager": "arduino", @@ -35,7 +40,7 @@ { "packager": "MattairTech_Arduino", "name": "CMSIS-Atmel", - "version": "1.0.0-mattairtech-1" + "version": "1.0.0-mattairtech-2" }, { "packager": "arduino", diff --git a/platform.txt b/platform.txt index 9113b9d25..b115cb56c 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=MattairTech SAM M0+ Boards -version=1.6.16 +version=1.6.17 # Compile variables # ----------------- From c7fbf7e17641ecbe136d4746e33f5b8d5d7287f3 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 25 Nov 2017 09:14:39 +0000 Subject: [PATCH 113/124] Doc update --- CHANGELOG | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 480bf34b4..1cbc8e646 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ * Documentation updates * Merged in changes from upstream SAMD CORE 1.6.17 (not released yet) * Improved ISR response time. Thanks @joverbee + * No fixed value for USB power current. 1.6.16 (release version, same as 1.6.16-beta-b0): 1.6.16-beta-b0: diff --git a/README.md b/README.md index 991535725..d192ff011 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ CHANGELOG for details on upstream commits and MattairTech additions that have be * Documentation updates * Merged in changes from upstream SAMD CORE 1.6.17 (not released yet) * Improved ISR response time. Thanks @joverbee + * No fixed value for USB power current. **1.6.16-beta-b0:** *Beta version 1.6.16-beta-b0 became release version 1.6.16. See above* From bfd279a95d760f9f1ea999d827d283b4d8389941 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 25 Nov 2017 09:41:20 +0000 Subject: [PATCH 114/124] Update templates --- extras/package_index.json.Beta.template | 1 + extras/package_index.json.PR.template | 1 + extras/package_index.json.Release.template | 1 + 3 files changed, 3 insertions(+) diff --git a/extras/package_index.json.Beta.template b/extras/package_index.json.Beta.template index 0d294ce61..503861af9 100644 --- a/extras/package_index.json.Beta.template +++ b/extras/package_index.json.Beta.template @@ -27,6 +27,7 @@ {"name": "MT-D21E_revB"}, {"name": "MT-D11"}, {"name": "Generic_D11C14A"}, + {"name": "Generic_D11D14AS"}, {"name": "arduino_zero"}, {"name": "arduino_mzero"} ], diff --git a/extras/package_index.json.PR.template b/extras/package_index.json.PR.template index 9aa554844..14bfa6bdf 100644 --- a/extras/package_index.json.PR.template +++ b/extras/package_index.json.PR.template @@ -27,6 +27,7 @@ {"name": "MT-D21E_revB"}, {"name": "MT-D11"}, {"name": "Generic_D11C14A"}, + {"name": "Generic_D11D14AS"}, {"name": "arduino_zero"}, {"name": "arduino_mzero"} ], diff --git a/extras/package_index.json.Release.template b/extras/package_index.json.Release.template index 71a249821..f6e55edb3 100644 --- a/extras/package_index.json.Release.template +++ b/extras/package_index.json.Release.template @@ -13,6 +13,7 @@ {"name": "MT-D21E_revB"}, {"name": "MT-D11"}, {"name": "Generic_D11C14A"}, + {"name": "Generic_D11D14AS"}, {"name": "arduino_zero"}, {"name": "arduino_mzero"} ], From 7897585b0df66bf8c7b0d81e34589166ec40be6b Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 25 Nov 2017 10:26:15 +0000 Subject: [PATCH 115/124] Final doc and template updates for 1.6.17-beta-b0 release --- README.md | 2 +- extras/package_index.json.Beta.template | 16 ++++++++-------- extras/package_index.json.PR.template | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index d192ff011..7f6d6e931 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ CHANGELOG for details on upstream commits and MattairTech additions that have be * Documentation updates -## What's New - Beta Version (1.6.16-beta) +## What's New - Beta Version (1.6.17-beta) **See Beta Builds section for installation instructions.** **1.6.17-beta-b0:** diff --git a/extras/package_index.json.Beta.template b/extras/package_index.json.Beta.template index 503861af9..9dfb54061 100644 --- a/extras/package_index.json.Beta.template +++ b/extras/package_index.json.Beta.template @@ -108,29 +108,29 @@ "host": "i686-mingw32", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" }, { "host": "x86_64-pc-linux-gnu", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" }, { "host": "i686-pc-linux-gnu", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" }, { "host": "x86_64-apple-darwin", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" } ] } diff --git a/extras/package_index.json.PR.template b/extras/package_index.json.PR.template index 14bfa6bdf..8c4d99512 100644 --- a/extras/package_index.json.PR.template +++ b/extras/package_index.json.PR.template @@ -108,29 +108,29 @@ "host": "i686-mingw32", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" }, { "host": "x86_64-pc-linux-gnu", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" }, { "host": "i686-pc-linux-gnu", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" }, { "host": "x86_64-apple-darwin", "url": "https://www.mattairtech.com/software/arduino/CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", "archiveFileName": "CMSIS-Atmel-1.0.0-mattairtech-2.tar.gz", - "checksum": "SHA-256:85a9d3e7d34b5272e46c4ad6943f7375a3bbff7ff2944d35fdfd0cf7778a3c2b", - "size": "2009341" + "checksum": "SHA-256:d10ca2a14c8db5757d2b1b4c1e52473ae5337f0762c6617a6074373f2f44540d", + "size": "2008479" } ] } From 77bf7833add406f0ce6fa30c65bb2b0b7d2f7915 Mon Sep 17 00:00:00 2001 From: Justin Mattair Date: Sat, 25 Nov 2017 10:38:16 +0000 Subject: [PATCH 116/124] Final platform.txt update for 1.6.17-beta-b0 release --- platform.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform.txt b/platform.txt index b115cb56c..c957e0b31 100644 --- a/platform.txt +++ b/platform.txt @@ -58,11 +58,11 @@ compiler.readelf.cmd=arm-none-eabi-readelf build.extra_flags= # These can be overridden in platform.local.txt -compiler.c.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.c.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-2.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} compiler.c.elf.extra_flags= #compiler.c.elf.extra_flags=-v -compiler.cpp.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -compiler.S.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.cpp.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-2.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.S.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-2.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} compiler.ar.extra_flags= compiler.elf2hex.extra_flags= @@ -139,7 +139,7 @@ tools.avrdude_remote.upload.pattern="openocd --version 2>&1 | grep 2016 && if op # # BOSSA # -tools.bossac.path={runtime.tools.bossac-1.7.0-mattairtech-1.path} +tools.bossac.path={runtime.tools.bossac-1.7.0-mattairtech-2.path} tools.bossac.cmd=bossac tools.bossac.cmd.windows=bossac.exe From d053a818c3bb09c66b304f8e2cdcff7f538c38fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20=C3=81ngel=20Jim=C3=A9nez?= Date: Sun, 17 Dec 2017 19:58:02 +0100 Subject: [PATCH 117/124] Incorrect condition checking in HID.h I found an incorrect checking of the -D macros which prevents the compilation of a project with USD enabled. The compilation should stop with #error only if none of the macros are defined. The condition, as it was written previously, prevents compiling a project with USB enabled. --- libraries/HID/HID.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index 45900f99e..c312ebe6f 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -23,7 +23,7 @@ #include #include "USB/PluggableUSB.h" -#if !defined(CDC_HID) || !defined(HID_ONLY) || !defined(WITH_CDC) +#if !defined(CDC_HID) && !defined(HID_ONLY) && !defined(WITH_CDC) #error Please select CDC_HID, HID_ONLY, or WITH_CDC in the Tools->USB menu. #endif From 5876ab597d441a5c348545cabd67e9224d149dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20=C3=81ngel=20Jim=C3=A9nez?= Date: Mon, 18 Dec 2017 09:37:10 +0100 Subject: [PATCH 118/124] Correction of include path for CMSIS-Atmel This corrects the include path for the CMSIS-Atmel inside the MattairTech package. Without this correction the bootloader compilation fails. --- bootloaders/zero/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index 2aebe77dd..ee6720dc5 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -154,7 +154,7 @@ BIN=$(NAME).bin HEX=$(NAME).hex -INCLUDES=-I"$(MODULE_PATH_ARDUINO)/tools/CMSIS/4.5.0/CMSIS/Include/" -I"$(MODULE_PATH)/tools/CMSIS-Atmel/1.0.0-mattairtech-1/CMSIS/Device/ATMEL/" +INCLUDES=-I"$(MODULE_PATH_ARDUINO)/tools/CMSIS/4.5.0/CMSIS/Include/" -I"$(MODULE_PATH)/tools/CMSIS-Atmel/1.0.0-mattairtech-2/CMSIS/Device/ATMEL/" # ----------------------------------------------------------------------------- # Linker options From ed807f9bbb232c4517e8944128762f5000536367 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Fri, 5 Jan 2018 14:59:23 -0500 Subject: [PATCH 119/124] Initial SPI slave API --- cores/arduino/SERCOM.cpp | 60 ++++++++++++++++++++++++--------- cores/arduino/SERCOM.h | 7 ++-- libraries/SPI/SPI.cpp | 69 +++++++++++++++++++++++++++++++++++--- libraries/SPI/SPI.h | 14 +++++++- libraries/SPI/keywords.txt | 3 ++ 5 files changed, 130 insertions(+), 23 deletions(-) diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index a8b04a838..f38d0353d 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -232,22 +232,27 @@ void SERCOM::disableDataRegisterEmptyInterruptUART() * ===== Sercom SPI * ========================= */ -void SERCOM::initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize charSize, SercomDataOrder dataOrder) +void SERCOM::initSPI(SercomSpiMode mode, SercomSpiTXPad txPad, SercomRXPad rxPad, SercomSpiCharSize charSize, SercomDataOrder dataOrder) { resetSPI(); initClockNVIC(); //Setting the CTRLA register - sercom->SPI.CTRLA.reg = SERCOM_SPI_CTRLA_MODE_SPI_MASTER | - SERCOM_SPI_CTRLA_DOPO(mosi) | - SERCOM_SPI_CTRLA_DIPO(miso) | + sercom->SPI.CTRLA.reg = ((mode == SPI_SLAVE_OPERATION) ? SERCOM_SPI_CTRLA_MODE_SPI_SLAVE : SERCOM_SPI_CTRLA_MODE_SPI_MASTER) | + SERCOM_SPI_CTRLA_DOPO(txPad) | + SERCOM_SPI_CTRLA_DIPO(rxPad) | dataOrder << SERCOM_SPI_CTRLA_DORD_Pos; //Setting the CTRLB register sercom->SPI.CTRLB.reg = SERCOM_SPI_CTRLB_CHSIZE(charSize) | + SERCOM_SPI_CTRLB_SSDE | SERCOM_SPI_CTRLB_RXEN; //Active the SPI receiver. + if (mode == SPI_SLAVE_OPERATION) { + sercom->SPI.INTENSET.reg = SERCOM_SPI_INTENSET_RXC | + SERCOM_SPI_INTENSET_SSL ; + } } void SERCOM::initSPIClock(SercomSpiClockMode clockMode, uint32_t baudrate) @@ -367,6 +372,26 @@ uint8_t SERCOM::transferDataSPI(uint8_t data) return sercom->SPI.DATA.bit.DATA; // Reading data } +uint8_t SERCOM::readDataSPI() +{ + while( sercom->SPI.INTFLAG.bit.RXC == 0 ) + { + // Waiting Complete Reception + } + + return sercom->SPI.DATA.bit.DATA; // Reading data +} + +void SERCOM::writeDataSPI(uint8_t data) +{ + while( sercom->SPI.INTFLAG.bit.DRE == 0 ) + { + // Waiting Data Register Empty + } + + sercom->SPI.DATA.bit.DATA = data; // Writing data into Data register +} + bool SERCOM::isBufferOverflowErrorSPI() { return sercom->SPI.STATUS.bit.BUFOVF; @@ -378,17 +403,22 @@ bool SERCOM::isDataRegisterEmptySPI() return sercom->SPI.INTFLAG.bit.DRE; } -//bool SERCOM::isTransmitCompleteSPI() -//{ -// //TXC : Transmit complete -// return sercom->SPI.INTFLAG.bit.TXC; -//} -// -//bool SERCOM::isReceiveCompleteSPI() -//{ -// //RXC : Receive complete -// return sercom->SPI.INTFLAG.bit.RXC; -//} +bool SERCOM::isReceiveCompleteSPI() +{ + //RXC : Receive complete + return sercom->SPI.INTFLAG.bit.RXC; +} + +bool SERCOM::isSlaveSelectLowSPI() +{ + //SSL : Slave select low + return sercom->SPI.INTFLAG.bit.SSL; +} + +void SERCOM::acknowledgeSPISlaveSelectLow() +{ + sercom->SPI.INTFLAG.bit.SSL = 1; +} uint32_t SERCOM::calculateBaudrateSynchronous(uint32_t baudrate) { diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index 1962db0aa..73a67ca46 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -172,7 +172,7 @@ class SERCOM void disableDataRegisterEmptyInterruptUART(); /* ========== SPI ========== */ - void initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize charSize, SercomDataOrder dataOrder) ; + void initSPI(SercomSpiMode mode, SercomSpiTXPad txPad, SercomRXPad rxPad, SercomSpiCharSize charSize, SercomDataOrder dataOrder) ; void initSPIClock(SercomSpiClockMode clockMode, uint32_t baudrate) ; void resetSPI( void ) ; @@ -183,10 +183,13 @@ class SERCOM void setBaudrateSPI(uint8_t divider) ; void setClockModeSPI(SercomSpiClockMode clockMode) ; uint8_t transferDataSPI(uint8_t data) ; + uint8_t readDataSPI( void ) ; + void writeDataSPI(uint8_t data) ; bool isBufferOverflowErrorSPI( void ) ; bool isDataRegisterEmptySPI( void ) ; - bool isTransmitCompleteSPI( void ) ; bool isReceiveCompleteSPI( void ) ; + bool isSlaveSelectLowSPI( void ) ; + void acknowledgeSPISlaveSelectLow ( void ); /* ========== WIRE ========== */ void initSlaveWIRE(uint8_t address) ; diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 3ccef9a07..330d245d0 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -28,7 +28,12 @@ const SPISettings DEFAULT_SPI_SETTINGS = SPISettings(); -SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, SercomSpiTXPad PadTx, SercomRXPad PadRx) +SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, SercomSpiTXPad PadTx, SercomRXPad PadRx) : + SPIClass(p_sercom, uc_pinMISO, uc_pinSCK, uc_pinMOSI, (uint8_t)-1, PadTx, PadRx) +{ +} + +SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, uint8_t uc_pinSS, SercomSpiTXPad PadTx, SercomRXPad PadRx) { initialized = false; assert(p_sercom != NULL); @@ -38,6 +43,7 @@ SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint _uc_pinMiso = uc_pinMISO; _uc_pinSCK = uc_pinSCK; _uc_pinMosi = uc_pinMOSI; + _uc_pinSS = uc_pinSS; // SERCOM pads _padTx=PadTx; @@ -53,7 +59,26 @@ void SPIClass::begin() pinPeripheral(_uc_pinSCK, PIO_SERCOM); pinPeripheral(_uc_pinMosi, PIO_SERCOM); - config(DEFAULT_SPI_SETTINGS); + config(SPI_MASTER_OPERATION, DEFAULT_SPI_SETTINGS); +} + +int SPIClass::beginSlave() +{ + if (_uc_pinSS == (uint8_t)-1) { + return 0; + } + + init(); + + // PIO init + pinPeripheral(_uc_pinMiso, g_APinDescription[_uc_pinMiso].ulPinType); + pinPeripheral(_uc_pinSCK, g_APinDescription[_uc_pinSCK].ulPinType); + pinPeripheral(_uc_pinMosi, g_APinDescription[_uc_pinMosi].ulPinType); + pinPeripheral(_uc_pinSS, g_APinDescription[_uc_pinSS].ulPinType); + + config(SPI_SLAVE_OPERATION, DEFAULT_SPI_SETTINGS); + + return 1; } void SPIClass::init() @@ -66,11 +91,11 @@ void SPIClass::init() initialized = true; } -void SPIClass::config(SPISettings settings) +void SPIClass::config(SercomSpiMode mode, SPISettings settings) { _p_sercom->disableSPI(); - _p_sercom->initSPI(_padTx, _padRx, SPI_CHAR_SIZE_8_BITS, settings.bitOrder); + _p_sercom->initSPI(mode, _padTx, _padRx, SPI_CHAR_SIZE_8_BITS, settings.bitOrder); _p_sercom->initSPIClock(settings.dataMode, settings.clockFreq); _p_sercom->enableSPI(); @@ -125,7 +150,7 @@ void SPIClass::beginTransaction(SPISettings settings) EIC->INTENCLR.reg = EIC_INTENCLR_EXTINT(interruptMask); } - config(settings); + config(SPI_MASTER_OPERATION, settings); } void SPIClass::endTransaction(void) @@ -223,6 +248,40 @@ void SPIClass::detachInterrupt() { // Should be disableInterrupt() } +void SPIClass::onSelect(void(*function)(void)) +{ + onSelectCallback = function; +} + +void SPIClass::onReceive(byte(*function)(byte)) +{ + onReceiveCallback = function; +} + +void SPIClass::onService() +{ + if (_p_sercom->isReceiveCompleteSPI()) { + byte nextOut; + byte in = _p_sercom->readDataSPI(); + + if (onReceiveCallback) { + nextOut = onReceiveCallback(in); + } else { + nextOut = 0xff; + } + + _p_sercom->writeDataSPI(nextOut); + } + + if (_p_sercom->isSlaveSelectLowSPI()) { + if (onSelectCallback) { + onSelectCallback(); + } + + _p_sercom->acknowledgeSPISlaveSelectLow(); + } +} + #if SPI_INTERFACES_COUNT > 0 /* In case new variant doesn't define these macros, * we put here the ones for Arduino Zero. diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index 50eff71e0..9d208373f 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -96,6 +96,7 @@ class SPISettings { class SPIClass { public: SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, SercomSpiTXPad, SercomRXPad); + SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, uint8_t uc_pinSS, SercomSpiTXPad, SercomRXPad); byte transfer(uint8_t data); @@ -112,20 +113,27 @@ class SPIClass { void detachInterrupt(); void begin(); + int beginSlave(); void end(); void setBitOrder(BitOrder order); void setDataMode(uint8_t uc_mode); void setClockDivider(uint8_t uc_div); + void onSelect(void(*)(void)); + void onReceive(byte(*)(byte)); + + void onService(void); + private: void init(); - void config(SPISettings settings); + void config(SercomSpiMode mode, SPISettings settings); SERCOM *_p_sercom; uint8_t _uc_pinMiso; uint8_t _uc_pinMosi; uint8_t _uc_pinSCK; + uint8_t _uc_pinSS; SercomSpiTXPad _padTx; SercomRXPad _padRx; @@ -134,6 +142,10 @@ class SPIClass { uint8_t interruptMode; char interruptSave; uint32_t interruptMask; + + // Callback user functions + void (*onSelectCallback)(void); + byte (*onReceiveCallback)(byte); }; #if SPI_INTERFACES_COUNT > 0 diff --git a/libraries/SPI/keywords.txt b/libraries/SPI/keywords.txt index 47738f9fa..e1fe5b30a 100644 --- a/libraries/SPI/keywords.txt +++ b/libraries/SPI/keywords.txt @@ -12,11 +12,14 @@ SPI KEYWORD1 # Methods and Functions (KEYWORD2) ####################################### begin KEYWORD2 +beginSlave KEYWORD2 end KEYWORD2 transfer KEYWORD2 #setBitOrder KEYWORD2 setDataMode KEYWORD2 setClockDivider KEYWORD2 +onSelect KEYWORD2 +onReceive KEYWORD2 ####################################### From 234ff41d5f575ae74b118d344a7d386eb0636af1 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Fri, 5 Jan 2018 15:19:55 -0500 Subject: [PATCH 120/124] Only write byte if there is a receive callback --- libraries/SPI/SPI.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 330d245d0..e82055c91 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -261,16 +261,13 @@ void SPIClass::onReceive(byte(*function)(byte)) void SPIClass::onService() { if (_p_sercom->isReceiveCompleteSPI()) { - byte nextOut; byte in = _p_sercom->readDataSPI(); if (onReceiveCallback) { - nextOut = onReceiveCallback(in); - } else { - nextOut = 0xff; - } + byte out = onReceiveCallback(in); - _p_sercom->writeDataSPI(nextOut); + _p_sercom->writeDataSPI(out); + } } if (_p_sercom->isSlaveSelectLowSPI()) { From 118b681894e9c61898951679bb506d5290c7c4d9 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Mon, 8 Jan 2018 12:43:51 -0500 Subject: [PATCH 121/124] Add SPI interrupt handlers --- libraries/SPI/SPI.cpp | 66 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index e82055c91..2ee1194e5 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -294,21 +294,75 @@ void SPIClass::onService() #define PAD_SPI_TX SPI_PAD_2_SCK_3 #define PAD_SPI_RX SERCOM_RX_PAD_0 #endif // PERIPH_SPI - SPIClass SPI (&PERIPH_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI, PAD_SPI_TX, PAD_SPI_RX); + #ifdef SPI_IT_HANDLER + // supports SPI slave mode + SPIClass SPI (&PERIPH_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI, PIN_SPI_SS, PAD_SPI_TX, PAD_SPI_RX); + + void SPI_IT_HANDLER(void) { + SPI.onService(); + } + #else + SPIClass SPI (&PERIPH_SPI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI, PAD_SPI_TX, PAD_SPI_RX); + #endif #endif #if SPI_INTERFACES_COUNT > 1 - SPIClass SPI1(&PERIPH_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI, PAD_SPI1_TX, PAD_SPI1_RX); + #ifdef SPI1_IT_HANDLER + // supports SPI slave mode + SPIClass SPI1(&PERIPH_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI, PIN_SPI1_SS, PAD_SPI1_TX, PAD_SPI1_RX); + + void SPI1_IT_HANDLER(void) { + SPI1.onService(); + } + #else + SPIClass SPI1(&PERIPH_SPI1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI, PAD_SPI1_TX, PAD_SPI1_RX); + #endif #endif #if SPI_INTERFACES_COUNT > 2 - SPIClass SPI2(&PERIPH_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI, PAD_SPI2_TX, PAD_SPI2_RX); + #ifdef SPI2_IT_HANDLER + // supports SPI slave mode + SPIClass SPI2(&PERIPH_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI, PIN_SPI2_SS, PAD_SPI2_TX, PAD_SPI2_RX); + + void SPI2_IT_HANDLER(void) { + SPI2.onService(); + } + #else + SPIClass SPI2(&PERIPH_SPI2, PIN_SPI2_MISO, PIN_SPI2_SCK, PIN_SPI2_MOSI, PAD_SPI2_TX, PAD_SPI2_RX); + #endif #endif #if SPI_INTERFACES_COUNT > 3 - SPIClass SPI3(&PERIPH_SPI3, PIN_SPI3_MISO, PIN_SPI3_SCK, PIN_SPI3_MOSI, PAD_SPI3_TX, PAD_SPI3_RX); + #ifdef SPI3_IT_HANDLER + // supports SPI slave mode + SPIClass SPI3(&PERIPH_SPI3, PIN_SPI3_MISO, PIN_SPI3_SCK, PIN_SPI3_MOSI, PIN_SPI3_SS, PAD_SPI3_TX, PAD_SPI3_RX); + + void SPI3_IT_HANDLER(void) { + SPI3.onService(); + } + #else + SPIClass SPI3(&PERIPH_SPI3, PIN_SPI3_MISO, PIN_SPI3_SCK, PIN_SPI3_MOSI, PAD_SPI3_TX, PAD_SPI3_RX); + #endif #endif #if SPI_INTERFACES_COUNT > 4 - SPIClass SPI4(&PERIPH_SPI4, PIN_SPI4_MISO, PIN_SPI4_SCK, PIN_SPI4_MOSI, PAD_SPI4_TX, PAD_SPI4_RX); + #ifdef SPI4_IT_HANDLER + // supports SPI slave mode + SPIClass SPI4(&PERIPH_SPI4, PIN_SPI4_MISO, PIN_SPI4_SCK, PIN_SPI4_MOSI, PIN_SPI4_SS, PAD_SPI4_TX, PAD_SPI4_RX); + + void SPI4_IT_HANDLER(void) { + SPI4.onService(); + } + #else + SPIClass SPI4(&PERIPH_SPI4, PIN_SPI4_MISO, PIN_SPI4_SCK, PIN_SPI4_MOSI, PAD_SPI4_TX, PAD_SPI4_RX); + #endif #endif #if SPI_INTERFACES_COUNT > 5 - SPIClass SPI5(&PERIPH_SPI5, PIN_SPI5_MISO, PIN_SPI5_SCK, PIN_SPI5_MOSI, PAD_SPI5_TX, PAD_SPI5_RX); + #ifdef SPI5_IT_HANDLER + // supports SPI slave mode + SPIClass SPI5(&PERIPH_SPI5, PIN_SPI5_MISO, PIN_SPI5_SCK, PIN_SPI5_MOSI, PIN_SPI5_SS, PAD_SPI5_TX, PAD_SPI5_RX); + + void SPI5_IT_HANDLER(void) { + SPI5.onService(); + } + #else + SPIClass SPI5(&PERIPH_SPI5, PIN_SPI5_MISO, PIN_SPI5_SCK, PIN_SPI5_MOSI, PAD_SPI5_TX, PAD_SPI5_RX); + #endif #endif From 30a85c6eac6f580565d730b14c251bc62348fa11 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Mon, 8 Jan 2018 13:05:24 -0500 Subject: [PATCH 122/124] Add SPI_HAS_SLAVE and SPI_HAS_ON_SELECT API's --- libraries/SPI/SPI.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index 9d208373f..0316eaeee 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -31,6 +31,14 @@ // - SPISetting(clock, bitOrder, dataMode) #define SPI_HAS_TRANSACTION 1 +// SPI_HAS_SLAVE means that SPI has +// - beginSlave() +// - onReceive(callback) +#define SPI_HAS_SLAVE + +// SPI_HAS_ON_SELECT means that SPI has onSelect(callback) method +#define SPI_HAS_ON_SELECT + #define SPI_MODE0 0x02 #define SPI_MODE1 0x00 #define SPI_MODE2 0x03 From 95d08de05796517b63f09dd8760e8c004d219e0a Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Wed, 10 Jan 2018 14:56:26 -0500 Subject: [PATCH 123/124] Handle slave select low first --- libraries/SPI/SPI.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 2ee1194e5..c4cf2ec57 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -260,6 +260,14 @@ void SPIClass::onReceive(byte(*function)(byte)) void SPIClass::onService() { + if (_p_sercom->isSlaveSelectLowSPI()) { + if (onSelectCallback) { + onSelectCallback(); + } + + _p_sercom->acknowledgeSPISlaveSelectLow(); + } + if (_p_sercom->isReceiveCompleteSPI()) { byte in = _p_sercom->readDataSPI(); @@ -269,14 +277,6 @@ void SPIClass::onService() _p_sercom->writeDataSPI(out); } } - - if (_p_sercom->isSlaveSelectLowSPI()) { - if (onSelectCallback) { - onSelectCallback(); - } - - _p_sercom->acknowledgeSPISlaveSelectLow(); - } } #if SPI_INTERFACES_COUNT > 0 From 5f36ae4fd4111b12f1c4fdecce384d75e872e4df Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Tue, 6 Mar 2018 10:44:06 +0100 Subject: [PATCH 124/124] Add MKR Motor Carrier variant IMPORTANT: lto build is needed to fit both production bootloader and production firmware in 16KB; at the moment 7-2017q4 toolchain is unable to produce a proper build, so use the system gcc toolchain (on Arch Linux) Marking the vector section as used allows us to use lto also on c files. Necessary to compile the bootloader safely (we could also add a checksum strategy) --- boards.txt | 52 +++ cores/arduino/RingBuffer.h | 2 +- cores/arduino/WVariant.h | 14 +- cores/arduino/cortex_handlers.c | 2 +- cores/arduino/wiring_analog.c | 30 +- cores/arduino/wiring_analog.h | 2 + cores/arduino/wiring_private.c | 2 + libraries/SPI/SPI.cpp | 8 +- libraries/Wire/Wire.h | 9 +- platform.txt | 7 +- variants/Generic_D11D14AS/variant.cpp | 12 +- variants/MKRMotorShield/README.md | 250 ++++++++++++ .../debug_scripts/SAMD11D14AS.gdb | 31 ++ .../gcc/4KB_Bootloader/flash_16KB.ld | 217 ++++++++++ .../gcc/No_Bootloader/flash_16KB.ld | 214 ++++++++++ .../openocd_scripts/SAMD11D14AS.cfg | 30 ++ variants/MKRMotorShield/pins_arduino.h | 21 + variants/MKRMotorShield/variant.cpp | 128 ++++++ variants/MKRMotorShield/variant.h | 379 ++++++++++++++++++ 19 files changed, 1375 insertions(+), 35 deletions(-) create mode 100644 variants/MKRMotorShield/README.md create mode 100644 variants/MKRMotorShield/debug_scripts/SAMD11D14AS.gdb create mode 100644 variants/MKRMotorShield/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld create mode 100644 variants/MKRMotorShield/linker_scripts/gcc/No_Bootloader/flash_16KB.ld create mode 100644 variants/MKRMotorShield/openocd_scripts/SAMD11D14AS.cfg create mode 100644 variants/MKRMotorShield/pins_arduino.h create mode 100644 variants/MKRMotorShield/variant.cpp create mode 100644 variants/MKRMotorShield/variant.h diff --git a/boards.txt b/boards.txt index f594f3601..4af048da8 100644 --- a/boards.txt +++ b/boards.txt @@ -19,6 +19,8 @@ menu.clock=Clock Source menu.usb=USB Config menu.serial=Serial Config menu.bootloader=Bootloader Size +menu.lto=Link time optimization +menu.pinmap=Pinmap # MattairTech Xeno @@ -748,6 +750,10 @@ d11d14as.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI d11d14as.menu.serial.one_uart.build.serialcom_uart=ONE_UART d11d14as.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE d11d14as.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.one_uart_no_spi=ONE_UART_ONE_WIRE_NO_SPI +d11d14as.menu.serial.one_uart_no_spi.build.serialcom_uart=ONE_UART +d11d14as.menu.serial.one_uart_no_spi.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.one_uart_no_spi.build.serialcom_spi=NO_SPI d11d14as.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI d11d14as.menu.serial.no_uart.build.serialcom_uart=NO_UART d11d14as.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE @@ -775,6 +781,52 @@ d11d14as.menu.usb.none=USB_DISABLED d11d14as.menu.usb.none.build.usbcom=USB_DISABLED d11d14as.menu.usb.none.build.pid=0x0856 +# MKR Motor Shield +mkrmotorshield.name=MKR Motor Shield +mkrmotorshield.vid.0=0x2341 +mkrmotorshield.pid.0=0x1337 +mkrmotorshield.build.mcu=cortex-m0plus +mkrmotorshield.build.f_cpu=48000000L +mkrmotorshield.build.usb_product="MKRMOTOR" +mkrmotorshield.build.usb_manufacturer="Arduino LLC" +mkrmotorshield.build.board=SAMD_ZERO +mkrmotorshield.build.core=arduino +mkrmotorshield.build.variant=MKRMotorShield +mkrmotorshield.build.variant_system_lib= +mkrmotorshield.build.vid=0x2341 +mkrmotorshield.build.pid=0x1337 +mkrmotorshield.upload.protocol=sam-ba +mkrmotorshield.bootloader.tool=arduino:openocd +mkrmotorshield.build.clockconfig=CLOCKCONFIG_INTERNAL +mkrmotorshield.build.extra_flags=-D__SAMD11D14AS__ {build.usb_flags} {build.pinmap} {build.lto} +mkrmotorshield.build.ldscript=flash_16KB.ld +mkrmotorshield.build.openocdscript=openocd_scripts/SAMD11D14AS.cfg +mkrmotorshield.bootloader.file=zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin +mkrmotorshield.menu.bootloader.4kb=4KB bootloader +mkrmotorshield.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +mkrmotorshield.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +mkrmotorshield.menu.bootloader.4kb.upload.maximum_size=12288 +mkrmotorshield.menu.bootloader.0kb=No bootloader +mkrmotorshield.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +mkrmotorshield.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +mkrmotorshield.menu.bootloader.0kb.upload.maximum_size=16384 +mkrmotorshield.menu.pinmap.complete=Complete +mkrmotorshield.menu.pinmap.complete.build.pinmap= +mkrmotorshield.menu.pinmap.minimal=Minimal (bootloader) +mkrmotorshield.menu.pinmap.minimal.build.pinmap=-DPIN_MAP_SUPER_COMPACT +mkrmotorshield.menu.lto.enabled=Enabled +mkrmotorshield.menu.lto.enabled.build.lto=-flto +mkrmotorshield.menu.lto.disabled=Disabled +mkrmotorshield.menu.lto.disabled.build.lto= +mkrmotorshield.upload.tool=arduino:openocd +mkrmotorshield.upload.use_1200bps_touch=false +mkrmotorshield.upload.wait_for_upload_port=false +mkrmotorshield.upload.native_usb=false +mkrmotorshield.build.serialcom_uart=NO_UART +mkrmotorshield.build.serialcom_wire=ONE_WIRE +mkrmotorshield.build.serialcom_spi=NO_SPI +mkrmotorshield.serialcom_spi=NO_SPI +mkrmotorshield.build.usbcom=USB_DISABLED # MattairTech Core for Arduino/Genuino Zero (Autodetect Port) arduino_zero.name=Arduino/Genuino Zero (Autodetect Port) diff --git a/cores/arduino/RingBuffer.h b/cores/arduino/RingBuffer.h index c2ad3664a..f4970370d 100644 --- a/cores/arduino/RingBuffer.h +++ b/cores/arduino/RingBuffer.h @@ -25,7 +25,7 @@ // using a ring buffer (I think), in which head is the index of the location // to which to write the next incoming character and tail is the index of the // location from which to read. -#define SERIAL_BUFFER_SIZE 64 +#define SERIAL_BUFFER_SIZE 68 class RingBuffer { diff --git a/cores/arduino/WVariant.h b/cores/arduino/WVariant.h index 999ea5a1c..41af7af6e 100644 --- a/cores/arduino/WVariant.h +++ b/cores/arduino/WVariant.h @@ -30,7 +30,7 @@ extern "C" { /* Definitions and types for pins */ typedef enum _EAnalogChannel { - No_ADC_Channel=-1, + No_ADC_Channel=0xFF, ADC_Channel0=0, ADC_Channel1=1, ADC_Channel2=2, @@ -59,7 +59,7 @@ typedef enum _EAnalogChannel // RESERVED (1 bit, used for negative) | Timer Number (3 bits: 0-7) | Timer Type (1 bit: 0=TCC, 1=TC) | Timer Channel (3 bits: 0-7) typedef enum _ETCChannel { - NOT_ON_TIMER=-1, + NOT_ON_TIMER=0xFF, TCC0_CH0 = (0<<4)|(0<<3)|(0), TCC0_CH1 = (0<<4)|(0<<3)|(1), TCC0_CH2 = (0<<4)|(0<<3)|(2), @@ -111,12 +111,12 @@ extern const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM] ; // RESERVED (1 bit, used for negative) | GCLK (3 bits: 0-7) | CCL (4 bits: 2 for CCL number, 2 for pin) typedef enum _EGCLK_CCL { - GCLK_CCL_NONE=-1, + GCLK_CCL_NONE=0xFF, } EGCLK_CCL ; typedef enum _EPortType { - NOT_A_PORT=-1, + NOT_A_PORT=0xFF, PORTA=0, PORTB=1, PORTC=2, @@ -142,7 +142,7 @@ typedef enum EXTERNAL_INT_15, EXTERNAL_INT_NMI, EXTERNAL_NUM_INTERRUPTS, - NOT_AN_INTERRUPT = -1, + NOT_AN_INTERRUPT = 0xFF, EXTERNAL_INT_NONE = NOT_AN_INTERRUPT, } EExt_Interrupts ; @@ -154,7 +154,7 @@ typedef enum #define INPUT_PULLDOWN (0x3) typedef enum _EPioType { - PIO_NOT_A_PIN=-1, /* Not under control of a peripheral. */ + PIO_NOT_A_PIN=0xFF, /* Not under control of a peripheral. */ PIO_INPUT=INPUT, /* The pin is controlled by PORT and is an input. */ PIO_OUTPUT=OUTPUT, /* The pin is controlled by PORT and is an output. */ @@ -219,7 +219,7 @@ typedef enum _EPioType //EIC REF ADC AC PTC DAC SERCOM SERCOM_ALT TC/TCC TCC COM AC/GCLK CCL typedef enum _EPioPeripheral { - PER_PORT=-1, /* The pin is controlled by PORT. */ + PER_PORT=0xFF, /* The pin is controlled by PORT. */ PER_EXTINT=0, /* The pin is controlled by the associated signal of peripheral A. */ PER_ANALOG=1, /* The pin is controlled by the associated signal of peripheral B. */ PER_SERCOM=2, /* The pin is controlled by the associated signal of peripheral C. */ diff --git a/cores/arduino/cortex_handlers.c b/cores/arduino/cortex_handlers.c index fa0b02f72..c239f25e7 100644 --- a/cores/arduino/cortex_handlers.c +++ b/cores/arduino/cortex_handlers.c @@ -94,7 +94,7 @@ extern uint32_t __bss_end__; extern uint32_t __StackTop; /* Exception Table */ -__attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table = +__attribute__ ((used,section(".isr_vector"))) const DeviceVectors exception_table = { /* Configure Initial Stack Pointer, using linker-generated symbols */ (void*) (&__StackTop), diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index 58c90f97e..7bc075feb 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -96,6 +96,12 @@ static void syncTC_16(Tc* TCx) { #endif } +// Wait for synchronization of registers between the clock domains +static __inline__ void syncTC_8(Tc* TCx) __attribute__((always_inline, unused)); +static void syncTC_8(Tc* TCx) { + while (TCx->COUNT8.STATUS.bit.SYNCBUSY); +} + // Wait for synchronization of registers between the clock domains static __inline__ void syncTCC(Tcc* TCCx) __attribute__((always_inline, unused)); static void syncTCC(Tcc* TCCx) { @@ -275,12 +281,15 @@ uint32_t analogRead( uint32_t pin ) return mapResolution(valueRead, _ADCResolution, _readResolution); } +void analogWrite(uint32_t pin, uint32_t value) { + analogWritePeriod(pin, value, 0xFFFF); +} // Right now, PWM output only works on the pins with // hardware support. These are defined in the appropriate // pins_*.c file. For the rest of the pins, we default // to digital output. -void analogWrite(uint32_t pin, uint32_t value) +void analogWritePeriod(uint32_t pin, uint32_t value, uint32_t period) { if ( pinPeripheral(pin, PIO_ANALOG_DAC) == RET_STATUS_OK ) { @@ -370,12 +379,13 @@ void analogWrite(uint32_t pin, uint32_t value) // Set PORT if ( TCx ) { + // -- Configure TC // Disable TCx TCx->COUNT16.CTRLA.bit.ENABLE = 0; syncTC_16(TCx); // Set Timer counter Mode to 16 bits, normal PWM - TCx->COUNT16.CTRLA.reg |= TC_CTRLA_MODE_COUNT16; + TCx->COUNT16.CTRLA.reg |= TC_CTRLA_MODE_COUNT16 | TC_CTRLA_PRESCSYNC_RESYNC; syncTC_16(TCx); // Set TCx as normal PWM #if (SAMD) @@ -395,6 +405,8 @@ void analogWrite(uint32_t pin, uint32_t value) // Disable TCCx TCCx->CTRLA.bit.ENABLE = 0; syncTCC(TCCx); + TCCx->CTRLA.reg |= TCC_CTRLA_PRESCALER_DIV16; + syncTCC(TCCx); // Set TCCx as normal PWM TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM; syncTCC(TCCx); @@ -402,7 +414,7 @@ void analogWrite(uint32_t pin, uint32_t value) TCCx->CC[Channelx].reg = (uint32_t)value; syncTCC(TCCx); // Set PER to maximum counter value (resolution : 0xFFFF) - TCCx->PER.reg = 0xFFFF; + TCCx->PER.reg = (uint16_t)period; syncTCC(TCCx); // Enable TCCx TCCx->CTRLA.bit.ENABLE = 1; @@ -421,13 +433,13 @@ void analogWrite(uint32_t pin, uint32_t value) #if (SAMD) TCCx->CTRLBSET.bit.LUPD = 1; syncTCC(TCCx); - TCCx->CCB[Channelx].reg = (uint32_t) value; - syncTCC(TCCx); - TCCx->CTRLBCLR.bit.LUPD = 1; -// LUPD caused endless spinning in syncTCC() on SAML (and probably SAMC). Note that CCBUF writes are already -// atomic. The LUPD bit is intended for updating several registers at once, which analogWrite() does not do. + TCCx->CCB[Channelx].reg = (uint32_t) value; + syncTCC(TCCx); + TCCx->CTRLBCLR.bit.LUPD = 1; + // LUPD caused endless spinning in syncTCC() on SAML (and probably SAMC). Note that CCBUF writes are already + // atomic. The LUPD bit is intended for updating several registers at once, which analogWrite() does not do. #elif (SAML21 || SAMC21) - TCCx->CCBUF[Channelx].reg = (uint32_t) value; + TCCx->CCBUF[Channelx].reg = (uint32_t) value; #endif syncTCC(TCCx); } diff --git a/cores/arduino/wiring_analog.h b/cores/arduino/wiring_analog.h index c5844ba75..f2ff2954b 100644 --- a/cores/arduino/wiring_analog.h +++ b/cores/arduino/wiring_analog.h @@ -95,6 +95,8 @@ extern void analogReference( eAnalogReference ulMode ) ; */ extern void analogWrite( uint32_t ulPin, uint32_t ulValue ) ; +extern void analogWritePeriod(uint32_t pin, uint32_t value, uint32_t period) ; + /* * \brief Reads the value from the specified analog pin. * diff --git a/cores/arduino/wiring_private.c b/cores/arduino/wiring_private.c index 63a46cf48..f3cbc30ce 100644 --- a/cores/arduino/wiring_private.c +++ b/cores/arduino/wiring_private.c @@ -140,6 +140,7 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) uint8_t pinNum = g_APinDescription[ulPin].ulPin; uint8_t pinCfg = PORT_PINCFG_INEN; // INEN should be enabled for both input and output (but not analog) +#if !defined PIN_MAP_SUPER_COMPACT // Disable DAC, if analogWrite() used previously the DAC is enabled // Note that on the L21, the DAC output would interfere with other peripherals if left enabled, even if the anaolog peripheral is not selected if ((pinAttribute & PIN_ATTR_DAC) && !((1UL << ulPeripheral) & PIN_ATTR_DAC)) @@ -179,6 +180,7 @@ int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ) } #endif } +#endif noInterrupts(); // Avoid possible invalid interim pin state diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index c4cf2ec57..66386c67e 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -71,10 +71,10 @@ int SPIClass::beginSlave() init(); // PIO init - pinPeripheral(_uc_pinMiso, g_APinDescription[_uc_pinMiso].ulPinType); - pinPeripheral(_uc_pinSCK, g_APinDescription[_uc_pinSCK].ulPinType); - pinPeripheral(_uc_pinMosi, g_APinDescription[_uc_pinMosi].ulPinType); - pinPeripheral(_uc_pinSS, g_APinDescription[_uc_pinSS].ulPinType); + pinPeripheral(_uc_pinMiso, PIO_SERCOM); + pinPeripheral(_uc_pinSCK, PIO_SERCOM); + pinPeripheral(_uc_pinMosi, PIO_SERCOM); + pinPeripheral(_uc_pinSS, PIO_SERCOM); config(SPI_SLAVE_OPERATION, DEFAULT_SPI_SETTINGS); diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index f845ba7dd..08af29244 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -56,10 +56,11 @@ class TwoWire : public Stream void onReceive(void(*)(int)); void onRequest(void(*)(void)); - inline size_t write(unsigned long n) { return write((uint8_t)n); } - inline size_t write(long n) { return write((uint8_t)n); } - inline size_t write(unsigned int n) { return write((uint8_t)n); } - inline size_t write(int n) { return write((uint8_t)n); } + inline size_t write(uint16_t n) { return write((const uint8_t *)&n, sizeof(uint16_t)); } + inline size_t write(unsigned long n) { return write((const uint8_t *)&n, sizeof(unsigned long)); } + inline size_t write(long n) { return write((const uint8_t *)&n, sizeof(long)); } + inline size_t write(unsigned int n) { return write((const uint8_t *)&n, sizeof(unsigned int)); } + inline size_t write(int n) { return write((const uint8_t *)&n, sizeof(int)); } using Print::write; void onService(void); diff --git a/platform.txt b/platform.txt index c957e0b31..d8aa81ac2 100644 --- a/platform.txt +++ b/platform.txt @@ -32,6 +32,7 @@ compiler.warning_flags.more=-Wall compiler.warning_flags.all=-Wall -Wextra compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ +#compiler.path=/bin/ compiler.c.cmd=arm-none-eabi-gcc compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD compiler.c.elf.cmd=arm-none-eabi-gcc @@ -58,11 +59,11 @@ compiler.readelf.cmd=arm-none-eabi-readelf build.extra_flags= # These can be overridden in platform.local.txt -compiler.c.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-2.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.c.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} compiler.c.elf.extra_flags= #compiler.c.elf.extra_flags=-v -compiler.cpp.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-2.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} -compiler.S.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-2.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.cpp.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} +compiler.S.extra_flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.0.0-mattairtech-1.path}/CMSIS/Device/ATMEL/" -D{build.clockconfig} -D{build.usbcom} -D{build.serialcom_uart} -D{build.serialcom_wire} -D{build.serialcom_spi} -D{build.bootloader_size} compiler.ar.extra_flags= compiler.elf2hex.extra_flags= diff --git a/variants/Generic_D11D14AS/variant.cpp b/variants/Generic_D11D14AS/variant.cpp index 992a3fc1b..861e23e42 100644 --- a/variants/Generic_D11D14AS/variant.cpp +++ b/variants/Generic_D11D14AS/variant.cpp @@ -96,20 +96,20 @@ SERCOM sercom0( SERCOM0 ) ; SERCOM sercom1( SERCOM1 ) ; SERCOM sercom2( SERCOM2 ) ; -#if defined(ONE_UART) || defined(TWO_UART) -Uart Serial1( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; void SERCOM1_Handler() { - Serial1.IrqHandler(); + Serial2.IrqHandler(); } #endif -#if defined(TWO_UART) -Uart Serial2( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; +#if defined(ONE_UART) || defined(TWO_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; void SERCOM0_Handler() { - Serial2.IrqHandler(); + Serial1.IrqHandler(); } #endif diff --git a/variants/MKRMotorShield/README.md b/variants/MKRMotorShield/README.md new file mode 100644 index 000000000..ca09728b4 --- /dev/null +++ b/variants/MKRMotorShield/README.md @@ -0,0 +1,250 @@ +# Generic ATsamD11D14AS + +``` +===================================== ATsamD11D14AS =================================== +Other COM PWM Analog INT Arduino* Arduino* Analog INT PWM COM Other +========================================================================================= + 1------------------- + TCC01 * * 5 | A5 A4 | 4 * * TCC00 REFB + SS TCC02 * 6 | A6 A3 | 3 * REFA + MISO TCC03 * * 7 | A7 A2 | 2 * * DAC +Xin32/Xin 8 | A8 (XIN) Vdd | +Xout32/Xout 9 | A9 (XOUT) Gnd | + MOSI/TX2 * NMI 14 | A14 A25 | 25 USB D+ + SCK/RX2 TC11 * * 15 | A15 A24 | 24 USB D- + TC10 * 16 | A16 A31 | 31 * TC21 RX1 SWDIO + SDA * 22 | A22 A30 | 30 TC20 TX1 SWDCLK + SCL 23 | A23 RST/A28 | 28 BOOT + ------------------- + +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the chip above is also used in Arduino (but without the 'A') for + all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). + When using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the + top left pin (A5). PIN_MAP_COMPACT uses less RAM. +* When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +* Tone available on TC2. +* Leave pin A30 floating (or use external pullup) during reset. +* DO NOT connect voltages higher than 3.3V! +``` + + +## Pins descriptions for Generic ATsamD11D14AS + +### PIN_MAP_STANDARD +``` +============================================================================================================================================ +Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | ---- | NOT A PIN | NOT A PIN +1 | ---- | NOT A PIN | NOT A PIN +2 | PA02 | DAC | EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +3 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +4 | PA04 | REFB / TCC00 | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +5 | PA05 | TCC01 | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +6 | PA06 | SS (unused) / TCC02 | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] +7 | PA07 | MISO / TCC03 | EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] +8 | PA08 | Xin32 / Xin | Xin32 +9 | PA09 | Xout32 / Xout | Xout32 +10 | ---- | NOT A PIN | NOT A PIN +11 | ---- | NOT A PIN | NOT A PIN +12 | ---- | NOT A PIN | NOT A PIN +13 | ---- | NOT A PIN | NOT A PIN +14 | PA14 | MOSI / TX2 | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] +15 | PA15 | SCK / RX2 / TC11 | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] TC1/WO[1] !TCC0/WO[1] +16 | PA16 | TC10 | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] +17 | ---- | NOT A PIN | NOT A PIN +18 | ---- | NOT A PIN | NOT A PIN +19 | ---- | NOT A PIN | NOT A PIN +20 | ---- | NOT A PIN | NOT A PIN +21 | ---- | NOT A PIN | NOT A PIN +22 | PA22 | SDA | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] +23 | PA23 | SCL | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[5] +24 | PA24 | USB_NEGATIVE | USB/DM +25 | PA25 | USB_POSITIVE | USB/DP +26 | ---- | NOT A PIN | NOT A PIN +27 | ---- | NOT A PIN | NOT A PIN +28 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +29 | ---- | NOT A PIN | NOT A PIN +30 | PA30 | TX1 / TC20 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +31 | PA31 | RX1 / TC21 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO +============================================================================================================================================ +``` + +### PIN_MAP_COMPACT +``` +============================================================================================================================================ +Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment) +--------|-------|-----------------------|------------------------------------------------------------------------------------------- +0 | PA02 | DAC | EIC/EXTINT[2] ADC/AIN[0] PTC/Y[0] DAC/VOUT +1 | PA03 | REFA | !EIC/EXTINT[3] REF/ADC/VREFA REF/DAC/VREFA ADC/AIN[1] PTC/Y[1] +2 | PA04 | REFB / TCC00 | EIC/EXTINT[4] REF/ADC/VREFB ADC/AIN[4] AC/AIN[0] PTC/Y[2] !SERCOM0/PAD[2] !SERCOM0/PAD[0] !TC1/WO[0] TCC0/WO[0] +3 | PA05 | TCC01 | EIC/EXTINT[5] ADC/AIN[3] AC/AIN[1] PTC/Y[3] !SERCOM0/PAD[3] !SERCOM0/PAD[1] !TC1/WO[1] TCC0/WO[1] +4 | PA06 | SS (unused) / TCC02 | !EIC/EXTINT[6] ADC/AIN[4] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[0] !SERCOM0/PAD[2] !TC2/WO[0] TCC0/WO[2] +5 | PA07 | MISO / TCC03 | EIC/EXTINT[7] ADC/AIN[5] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[1] !SERCOM0/PAD[3] !TC2/WO[1] TCC0/WO[3] +6 | PA08 | Xin32 / Xin | Xin32 +7 | PA09 | Xout32 / Xout | Xout32 +8 | PA14 | MOSI / TX2 | EIC/NMI ADC/AIN[6] PTC/X[0] PTC/Y[6] SERCOM0/PAD[0] !SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[0] +9 | PA15 | SCK / RX2 / TC11 | EIC/EXTINT[1] ADC/AIN[7] PTC/X[1] PTC/Y[7] SERCOM0/PAD[1] !SERCOM2/PAD[1] TC1/WO[1] !TCC0/WO[1] +10 | PA16 | TC10 | EIC/EXTINT[0] PTC/X[4] PTC/Y[10] !SERCOM1/PAD[2] !SERCOM2/PAD[2] TC1/WO[0] !TCC0/WO[6] +11 | PA22 | SDA | EIC/EXTINT[6] PTC/X[6] PTC/Y[12] !SERCOM1/PAD[0] SERCOM2/PAD[0] !TC1/WO[0] !TCC0/WO[4] +12 | PA23 | SCL | !EIC/EXTINT[7] PTC/X[7] PTC/Y[13] !SERCOM1/PAD[1] SERCOM2/PAD[1] !TC1/WO[1] !TCC0/WO[5] +13 | PA24 | USB_NEGATIVE | USB/DM +14 | PA25 | USB_POSITIVE | USB/DP +15 | PA28 | Reset | Reset, BOOT (double tap bootloader entry) +16 | PA30 | TX1 / TC20 / SWD CLK | !EIC/EXTINT[2] !SERCOM1/PAD[0] SERCOM1/PAD[2] TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot +17 | PA31 | RX1 / TC21 / SWD IO | EIC/EXTINT[3] !SERCOM1/PAD[1] SERCOM1/PAD[3] TC2/WO[1] !TCC0/WO[3] SWD IO +============================================================================================================================================ + +* Most pins can be used for more than one function. When using PIN_MAP_STANDARD, the port + pin number printed on the chip above is also used in Arduino (but without the 'A') for + all of the supported functions (ie: digitalRead(), analogRead(), analogWrite(), etc.). + When using PIN_MAP_COMPACT, the Arduino numbering is sequential starting from 0 at the + top left pin (A5). PIN_MAP_COMPACT uses less RAM. +* NOT A PIN means the Arduino pin number is not mapped to a physical pin. +* Pins 24 and 25 are in use by USB (USB_NEGATIVE and USB_POSITIVE). +* The tone library uses TC2. +* Leave pin A30 floating (or use external pullup) during reset. +``` + + +## Board Configuration Notes + +* **Crystals** + * Either a 32.768KHz crystal or a high speed crystal can be used. + * The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually. + +* **GPIO** + * All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN. + * Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin, enabled by default). + * Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default). + +* **Analog Inputs** + * 8 pins can be configured as ADC analog inputs. + * Each pin measures from ground to 3.3 volts by default. + * Each pin provides 10 bits of resolution (1024 values) by default. + * 12-bit resolution supported by using the analogReadResolution() function. + * The upper end of the measurement range can be changed using the analogReference() function. + * A reference voltage can be connected to REF. + +* **DAC** + * One analog output is available on pin 2. + * Provides a 10-bit voltage output with the analogWrite() function. + +* **PWM** + * 8 pins can be configured as PWM outputs. + * Each pin provides 8 bits of resolution (256 values) by default. + * 12-bit resolution supported by using the analogWriteResolution() function. + +* **External Interrupts** + * 8 pins can be configured with external interrupts. + +* **SERCOM** + * 3 SERCOM are available. + * Up to 2 UART instances + * 1 SPI instance + * 1 WIRE (I2C) instance + + + +## PinDescription table format + +### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0. +MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions. +If using board variant files with the old format, the new core will still read the +table the old way, losing any new features introduced by the new column. Additionally, +new definitions have been added for L21 and C21 support. + +### Each pin can have multiple functions. +The PinDescription table describes how each of the pins can be used by the Arduino +core. Each pin can have multiple functions (ie: ADC input, digital output, PWM, +communications, etc.), and the PinDescription table configures which functions can +be used for each pin. This table is mainly accessed by the pinPeripheral function in +wiring_private.c, which is used to attach a pin to a particular peripheral function. +The communications drivers (ie: SPI, I2C, and UART), analogRead(), analogWrite(), +analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to +verify that the pin can perform the function requested, and to configure the pin for +that function. Most of the contents of pinMode() are now in pinPeripheral(). + +### Pin Mapping +There are different ways that pins can be mapped. Typically, there is no relation +between the arduino pin number used, and the actual port pin designator. Thus, the +pcb must be printed with the arduino numbering, otherwise, if the port pin is printed, +a cross reference table is needed to find the arduino pin number. However, this results +in the least amount of space used by the table. Another method, used by default by the +MT-D21E and MT-D11, maps Arduino pin numbers to the actual port pin number (ie: Arduino +pin 28 = Port A28). This works well when there is only one port (or if the PORTB pins +are used for onboard functions and not broken out). PIO_NOT_A_PIN entries must be added +for pins that are used for other purposes or for pins that do not exist (especially the +D11), so some FLASH space may be wasted. For an example of both types, see variant.cpp +from the MT-D11 variant. The MT-D21J combines both methods, using the actual port pin +designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2), then +using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be +used, leaving the other pin for some number above 31. + +**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.** + +### Port +This is the port (ie: PORTA). + +### Pin +This is the pin (bit) within the port. Valid values are 0-31. + +### PinType +This indicates what peripheral function the pin can be attached to. In most cases, +this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute +field. It can also be set to a specific peripheral. In this case, any attempt to +configure the pin (using pinPeripheral or pinMode) as anything else will fail (and +pinPeripheral will return -1). This can be used to prevent accidental re-configuration +of a pin that is configured for only one function (ie: USB D- and D+ pins). If a pin +is not used or does not exist, PIO_NOT_A_PIN must be entered in this field. See +WVariant.h for valid entries. These entries are also used as a parameter to +pinPeripheral() with the exception of PIO_NOT_A_PIN and PIO_MULTI. The pinMode function +now calls pinPeripheral() with the desired mode. Note that this field is not used to +select between the two peripherals possible with each of the SERCOM and TIMER functions. +PeripheralAttribute is now used for this. + +### PeripheralAttribute: +This is an 8-bit bitfield used for various peripheral configuration. It is primarily +used to select between the two peripherals possible with each of the SERCOM and TIMER +functions. TIMER pins are individual, while SERCOM uses a group of two to four pins. +This group of pins can span both peripherals. For example, pin 19 (SPI1 SCK) on the +MT-D21E uses PER_ATTR_SERCOM_ALT while pin 22 (SPI1 MISO) uses PER_ATTR_SERCOM_STD. +Both TIMER and SERCOM can exist for each pin. This bitfield is also used to set the +pin drive strength. In the future, other attributes (like input buffer configuration) +may be added. Starting with 1.6.8, the ADC instance on the C21 (there are two) is also +selected here. See WVariant.h for valid entries. + +### PinAttribute +This is a 32-bit bitfield used to list all of the valid peripheral functions that a +pin can attach to. This includes GPIO functions like PIN_ATTR_OUTPUT. Certain +attributes are shorthand for a combination of other attributes. PIN_ATTR_DIGITAL +includes all of the GPIO functions, while PIN_ATTR_TIMER includes both +PIN_ATTR_TIMER_PWM and PIN_ATTR_TIMER_CAPTURE (capture is not used yet). +PIN_ATTR_ANALOG is an alias to PIN_ATTR_ANALOG_ADC. This bitfield is useful for +limiting a pin to only input related functions or output functions. This allows a pin +to have a more flexible configuration, while restricting the direction (ie: to avoid +contention). See WVariant.h for valid entries. + +### TCChannel +This is the TC/TCC channel (if any) assigned to the pin. Some TC channels are available +on multiple pins. In general, only one pin should be configured in the pinDescription +table per TC channel. Starting with 1.6.8, the timer type is now encoded in this column +to support the L21 and C21, which use TC numbers starting at 0 (rather than 3 as on the +D21). See WVariant.h for valid entries. + +### ADCChannelNumber +This is the ADC channel (if any) assigned to the pin. The C21 has two ADC instances, +which is selected in the PeripheralAttribute column. See WVariant.h for valid entries. + +### ExtInt +This is the interrupt (if any) assigned to the pin. Some interrupt numbers are +available on multiple pins. In general, only one pin should be configured in the +pinDescription table per interrupt number. Thus, for example, if an interrupt was +needed on pin 2, EXTERNAL_INT_2 can be moved from pin 18. See WVariant.h for valid +entries. + +### GCLKCCL +This column was added in 1.6.8-beta-b0. It is not yet used. It will eventually support +the Analog Comparators (AC), the Configurable Custom Logic (CCL) units of the L21 and +C21, and the GCLK outputs (inputs). diff --git a/variants/MKRMotorShield/debug_scripts/SAMD11D14AS.gdb b/variants/MKRMotorShield/debug_scripts/SAMD11D14AS.gdb new file mode 100644 index 000000000..1daf3ccc2 --- /dev/null +++ b/variants/MKRMotorShield/debug_scripts/SAMD11D14AS.gdb @@ -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 at91samd11d14as" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/MKRMotorShield/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld b/variants/MKRMotorShield/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld new file mode 100644 index 000000000..1e2d5f052 --- /dev/null +++ b/variants/MKRMotorShield/linker_scripts/gcc/4KB_Bootloader/flash_16KB.ld @@ -0,0 +1,217 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x1000, LENGTH = 0x00004000-0x1000 /* First 4KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.sketch_boot)) + + . = ALIGN(0x1000); + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MKRMotorShield/linker_scripts/gcc/No_Bootloader/flash_16KB.ld b/variants/MKRMotorShield/linker_scripts/gcc/No_Bootloader/flash_16KB.ld new file mode 100644 index 000000000..bd135b3dd --- /dev/null +++ b/variants/MKRMotorShield/linker_scripts/gcc/No_Bootloader/flash_16KB.ld @@ -0,0 +1,214 @@ +/* + 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 +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + __text_start__ = .; + + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.ramfunc*) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(16); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/MKRMotorShield/openocd_scripts/SAMD11D14AS.cfg b/variants/MKRMotorShield/openocd_scripts/SAMD11D14AS.cfg new file mode 100644 index 000000000..2b1d4c72f --- /dev/null +++ b/variants/MKRMotorShield/openocd_scripts/SAMD11D14AS.cfg @@ -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 at91samd11d14as +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/MKRMotorShield/pins_arduino.h b/variants/MKRMotorShield/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/MKRMotorShield/pins_arduino.h @@ -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" + diff --git a/variants/MKRMotorShield/variant.cpp b/variants/MKRMotorShield/variant.cpp new file mode 100644 index 000000000..44b5796f8 --- /dev/null +++ b/variants/MKRMotorShield/variant.cpp @@ -0,0 +1,128 @@ +/* + 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 +*/ + +/* + * Modified 23 November 2017 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + + +#include "variant.h" + +/* + * Pins descriptions + */ +extern "C" { + +#if defined PIN_MAP_STANDARD +const PinDescription g_APinDescription[]= +{ + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, ADC_Channel5, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, // Unused + { PORTA, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // Unused + { PORTA, 10, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_2, GCLK_CCL_NONE }, // Unused + { PORTA, 11, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH6, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { PORTA, 17, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH7, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH4, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), TCC0_CH5, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // Unused + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { NOT_A_PORT, 0, PIO_NOT_A_PIN, PER_ATTR_NONE, PIN_ATTR_NONE, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SWD IO +} ; +#elif defined PIN_MAP_COMPACT +const PinDescription g_APinDescription[]= +{ + { PORTA, 2, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_DAC|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel0, EXTERNAL_INT_2, GCLK_CCL_NONE }, + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 4, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH0, ADC_Channel2, EXTERNAL_INT_4, GCLK_CCL_NONE }, + { PORTA, 5, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TCC0_CH1, ADC_Channel3, EXTERNAL_INT_5, GCLK_CCL_NONE }, + { PORTA, 6, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TCC0_CH2, ADC_Channel4, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 7, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_ALT|PER_ATTR_SERCOM_ALT), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TCC0_CH3, ADC_Channel5, EXTERNAL_INT_7, GCLK_CCL_NONE }, + { PORTA, 8, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 9, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { PORTA, 16, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_EXTINT), TC1_CH0, No_ADC_Channel, EXTERNAL_INT_0, GCLK_CCL_NONE }, + { PORTA, 22, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_6, GCLK_CCL_NONE }, + { PORTA, 23, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 24, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DM + { PORTA, 25, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_DIGITAL|PIN_ATTR_COM), NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // USB/DP + { PORTA, 28, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // Unused (Reset) + { PORTA, 30, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM), TC2_CH0, No_ADC_Channel, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, // SWD CLK + { PORTA, 31, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_ALT), (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC2_CH1, No_ADC_Channel, EXTERNAL_INT_3, GCLK_CCL_NONE }, // SWD IO +} ; +#elif defined PIN_MAP_SUPER_COMPACT +// bootloader only needs BOOT_PIN, LED and WIRE +const PinDescription g_APinDescription[]= +{ + { PORTA, 3, PIO_MULTI, PER_ATTR_DRIVE_STRONG, (PIN_ATTR_ADC|PIN_ATTR_REF|PIN_ATTR_DIGITAL), NOT_ON_TIMER, ADC_Channel1, EXTERNAL_INT_NONE, GCLK_CCL_NONE }, + { PORTA, 14, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), NOT_ON_TIMER, ADC_Channel6, EXTERNAL_INT_NMI, GCLK_CCL_NONE }, + { PORTA, 15, PIO_MULTI, (PER_ATTR_DRIVE_STRONG|PER_ATTR_TIMER_STD|PER_ATTR_SERCOM_STD), (PIN_ATTR_ADC|PIN_ATTR_DIGITAL|PIN_ATTR_TIMER|PIN_ATTR_SERCOM|PIN_ATTR_EXTINT), TC1_CH1, ADC_Channel7, EXTERNAL_INT_1, GCLK_CCL_NONE }, + { PORTA, 27, PIO_MULTI, PER_ATTR_DRIVE_STRONG, PIN_ATTR_DIGITAL, NOT_ON_TIMER, No_ADC_Channel, EXTERNAL_INT_7, GCLK_CCL_NONE }, // Unused +} ; +#endif + +} + +const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TC1, TC2 } ; + +// Multi-serial objects instantiation +SERCOM sercom0( SERCOM0 ) ; +SERCOM sercom1( SERCOM1 ) ; +SERCOM sercom2( SERCOM2 ) ; + +#if defined(TWO_UART) +Uart Serial2( SERCOM_INSTANCE_SERIAL1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ; + +void SERCOM1_Handler() +{ + Serial2.IrqHandler(); +} +#endif + +#if defined(ONE_UART) || defined(TWO_UART) +Uart Serial1( SERCOM_INSTANCE_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ; + +void SERCOM0_Handler() +{ + Serial1.IrqHandler(); +} +#endif diff --git a/variants/MKRMotorShield/variant.h b/variants/MKRMotorShield/variant.h new file mode 100644 index 000000000..ed9a2536b --- /dev/null +++ b/variants/MKRMotorShield/variant.h @@ -0,0 +1,379 @@ +/* + 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 +*/ + +/* + * Modified 9 December 2016 by Justin Mattair + * for MattairTech boards (www.mattairtech.com) + * + * See README.md for documentation and pin mapping information + */ + +#ifndef _VARIANT_MATTAIRTECH_D11D14AS_ +#define _VARIANT_MATTAIRTECH_D11D14AS_ + +/* The definitions here need the MattairTech SAMD core >=1.6.8. + * The format is different than the stock Arduino SAMD core, + * which uses ARDUINO_SAMD_VARIANT_COMPLIANCE instead. + */ +#define MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE 10608 + +/*---------------------------------------------------------------------------- + * Clock Configuration + *----------------------------------------------------------------------------*/ + +/** Master clock frequency (also Fcpu frequency) */ +#define VARIANT_MCK (48000000ul) + +/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ + * must also be defined with the external crystal frequency in Hertz. + */ +#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL + +/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL + * defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in + * a more accurate 48MHz output frequency at the expense of increased jitter. + */ +//#define PLL_FRACTIONAL_ENABLED + +/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal + * will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being + * multiplied by the PLL. This will result in a faster lock time for the PLL, + * however, it will also result in a less accurate PLL output frequency if the + * crystal is not divisible (without remainder) by 1MHz. In this case, define + * PLL_FRACTIONAL_ENABLED as well. + */ +//#define PLL_FAST_STARTUP + +/* The fine calibration value for DFLL open-loop mode is defined here. + * The coarse calibration value is loaded from NVM OTP (factory calibration values). + */ +#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512) + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" +#include "sam.h" + +#ifdef __cplusplus +#include "SERCOM.h" +#include "Uart.h" +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +// Number of pins defined in PinDescription array +#if !defined(PIN_MAP_STANDARD) && !defined(PIN_MAP_COMPACT) && !defined(PIN_MAP_SUPER_COMPACT) +#define PIN_MAP_STANDARD +#endif +//#define PIN_MAP_COMPACT +//#define PIN_MAP_SUPER_COMPACT + +#if defined PIN_MAP_STANDARD + #define NUM_PIN_DESCRIPTION_ENTRIES (32u) +#elif defined PIN_MAP_COMPACT + #define NUM_PIN_DESCRIPTION_ENTRIES (18u) +#elif defined PIN_MAP_SUPER_COMPACT + #define NUM_PIN_DESCRIPTION_ENTRIES (4u) +#else + #error "variant.h: You must set PIN_MAP_STANDARD or PIN_MAP_COMPACT" +#endif + +#define PINS_COUNT NUM_PIN_DESCRIPTION_ENTRIES +#define NUM_DIGITAL_PINS PINS_COUNT +#define NUM_ANALOG_INPUTS (8u) +#define NUM_ANALOG_OUTPUTS (1u) +#define analogInputToDigitalPin(p) (p) + +#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) +#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) +//#define analogInPinToBit(P) ( ) +#define portOutputRegister(port) ( &(port->OUT.reg) ) +#define portInputRegister(port) ( &(port->IN.reg) ) +#define portModeRegister(port) ( &(port->DIR.reg) ) +#define digitalPinHasPWM(P) ( (g_APinDescription[P].ulPinAttribute & PIN_ATTR_TIMER_PWM) == PIN_ATTR_TIMER_PWM ) + +/* + * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD + * architecture. If you need to check if a pin supports PWM you must + * use digitalPinHasPWM(..). + * + * https://github.com/arduino/Arduino/issues/1833 + */ +// #define digitalPinToTimer(P) + +/* LEDs + * None of these defines are currently used by the core. + */ + + +/* + * Analog pins + */ +#if defined PIN_MAP_STANDARD +#define PIN_A2 (2ul) +#define PIN_A3 (3ul) +#define PIN_A4 (4ul) +#define PIN_A5 (5ul) +#define PIN_A6 (6ul) +#define PIN_A7 (7ul) +#define PIN_A14 (14ul) +#define PIN_A15 (15ul) +#define PIN_DAC0 (2ul) +#elif defined PIN_MAP_COMPACT +#define PIN_A2 (0ul) +#define PIN_A3 (1ul) +#define PIN_A4 (2ul) +#define PIN_A5 (3ul) +#define PIN_A6 (4ul) +#define PIN_A7 (5ul) +#define PIN_A14 (8ul) +#define PIN_A15 (9ul) +#define PIN_DAC0 (0ul) +#elif defined PIN_MAP_SUPER_COMPACT +#define PIN_A2 (0ul) +#define PIN_A3 (0ul) +#define PIN_A4 (0ul) +#define PIN_A5 (0ul) +#define PIN_A6 (0ul) +#define PIN_A7 (0ul) +#define PIN_A14 (0ul) +#define PIN_A15 (0ul) +#define PIN_DAC0 (0ul) +#endif + +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A6 = PIN_A6; +static const uint8_t A7 = PIN_A7; +static const uint8_t A14 = PIN_A14; +static const uint8_t A15 = PIN_A15; +static const uint8_t DAC0 = PIN_DAC0; + +#define ADC_RESOLUTION 12 + +#define REMAP_ANALOG_PIN_ID while(0) +// #define REMAP_ANALOG_PIN_ID if ( ulPin < A0 ) ulPin += A0 + +/* Set default analog voltage reference */ +#define VARIANT_AR_DEFAULT AR_DEFAULT + +/* Reference voltage pins (define even if not enabled with PIN_ATTR_REF in the PinDescription table) */ +#if defined PIN_MAP_STANDARD +#define REFA_PIN (3ul) +#define REFB_PIN (4ul) +#elif defined PIN_MAP_COMPACT +#define REFA_PIN (1ul) +#define REFB_PIN (2ul) +#elif defined PIN_MAP_SUPER_COMPACT +#define REFA_PIN (0ul) +#define REFB_PIN (0ul) +#endif + + +// The ATN pin may be used in the future as the first SPI chip select. +// On boards that do not have the Arduino physical form factor, it can to set to any free pin. +#if defined PIN_MAP_STANDARD +#define PIN_ATN (6ul) +#elif defined PIN_MAP_COMPACT +#define PIN_ATN (4ul) +#elif defined PIN_MAP_SUPER_COMPACT +#define PIN_ATN (0ul) +#endif +static const uint8_t ATN = PIN_ATN; + + +/* + * Serial interfaces + */ +// Serial1 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL1_RX (31ul) +#define PIN_SERIAL1_TX (30ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL1_RX (17ul) +#define PIN_SERIAL1_TX (16ul) +#endif + +#define PAD_SERIAL1_TX (UART_TX_PAD_2) +#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3) +#define SERCOM_INSTANCE_SERIAL1 &sercom1 + +// Serial2 +#if defined PIN_MAP_STANDARD +#define PIN_SERIAL2_RX (15ul) +#define PIN_SERIAL2_TX (14ul) +#elif defined PIN_MAP_COMPACT +#define PIN_SERIAL2_RX (9ul) +#define PIN_SERIAL2_TX (8ul) +#endif + +#define PAD_SERIAL2_TX (UART_TX_PAD_0) +#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1) +#define SERCOM_INSTANCE_SERIAL2 &sercom0 + + +/* + * SPI Interfaces + */ +#if defined(ONE_SPI) +#define SPI_INTERFACES_COUNT 1 +#else +#define SPI_INTERFACES_COUNT 0 +#endif + +#if defined PIN_MAP_STANDARD +#define PIN_SPI_MISO (7u) +#define PIN_SPI_MOSI (14u) +#define PIN_SPI_SCK (15u) +#define PIN_SPI_SS (6u) +#elif defined PIN_MAP_COMPACT +#define PIN_SPI_MISO (5u) +#define PIN_SPI_MOSI (8u) +#define PIN_SPI_SCK (9u) +#define PIN_SPI_SS (4u) +#endif + +#if defined(ONE_SPI) +#define PERIPH_SPI sercom0 +#define PAD_SPI_TX SPI_PAD_0_SCK_1 +#define PAD_SPI_RX SERCOM_RX_PAD_3 + +static const uint8_t SS = PIN_SPI_SS ; // The SERCOM SS PAD is available on this pin but HW SS isn't used. Set here only for reference. +static const uint8_t MOSI = PIN_SPI_MOSI ; +static const uint8_t MISO = PIN_SPI_MISO ; +static const uint8_t SCK = PIN_SPI_SCK ; +#endif + +/* + * Wire Interfaces + */ +#if defined(ONE_WIRE) +#define WIRE_INTERFACES_COUNT 1 +#else +#define WIRE_INTERFACES_COUNT 0 +#endif + +#if defined PIN_MAP_STANDARD +#define PIN_WIRE_SDA (14u) +#define PIN_WIRE_SCL (15u) +#elif defined PIN_MAP_COMPACT +#define PIN_WIRE_SDA (11u) +#define PIN_WIRE_SCL (12u) +#elif defined PIN_MAP_SUPER_COMPACT +#define PIN_WIRE_SDA (1u) +#define PIN_WIRE_SCL (2u) +#endif + +#define PERIPH_WIRE sercom0 +#define WIRE_IT_HANDLER SERCOM0_Handler + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +/* + * USB - Define PIN_USB_HOST_ENABLE to assert the defined pin to + * PIN_USB_HOST_ENABLE_VALUE during startup. Leave undefined to disable this pin. + */ +#if defined PIN_MAP_STANDARD +#define PIN_USB_DM (24ul) +#define PIN_USB_DP (25ul) +//#define PIN_USB_HOST_ENABLE (28ul) +#elif defined PIN_MAP_COMPACT +#define PIN_USB_DM (13ul) +#define PIN_USB_DP (14ul) +//#define PIN_USB_HOST_ENABLE (15ul) +#endif + +#define PIN_USB_HOST_ENABLE_VALUE HIGH + +#ifdef __cplusplus +} +#endif + + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + +/* ========================= + * ===== SERCOM DEFINITION + * ========================= +*/ +extern SERCOM sercom0; +extern SERCOM sercom1; +extern SERCOM sercom2; + +extern Uart Serial1; +extern Uart Serial2; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_USBVIRTUAL SerialUSB +// SERIAL_PORT_MONITOR seems to be used only by the USB Host library (as of 1.6.5). +// It normally allows debugging output on the USB programming port, while the USB host uses the USB native port. +// The programming port is connected to a hardware UART through a USB-Serial bridge (EDBG chip) on the Zero. +// Boards that do not have the EDBG chip will have to connect a USB-TTL serial adapter to 'Serial' to get +// the USB Host debugging output. +#define SERIAL_PORT_MONITOR Serial1 +// Serial has no physical pins broken out, so it's not listed as HARDWARE port +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +// The MT-D11 does not have the EDBG support chip, which provides a USB-UART bridge +// accessible using Serial (the Arduino serial monitor is normally connected to this). +// So, the USB virtual serial port (SerialUSB) must be used to communicate with the host. +// Because most sketches use Serial to print to the monitor, it is aliased to SerialUSB. +// Remember to use while(!Serial); to wait for a connection before Serial printing. + +// When USB CDC is enabled, Serial refers to SerialUSB, otherwise it refers to Serial1. +#if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) +#define Serial SerialUSB +#else +#define Serial Serial1 +#endif + +#endif /* _VARIANT_ARDUINO_ZERO_ */