Skip to content
Closed
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
fd50d90
fix makefile for easier programming
ladyada Oct 28, 2015
11fa3d3
pulse D13 LED during bootloader active
ladyada Oct 31, 2015
85d6c73
makefile now compiles from within Roaming/Arduino15 subfolder
ladyada Oct 31, 2015
e715bf3
add support for A6 (D8) and A7 (D9)
ladyada Nov 1, 2015
f851644
bootloader with different VID/PID
ladyada Nov 1, 2015
def75fa
adds bootloaders/feather
toddtreece Nov 17, 2015
9ad4e0d
reverts bootloaders/zero changes
toddtreece Nov 17, 2015
d5cda2b
Merge branch 'master' of github.com:arduino/ArduinoCore-samd
toddtreece Nov 17, 2015
e7579eb
adds new boards.txt
toddtreece Nov 18, 2015
22f47bb
Update platform.txt
ladyada Nov 24, 2015
bf20844
Merge branch 'master' of github.com:arduino/ArduinoCore-samd
ladyada Nov 24, 2015
5c7319f
make it so native USB is Serial
ladyada Jan 13, 2016
d8f4306
Serial5 not available anyhow
ladyada Jan 24, 2016
d95e053
Update Board for Feather M0
obsoleted Feb 10, 2016
c34dd05
Keep ARDUINO_SAMD_ZERO flag for compatilibity
obsoleted Feb 11, 2016
9d193cc
add metro m0 (testing)
ladyada Feb 14, 2016
440afc5
add USB CDC RX & TX LEDs with 10ms minimum on time, tested
ladyada Feb 14, 2016
616475a
fix random init() call, set debug output to Serial1
ladyada Feb 15, 2016
ae5e0b8
use Serial1 option for debug output (since USB port is taken)
ladyada Feb 15, 2016
e25840e
manually did https://github.com/arduino/ArduinoCore-samd/pull/88 and …
ladyada Feb 15, 2016
f41f197
Working demo with nice status change notifications
ladyada Feb 15, 2016
188d880
woot, that wasnt too bad - updated debug for Serial1, works nicely
ladyada Feb 15, 2016
21b53d1
Merge pull request #1 from obsoleted/board_featherm0
ladyada Feb 17, 2016
a2024c7
Merge branch 'master' of https://github.com/arduino/ArduinoCore-samd …
ladyada Mar 4, 2016
0303c16
merge with upstream, pulse LED & VID/PID change for bootloader
ladyada Mar 6, 2016
83834c3
feather bootloader files
ladyada Mar 6, 2016
58392be
fixed up DAC refs
ladyada Apr 16, 2016
9b72387
cleaned up slight difference in USB union bitflags with a new USBDevi…
ladyada Apr 16, 2016
72f6d46
well, it compiles now!
ladyada Apr 16, 2016
bdabb74
clumsy but has correct bossac and can upload&reset ( it seems )
ladyada Apr 18, 2016
340ad50
stashing - still need to do the variant!
ladyada May 10, 2016
402a502
Merge branch 'master' of https://github.com/arduino/ArduinoCore-samd
ladyada May 14, 2016
f8734ea
make readme less confusing, so people dont think its the official core!
ladyada May 14, 2016
3277492
bump version!
ladyada May 14, 2016
25cd637
Merge branch 'master' into atsamr
ladyada May 14, 2016
b467584
missing DAC0 def fix
ladyada May 14, 2016
433f644
Merge branch 'master' into atsamr
ladyada May 14, 2016
ebaf3bc
first pass at variant. Serial1 on sercom5, SPI on sercom 2 working
ladyada May 14, 2016
03844b1
SPI1 tested & works
ladyada May 15, 2016
b923678
radio workin, all pins accounted for
ladyada May 20, 2016
71c6f9d
align back to mainline (and put in missing Serial5) - not sure if USB…
ladyada May 20, 2016
b86cc80
Merge branch 'master' into atsamr
ladyada May 23, 2016
51f6ca8
comment out radio but fix adc support in zero on the extra pins
ladyada Jun 22, 2016
f0d0188
bump platform version
ladyada Jun 23, 2016
e8c4141
fix platform path
ladyada Jun 23, 2016
6bef47d
mac bossac
ladyada Jun 24, 2016
5b1108c
Added bossac_osx with +x privilege.
tdicola Jun 24, 2016
45c9d5b
Tweak platform.txt to use OSX bossac.
tdicola Jun 24, 2016
f8b1ce3
add linux bossac
Jun 24, 2016
f6d0aaf
revert platform, will try again later :/
ladyada Jun 24, 2016
fed20f6
Fix for PWM on many pins, now works on: 5, 6, 9, 10, 11, 12, 13, 15 (…
ladyada Jul 25, 2016
488ed7f
re-fix analog 6 & 7
ladyada Aug 3, 2016
c569975
another A6/A7 fix
ladyada Aug 3, 2016
cfd2cca
bump version
ladyada Aug 3, 2016
732aefc
unknown change but commiting anyhow (we dont use the files)
ladyada Jan 15, 2017
af9e214
Merge remote-tracking branch 'upstream/master'
ladyada Jan 15, 2017
9712b43
oops fix merge conflict
ladyada Jan 15, 2017
c6ba693
rev D hardware match
ladyada Jan 18, 2017
d05675d
fix pid for bootloader
ladyada Jan 18, 2017
67599aa
add qtouch library and linking
ladyada Jan 25, 2017
cb3aea3
add metro m0 variant
ladyada Jan 31, 2017
590c97f
Merge remote-tracking branch 'upstream/master'
ladyada Feb 1, 2017
16d8216
add SPI flash SS pin
ladyada Feb 3, 2017
eef984e
fix analog pins, I2S not working yet
ladyada Feb 8, 2017
427725a
Merge remote-tracking branch 'upstream/master'
ladyada Feb 23, 2017
da00e39
fix for quote-needing paths
ladyada Feb 27, 2017
fbc2a13
bigger buffer for Wire
ladyada Feb 27, 2017
0acb9be
ignore emacs saves
ladyada Mar 19, 2017
92aec3e
new variant for feather m0 express (it has second SPI port)
ladyada Mar 19, 2017
ca16afe
fix SPI1 - tested
ladyada Mar 19, 2017
e7f2b53
bump version!
ladyada Mar 21, 2017
8578ec2
oops, forgot!
ladyada Mar 21, 2017
858d176
re-bump
ladyada Mar 21, 2017
94786e9
update for rev F - we'll manually config i2s since we dont need an fs…
ladyada Apr 14, 2017
8012aac
rev g varianty
ladyada Apr 21, 2017
10a9c83
Merge remote-tracking branch 'upstream/master'
ladyada Apr 21, 2017
8a921a4
Tweak the DFLL crystal-less startup sequence to more reliably start.
tannewt Apr 25, 2017
e61846f
nicer #Defines
ladyada Apr 27, 2017
eb7b6da
bump version
ladyada May 8, 2017
d1cf9ff
right variant to match rev G
ladyada Jun 23, 2017
ba140a7
unknown why but if pin has analog set it variant, pwm doesnt work. ju…
ladyada Jun 29, 2017
c1831f1
removed unneeded libs
ladyada Jun 29, 2017
5a01c5e
bump!
ladyada Jun 29, 2017
99001c0
no longer needed
ladyada Jun 29, 2017
37b9881
DM: added samd51 support
deanm1278 Jun 30, 2017
2b7298e
Update README.md
deanm1278 Jun 30, 2017
24a653d
Add Gemma m0 - tested just about everything
ladyada Jul 1, 2017
62bf9f8
DM: fixed pwm and dac (almost)
deanm1278 Jul 3, 2017
fb6f09a
Update README.md
deanm1278 Jul 3, 2017
6d06982
Allow attachInterrupt() on NMI pin (PA08 on ATSAMD21E)
PaintYourDragon Feb 14, 2017
04e3b13
DM: fix switching between dac output and analogread
deanm1278 Jul 7, 2017
1c33cd2
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Jul 7, 2017
887a448
DM: fixed tone
deanm1278 Jul 7, 2017
7a363cc
Update README.md
deanm1278 Jul 7, 2017
7e76b3c
DM: clocked to 120MHZ, peripherals to 100, USB to 48
deanm1278 Jul 11, 2017
31aecad
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Jul 11, 2017
5c7e00e
DM: mostly fixed usb enumeration delay
deanm1278 Jul 25, 2017
ce608f2
DM: added support for samd51J20A
deanm1278 Aug 1, 2017
f741c82
trinket m0 start
ladyada Aug 1, 2017
e8f2213
rename and assign VID/PID
ladyada Aug 2, 2017
5a0bf8a
DM: added metro m4 variant
deanm1278 Aug 4, 2017
dd7d17e
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Aug 4, 2017
de847a1
add gemma & trinket m0
ladyada Aug 6, 2017
236fe64
DM: variant changes got bonked
deanm1278 Aug 31, 2017
c0272da
DM: fixed i2c pins
deanm1278 Aug 31, 2017
04731bc
not having any SPI breaks things - maybe just have a 'fake' sck+mosi …
ladyada Sep 17, 2017
c0c9ba0
DM: fixed DAC, SPI
deanm1278 Sep 20, 2017
13707df
DM: added FPU support
deanm1278 Sep 20, 2017
01232bf
DM: bugfixes
deanm1278 Sep 21, 2017
2789053
DM: in progress i2s / dma support
deanm1278 Sep 22, 2017
0da4144
DM: lets not feed PLLs from xosc
deanm1278 Sep 25, 2017
3461ace
DM: oops committed wrong stuff, actually fixed DPLL problems
deanm1278 Sep 25, 2017
cfa521c
DM: not crystalless
deanm1278 Sep 25, 2017
e42ab7b
DM: fixed SERCOM baud rates
deanm1278 Sep 25, 2017
da3291d
DM: updated bootloader size to 16k, fixed USB vid/pid
deanm1278 Oct 4, 2017
3d72ce6
DM: fixed VID/PID
deanm1278 Oct 4, 2017
fb41af4
DM: fixed dpll1 freq
deanm1278 Oct 4, 2017
6826404
DM: update sercom IRQs for M4
deanm1278 Oct 10, 2017
c3b70d0
DM: fixed ADC channel
deanm1278 Oct 10, 2017
169c784
DM: fixed USB enumeration bug in bootloader and core
deanm1278 Oct 11, 2017
e131567
Update README.md
deanm1278 Oct 11, 2017
63ba6aa
DM: EIC and VARIANT_MCK fix
deanm1278 Oct 13, 2017
e8b316c
DM: adding feather m4
deanm1278 Oct 13, 2017
5871530
working on getting sercoms working. i2c OK. serial is not :(
ladyada Oct 14, 2017
2b39437
fix numbering for soft-SPI (tested)
ladyada Oct 14, 2017
13e2406
DM: update m4 bootloader for multiple targets
deanm1278 Oct 16, 2017
7bae00e
DM: updates for rev B
deanm1278 Oct 17, 2017
ceafcf8
DM: temp fix for rando failure bug, turn off C optimizations for now
deanm1278 Oct 17, 2017
45f3eeb
DM: updated variant for rev B
deanm1278 Oct 17, 2017
c62a2be
Update README.md
deanm1278 Oct 17, 2017
4f072bc
DM: fix upload bug
deanm1278 Oct 18, 2017
70066a8
Update README.md
deanm1278 Oct 18, 2017
32d321b
move feather m0 out to its own variant and fix D8/D9 PWM/analog mixup
ladyada Oct 20, 2017
3506e15
fix for Feather M0 #9 PWM
ladyada Oct 20, 2017
2d8ca01
updated install procedure
ladyada Oct 22, 2017
caf2363
~markdown~
ladyada Oct 22, 2017
765a5de
rephrase
ladyada Oct 22, 2017
f80cf3b
DM: fix analog correction library
deanm1278 Oct 24, 2017
b8042c4
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Oct 24, 2017
6ead93c
DM: some usb host fixes (still not working)
deanm1278 Oct 24, 2017
fb5de48
Update README.md
deanm1278 Oct 24, 2017
4f22a07
DM: fix tone 0 frequency
deanm1278 Oct 24, 2017
ca58c2f
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Oct 24, 2017
b425bcd
Update README.md
jerryneedell Oct 27, 2017
3826294
Update README.md
jerryneedell Oct 27, 2017
8f2c6a1
Update README.md
jerryneedell Oct 27, 2017
1070407
Merge pull request #17 from jerryneedell/samd51
ladyada Oct 28, 2017
a84b050
Update README.md
jerryneedell Oct 29, 2017
92dc436
Update README.md
jerryneedell Oct 29, 2017
ace678a
Update README.md
jerryneedell Oct 29, 2017
b000142
Update README.md
jerryneedell Oct 29, 2017
a19d197
Update README.md
jerryneedell Oct 29, 2017
74d6d1b
Update README.md
jerryneedell Oct 29, 2017
99e8fe9
Update README.md
jerryneedell Oct 29, 2017
7abe4a1
Merge pull request #18 from jerryneedell/samd51
ladyada Oct 29, 2017
03590c5
DM: we have a 12 bit dac lets use
deanm1278 Oct 30, 2017
e8b4580
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Oct 30, 2017
4f128a7
DM: fix worst bug in entire world
deanm1278 Nov 3, 2017
a75e94f
DM: updated magic number to match circuitpython stuff
deanm1278 Nov 6, 2017
ed2087b
DM: updated feather m4 variant for new rev
deanm1278 Nov 7, 2017
fb82965
add itsybitsy m0 variant (commented out) and bootloaders for all
ladyada Nov 12, 2017
5d4285e
DM: fixed math lib paths for m0 boards
deanm1278 Nov 20, 2017
7f275e1
DM: added math libraries
deanm1278 Dec 5, 2017
fa63c67
DM: some I2S stuff
deanm1278 Dec 13, 2017
7f3c9f0
DM: fixed m0 boards compilation error with math additions
deanm1278 Dec 18, 2017
9ba241a
DM: update feather m4 variant
deanm1278 Dec 22, 2017
9349090
DM: fix typo in cplay express boards.txt
deanm1278 Jan 3, 2018
6fc17a3
DM: fix linker vfp arguments
deanm1278 Jan 4, 2018
c00e68d
add itsybitsy (needs PID update before release)
ladyada Jan 27, 2018
db3f0db
Update itsybitsy for USB PIDs!
ladyada Feb 2, 2018
69071fd
bump to add itsy
ladyada Feb 7, 2018
6c0f402
prelim pirkey config
ladyada Mar 16, 2018
d27f766
update usb stuff
deanm1278 Mar 20, 2018
78d9fbe
update pinout and stuff for new revision
deanm1278 Mar 20, 2018
bdcc18d
DM: update feather m4 pinout for new rev
deanm1278 Mar 27, 2018
70c5f9c
DM: fix feather m4 variant
deanm1278 Mar 28, 2018
aebe54b
DM: update pwms for samd51
deanm1278 Mar 29, 2018
f5093b6
start of pirkey
ladyada Mar 29, 2018
ad797c1
fix correct IRQ #'s (see DS) not a full sweep, just did pins that wer…
ladyada Mar 29, 2018
a222c14
DM: fix delay microseconds
deanm1278 Apr 2, 2018
d1b7b57
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Apr 2, 2018
d184519
DM: update interrupt numbers on metro m4
deanm1278 Apr 2, 2018
965af33
DM: remove incorrect pins comment
deanm1278 Apr 2, 2018
625fd55
Merge branch 'master' of github.com:adafruit/ArduinoCore-samd
deanm1278 Apr 2, 2018
6180dcb
Merge branch 'samd51'
deanm1278 Apr 2, 2018
04618d7
DM: delete mistake file
deanm1278 Apr 2, 2018
59de275
Merge pull request #32 from adafruit/merge-samd51
ladyada Apr 2, 2018
1c1cb3e
Update README.md
ladyada Apr 2, 2018
040bda6
DM: fix interrupts, pcc pins
deanm1278 Apr 5, 2018
b16a801
updated for neopixel to be on #40 like the silkscreen
ladyada Apr 9, 2018
c3f1fa4
fix math.h complaints
ladyada Apr 9, 2018
f41c917
add PWMs on pin 0, 1, A3, A4 - tested!
ladyada Apr 10, 2018
bd0c38e
update cmsis-atmel and bossac path (we'll see!)
ladyada Apr 10, 2018
06ca7be
update for new bossac
ladyada Apr 10, 2018
e4a41f3
lets start with two versions, we can bump up bossac for everything el…
ladyada Apr 10, 2018
a91e014
DM: fix dac not holding value bug
deanm1278 Apr 16, 2018
f01d4ce
DM: fix dac clock and first write bug
deanm1278 Apr 16, 2018
9064f83
we have lots o pins >.<
ladyada Apr 20, 2018
88395d6
removed unused .a and fixed frequency
ladyada Apr 23, 2018
e47bcbd
DM: fix some pwms
deanm1278 Apr 26, 2018
8543148
Merge branch 'master' of github.com:adafruit/ArduinoCore-samd
deanm1278 Apr 26, 2018
fab83cf
update clocks to match arduino samd
deanm1278 Apr 30, 2018
42aa484
DM: update pwms, timer definitions
deanm1278 Apr 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.bz2
*.atsuo

bootloaders/*/build/
*~
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
# Arduino Core for SAMD21 CPU
# Arduino Core for SAMD21 and SAMD51 CPU

This repository contains the source code and configuration files of the Arduino Core
for Atmel's SAMD21 processor (used on the Arduino/Genuino Zero, MKR1000 and MKRZero boards).
for Atmel's SAMD21 and SAMD51 processor (used on the Arduino/Genuino Zero, MKR1000 and MKRZero boards).

In particular, this adds support for the Adafruit SAMD Boards such as the Feather M0

## Installation on Arduino IDE

Install the Adafruit Board Support package json and then install the Adafruit SAMD board package
This is a detailed process for now!

https://learn.adafruit.com/adafruit-feather-m0-basic-proto/using-with-arduino-ide
1. Install Arduino IDE 1.8.5 or greater
2. Remove the Adafruit SAMD board support package if you have installed it
3. make a folder in your ArduinoSketchFolder called "hardware", then make a folder "hardware/Adafruit"
4. in "hardware/Adafruit" git clone https://github.com/adafruit/ArduinoCore-samd, and rename the folder "samd"
5. Check you now have "ArduinoSketcheFolderName/hardware/Adafruit/samd/boards.txt"
6. git checkout samd51 from within the cloned repo, and check boards.txt contains "# Adafruit Metro M4 (SAMD51)"
7. Now we need to update CMSIS! Download https://github.com/adafruit/ArduinoModule-CMSIS-Atmel/archive/master.zip and unzip
8. Find your Arduino CMSIS, in Mac its "~/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS" version # may vary, you'll need "Go to folder..." feature in the Finder to get to " ~/Library/Arduino15" as it is hidden. In Windows it is "C:\Users\yourusername\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.1.0\CMSIS" Inside is a folder named Device

For Linux: the Arduino stuff is located in ~/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS

9. Inside the downloaded CMSIS zip, go into the CMSIS-Atmel/CMSIS folder, you should see a folder named Device. *DRAG THE DEVICE FOLDER ONLY* from the zip to your arduino Library folder so that Device is merged with Device. It will replace a bunch of files.

For Linux, it may be better to just delete the original Device Folder then copy over the new one - the drag/drop worked ok on MACOS, but not so well on my Linux box.

10. You will also need to replace bossac. For Windows or Mac: Go here https://github.com/adafruit/BOSSA/releases and download either windows exe or mac app of latest bossac. unzip. Go to Step 12.

For Linux users it is best to build a copy of bossac locally -
clone the Adafruit Repostitory to somewhere on your local machine.
```
git clone https://github.com/adafruit/BOSSA.git
change to the arduino branch
git checkout arduino
```
Follow the instructions to build bossac in README.md or at https://github.com/adafruit/BOSSA/tree/arduino.

11. Replace the binary at ".../Library/Arduino15/packages/arduino/tools/bossac/1.7.0/bossac" or "...\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0\bossac"
12. On Windows 7 you will also need to install the updated serial driver, download https://github.com/adafruit/Adafruit_Windows_Drivers/archive/master.zip to get all the drivers, and point the Device Manager to the unzipped folder. It isn't signed, so just approve the installation manually.
13. That's it!

## Bugs or Issues

## Known Issues for SAMD51:
* AREF must be tied to 3.3V for dac to work. This is a bug in the SAMD51 silicon.
* USB host mode doesn't work yet

If you find a bug you can submit an issue here on github:

https://github.com/adafruit/ArduinoCore-samd
Expand Down
79 changes: 73 additions & 6 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ adafruit_feather_m0.build.usb_product="Feather M0"
adafruit_feather_m0.build.usb_manufacturer="Adafruit"
adafruit_feather_m0.build.board=SAMD_FEATHER_M0
adafruit_feather_m0.build.core=arduino
adafruit_feather_m0.build.extra_flags=-DARDUINO_SAMD_ZERO -D__SAMD21G18A__ {build.usb_flags}
adafruit_feather_m0.build.extra_flags=-DARDUINO_SAMD_ZERO -DARM_MATH_CM0PLUS -D__SAMD21G18A__ {build.usb_flags}
adafruit_feather_m0.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_feather_m0.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_feather_m0.build.variant=feather_m0
Expand All @@ -41,6 +41,7 @@ adafruit_feather_m0.build.vid=0x239A
adafruit_feather_m0.build.pid=0x800B
adafruit_feather_m0.bootloader.tool=openocd
adafruit_feather_m0.bootloader.file=feather/samd21_sam_ba.bin
adafruit_feather_m0.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math

adafruit_feather_m0_express.name=Adafruit Feather M0 Express
adafruit_feather_m0_express.vid.0=0x239A
Expand All @@ -59,7 +60,7 @@ adafruit_feather_m0_express.build.usb_product="Feather M0 Express"
adafruit_feather_m0_express.build.usb_manufacturer="Adafruit"
adafruit_feather_m0_express.build.board=SAMD_FEATHER_M0_EXPRESS
adafruit_feather_m0_express.build.core=arduino
adafruit_feather_m0_express.build.extra_flags=-DARDUINO_SAMD_ZERO -DARDUINO_SAMD_FEATHER_M0 -DADAFRUIT_FEATHER_M0_EXPRESS -D__SAMD21G18A__ {build.usb_flags}
adafruit_feather_m0_express.build.extra_flags=-DARDUINO_SAMD_ZERO -DARDUINO_SAMD_FEATHER_M0 -DARM_MATH_CM0PLUS -DADAFRUIT_FEATHER_M0_EXPRESS -D__SAMD21G18A__ {build.usb_flags}
adafruit_feather_m0_express.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_feather_m0_express.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_feather_m0_express.build.variant=feather_m0_express
Expand All @@ -68,6 +69,7 @@ adafruit_feather_m0_express.build.vid=0x239A
adafruit_feather_m0_express.build.pid=0x801B
adafruit_feather_m0_express.bootloader.tool=openocd
adafruit_feather_m0_express.bootloader.file=feather/samd21_sam_ba.bin
adafruit_feather_m0_express.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math

#adafruit_radio_m0.name=Adafruit M0 Radio (Native USB Port)
#adafruit_radio_m0.vid.0=0x239A
Expand All @@ -86,7 +88,7 @@ adafruit_feather_m0_express.bootloader.file=feather/samd21_sam_ba.bin
#adafruit_radio_m0.build.usb_manufacturer="Adafruit"
#adafruit_radio_m0.build.board=SAMD_ZERO
#adafruit_radio_m0.build.core=arduino
#adafruit_radio_m0.build.extra_flags=-D__SAMR21G18A__ {build.usb_flags}
#adafruit_radio_m0.build.extra_flags=-D__SAMR21G18A__ -DARM_MATH_CM0PLUS {build.usb_flags}
#adafruit_radio_m0.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
#adafruit_radio_m0.build.openocdscript=openocd_scripts/arduino_zero.cfg
#adafruit_radio_m0.build.variant=zero_radio
Expand All @@ -113,7 +115,7 @@ adafruit_metro_m0.build.usb_product="Metro M0 Express"
adafruit_metro_m0.build.usb_manufacturer="Adafruit"
adafruit_metro_m0.build.board=SAMD_ZERO
adafruit_metro_m0.build.core=arduino
adafruit_metro_m0.build.extra_flags=-D__SAMD21G18A__ -DARDUINO_SAMD_ZERO -DADAFRUIT_METRO_M0_EXPRESS {build.usb_flags}
adafruit_metro_m0.build.extra_flags=-D__SAMD21G18A__ -DARDUINO_SAMD_ZERO -DARM_MATH_CM0PLUS -DADAFRUIT_METRO_M0_EXPRESS {build.usb_flags}
adafruit_metro_m0.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_metro_m0.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_metro_m0.build.variant=metro_m0
Expand All @@ -122,6 +124,7 @@ adafruit_metro_m0.build.vid=0x239A
adafruit_metro_m0.build.pid=0x8013
adafruit_metro_m0.bootloader.tool=openocd
adafruit_metro_m0.bootloader.file=metro/bootloader_uf2.bin
adafruit_metro_m0.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math

# Adafruit Circuit Playground M0
# ------------------------------
Expand All @@ -142,7 +145,7 @@ adafruit_circuitplayground_m0.build.usb_product="Circuit Playground Express"
adafruit_circuitplayground_m0.build.usb_manufacturer="Adafruit"
adafruit_circuitplayground_m0.build.board=SAMD_CIRCUITPLAYGROUND_EXPRESS
adafruit_circuitplayground_m0.build.core=arduino
adafruit_circuitplayground_m0.build.extra_flags=-DCRYSTALLESS -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DADAFRUIT_CIRCUITPLAYGROUND_M0 {build.usb_flags}
adafruit_circuitplayground_m0.build.extra_flags=-DCRYSTALLESS -DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DADAFRUIT_CIRCUITPLAYGROUND_M0 {build.usb_flags}
adafruit_circuitplayground_m0.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_circuitplayground_m0.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_circuitplayground_m0.build.variant=circuitplay
Expand All @@ -151,6 +154,7 @@ adafruit_circuitplayground_m0.build.vid=0x239A
adafruit_circuitplayground_m0.build.pid=0x8018
adafruit_circuitplayground_m0.bootloader.tool=openocd
adafruit_circuitplayground_m0.bootloader.file=circuitplay/bootloader_uf2.bin
adafruit_circuitplayground_m0.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math

adafruit_gemma_m0.name=Adafruit Gemma M0
adafruit_gemma_m0.vid.0=0x239A
Expand Down Expand Up @@ -234,6 +238,7 @@ adafruit_itsybitsy_m0.build.vid=0x239A
adafruit_itsybitsy_m0.build.pid=0x800F
adafruit_itsybitsy_m0.bootloader.tool=openocd
adafruit_itsybitsy_m0.bootloader.file=itsybitsy/samd21_sam_ba.bin
adafruit_itsybitsy_m0.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math


adafruit_pirkey.name=Adafruit pIRkey
Expand Down Expand Up @@ -261,4 +266,66 @@ adafruit_pirkey.build.variant_system_lib=
adafruit_pirkey.build.vid=0x239A
adafruit_pirkey.build.pid=0x801E
adafruit_pirkey.bootloader.tool=openocd
adafruit_pirkey.bootloader.file=pirkey/bootloader_uf2.bin
adafruit_pirkey.bootloader.file=pirkey/bootloader_uf2.bin
adafruit_pirkey.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math


# Adafruit Metro M4 (SAMD51)
# ------------------------------
adafruit_metro_m4.name=Adafruit Metro M4 (SAMD51)
adafruit_metro_m4.vid.0=0x239A
adafruit_metro_m4.pid.0=0x8020
adafruit_metro_m4.vid.1=0x239A
adafruit_metro_m4.pid.1=0x0020
adafruit_metro_m4.upload.tool=bossac
adafruit_metro_m4.upload.protocol=sam-ba
adafruit_metro_m4.upload.maximum_size=507904
adafruit_metro_m4.upload.use_1200bps_touch=true
adafruit_metro_m4.upload.wait_for_upload_port=true
adafruit_metro_m4.upload.native_usb=true
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=METRO_M4
adafruit_metro_m4.build.core=arduino
adafruit_metro_m4.build.extra_flags=-D__SAMD51J19A__ -D__SAMD51__ {build.usb_flags} -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
adafruit_metro_m4.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
adafruit_metro_m4.build.openocdscript=openocd_scripts/arduino_zero.cfg
adafruit_metro_m4.build.variant=metro_m4
adafruit_metro_m4.build.variant_system_lib=
adafruit_metro_m4.build.vid=0x239A
adafruit_metro_m4.build.pid=0x8020
adafruit_metro_m4.bootloader.tool=openocd
adafruit_metro_m4.bootloader.file=metroM4/bootloader.bin
adafruit_metro_m4.compiler.arm.cmsis.ldflags="-L{build.variant.path}" -larm_cortexM4lf_math -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=507904
#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} -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
#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/bootloader.bin
#adafruit_feather_m4.compiler.arm.cmsis.ldflags="-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
Binary file added bootloaders/metroM4/bootloader.bin
Binary file not shown.
Binary file added bootloaders/metroM4/update-bootloader.bin
Binary file not shown.
Binary file added bootloaders/metroM4/update-bootloader.uf2
Binary file not shown.
6 changes: 3 additions & 3 deletions cores/arduino/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
class HardwareSerial : public Stream
{
public:
virtual void begin(unsigned long);
virtual void begin(unsigned long baudrate, uint16_t config);
virtual void end();
virtual void begin(unsigned long) {}
virtual void begin(unsigned long baudrate, uint16_t config) {}
virtual void end() {}
virtual int available(void) = 0;
virtual int peek(void) = 0;
virtual int read(void) = 0;
Expand Down
34 changes: 33 additions & 1 deletion cores/arduino/Reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,72 @@ extern "C" {
extern const uint32_t __text_start__;
#define APP_START ((volatile uint32_t)(&__text_start__) + 4)

#else

#if defined(__SAMD51__)
#define APP_START 0x00004004
#else
#define APP_START 0x00002004
#endif

#endif

static inline bool nvmReady(void) {
#if defined(__SAMD51__)
return NVMCTRL->STATUS.reg & NVMCTRL_STATUS_READY;
#else
return NVMCTRL->INTFLAG.reg & NVMCTRL_INTFLAG_READY;
#endif
}

__attribute__ ((long_call, section (".ramfunc")))
static void banzai() {
// Disable all interrupts
__disable_irq();

#if defined(__SAMD51__)
//THESE MUST MATCH THE BOOTLOADER
#define DOUBLE_TAP_MAGIC 0xf01669efUL
#define BOOT_DOUBLE_TAP_ADDRESS (HSRAM_ADDR + HSRAM_SIZE - 4)

unsigned long *a = (unsigned long *)BOOT_DOUBLE_TAP_ADDRESS;
*a = DOUBLE_TAP_MAGIC;
//NVMCTRL->ADDR.reg = APP_START;
//NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_CMD_EB | NVMCTRL_CTRLB_CMDEX_KEY;

// Reset the device
NVIC_SystemReset() ;

while (true);
#else

// Avoid erasing the application if APP_START is < than the minimum bootloader size
// This could happen if without_bootloader linker script was chosen
// Minimum bootloader size in SAMD21 family is 512bytes (RM section 22.6.5)

if (APP_START < (0x200 + 4)) {
goto reset;
}


// Erase application
while (!nvmReady())
;

NVMCTRL->STATUS.reg |= NVMCTRL_STATUS_MASK;
NVMCTRL->ADDR.reg = (uintptr_t)&NVM_MEMORY[APP_START / 4];
NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMD_ER | NVMCTRL_CTRLA_CMDEX_KEY;

while (!nvmReady())
;
;

reset:
// Reset the device
NVIC_SystemReset() ;

while (true);
#endif

}

static int ticks = -1;
Expand Down
Loading