Add MKR WiFi1010 variant and bootloader

* Update variant for hardware changes

- Use sercom2 for SPI1
- Remove Serial2
- update various comments
- disable NINA on start

* Add Serial2 (overlaps with SPI1)

This commit squashes all the dev commits from @agdl, @sandeepmistry and @facchinm
This commit is contained in:
agdl 2018-03-19 09:46:12 +01:00 committed by Martino Facchin
parent d72f11735d
commit b45714977d
13 changed files with 1601 additions and 0 deletions

View file

@ -249,6 +249,35 @@ mkrwan1300.build.pid=0x8053
mkrwan1300.bootloader.tool=openocd
mkrwan1300.bootloader.file=mkrwan1300/samd21_sam_ba_arduino_mkrwan1300.bin
# Arduino MKR WiFi 1010
# --------------------
mkrwifi1010.name=Arduino MKR WiFi 1010
mkrwifi1010.vid.0=0x2341
mkrwifi1010.pid.0=0x8054
mkrwifi1010.vid.1=0x2341
mkrwifi1010.pid.1=0x0054
mkrwifi1010.upload.tool=bossac
mkrwifi1010.upload.protocol=sam-ba
mkrwifi1010.upload.maximum_size=262144
mkrwifi1010.upload.use_1200bps_touch=true
mkrwifi1010.upload.wait_for_upload_port=true
mkrwifi1010.upload.native_usb=true
mkrwifi1010.build.mcu=cortex-m0plus
mkrwifi1010.build.f_cpu=48000000L
mkrwifi1010.build.usb_product="Arduino MKR WiFi 1010"
mkrwifi1010.build.usb_manufacturer="Arduino LLC"
mkrwifi1010.build.board=SAMD_MKRWIFI1010
mkrwifi1010.build.core=arduino
mkrwifi1010.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -DUSE_BQ24195L_PMIC
mkrwifi1010.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
mkrwifi1010.build.openocdscript=openocd_scripts/arduino_zero.cfg
mkrwifi1010.build.variant=mkrwifi1010
mkrwifi1010.build.vid=0x2341
mkrwifi1010.build.pid=0x8054
mkrwifi1010.bootloader.tool=openocd
mkrwifi1010.bootloader.file=mkrwifi1010/samd21_sam_ba_arduino_mkrwifi1010.bin
# Adafruit Circuit Playground M0
# ------------------------------
adafruit_circuitplayground_m0.name=Adafruit Circuit Playground Express

View file

