Skip to content

Commit

Permalink
DM: adding feather m4
Browse files Browse the repository at this point in the history
  • Loading branch information
deanm1278 committed Aug 30, 2018
1 parent 6820318 commit a7277e6
Show file tree
Hide file tree
Showing 19 changed files with 1,125 additions and 21 deletions.
34 changes: 33 additions & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ adafruit_metro_m4.build.mcu=cortex-m4
adafruit_metro_m4.build.f_cpu=48000000L
adafruit_metro_m4.build.usb_product="Adafruit Metro M4"
adafruit_metro_m4.build.usb_manufacturer="Adafruit LLC"
adafruit_metro_m4.build.board=SAMD_METRO_M4
adafruit_metro_m4.build.board=METRO_M4
adafruit_metro_m4.build.core=arduino
adafruit_metro_m4.build.extra_flags=-D__SAMD51J20A__ -D__SAMD51__ {build.usb_flags}
adafruit_metro_m4.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
Expand All @@ -249,3 +249,35 @@ adafruit_metro_m4.bootloader.file=metroM4/samd51_sam_ba.bin
adafruit_metro_m4.compiler.c.elf.extra_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
adafruit_metro_m4.compiler.c.extra_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
adafruit_metro_m4.compiler.cpp.extra_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16

# Adafruit Feather M4 (SAMD51)
# ------------------------------
adafruit_feather_m4.name=Adafruit Feather M4 (SAMD51)
adafruit_feather_m4.vid.0=0x239A
adafruit_feather_m4.pid.0=0x8022
adafruit_feather_m4.vid.1=0x239A
adafruit_feather_m4.pid.1=0x0022
adafruit_feather_m4.upload.tool=bossac
adafruit_feather_m4.upload.protocol=sam-ba
adafruit_feather_m4.upload.maximum_size=524288
adafruit_feather_m4.upload.use_1200bps_touch=true
adafruit_feather_m4.upload.wait_for_upload_port=true
adafruit_feather_m4.upload.native_usb=true
adafruit_feather_m4.build.mcu=cortex-m4
adafruit_feather_m4.build.f_cpu=48000000L
adafruit_feather_m4.build.usb_product="Adafruit Feather M4"
adafruit_feather_m4.build.usb_manufacturer="Adafruit LLC"
adafruit_feather_m4.build.board=FEATHER_M4
adafruit_feather_m4.build.core=arduino
adafruit_feather_m4.build.extra_flags=-D__SAMD51G19A__ -D__SAMD51__ {build.usb_flags}
adafruit_feather_m4.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_feather_m4.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_feather_m4.build.variant=feather_m4
adafruit_feather_m4.build.variant_system_lib=
adafruit_feather_m4.build.vid=0x239A
adafruit_feather_m4.build.pid=0x8022
adafruit_feather_m4.bootloader.tool=openocd
adafruit_feather_m4.bootloader.file=metroM4/samd51_sam_ba.bin
adafruit_feather_m4.compiler.c.elf.extra_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
adafruit_feather_m4.compiler.c.extra_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
adafruit_feather_m4.compiler.cpp.extra_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
Binary file modified bootloaders/metroM4/.vs/samdx1_sam_ba/v14/.atsuo
Binary file not shown.
4 changes: 2 additions & 2 deletions bootloaders/metroM4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ SIZE=$(ARM_GCC_PATH)size

# -----------------------------------------------------------------------------
# Boards definitions
BOARD_ID?=METRO_M4
BOARD_ID?=FEATHER_M4

# -----------------------------------------------------------------------------
# Compiler options
CFLAGS_EXTRA=-D__SAMD51J20A__ -DBOARD_ID_$(BOARD_ID)
CFLAGS_EXTRA=-D__SAMD51G19A__ -DBOARD_ID_$(BOARD_ID)
CFLAGS=-mthumb -mcpu=cortex-m4 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500
ifdef DEBUG
CFLAGS+=-g3 -O1 -DDEBUG=1
Expand Down
2 changes: 2 additions & 0 deletions bootloaders/metroM4/board_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#if defined(BOARD_ID_METRO_M4)
#include "board_definitions_metro_m4.h"
#elif defined(BOARD_ID_FEATHER_M4)
#include "board_definitions_feather_m4.h"
#else
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
#endif
Expand Down
82 changes: 82 additions & 0 deletions bootloaders/metroM4/board_definitions_feather_m4.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
Copyright (c) 2015 Arduino LLC. All right reserved.
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_

/*
* USB device definitions
*/
#define STRING_PRODUCT "Feather M4"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x9A
#define USB_PID_HIGH 0x00
#define USB_PID_LOW 0x22

/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))

/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5

#define GPIO(port, pin) ((((port)&0x7u) << 5) + ((pin)&0x1Fu))