@ -0,0 +1,502 @@
:10000000FC7F0020810B0000710B0000750B0000CD
:1000100000000000000000000000000000000000E0
:10002000000000000000000000000000790B00004C
:1000300000000000000000007D0B0000D50C000057
:1000400010B5064C2378002B07D1054B002B02D0AE
:10005000044800E000BF0123237010BD5C000020B5
:1000600000000000D81E000008B5084B002B03D08C
:100070000748084900E000BF07480368002B03D089
:10008000064B002B00D0984708BDC046000000007A
:10009000D81E000060000020580000200000000072
:1000A000064B0322104002040549586808401043DB
:1000B0005860DA695107FCD47047C0460008004216
:1000C000FFFFFCFF38B5284A284B5A805A7852B2B5
:1000D000002AFBDB264B04211A6A264D0A431A62CA
:1000E0002B68012213432B602A680123214C1A42FA
:1000F000FAD1E2691A42F7D11423236041001E4865
:1001000001F00CFD421EE068FF231A4098431043A3
:10011000E0602368022213432360EA69154B9107CC
:10012000FBD45A8B30218A4310210A435A83EB694E
:1001300001205A07FBD4114B02241A7802431A708B
:100140000F4B0F22197891431970197821431970B8
:100150000C490C782043087019780A401A701A78F4
:1001600020210A431A7038BD14400000000C0040E2
:100170000004004000080042006CDC0248440041DA
:100180003444004149440041F7B500230F1C01925B
:100190001D1C994254D001212A4E4000084333705F
:1001A000C1B2294B0322588B1C1C000910400128A6
:1001B00004D05B8B1B091A40022AF2D1606AC00A84
:1001C000C00208436062217E1F4B0122880708D4C9
:1001D000197E1142F7D05968C02292020A435A6030
:1001E00003E05B8B9B08134201D0002528E03270AE
:1001F000237E9907FCD5154A154B117801251970F6
:100200006268BD4212D0134B022013406360FFF7B7
:1002100047FF33785A1C3270227E9007FCD50B4979
:100220000B480A780135C254EDB2E9E78023DB02BE
:10023000134363600199002902D00320FFF730FFC8
:10024000281CFEBD7800002000080042280800425B
:1002500099000020FFFFFBFF024B00221870024BA9
:100260001A7070477A00002079000020F8B5274BFB
:100270001C786400E4B2264B03215D8B1A1C2D0907
:100280000D40012D04D05B8B1B0919400229F2D1CE
:10029000536ADB0ADB0223435362117E01231942B6
:1002A000FBD01B49498B8908194204D00320FFF772
:1002B000F7FE022427E017490D782B1C002B11D0E4
:1002C000154EEC1A365D154C2670114E177E012422
:1002D000768B274202D12642F7D00BE0B6082642A1
:1002E0000ED007E00B701C1C00280CD00320FFF779
:1002F000D7FE08E003200B700324FFF7D1FE02E0D5
:10030000013BDBB2DAE7201CF8BDC0467A000020D2
:1003100000080042790000207B00002028080042ED
:10032000034A1378591C1170024AD05401207047B7
:10033000790000207B000020154A164B1178002917
:1003400009D11549187809784118C9B21970802067
:1003500012494003C86111780131C9B2117019788E
:10036000F02902D81978092909D80B4908784042A0
:10037000C0B20870187809784118C9B2197012789B
:100380001B789A4203D18022044B5203DA617047F2
:100390007D000020010000200000002000440041FA
:1003A00010B5041C6B20FFF757FF201CFFF7B8FFA8
:1003B0000120FFF75BFF01210A1C6B20FFF7E4FE21
:1003C000014B187810BDC0469900002038B5051CB7
:1003D0006B200C1CFFF740FF281CFFF7A1FF201C1F
:1003E000FFF79EFF0120FFF741FF022038BD08B54F
:1003F0000520FFF7D5FFCE23011C19400520FFF78C
:10040000E5FF012008BD000010B5041C0020FFF727
:10041000C7FF78232D4A9843C1B2944242D018D8DE
:100420002B4B9C4238D009D82A4B9C4230D02A4BC7
:100430009C422FD0294B9C4245D13FE0284B9C4207
:100440002CD0284B9C422BD0274B9C423BD12023C5
:1004500033E0264A94422BD00AD8254B9C4223D025
:10046000244B9C4222D0244B9C422CD1402324E09C
:10047000224A94421ED004D8214B9C4223D16023AF
:100480001BE0204A944217D01F4A944215D01AE02C
:10049000082312E0102310E018230EE028230CE0BC
:1004A00030230AE0382308E0482306E0502304E024
:1004B000582302E0682300E0702319430020FFF76F
:1004C00085FF012000E0002010BDC046581100004B
:1004D00018100000780F0000C80F0000280F00005F
:1004E000B810000008110000681000009812000009
:1004F000F811000048120000A81100003813000095
:10050000E812000088130000D813000010B5041C86
:100510000020FFF745FF07239843E122C1B2920074
:10052000944220D008D8962C18D0FA235B009C4225
:1005300017D0642C22D11CE0114A944215D005D862
:100540009623DB009C4219D1042311E0FA22D20049
:1005500094420CD00B4A94420AD00FE0012421436C
:1005600007E0022304E0032302E0052300E0062362
:1005700019430020FFF72AFF012000E0002010BDF2
:10058000DC050000B80B000070B504AC267805ACA3
:100590002578441EA041C401002901D040210C430C
:1005A000002A01D020221443002B01D010231C4329
:1005B000002E01D008231C43002D01D004231C432E
:1005C0000220FFF7EDFE0125011C294021430220F6
:1005D000FFF7FCFE281C70BD10B5041C0420FFF7BB
:1005E000DFFE03231840084B9C4204D0074B9C427B
:1005F00008D1B02100E0982101430420FFF7E6FE76
:10060000012000E0002010BD10100000701000005C
:1006100008B50120FFF7C4FECF23011C19400120BB
:10062000FFF7D4FE012008BD07B5FFF7E0FEFFF796
:10063000EFFF0948FFF7E8FEFA20C000FFF766FF6A
:10064000002300930193181C191C1A1CFFF79CFF30
:100650000248FFF7C1FF07BD08110000101000009D
:1006600008B50348FFF72EFDFFF7DEFF08BDC046C3
:10067000A086010010B5C3699C07FCD4036802245E
:10068000A3430360C46901231C42FBD104682343D4
:1006900003600368DC07FCD4C46901231C42FBD15E
:1006A000C469DC401C42F7D1084B1A430260C3699D
:1006B0005A07FCD4C0239B0243608181C3699C0715
:1006C000FCD4036802221343036010BD0400004001
:1006D000037EDA07FCD5018570470000027E012306
:1006E0005107FBD5428B1A4207D1428BDA401A429E
:1006F00003D1428B92081A4202D0034B01221A7096
:10070000008DC0B27047C0467E00002070B50368FF
:10071000041C988B1A1C0821FF32084226D0802026
:1007200099839872112353704021144B9171507129
:100730005E68134DC0202E40800506435E605E69F2
:100740003540284358610F4818600F4818615D68AC
:100750000E4828408025AD02284358605868800B19
:100760008003586000235171237105E0137ADA0683
:1007700002D5201C00F0E8FA207970BD9C01002011
:10078000FFFFFF8F9C0000201C010020FF3F00F0B6
:10079000002303714371044B016083600B780222D4
:1007A00013430B707047C0460D07000038B5364B39
:1007B0002021DA6901200A43DA61344B06241A78D1
:1007C00002431A70324B0F2219789143197019782D
:1007D000214319702F490C782043087019780A407A
:1007E0001A701A7860210A431A702B4B2B4A5A80D0
:1007F0005A7852B2002AFBDB294B01211A780A43AE
:100800001A709A78D107FCD426480268510B1F222F
:100810001140914200D1052111408C011D8D2249CA
:100820002940214319850468A10C0A401F2A00D1E0
:100830001D221C8D1F210A408C4322431A85026809
:100840000721D20D0A408A4200D103220A40188DA6
:100850001103164A02400A431A8519787F220A407A
:100860001A701A78042112480A431A7058621A89B9
:100870000C218A431A811A8901218A431A81002195
:10088000802201F0A4F938BD000400405844004122
:100890003C44004159440041000C00400640000027
:1008A00000500041246080003FF8FFFFFF8FFFFFF2
:1008B0009C010020F7B5141C1F4A5F0101971D1C05
:1008C000D319061C5869271C4000400F0330103311
:1008D000C74006D00F1C8022596812060A435A608E
:1008E00009E02F1C7B1E9F41144BBF01FF18381CD1
:1008F000221C01F063F901990F480835421817616D
:10090000131C5269A104920B890C92030A435A6189
:1009100059690B4A0A405A616B01F3180222DA71D5
:100920005979802252420A435A716B01F318DB79DC
:100930009A07FAD5201CFEBD9C0100201C01002056
:10094000FF3F00F0F8B51A4E051C3378141C002B3D
:1009500012D1184B184A1A645A6C920B92035A64BB
:10096000586C164A02405A64A2235B00EA5C40209D
:100970000243EA54012333704827FF37EA5D01231D
:10098000134012D00B4B5A6C9204920CA24202D22A
:100990005C6CA404A40C081C221C074901F00EF98D
:1009A0000123EB550023337000E01C1C201CF8BD14
:1009B0007F0000209C010020DC000020FF3F00F0B1
:1009C000FF3083792022002900D110221343837144
:1009D00070470000084BFF305A69920B92035A612E
:1009E00002230372827980235B4213438371037A6B
:1009F0009A07FCD57047C0469C01002080235B42CB
:100A00001943C9B28172704770B5A02303225B00FD
:100A1000C254134B134A5C6CC021144089050C432B
:100A200046255C64FF35402444550F4D30261D6437
:100A300090256D0046555D6B1540294392255963FD
:100A40006D0080214155094D1D63B0256D00445551
:100A50005C6F22405A67B2235B00C15470BDC04630
:100A60009C010020FFFFFF8FDC0000205C010020C4
:100A700030B5364A1E235168082099430223194392
:100A8000516033498A6902438A613248324A90820E
:100A9000908A03439382D3689807FCD52F4B01209B
:100AA00018701878C40704D52C48407840B2002844
:100AB000F7DB01209860587840B20028FBDB284C17
:100AC00026484460587840B20028FBDB8224234843
:100AD000E4014480587840B20028FBDB908C8024ED
:100AE000A0439084D068C506FCD51E4C1A48C46249
:100AF000D4681948E506FBD5848C1B4D2C438484AF
:100B0000D4681548E506FBD5848C02252C438484E3
:100B1000D0680406FCD51048C0684506F8D5D068F2
:100B2000C406FCD500229A605A7852B2002AFBDB38
:100B30000E480A4A50605A7852B2002AFBDB002362
:100B40000B724B728B72CB7230BDC04600400041BD
:100B5000000400400C06000000080040000C0040AB
:100B600001050100B805FF7D040A0000000703002D
:100B70000EBEFEE70DBEFEE705BEFEE702BEFEE7C7
:100B80000E4A0F4838B5824204D10E4A0E4B9342AA
:100B90000ED10AE00D4C9442F7D00023D1188842C0
:100BA000F3D9E55804330D60F8E700F011F804E0DC
:100BB0009342FAD2002102C3FAE7FEE700000020C8
:100BC0005C000020AC0300205C000020DC1E000064
:100BD00038B5344D2B6801331AD0334B2A1D1A60B7
:100BE000EAB2002A14D1314B197801231940304B55
:100BF0000AD118682F4A904201D1196008E01A60A2
:100C00002D4A013A002AFCD11A602C4B01221A709D
:100C1000FFF72EFF62B6FFF723FD284B284C1B7809
:100C2000002B0AD02B6883F308881E4BFF229343C6
:100C3000A3601D4B1B681B68184700F09DFD00F06A
:100C40004FF8204B802252039A601F4B1F4A051C0D
:100C50005A60216AC0220902090A12060A43226266
:100C600000229A6007221A60AB68281C9847184B2C
:100C7000002801D001221A701A78002A05D000201D
:100C800000F08CFA00F004FBFCE71B78002BEBD1A2
:100C900000F0E6FD0028E7D0012000F07FFA00F028
:100CA000F7FAFCE7002000001C0200203804004096
:100CB000FC7F00203581730748E801008000002098
:100CC00000ED00E00044004110E000E0E703000018
:100CD0008100002008B5FFF72FFB00F0C3FA08BD24
:100CE00010B5054B054C2360FFF760FD201C216803
:100CF000FFF74EFD201C10BD0050004120020020D7
:100D000070B5051CC0B0081C161C0C1C00F067FF59
:100D100040006A46032302305370107076080123A6
:100D2000E218013A11785A00002906D1281C6946B8
:100D30000023FFF7BFFD40B070BDB342F6DA68464E
:100D400081520133ECE70000F7B5BA4A0468137822
:100D5000B949271CFF37051C102038720B705378D7
:100D6000B648B74E037093783380D1783388090240
:100D70000B4333801179B34B1980517918880902DC
:100D8000084318809079B0490880D2790888120207
:100D900002430A8040227A71A84F3A78A64F120285
:100DA00038780F1C0243A9488446181C624500D1BC
:100DB000C2E020DC802149008A4200D16EE109DCDA
:100DC000812A00D192E0822A00D195E0802A00D0C9
:100DD00064E18BE081235B009A4200D1CFE000DA2E
:100DE00058E1C0239B009A4200D157E1984B9A42A8
:100DF00000D14FE152E190231B019A4269D015DCEA
:100E0000D023DB009A4222D088231B019A4269D06A
:100E1000A023DB009A4200D040E1201CFFF7DAFD5E
:100E20003188286889B2FFF7E9FD3BE1894B9A4296
:100E300000D12FE100DC31E1874B9A4200D11DE166
:100E4000864B9A4200D029E133886B7122E13388C6
:100E50001B0A012B08D10B8812222868934201D863
:100E60000A8892B27E4911E133881B0A022B08D10D
:100E70000B8843222868934201D80A8892B27949A4
:100E800004E133881B0A032B00D007E13388DBB26F
:100E9000012B17D0002B07D0022B00D0FEE00A88D0
:100EA0002868D2B2704911E0042201A86F4900F00D
:100EB00085FE3B8804222868934201D83A8892B282
:100EC00001A9E3E00A8828686949D2B2FFF718FF50
:100ED000E8E03388201C2B71FFF77CFD201CFFF716
:100EE00093FDDFE0291C01C90122CFE06149002305
:100EF0000B8028680222CAE05E4900220A80188816
:100F0000502210405C4A10701E880F20304018801C
:100F10001888032800D9C1E012781B8808335B01C8
:100F2000E418A379002A01D09B0600E0DB06DB0F62
:100F30000B8028680222A9E019887F2291434E4A3B
:100F4000C9B2117018880F21014019803188002919
:100F500000D0A3E01988002900D19FE01988032957
:100F600000D99BE012781B8808335B01E318002A44
:100F700002D020225A718DE0102159718AE0028836
:100F80007F239A433C4BD2B21A7001880F220A4049
:100F900002803288002A00D080E00288002A00D136
:100FA0007CE00288032A00D978E01B78002B1FD050
:100FB000038808335B01E3189B799A066AD5038896
:100FC000202208335B01E3181A71038808335B01A0
:100FD000E318DB795F065DD50388402208335B01A7
:100FE000E318DA710388022208335B01E3181EE07C
:100FF000038808335B01E3189B79D9064AD5038837
:10100000102208335B01E3181A71038808335B016F
:10101000E318DB799A063DD50388202208335B016B
:10102000E318DA710388012208335B01E3181A71AF
:1010300030E0C0469C000020830000208800002093
:101040008A0000208C00002086000020020300009F
:101050000103000021200000A12100002122000046
:101060002C1C000004000020141C0000041C0000C4
:10107000081C000084000020820000200B88082249
:101080002868934201D80A8892B207490023FFF7E3
:1010900011FC07E0201CFFF79DFC03E0201C012150
:1010A000FFF78EFCF7BDC0464800002007B5054B92
:1010B0000122019001A91868131CFFF7FBFB012016
:1010C0000EBDC0462002002013B5054B6C46073408
:1010D0001868211C0122FFF735FC207816BDC04698
:1010E0002002002010B5074C201CFFF70FFB031C4B
:1010F0000020834205D022684823FF33D05C0123BF
:10110000184010BD2002002010B5054A0C1C031C1D
:10111000191C10680123221CFFF7CCFB201C10BDFA
:101120002002002070B5084C061C201C0D1CFFF787
:10113000EDFA0023984205D02068311C2A1CFFF7E5
:1011400001FC031C181C70BD20020020F8B50C4CDB
:10115000051C201C0E1CFFF7D9FA0023271C341C89
:1011600098420AD0002C07D0291C221C3868FFF7AF
:10117000E9FB241A2D18F5E7331C181CF8BDC046EE
:101180002002002008B5031C081C111C9847024BC4
:1011900064221A8008BDC04692000020012805D1B3
:1011A000054B064A1A60064B187004E0002802D16D
:1011B000044A014B1A60704790020020601C000036
:1011C00098000020AC1C000030B50A1C1C4985B0FA
:1011D0000978031C00292AD0042A01D1006804E000
:1011E000022A01D1008800E00078520004A98B187F
:1011F0000B3B9C1AA3420BD00F210140092902D8B6
:101200003025294300E0373119700009013BF1E72F
:1012100001A930230B7078234B700A208B1898702B
:101220000D20D870074B04321B68D86803E00549CD
:101230000968C868191CFFF7A5FF05B030BDC04696
:101240008E0000209002002072B6EFF30883044A5B
:101250001360036883F30888436818477047C046E3
:1012600094020020084B1A88002A03D01A88013AF9
:1012700092B21A80054B1A88002A03D01A88013AC4
:1012800092B21A807047C046920000209000002061
:10129000F0B591B008A9CC4A0B1C31CA31C351CA70
:1012A00051C360CA60C3C94BC9489A687A255203C2
:1012B000520F92005258C74902609C68A4B2624320
:1012C0000C60C54900240A60C44A1460C44C2570EF
:1012D000C44CC54D2368281C1B6940219847002831
:1012E00002D0C24B64221A80C14B00221860C14B4D
:1012F0001D60C14BC04DBE4F1A602A683B689A42C0
:10130000E6D2BC4B1B681A78FF2A00D114E2232ACC
:1013100000D0EBE1B94E3378002B06D0B14BB84981
:101320001B680222D868FFF72DFFAD4B1B78532BAB
:101330003CD13B682A6893421ED9AE4801322A60EC
:101340009A1AB04B01681B6801310160AE4E9A4297
:1013500001D2326000E03360A04832680068049037
:1013600000F02CFC336829685A182A60A14A1668D4
:10137000F1181160A54A13702B68013B2B609D4B3F
:101380001A68013A1A60A14B9E4A1B7811688B4279
:101390000AD222689148C91A0068926990470028C9
:1013A00002D0924B64221A80C0468DE1522B0AD1A2
:1013B0008A48944A2368006811685B6903909847DB
:1013C0006422934B0DE04F2B05D1844B8D4A1B6853
:1013D00012681A7078E1482B05D1804B894A1B6846
:1013E00012681A8070E1572B05D17C4B854A1B6827
:1013F00012681A6068E16F2B03D1784B01211868DD
:1014000007E0682B08D1754B7E481B6802211B88BA
:101410000360FFF7D9FE57E1772B06D16F4B794870
:101420001B6804211B680360F3E7472B13D1754B3E
:101430001868FFF709FF774B1B6883F3088862B6CB
:10144000754B1B78002B00D13EE1664B06201B68D4
:101450001B68984738E1542B04D101233370614B4A
:101460001B6864E04E2B0CD13378002B06D15D4B0A
:1014700063491B680222D868FFF784FE002333709B
:1014800022E1562B57D123686449D8680122FFF71F
:1014900079FE23686249D8680322FFF773FE614D25
:1014A0002368291CD8680122FFF76CFE23685E4977
:1014B000D8680D22FFF766FE2368291CD868012230
:1014C000FFF760FE4B4F4C4D5849002339602B60AD
:1014D0003A1C281C13685E1C16601B780593002BB1
:1014E00003D0036801330360F4E73E4E2A68336893
:1014F000D868FFF747FE33684A49D8680122FFF7EA
:1015000041FE059929604A4939603A4A1368581CD6
:1015100010601B78002B04D0374B1A6801321A6018
:10152000F3E733682A68D868FFF72CFE3368D86879
:1015300033490222C6E0334A582B17D1244E264D98
:10154000366813682A68B10093420AD21F4D5808C2
:10155000E861384828801D4D287DC607FBD55B18FB
:10156000F2E7204B34491B68D868AAE0592B79D19F
:1015700012681A4B3149002A02D11B680B606CE0DB
:10158000124D086819686B68104E8025AB439208AD
:101590007360002A61D02A4B0C4D2B800B4E337D9B
:1015A000DD07FBD500230A4D2D680195AD08AB4240
:1015B00003D3244D054E358046E09342F9D09D007B
:1015C000465901334E51EEE7401C000000400041F7
:1015D00048020020400200203C0200208C02002033
:1015E00038020020900200204C02002090000020D1
:1015F0003002002034020020440200208E0000202F
:10160000A01C0000980200209C0200202C02002058
:101610009200002094020020980000207C1C000012
:10162000A51C00007E1C0000C81C0000801C0000DF
:101630008C1C000002A5FFFF951C000094000020F8
:1016400044A5FFFF04A5FFFF3F4E357DEE07FBD508
:101650009D0049194019D21A9BE73C4B3C491B6835
:10166000D8682EE05A2B2FD13A4B17681D680026F8
:10167000EF19BD4206D02878311C00F013F901356E
:10168000061CF6E7314B34491B680122D868FFF786
:1016900079FD07230F223240111C36093031092A07
:1016A00000DD07311820C0186A468154013BF1D291
:1016B000236806A9D8680822FFF764FD2368274934
:1016C000D8680322FFF75EFD254B7A221A70254B5E
:1016D00000221A60244B1B7893422DD01B4B2349C8
:1016E0001B680122D868FFF74DFD25E0111C303939
:1016F000C8B21C4B092804D81D682A01114319607F
:101700001AE0111C4139052903D81E68373A310106
:1017100006E0111C6139052904D81868573A0101FF
:101720000A4308E02C2A03D10A4A1968116001E033
:101730000B490A7000221A600D4B1A6801321A60B8
:101740000C4B1A680132D5E50040004190020020A0
:10175000991C00008C0200209D1C00009F1C0000B2
:1017600038020020980200208E000020A31C0000F8
:10177000440200203402002010B51C4B01201A78CE
:10178000032402431A701A4B0F22197891431970DF
:1017900019782143197017490C782043087019787B
:1017A0000A401A701A7830210A431A70124B8021AD
:1017B0001A6A0A431A62114B114A5A805A7852B275
:1017C000002AFBDBC4220F480F499203FEF752FFA9
:1017D0000E4A002313700E4A13700E4A13700E4AFD
:1017E00013700E4A13700E4A137010BDD644004198
:1017F000BB440041D744004100040040000C0040BD
:1018000019400000001C00422AF60000A00200203F
:1018100027030020A1020020A402002028030020AA
:101820002503002008B5C1B20248FEF751FF012090
:1018300008BDC046001C0042024B187E4007C00F86
:101840007047C046001C004208B5FFF7F5FF0028AE
:10185000FBD00248FEF742FF08BDC046001C004214
:1018600008B5FFF7E9FF0023984205D0FFF7ECFF2A
:10187000031C233B5A425341181C08BD70B5041C7D
:101880000D1C4618B44204D02078FFF7CBFF01347A
:10189000F8E7281C70BD10B5041CFFF7D5FF2070B9
:1018A000012010BD0B0A5840034B4000C05A0902EA
:1018B000484080B27047C046D61C0000F7B50024EF
:1018C000051C0F1C261CBC4220D0FFF7BDFF114B8E
:1018D000C0B21B780190002B1AD1311CFFF7E2FF38
:1018E0000D4B061C1A88002A04D10C4A11782A1CB8
:1018F000002907D001996A1C2970802F02D119880C
:10190000013919800134A4B2151CDCE7301C00E059
:101910000120FEBD25030020A20200202603002096
:10192000F0B53E4E85B0002203900C1C32703C4B4B
:10193000914201D1012201E03A490C801A707F23C3
:101940001C4201D080349C43FFF77EFF3378C0B245
:10195000002B07D000253570FFF776FF3378C0B233
:10196000AB4236D1432803D0712853D01528EBD190
:10197000012300930120FFF755FF0098FFF752FF66
:1019800000998025C843C0B2FFF74CFF039B002796
:101990000293244A1388002B1DD121490193097811
:1019A000002918D10198FFF73DFF391C0198FFF776
:1019B00079FF013D071C002DEBD1000AC0B2FFF7F3
:1019C00031FFF8B2FFF72EFFFFF73EFF3378002B11
:1019D0000AD035701FE00299013B09781380029B01
:1019E000019101330293DDE7C0B2062807D1009BC5
:1019F00003990133DBB280310093803C0391002CCA
:101A0000B8D10420FFF70EFFFFF71EFF044B01259E
:101A10001C7000E00025281C05B0F0BD2503002047
:101A200026030020A2020020F0B5384C87B0002326
:101A300001902370994201D1012301E0344A1180C1
:101A4000344A642613704320FFF7ECFE324FFFF751
:101A5000F3FE002803D1002F03D0013FF7E7002F4A
:101A600003D1013E002EEED14DE00125FFF7ECFE43
:101A70002378002B38D1C0B20290012805D0042869
:101A80003DD10620FFF7CEFE39E005AE0221301C25
:101A9000FFF714FF01988021FFF710FF23780390D0
:101AA000002B18D1FFF7D0FE0702FFF7CDFEBFB223
:101AB00023783F18BFB2012B0DD0039B9F4207D163
:101AC0003378AB4204D1EB437278DBB29A4204D054
:101AD0001820FFF7A7FE002303E00620FFF7A2FE71
:101AE000029B2278002A02D0002626700BE0012BF0
:101AF00005D1019A6B1C8032DDB20192B6E7054A2E
:101B0000002313700126301C07B0F0BD2503002010
:101B1000A20200202603002000350C00002934D04A
:101B20000123002210B488422CD301242407A142AF
:101B300004D2814202D209011B01F8E7E400A1426C
:101B400004D2814202D249005B00F8E7884201D307
:101B5000401A1A434C08A04202D3001B5C082243DF
:101B60008C08A04202D3001B9C082243CC08A04250
:101B700002D3001BDC082243002803D01B0901D03C
:101B80000909E3E7101C10BC7047002801D00020B1
:101B9000C04307B4024802A14018029003BDC046EA
:101BA000190000000029F0D003B5FFF7B9FF0EBC03
:101BB0004243891A1847C0467047C04610B50023F3
:101BC000934203D0CC5CC4540133F9E710BD031C2D
:101BD0008218934202D019700133FAE7704700234C
:101BE000C25C0133002AFBD1581E7047F8B5C046CD
:101BF000F8BC08BC9E467047F8B5C046F8BC08BCA7
:101C00009E4670470403090441726475696E6F2033
:101C10004C4C430041726475696E6F204D4B5220ED
:101C2000576946692031303130000000120100024E
:101C300002000040412354000002010200010000A4
:101C4000080000001000000020000000400000001C
:101C500080000000000100000002000000040000FD
:101C60002518000049180000391800007D180000F0
:101C70009718000021190000291A000076002000A2
:101C80004D617220313920323031380030393A34E8
:101C9000353A313400580A0D00590A0D005A002314
:101CA0000A0D003E00322E3000000000AD10000092
:101CB000C9100000E5100000091100002511000006
:101CC000091100004D1100005B41726475696E6F6F
:101CD0003A58595A5D000000211042206330844078
:101CE000A550C660E770088129914AA16BB18CC1EB
:101CF000ADD1CEE1EFF13112100273325222B55262
:101D00009442F772D662399318837BB35AA3BDD33A
:101D10009CC3FFF3DEE36224433420040114E66431
:101D2000C774A44485546AA54BB528850995EEE58A
:101D3000CFF5ACC58DD55336722611163006D77641
:101D4000F6669556B4465BB77AA719973887DFF7DA
:101D5000FEE79DD7BCC7C448E5588668A778400809
:101D6000611802282338CCC9EDD98EE9AFF948892A
:101D700069990AA92BB9F55AD44AB77A966A711AA1
:101D8000500A333A122AFDDBDCCBBFFB9EEB799B7A
:101D9000588B3BBB1AABA66C877CE44CC55C222CF1
:101DA000033C600C411CAEED8FFDECCDCDDD2AADCA
:101DB0000BBD688D499D977EB66ED55EF44E133E81
:101DC000322E511E700E9FFFBEEFDDDFFCCF1BBF1A
:101DD0003AAF599F788F8891A981CAB1EBA10CD1F4
:101DE0002DC14EF16FE18010A100C230E3200450FC
:101DF000254046706760B9839893FBA3DAB33DC36F
:101E00001CD37FE35EF3B1029012F322D23235424B
:101E1000145277625672EAB5CBA5A89589856EF5FE
:101E20004FE52CD50DC5E234C324A014810466749B
:101E3000476424540544DBA7FAB79987B8975FE74E
:101E40007EF71DC73CD7D326F2369106B0165766EB
:101E50007676154634564CD96DC90EF92FE9C899D6
:101E6000E9898AB9ABA94458654806782768C0183B
:101E7000E1088238A3287DCB5CDB3FEB1EFBF98BAE
:101E8000D89BBBAB9ABB754A545A376A167AF10A8B
:101E9000D01AB32A923A2EFD0FED6CDD4DCDAABDBE
:101EA0008BADE89DC98D267C076C645C454CA23CDB
:101EB000832CE01CC10C1FEF3EFF5DCF7CDF9BAF8E
:101EC000BABFD98FF89F176E367E554E745E932E2B
:0C1ED000B23ED10EF01E00000000000029
:101EDC0001140000090243000201008032090400D1
:101EEC000001020200000524001001042402000578
:101EFC00240600010524010001070583030800FFE7
:101F0C0009040100020A00000007058102400000DC
:101F1C00070502024000000000C20100000008009A
:0C1F2C00690000004100000000000000FF
:0400000300000B816D
:00000001FF

View file

@ -33,6 +33,8 @@
#include "board_definitions_arduino_mkrgsm1400.h"
#elif defined(BOARD_ID_arduino_mkrwan1300)
#include "board_definitions_arduino_mkrwan1300.h"
#elif defined(BOARD_ID_arduino_mkrwifi1010)
#include "board_definitions_arduino_mkrwifi1010.h"
#else
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
#endif

View file

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

View file

@ -22,5 +22,8 @@ mv -v samd21_sam_ba_arduino_mkrgsm1400.* ../mkrgsm1400/
BOARD_ID=arduino_mkrwan1300 NAME=samd21_sam_ba_arduino_mkrwan1300 make clean all
mv -v samd21_sam_ba_arduino_mkrwan1300.* ../mkrwan1300/
BOARD_ID=arduino_mkrwifi1010 NAME=samd21_sam_ba_arduino_mkrwifi1010 make clean all
mv -v samd21_sam_ba_arduino_mkrwifi1010.* ../mkrwifi1010/
echo Done building bootloaders!

View file

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

View file

@ -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)
*(.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")
}

View file

@ -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)
*(.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")
}

View file

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

View file

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

View file

@ -0,0 +1,252 @@
/*
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
*/
#include "variant.h"
#include "Arduino.h"
const PinDescription g_APinDescription[] = {
/*
+------------+------------------+--------+-----------------+--------+-----------------------+---------+---------+--------+--------+----------+----------+
| Pin number | MKR Board pin | PIN | Notes | Peri.A | Peripheral B | Perip.C | Perip.D | Peri.E | Peri.F | Periph.G | Periph.H |
| | | | | EIC | ADC | AC | PTC | DAC | SERCOMx | SERCOMx | TCCx | TCCx | COM | AC/GLCK |
| | | | |(EXTINT)|(AIN)|(AIN)| | | (x/PAD) | (x/PAD) | (x/WO) | (x/WO) | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| 00 | D0 | PA22 | | *06 | | | X10 | | 3/00 | 5/00 |* TC4/0 | TCC0/4 | | GCLK_IO6 |
| 01 | D1 | PA23 | | *07 | | | X11 | | 3/01 | 5/01 |* TC4/1 | TCC0/5 | USB/SOF | GCLK_IO7 |
| 02 | D2 | PA10 | | 10 | *18 | | X02 | | 0/02 | 2/02 |*TCC1/0 | TCC0/2 | I2S/SCK0 | GCLK_IO4 |
| 03 | D3 | PA11 | | 11 | *19 | | X03 | | 0/03 | 2/03 |*TCC1/1 | TCC0/3 | I2S/FS0 | GCLK_IO5 |
| 04 | D4 | PB10 | | *10 | | | | | | 4/02 |* TC5/0 | TCC0/4 | I2S/MCK1 | GCLK_IO4 |
| 05 | D5 | PB11 | | *11 | | | | | | 4/03 |* TC5/1 | TCC0/5 | I2S/SCK1 | GCLK_IO5 |
| 06 | D6 | PA20 | LED_BUILTIN | *04 | | | X08 | | 5/02 | 3/02 | |*TCC0/6 | I2S/SCK0 | GCLK_IO4 |
| 07 | D7 | PA21 | | *05 | | | X09 | | 5/03 | 3/03 | |*TCC0/7 | I2S/FS0 | GCLK_IO5 |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
*/
{ PORTA, 22, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM4_CH0, TC4_CH0, EXTERNAL_INT_6 },
{ PORTA, 23, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 },
{ PORTA, 10, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel18, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_NONE },
{ PORTA, 11, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel19, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_NONE },
{ PORTB, 10, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM5_CH0, TC5_CH0, EXTERNAL_INT_10 },
{ PORTB, 11, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM5_CH1, TC5_CH1, EXTERNAL_INT_11 },
{ PORTA, 20, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH6, TCC0_CH6, EXTERNAL_INT_4 },
{ PORTA, 21, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH7, TCC0_CH7, EXTERNAL_INT_5 },
/*
+------------+------------------+--------+-----------------+--------+-----------------------+---------+---------+--------+--------+----------+----------+
| Pin number | MKR Board pin | PIN | Notes | Peri.A | Peripheral B | Perip.C | Perip.D | Peri.E | Peri.F | Periph.G | Periph.H |
| | | | | EIC | ADC | AC | PTC | DAC | SERCOMx | SERCOMx | TCCx | TCCx | COM | AC/GLCK |
| | | | |(EXTINT)|(AIN)|(AIN)| | | (x/PAD) | (x/PAD) | (x/WO) | (x/WO) | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| | SPI | | | | | | | | | | | | | |
| 08 | MOSI | PA16 | | *00 | | | X04 | | *1/00 | 3/00 |*TCC2/0 | TCC0/6 | | GCLK_IO2 |
| 09 | SCK | PA17 | | *01 | | | X05 | | *1/01 | 3/01 | TCC2/1 | TCC0/7 | | GCLK_IO3 |
| 10 | MISO | PA19 | | 03 | | | X07 | | *1/03 | 3/03 |* TC3/1 | TCC0/3 | I2S/SD0 | AC/CMP1 |
+------------+------------------+--------+-----------------+--------------------+-----+-----+---------+---------+--------+--------+----------+----------+
| | Wire | | | | | | | | | | | | | |
| 11 | SDA | PA08 | | NMI | *16 | | X00 | | *0/00 | 2/00 | TCC0/0 | TCC1/2 | I2S/SD1 | |
| 12 | SCL | PA09 | | 09 | *17 | | X01 | | *0/01 | 2/01 | TCC0/1 | TCC1/3 | I2S/MCK0 | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| | Serial1 | | | | | | | | | | | | | |
| 13 | RX | PB23 | | 07 | | | | | | *5/03 | | | | GCLK_IO1 |
| 14 | TX | PB22 | | 06 | | | | | | *5/02 | | | | GCLK_IO0 |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
*/
// DIPO=3 DOPO=0
{ PORTA, 16, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_0 }, // MOSI: SERCOM1/PAD[0]
{ PORTA, 17, PIO_SERCOM, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // SCK: SERCOM1/PAD[1]
{ PORTA, 19, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_NONE }, // MISO: SERCOM1/PAD[3]
// PINOUT=0
{ PORTA, 8, PIO_SERCOM, (PIN_ATTR_DIGITAL ), ADC_Channel16, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NMI }, // SDA: SERCOM0/PAD[0]
{ PORTA, 9, PIO_SERCOM, (PIN_ATTR_DIGITAL ), ADC_Channel17, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCL: SERCOM0/PAD[1]
// RXPO=3 TXPO=1
{ PORTB, 23, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RX: SERCOM5/PAD[3]
{ PORTB, 22, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // TX: SERCOM5/PAD[2]
/*
+------------+------------------+--------+-----------------+--------+-----------------------+---------+---------+--------+--------+----------+----------+
| Pin number | MKR Board pin | PIN | Notes | Peri.A | Peripheral B | Perip.C | Perip.D | Peri.E | Peri.F | Periph.G | Periph.H |
| | | | | EIC | ADC | AC | PTC | DAC | SERCOMx | SERCOMx | TCCx | TCCx | COM | AC/GLCK |
| | | | |(EXTINT)|(AIN)|(AIN)| | | (x/PAD) | (x/PAD) | (x/WO) | (x/WO) | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| 15 | A0 / DAC0 | PA02 | | 02 | *00 | | Y00 | OUT | | | | | | |
| 16 | A1 | PB02 | | *02 | *10 | | Y08 | | | 5/00 | | | | |
| 17 | A2 | PB03 | | *03 | *11 | | Y09 | | | 5/01 | | | | |
| 18 | A3 | PA04 | | 04 | *04 | 00 | Y02 | | | 0/00 |*TCC0/0 | | | |
| 19 | A4 | PA05 | | 05 | *05 | 01 | Y03 | | | 0/01 |*TCC0/1 | | | |
| 20 | A5 | PA06 | | 06 | *06 | 02 | Y04 | | | 0/02 | TCC1/0 | | | |
| 21 | A6 | PA07 | | 07 | *07 | 03 | Y05 | | | 0/03 | TCC1/1 | | I2S/SD0 | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
*/
{ PORTA, 2, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG /*DAC*/ ), ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
{ PORTB, 2, PIO_ANALOG, (PIN_ATTR_DIGITAL ), ADC_Channel10, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 },
{ PORTB, 3, PIO_ANALOG, (PIN_ATTR_DIGITAL ), ADC_Channel11, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 },
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel4, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NONE },
{ PORTA, 5, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel5, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_NONE },
{ PORTA, 6, PIO_ANALOG, (PIN_ATTR_DIGITAL ), ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
{ PORTA, 7, PIO_ANALOG, (PIN_ATTR_DIGITAL ), ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
/*
+------------+------------------+--------+-----------------+--------+-----------------------+---------+---------+--------+--------+----------+----------+
| Pin number | MKR Board pin | PIN | Notes | Peri.A | Peripheral B | Perip.C | Perip.D | Peri.E | Peri.F | Periph.G | Periph.H |
| | | | | EIC | ADC | AC | PTC | DAC | SERCOMx | SERCOMx | TCCx | TCCx | COM | AC/GLCK |
| | | | |(EXTINT)|(AIN)|(AIN)| | | (x/PAD) | (x/PAD) | (x/WO) | (x/WO) | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| | USB | | | | | | | | | | | | | |
| 22 | | PA24 | USB N | 12 | | | | | 3/02 | 5/02 | TC5/0 | TCC1/2 | USB/DM | |
| 23 | | PA25 | USB P | 13 | | | | | 3/03 | 5/03 | TC5/1 | TCC1/3 | USB/DP | |
| 24 | | PA18 | USB ID | 02 | | | X06 | | 1/02 | 3/02 | TC3/0 | TCC0/2 | | AC/CMP0 |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| 25 | AREF | PA03 | | 03 | 01 | | Y01 | | | | | | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
*/
{ 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, 18, PIO_DIGITAL, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
{ PORTA, 3, PIO_DIGITAL, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VREFP
/*
+------------+------------------+--------+-----------------+--------+-----------------------+---------+---------+--------+--------+----------+----------+
| Pin number | MKR Board pin | PIN | Notes | Peri.A | Peripheral B | Perip.C | Perip.D | Peri.E | Peri.F | Periph.G | Periph.H |
| | | | | EIC | ADC | AC | PTC | DAC | SERCOMx | SERCOMx | TCCx | TCCx | COM | AC/GLCK |
| | | | |(EXTINT)|(AIN)|(AIN)| | | (x/PAD) | (x/PAD) | (x/WO) | (x/WO) | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| | WiFi SPI | | | | | | | | | | | | | |
| 26 | | PA12 | NINA_MOSI | 12 | | | | | *2/00 | 4/00 | TCC2/0 | TCC0/6 | | AC/CMP0 |
| 27 | | PA13 | NINA_MISO | 13 | | | | | *2/01 | 4/01 | TCC2/1 | TCC0/7 | | AC/CMP1 |
| 28 | | PA14 | NINA_CS | 14 | | | | | 2/02 | 4/02 | TC3/0 | TCC0/4 | | GCLK_IO0 |
| 29 | | PA15 | NINA_SCK | 15 | | | | | *2/03 | 4/03 | TC3/1 | TCC0/5 | | GCLK_IO1 |
| 30 | | PA27 | NINA_GPIO0 | *15 | | | | | | | | | | GCLK_IO0 |
| 31 | | PB08 | NINA_RESETN | 08 | 02 | | Y14 | | | 4/00 | TC4/0 | | | |
| 32 | | PB09 | ADC_VBAT | *09 | 03 | | Y15 | | | 4/01 | TC4/1 | | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| | 32768Hz Crystal | | | | | | | | | | | | | |
| 33 | | PA00 | XIN32 | 00 | | | | | | 1/00 | TCC2/0 | | | |
| 34 | | PA01 | XOUT32 | 01 | | | | | | 1/01 | TCC2/1 | | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
| 35 | | PA28 | NINA_ACK | 01 | | | | | | 1/01 | TCC2/1 | | | |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
*/
// DIPO=3 DOPO=0
{ PORTA, 12, PIO_SERCOM, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MOSI: SERCOM2/PAD[0]
{ PORTA, 13, PIO_SERCOM, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCK: SERCOM2/PAD[1]
{ PORTA, 14, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SS: as GPIO
{ PORTA, 15, PIO_SERCOM, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // MISO: SERCOM2/PAD[3]
{ PORTA, 27, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 },
{ PORTB, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG ), ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
{ PORTB, 9, PIO_ANALOG, (PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel3, PWM4_CH1, TC4_CH1, EXTERNAL_INT_9 },
{ PORTA, 0, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
{ PORTA, 1, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
{ PORTA, 28, PIO_DIGITAL, (PIN_ATTR_DIGITAL ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
};
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);
#if defined(USE_BQ24195L_PMIC)
#include "wiring_private.h"
#define PMIC_ADDRESS 0x6B
#define PMIC_REG01 0x01
#define PMIC_REG07 0x07
static inline void enable_battery_charging() {
PERIPH_WIRE.initMasterWIRE(100000);
PERIPH_WIRE.enableWIRE();
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG01);
PERIPH_WIRE.sendDataMasterWIRE(0x1B); // Charge Battery + Minimum System Voltage 3.5V
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
PERIPH_WIRE.disableWIRE();
}
static inline void disable_battery_fet(bool disabled) {
PERIPH_WIRE.initMasterWIRE(100000);
PERIPH_WIRE.enableWIRE();
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG07);
// No D+/D detection + Safety timer not slowed by 2X during input DPM or thermal regulation +
// BAT fet disabled/enabled + charge and bat fault INT
PERIPH_WIRE.sendDataMasterWIRE(0x0B | (disabled ? 0x20 : 0x00));
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
PERIPH_WIRE.disableWIRE();
}
#endif
void initVariant() {
#if defined(USE_BQ24195L_PMIC)
pinMode(ADC_BATTERY, OUTPUT);
digitalWrite(ADC_BATTERY, LOW);
delay(10);
pinMode(ADC_BATTERY, INPUT);
delay(100);
bool batteryPresent = analogRead(ADC_BATTERY) > 600;
if (batteryPresent) {
enable_battery_charging();
}
disable_battery_fet(!batteryPresent);
#endif
// NINA - SPI boot
pinMode(NINA_GPIO0, OUTPUT);
digitalWrite(NINA_GPIO0, HIGH);
// disable NINA
pinMode(NINA_RESETN, OUTPUT);
digitalWrite(NINA_RESETN, HIGH);
}
// Serial1
Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX);
void SERCOM5_Handler()
{
Serial1.IrqHandler();
}
// Serial2
Uart Serial2(&sercom2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX, PIN_SERIAL2_RTS, PIN_SERIAL2_CTS);
void SERCOM2_Handler()
{
Serial2.IrqHandler();
}

View file

@ -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
*/
#pragma once
// The definitions here needs a SAMD core >=1.6.10
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
#include <WVariant.h>
// General definitions
// -------------------
// Frequency of the board main oscillator
#define VARIANT_MAINOSC (32768ul)
// Master clock frequency
#define VARIANT_MCK (48000000ul)
// Pins
// ----
// Number of pins defined in PinDescription array
#define PINS_COUNT (26u)
#define NUM_DIGITAL_PINS (15u)
#define NUM_ANALOG_INPUTS (7u)
#define NUM_ANALOG_OUTPUTS (1u)
// Low-level pin register query macros
// -----------------------------------
#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)
//Battery
#define ADC_BATTERY (32u)
//NINA
#define NINA_GPIO0 (30u)
#define NINA_RESETN (31u)
#define NINA_ACK (35u)
// LEDs
// ----
#define PIN_LED (6u)
#define LED_BUILTIN PIN_LED
// Analog pins
// -----------
#define PIN_A0 (15u)
#define PIN_A1 (16u)
#define PIN_A2 (17u)
#define PIN_A3 (18u)
#define PIN_A4 (19u)
#define PIN_A5 (20u)
#define PIN_A6 (21u)
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;
#define ADC_RESOLUTION 12
// SPI Interfaces
// --------------
#define SPI_INTERFACES_COUNT 2
// SPI
#define PIN_SPI_MISO (10u)
#define PIN_SPI_MOSI (8u)
#define PIN_SPI_SCK (9u)
#define PIN_SPI_SS (4u)
#define PERIPH_SPI sercom1
#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; // SPI Slave SS not 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;
// SPI1
#define PIN_SPI1_MISO (27u)
#define PIN_SPI1_MOSI (26u)
#define PIN_SPI1_SCK (29u)
#define PIN_SPI1_SS (28u)
#define PERIPH_SPI1 sercom2
#define PAD_SPI1_TX SPI_PAD_0_SCK_3
#define PAD_SPI1_RX SERCOM_RX_PAD_1
static const uint8_t SS1 = PIN_SPI1_SS;
static const uint8_t MOSI1 = PIN_SPI1_MOSI;
static const uint8_t MISO1 = PIN_SPI1_MISO;
static const uint8_t SCK1 = PIN_SPI1_SCK;
#define SPIWIFI_SS PIN_SPI1_SS
#define SPIWIFI_ACK NINA_ACK
#define SPIWIFI_RESET (~NINA_RESETN) // fixme! Inverted logic
// Wire Interfaces
// ---------------
#define WIRE_INTERFACES_COUNT 1
// Wire
#define PIN_WIRE_SDA (11u)
#define PIN_WIRE_SCL (12u)
#define PERIPH_WIRE sercom0
#define WIRE_IT_HANDLER SERCOM0_Handler
// USB
// ---
#define PIN_USB_DM (22ul)
#define PIN_USB_DP (23ul)
#define PIN_USB_HOST_ENABLE (24ul)
// I2S Interfaces
// --------------
#define I2S_INTERFACES_COUNT 1
#define I2S_DEVICE 0
#define I2S_CLOCK_GENERATOR 3
#define PIN_I2S_SD (PIN_A6)
#define PIN_I2S_SCK (2u)
#define PIN_I2S_FS (3u)
// Serial ports
// ------------
#ifdef __cplusplus
#include "SERCOM.h"
#include "Uart.h"
// Instances of SERCOM
extern SERCOM sercom0;
extern SERCOM sercom1;
extern SERCOM sercom2;
extern SERCOM sercom3;
extern SERCOM sercom4;
extern SERCOM sercom5;
// Serial1
extern Uart Serial1;
#define PIN_SERIAL1_RX (13ul)
#define PIN_SERIAL1_TX (14ul)
#define PAD_SERIAL1_TX (UART_TX_PAD_2)
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
// Serial2
extern Uart Serial2;
#define PIN_SERIAL2_RX (27ul)
#define PIN_SERIAL2_TX (26ul)
#define PAD_SERIAL2_TX (UART_TX_RTS_CTS_PAD_0_2_3)
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1)
#define PIN_SERIAL2_RTS (28u)
#define PIN_SERIAL2_CTS (29u)
#endif // __cplusplus
// 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
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial1
// Alias Serial to SerialUSB
#define Serial SerialUSB
// Alias Serial1 to SerialNina (useful in libraries)
#define SerialNina Serial1
#define SPIWIFI SPI1