#define BOOK_USART_MASK APBAMASK
#define BOOT_USART_MODULE SERCOM0
#define BOOT_USART_BUS_CLOCK_INDEX MCLK_APBAMASK_SERCOM0
#define BOOT_GCLK_ID_CORE SERCOM0_GCLK_ID_CORE
#define BOOT_GCLK_ID_SLOW SERCOM0_GCLK_ID_SLOW
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_UNUSED
#define BOOT_USART_PAD2 PINMUX_UNUSED

#define BOOT_USART_PAD1 PINMUX_PA10C_SERCOM0_PAD2
#define BOOT_USART_PAD0 PINMUX_PA11C_SERCOM0_PAD3

/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY

/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)

/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)

#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (17)

#define BOARD_LEDRX_PORT (1)
#define BOARD_LEDRX_PIN (3)

#define BOARD_LEDTX_PORT (0)
#define BOARD_LEDTX_PIN (27)

#endif // _BOARD_DEFINITIONS_H_
1 change: 0 additions & 1 deletion bootloaders/metroM4/board_definitions_metro_m4.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_

/*
* USB device definitions
*/
Expand Down
Binary file modified bootloaders/metroM4/samd51_sam_ba.bin
Binary file not shown.
7 changes: 5 additions & 2 deletions bootloaders/metroM4/samd51_sam_ba.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.ARMGCC.C</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATSAMD51J20A</avrdevice>
<avrdevice>ATSAMD51G19A</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
Expand Down Expand Up @@ -41,7 +41,7 @@
</AsfFrameworkConfig>
<avrtool>com.atmel.avrdbg.tool.edbg</avrtool>
<avrtoolserialnumber>00000000EZE000006352</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x60060004</avrdeviceexpectedsignature>
<avrdeviceexpectedsignature>0x60060007</avrdeviceexpectedsignature>
<avrtoolinterface>SWD</avrtoolinterface>
<com_atmel_avrdbg_tool_atmelice>
<ToolOptions>
Expand Down Expand Up @@ -133,6 +133,9 @@
<SubType>compile</SubType>
<Link>board_definitions.h</Link>
</Compile>
<Compile Include="board_definitions_feather_m4.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="board_definitions_metro_m4.h">
<SubType>compile</SubType>
</Compile>
Expand Down
Binary file modified bootloaders/metroM4/samd51_sam_ba.elf
Binary file not shown.
30 changes: 15 additions & 15 deletions bootloaders/metroM4/samd51_sam_ba.hex
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
:1000700000800648036813B1054B03B1984708BDDB
:1000800000000000041C0000600000205800002058
:10009000000000001A4B1B7813F0FF0F0AD1194B18
:1000A0001A78194909780A44D2B21A704FF400122A
:1000A0001A78194909780A44D2B21A704FF400320A
:1000B000164BDA61124B1A780132D2B21A70114B18
:1000C0001B78DBB2F02B04D80E4B1B78DBB2092B6C
:1000D0000AD80D4B1A785242D2B21A70094A1178D6
:1000E0001B780B44DBB21370054B1A78054B1B7859
:1000F000D2B29A4203D14FF40012044BDA61704736
:1000F000D2B29A4203D14FF40032044BDA61704716
:100100007800002001000020000000200080004155
:1001100010B4C36913F0020FFBD104686FF34104FC
:100120000460C36913F0010FFBD1046844F00104BB
Expand Down Expand Up @@ -114,8 +114,8 @@
:100710002D4B19602E4B013BFDD100212A4B196056
:10072000254B1B6883F3088822F07F02294B9A60CF
:10073000234B1B681B681847FFF708FF62B600F0E1
:10074000D1FE00F055F80546234B4FF400129A6095
:100750004022C3F88820C3F898204FF000629A60C6
:10074000D1FE00F055F80546234B4FF400329A6075
:100750000822C3F88820C3F898204FF000629A60FE
:100760009A611E4B40F2E7325A60C021194A82F862
:10077000231000229A6007221A60194C0126AB68E8
:100780002846984700B12670237813F0FF0F05D054
Expand Down Expand Up @@ -173,10 +173,10 @@
:100AC000C2F34012C2F30012164B1A803068154967
:100AD00002220023FFF754FCFEE020460121FFF72D
:100AE000DDFCF9E020460121FFF7D8FCF4E02046C8
:100AF000FFF7E4FCF0E000BF94000020830000203A
:100B0000860000207C000020800000207E00002065
:100AF000FFF7E4FCF0E000BF94000020810000203C
:100B000084000020860000207C0000207E00002061
:100B10004C190000040000203019000034190000B6
:100B20004019000084000020820000206B4B1988CF
:100B20004019000082000020800000206B4B1988D3
:100B300089B221F07F01C9B2694A11701A8802F0A6
:100B40000F021A80674B1B889BB2DBB9634B1B8873
:100B50009BB2BBB1614B1B889BB2032B12D8604B7D
Expand All @@ -203,8 +203,8 @@
:100CA0000DFC19E03068104B1B889BB2082B9DBFD0
:100CB0000D4B1A8892B208220C490023FFF760FB03
:100CC0000AE0084B1B8873712046FFF7F7FB03E02F
:100CD00020460121FFF7E2FB03B0F0BD80000020B9
:100CE000820000207C0000207E00002048000020C0
:100CD00020460121FFF7E2FB03B0F0BD7C000020BD
:100CE00080000020860000207E00002048000020B8
:100CF00000B583B002A941F8040D054B1868012224
:100D00001346FFF73DFB012003B05DF804FB00BF75
:100D10001802002000B583B0054B18680DF10701DB
Expand Down Expand Up @@ -238,15 +238,15 @@
:100ED00043681847704700BF8C0200200E4B1B88E8
:100EE0009BB24BB10C4A1388013B9BB213801BB9D8
:100EF0004FF00062094B9A61094B1B889BB24BB1C2
:100F0000074A1388013B9BB213801BB94022034B55
:100F0000074A1388013B9BB213801BB90822034B8D
:100F1000C3F89820704700BF900000200080004177
:100F20008E0000202DE9F0438BB002AC894D0FCD2F
:100F30000FC495E80F0084E80F00874A9368C3F355
:100F400002430AA901EB830353F8203C83490B6059
:100F5000926892B282490A6002FB03F381490B60F6
:100F60000022814B1A607A22804B1A707A4C7B4D9A
:100F70007F4B1B681B697F4840219847034630B16F
:100F800040217D4AC2F8941064217C4A11807C4A39
:100F800008217D4AC2F8941064217C4A11807C4A71
:100F9000136078497B4A116000217B4A1160002B65
:100FA000E6D0784B1B681B78FF2B00F06682232B62
:100FB00040F00482754B1B7813F0FF0F05D06C4B8B
Expand All @@ -258,7 +258,7 @@
:1010100011605C4A116819441160604A13705A4BA0
:101020001A68013A1A60574B1A68013A1A605B4B0A
:101030001B78584A11688B420ED24D4A1268926949
:1010400049480068C91A904730B140224A4BC3F85A
:1010400049480068C91A904730B108224A4BC3F892
:1010500094206422494B1A8000BF9DE1522B0FD18E
:10106000434B1B685B69404A10684A4A11689847BD
:101070004FF00062404B5A616422494B1A808BE169
Expand Down Expand Up @@ -402,14 +402,14 @@
:10191000181A013870470000F8B500BFF8BC08BCC1
:101920009E467047F8B500BFF8BC08BC9E4670479D
:101930000403090441726475696E6F204C4C4300C6
:101940004D6574726F204D340000000012010002DA
:10195000020000409A232000000201020001000062
:1019400046656174686572204D3400001201000222
:10195000020000409A232200000201020001000060
:1019600008000000100000002000000040000000FF
:1019700080000000000100000002000000040000E0
:1019800099150000BD150000AD150000F11500000F
:101990000D160000B1160000DD170000322E3000D9
:1019A0000A0D000076000000200000004F63742044
:1019B000203420323031370031303A35353A313049
:1019B000313320323031370031353A32343A33392D
:1019C00000000000580A0D00590A0D005A000000DE
:1019D000230A0D003E000000F10C0000150D000070
:1019E000350D0000550D0000710D0000550D000073
Expand Down
2 changes: 2 additions & 0 deletions cores/arduino/wiring_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,11 @@ void analogWrite(uint32_t pin, uint32_t value)
TCC0_GCLK_ID,
TCC1_GCLK_ID,
TCC2_GCLK_ID,
#if defined(TCC3)
TCC3_GCLK_ID,
TCC4_GCLK_ID,
TC5_GCLK_ID,
#endif
};

GCLK->PCHCTRL[GCLK_CLKCTRL_IDs[tcNum]].reg = GCLK_PCHCTRL_GEN_GCLK0_Val | (1 << GCLK_PCHCTRL_CHEN_Pos); //use clock generator 0
Expand Down
31 changes: 31 additions & 0 deletions variants/feather_m4/debug_scripts/variant.gdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Arduino Zero OpenOCD script.
#
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

# Define 'reset' command
define reset

info reg

break main

# End of 'reset' command
end

target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"
Binary file added variants/feather_m4/libsamd21_qtouch_gcc.a
Binary file not shown.
Loading

0 comments on commit a7277e6

Please sign in to comment.