diff --git a/.gitignore b/.gitignore index 192fb0945..2ad1d1f84 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.bz2 + +bootloaders/*/build/ diff --git a/CHANGELOG b/CHANGELOG index b1e0ffb07..11b79f3a6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,12 +1,53 @@ -SAMD CORE 1.6.3 +SAMD CORE 1.6.6 2016.05.19 +* Fixed digitalPinToInterrupt() macro, now it works as documented. +* Added analogInputToDigitalPin macro +* Fixed NUM_DIGITAL_PINS for Zero Board. +* On-board RX-TX LEDs now blinks when there is activity on the native USB port +* Fixed platform.txt, the core now compiles again with Arduino IDE <=1.6.5. Thanks @per1234 +* Fixed Wire.write(0x00) "ambiguos method" error +* String class now supports iterators. Thanks @Chris--A +* Remove enabling bootloader protection when burning bootloader. This enables WDT, so sketches do not work. +* Added remote upload for Yun-Shield + +SAMD CORE 1.6.5 2016.04.02 + +* Added Arduino/Genuino MKR1000 board +* Set NVMCTRL.MANW bit to 1 (default is 0). This prevents accidental writes on program memory. +* Bootloader: Fixed wrong UART speed (regression) +* Fixed incorrect return value from Wire.available() when the receive buffer is not fully read. +* Added DAC0 definition in Arduino/Genuino Zero variant file. +* Enabled bootloader protection after "Burn bootloader". + +SAMD CORE 1.6.4 2016.02.19 + +* Fixed Wire address setup when running as slave. +* Fixed String constructor when using floating point numbers. +* USBHost: fixed blocking USBHost.Task(). Thanks @bbx10 +* USBHost: fixed some ASCII Control codes in keyboard controller. Thanks @bbx10 +* USBHost: ported some minor fix from upstream UHS2. Thanks @bbx10 +* USBHost: fixed wrong library initialization. Thanks @bbx10 @ladyada +* better interrupt handling in Serial::accept() + +SAMD CORE 1.6.3 2016.02.15 + +* Added drivers for Arduino/Genuino MKR1000 board +* Fixed Wire master repeated start behaviour +* Added SerialUSB methods: readBreak(), baud(), stopbits(), paritytype(), numbits(), dtr(), rts() * Added SPI.transfer16(..) method * Bugfix: added missing Serial.begin(baud, config) method. Thanks @tuxedo0801 +* Fixed Serial baudrate calculations for 1200bps. Thanks @TomKeddie +* Fixed Serial.flush() that now waits until the last bit has been sent. Thanks @TomKeddie +* Fixed Serial configuration for data-bit. Thanks @TomKeddie * Bootloader: 32Khz external oscillator is now used, improves USB clock. Thanks @aethaniel * Bootloader: Clean up of makefiles and file organization. Thanks @aethaniel * Added PWM capability to pins A1/A2 of Arduino Zero. * variant.h/cpp: PWM capability is now determined by PIN_ATTR_PWM combined with PIN_ATTR_TIMER or PIN_ATTR_TIMER_ALT for timer selection. +* Small fix to USBHost example "USB_desc.ino". Thanks @bbx10 +* USBHost: USB-Keyboard right shift key was ignored. Thanks @bbx10 +* Wire library now support multiple instances in variant. Thanks @spiderkeys +* Ported some SerialUSB API (readBreak(), baud(), stopbits(), paritytype(), numbits(), dtr(), rts()) SAMD CORE 1.6.2 2015.11.03 diff --git a/VARIANT_COMPLIANCE_CHANGELOG b/VARIANT_COMPLIANCE_CHANGELOG new file mode 100644 index 000000000..bf1a4df97 --- /dev/null +++ b/VARIANT_COMPLIANCE_CHANGELOG @@ -0,0 +1,8 @@ +SAMD CORE 1.6.6 + +* digitalPinToInterrupt #define moved to Arduino.h, variant.h must no longer define it + +SAMD CORE 1.6.3 + +* Timer for pin PWM selected based on value of PIN_ATTR_TIMER_ALT or PIN_ATTR_TIMER, + prior to this "pin type" (ulPinType) was used diff --git a/boards.txt b/boards.txt index 5e9985120..2adab40d6 100644 --- a/boards.txt +++ b/boards.txt @@ -87,3 +87,48 @@ arduino_zero_native.build.vid=0x2341 arduino_zero_native.build.pid=0x804d arduino_zero_native.bootloader.tool=openocd arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin + +# Arduino/Genuino MKR1000 +# --------------------------------------- +mkr1000.name=Arduino/Genuino MKR1000 +mkr1000.vid.0=0x2341 +mkr1000.pid.0=0x804e +mkr1000.vid.1=0x2341 +mkr1000.pid.1=0x004e + +mkr1000.vid.2=0x2341 +mkr1000.pid.2=0x824e +# If the board is a 2341:824e use 2341:824e for build and set other parameters as well +mkr1000.vid.2.build.vid=0x2341 +mkr1000.vid.2.build.pid=0x824e +mkr1000.vid.2.build.usb_product="Genuino MKR1000" +mkr1000.vid.2.bootloader.file=mkr1000/samd21_sam_ba_genuino_mkr1000.bin + +mkr1000.vid.3=0x2341 +mkr1000.pid.3=0x024e +# If the board is a 2341:024e use 2341:824e for build and set other parameters as well +mkr1000.vid.3.build.vid=0x2341 +mkr1000.vid.3.build.pid=0x824e +mkr1000.vid.3.build.usb_product="Genuino MKR1000" +mkr1000.vid.3.bootloader.file=mkr1000/samd21_sam_ba_genuino_mkr1000.bin + +mkr1000.upload.tool=bossac +mkr1000.upload.protocol=sam-ba +mkr1000.upload.maximum_size=262144 +mkr1000.upload.use_1200bps_touch=true +mkr1000.upload.wait_for_upload_port=true +mkr1000.upload.native_usb=true +mkr1000.build.mcu=cortex-m0plus +mkr1000.build.f_cpu=48000000L +mkr1000.build.usb_product="Arduino MKR1000" +mkr1000.build.usb_manufacturer="Arduino LLC" +mkr1000.build.board=SAMD_MKR1000 +mkr1000.build.core=arduino +mkr1000.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} +mkr1000.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld +mkr1000.build.openocdscript=openocd_scripts/arduino_zero.cfg +mkr1000.build.variant=mkr1000 +mkr1000.build.vid=0x2341 +mkr1000.build.pid=0x804e +mkr1000.bootloader.tool=openocd +mkr1000.bootloader.file=mkr1000/samd21_sam_ba_arduino_mkr1000.bin diff --git a/bootloaders/mkr1000/README.md b/bootloaders/mkr1000/README.md new file mode 100644 index 000000000..7a30bd7cb --- /dev/null +++ b/bootloaders/mkr1000/README.md @@ -0,0 +1,6 @@ + +The source code of the bootloader is in the folder: + + bootloader/zero/ + + diff --git a/bootloaders/mkr1000/samd21_sam_ba_arduino_mkr1000.bin b/bootloaders/mkr1000/samd21_sam_ba_arduino_mkr1000.bin new file mode 100755 index 000000000..4a390fe10 Binary files /dev/null and b/bootloaders/mkr1000/samd21_sam_ba_arduino_mkr1000.bin differ diff --git a/bootloaders/mkr1000/samd21_sam_ba_arduino_mkr1000.hex b/bootloaders/mkr1000/samd21_sam_ba_arduino_mkr1000.hex new file mode 100644 index 000000000..5dec260ff --- /dev/null +++ b/bootloaders/mkr1000/samd21_sam_ba_arduino_mkr1000.hex @@ -0,0 +1,376 @@ +:10000000FC7F0020E9050000D5050000D9050000AF +:1000100000000000000000000000000000000000E0 +:10002000000000000000000000000000DD050000EE +:100030000000000000000000E1050000E5050000F0 +:1000400010B5064C2378002B07D1054B002B02D0AE +:10005000044800E000BF0123237010BD58000020B9 +:1000600000000000F816000008B5084B002B03D074 +:100070000748084900E000BF07480368002B03D089 +:10008000064B002B00D0984708BDC046000000007A +:10009000F81600005C000020540000200000000062 +:1000A00010B5C3699C07FCD403680224A343036012 +:1000B000C46901231C42FBD1046823430360036825 +:1000C000DC07FCD4C46901231C42FBD1C469DC40B9 +:1000D0001C42F7D1084B1A430260C3695A07FCD48B +:1000E000C0239B0243608181C3699C07FCD40368E1 +:1000F00002221343036010BD04000040037EDA07B0 +:10010000FCD5018570470000027E01235107FBD515 +:10011000428B1A4207D1428BDA401A4203D1428BFA +:1001200092081A4202D0034B01221A70008DC0B20D +:100130007047C0467400002070B50368041C988B9B +:100140001A1C0821FF32084228D0988B174D014312 +:10015000802099839872112353704021144B917120 +:1001600050715E68C0202E40800506435E605E6967 +:100170003540284358610F4818600F4818615D6882 +:100180000E4828408025AD02284358605868800BEF +:100190008003586000235171237105E0137ADA0659 +:1001A00002D5201C00F0A0FA207970BDFFFFFF8F60 +:1001B0008C0100208C0000200C010020FF3F00F08B +:1001C000002303714371044B016083600B780222AA +:1001D00013430B707047C0463901000038B5364BE9 +:1001E0002021DA6901200A43DA61344B06241A78A7 +:1001F00002431A70324B0F22197891431970197803 +:10020000214319702F490C782043087019780A404F +:100210001A701A7860210A431A702B4B2B4A5A80A5 +:100220005A7852B2002AFBDB294B01211A780A4383 +:100230001A709A78D107FCD426480268510B1F2205 +:100240001140914200D1052111408C011D8D2249A0 +:100250002940214319850468A10C0A401F2A00D1B6 +:100260001D221C8D1F210A408C4322431A850268DF +:100270000721D20D0A408A4200D103220A40188D7C +:100280001103164A02400A431A8519787F220A4050 +:100290001A701A78042112480A431A7058621A898F +:1002A0000C218A431A811A8901218A431A8100216B +:1002B000802201F0B6F838BD0004004058440041E7 +:1002C0003C44004159440041000C004006400000FD +:1002D00000500041246080003FF8FFFFFF8FFFFFC8 +:1002E0008C010020F7B5141C234A5F0101971D1CE7 +:1002F000D319061C5869271C4000400F03301033E7 +:10030000C74006D00F1C8022596812060A435A6063 +:1003100009E02F1C7B1E9F41184BBF01FF18381CA2 +:10032000221C01F075F8019913480835421817612D +:10033000131C5269A104920B890C92030A435A615F +:1003400059690F4A02200A405A616B01F318D979A2 +:10035000032211400143D8799043021C0A43DA7109 +:100360005979802252420A435A716B01F318DB79A2 +:100370009A07FAD5201CFEBD8C0100200C0100203C +:10038000FF3F00F0F8B51E4E041C3378151C002BFF +:1003900012D11C4B1C4A1A645A6C920B92035A6479 +:1003A000586C1A4A02405A64A2235B00E25C402067 +:1003B0000243E254012333704827FF37E25D0123F3 +:1003C00013401AD00F4B5A6C9204920CAA4202D2DC +:1003D0005D6CAD04AD0C081C2A1C0B4901F018F82B +:1003E000E25D03231A4001210A43E15D99430B1C9E +:1003F0001343E3550023337000E01D1C281CF8BD97 +:10040000750000208C010020CC000020FF3F00F090 +:10041000FF30827930239A43131C2022002900D117 +:1004200010221343837170470C4BFF305A6902212D +:10043000920B92035A61027A03231A400A43017A0B +:1004400099430B1C13430372827980235B4213434D +:100450008371037A9A07FCD57047C0468C0100204F +:1004600080235B421943C9B28172704770B5A023E3 +:1004700003225B00C254134B134A5C6CC02114402E +:1004800089050C4346255C64FF35402444550F4DD7 +:1004900030261D6490256D0046555D6B154029433F +:1004A000922559636D0080214155094D1D63B0258A +:1004B0006D0044555C6F22405A67B2235B00C15403 +:1004C00070BDC0468C010020FFFFFF8FCC000020D4 +:1004D0004C01002030B5364A1E235168082099434C +:1004E00002231943516033498A6902438A613248C1 +:1004F000324A9082908A03439382D3689807FCD54E +:100500002F4B012018701878C40704D52C48407868 +:1005100040B20028F7DB01209860587840B20028EC +:10052000FBDB284C26484460587840B20028FBDBAF +:1005300082242348E4014480587840B20028FBDB41 +:10054000908C8024A0439084D068C506FCD51E4CB6 +:100550001A48C462D4681948E506FBD5848C1B4D43 +:100560002C438484D4681548E506FBD5848C022589 +:100570002C438484D0680406FCD51048C068450626 +:10058000F8D5D068C406FCD500229A605A7852B2D9 +:10059000002AFBDB0E480A4A50605A7852B2002A01 +:1005A000FBDB00230B724B728B72CB7230BDC046EB +:1005B00000400041000400400C060000000800401C +:1005C000000C004001050100B805FF7D040A000091 +:1005D000000703000EBEFEE70DBEFEE705BEFEE708 +:1005E00002BEFEE701BEFEE70E4A0F4838B5824262 +:1005F00004D10E4A0E4B93420ED10AE00D4C9442A8 +:10060000F7D00023D1188842F3D9E55804330D60A0 +:10061000F8E700F011F804E09342FAD2002102C397 +:10062000FAE7FEE7000000205800002098030020B1 +:1006300058000020FC16000010B5244B0022197849 +:1006400001231940224B0AD11868224A904201D155 +:10065000196014E01A60204A013A002AFCD11A609D +:100660001E4B1968181C4A1C09D0FF22134206D1E0 +:1006700081F3088893431A4A936043681847FFF749 +:1006800029FF62B600F0F2FC00F0C8F9041CA36870 +:10069000201C9847134B002801D001221A701A78A9 +:1006A000002A05D0002000F035FA00F091FAFCE7AE +:1006B0001B78002BEBD100F04DFD0028E7D0012086 +:1006C00000F028FA00F084FAFCE7C0463804004045 +:1006D000FC7F00203581730748E8010000200000FE +:1006E00000ED00E076000020F8B50468051C201C31 +:1006F000FF30037AB64A10210B430372B54F1378CB +:10070000B5493B705378B54E0B7093783380D178F0 +:10071000338809020B4333801179B14B1980517929 +:100720001F8809020F431F809779AE490F80D27945 +:100730000F8812023A430A8040224271A648A54F10 +:1007400002783878A84F12020243181CBA4200D12E +:1007500099E01EDC802149008A4200D158E107DC83 +:10076000812A6AD0822A6ED0802A00D050E164E0CB +:1007700081235B009A4200D1AFE000DA23E1C0237D +:100780009B009A4200D143E1984B9A4200D11AE172 +:100790003EE190231B019A4242D015DCD023DB00BE +:1007A0009A4222D088231B019A4242D0A023DB0028 +:1007B0009A4200D02CE1201CFFF736FE31882868D1 +:1007C00089B2FFF74DFE27E1894B9A4200D1FAE04A +:1007D00000DC1DE1874B9A4200D1E8E0864B9A424B +:1007E00000D015E133886B71EDE033881B0A012BD3 +:1007F00008D10B8812222868934201D80A8892B245 +:100800007E49DCE033881B0A022B00D000E10B8814 +:1008100043222868934201D80A8892B27849CEE0F0 +:100820003388201C2B71FFF7FFFD201CFFF71EFEF5 +:10083000F2E0291C01C90122C1E0724900230B80AA +:1008400028680222BCE06F4900220A8018885022E2 +:1008500010406D4A10701E880F2030401880188894 +:10086000032800D9D4E012781B8808335B01E41810 +:10087000A379002A01D09B0600E0DB06DB0F0B808A +:10088000286802229BE019887F2291435E4AC9B200 +:10089000117018880F21014019803188002900D07B +:1008A000B6E01988002900D1B2E01988032900D9DF +:1008B000AEE012781B8808335B01E318002A05D0EC +:1008C0005A7930218A4320210A4304E05A793021A1 +:1008D0008A43102002435A7175E002887F239A43AD +:1008E000494BD2B21A7001880F220A400280328826 +:1008F000002A00D08CE00288002A00D188E002881B +:10090000032A00D984E01B78002B27D00388083302 +:100910005B01E3189B79990655D50388302108338C +:100920005B01E3181A798A4320210A431A7103886C +:1009300008335B01E318DB795A0644D5038860214C +:1009400008335B01E318DA798A4340210A43DA71FC +:100950000388022208335B01E31826E0038808338A +:100960005B01E3189B79DF062DD50388302108331E +:100970005B01E3181A798A4310210A431A7103882C +:1009800008335B01E318DB7999061CD503886021E5 +:1009900008335B01E318DA798A4320210A43DA71CC +:1009A0000388012208335B01E3181A710BE00B88FE +:1009B00008222868934201D80A8892B2134900237A +:1009C000FFF790FC28E0201CFFF72EFD24E0C04636 +:1009D0008C0000208100002077000020780000209B +:1009E0007C0000207E0000200203000001030000C4 +:1009F00021200000A1210000212200004C14000051 +:100A0000000000207A000020800000204400002028 +:100A1000201C0121FFF7FCFCF8BDC04610B5054BBA +:100A2000054C2360FFF7DAFB201C2168FFF7C8FBA9 +:100A3000201C10BD005000410C02002007B5054BE2 +:100A40000122019001A91868131CFFF74BFC01203B +:100A50000EBDC0460C02002013B5054B6C46073492 +:100A60001868211C0122FFF78DFC207816BDC046B6 +:100A70000C02002010B5074C201CFFF75DFB031C87 +:100A80000020834205D022684823FF33D05C012335 +:100A9000184010BD0C02002010B5054A0C1C031CA8 +:100AA000191C10680123221CFFF71CFC201C10BD20 +:100AB0000C02002070B5084C061C201C0D1CFFF712 +:100AC0003BFB0023984205D02068311C2A1CFFF70D +:100AD00059FC031C181C70BD0C020020F8B50C4C0E +:100AE000051C201C0E1CFFF727FB0023271C341CB1 +:100AF00098420AD0002C07D0291C221C3868FFF726 +:100B000041FC241A2D18F5E7331C181CF8BDC0460B +:100B10000C020020012805D1054B064A1A60064B3D +:100B2000187004E0002802D1044A014B1A60704793 +:100B30007C0200208014000089000020CC140000FA +:100B400030B51A4B85B01B78002B29D0042901D170 +:100B5000026804E0022901D1028800E0027849001D +:100B600004A843180B3B5C1AA3420BD00F20104083 +:100B7000092802D83025284300E0373018701209C0 +:100B8000013BF1E701A830230370782343700A2268 +:100B900043189A700D22DA70054B04311B6801E08E +:100BA000034B1B68DB68984705B030BD8800002008 +:100BB0007C02002072B6EFF30883044A13600368D6 +:100BC00083F30888436818477047C04680020020B6 +:100BD000F0B58FB006A9CD4A0B1C31CA31C351CA3A +:100BE00051C360CA60C3CA4CCA48A3687A255B0374 +:100BF0005B0F9B005B58C8490360A26892B25343E5 +:100C00000A60C649C64A0B6000231360C54B1D70BD +:100C1000C54BC64D1B68281C1B6940219847C44B17 +:100C200000221860C34B1D60C34BC34DC04F1A60F8 +:100C3000286839688842EBD2BE4B1B681A78FF2AB5 +:100C400000D1F7E1232A00D0CEE1BC4E3378002B4F +:100C500005D0B54BBA481B680221DB689847B14BF9 +:100C60001B78532B38D13B682A6893421ED9B14870 +:100C700001322A609A1AB34B01681B680131016086 +:100C8000B14E9A4201D2326000E03360A44832682B +:100C90000068029000F0BCFB336829685A182A608B +:100CA000A44A1668F1181160A84A13702B68013B1A +:100CB0002B60A04B1A68013A1A60A44BA14A1B781A +:100CC00011688B4206D2984A954812680068C91A82 +:100CD00092699047C04676E1522B07D1904A924BD9 +:100CE00010681B68974A5B6911686BE14F2B05D14F +:100CF0008B4B944A1B6812681A7064E1482B05D12B +:100D0000874B904A1B6812681A805CE1572B05D10B +:100D1000834B8C4A1B6812681A6054E16F2B03D115 +:100D20007F4B0121186807E0682B08D17C4B854870 +:100D30001B6802211B880360FFF702FF43E1772B4A +:100D400006D1774B7F481B6804211B680360F3E7DB +:100D5000472B13D17B4B1868FFF72CFF7C4B1B688C +:100D600083F3088862B67B4B1B78002B00D12AE105 +:100D70006D4B06201B681B68984724E1542B04D157 +:100D800001233370684B1B685CE04E2B0BD133782A +:100D9000002B05D1644B6A481B680221DB68984729 +:100DA000002333700FE1562B50D15F4D01212B688A +:100DB0006948DB6898472B680321DB6867489847D8 +:100DC000674E2B68301CDB68012198472B680D218A +:100DD000DB68644898472B68301CDB680121984722 +:100DE000544F614B544E3B60002333603A1C311C1E +:100DF0001368581C10601B780393002B03D00B68FA +:100E000001330B60F4E72B683168DB68564898477C +:100E10002B685348DB68012198470398306053489A +:100E20003860444A1368591C11601A78424B002AF2 +:100E300003D01A6801321A60F3E72A681968D36888 +:100E400098472B68DB683E480221BBE03D4A582B9F +:100E500015D1304E314D366813682A68B10093427F +:100E600008D25808E06142482080207DC507FCD5A3 +:100E70005B18F4E72C4B3F481B68DB68A1E0592B5B +:100E800033D11268264B3C49002A02D11B680B6003 +:100E900026E00868196863688025AB4392086360A0 +:100EA000002A1DD0354B2380237DDE07FCD500238F +:100EB000184D2D680095AD08AB4202D3304D25800A +:100EC00006E09342FAD09D00465901334E51EFE7B8 +:100ED000257DEE07FCD59D0049194019D21ADFE7A0 +:100EE000114B28481B68DB686BE05A2B6BD10C4B0D +:100EF00017681D680026EF19BD4245D02878311CBF +:100F000000F04AF90135061CF6E7C04660140000FF +:100F100000400041340200202C0200202802002062 +:100F200078020020240200207C02002038020020E9 +:100F30001C02002020020020300200208800002037 +:100F4000C014000084020020880200201802002043 +:100F500080020020890000209C140000C5140000BD +:100F60009E140000E8140000A0140000AC1400005F +:100F700002A5FFFFB51400008400002044A5FFFF78 +:100F800004A5FFFFB91400002E4D2F482B68012146 +:100F9000DB68984707230F223240111C3609303195 +:100FA000092A00DD07311020C0186A468154013B30 +:100FB000F1D22B6804A8DB68082198472B682348E6 +:100FC000DB6803219847224D7A232B70214B0022A6 +:100FD0001A60214B1B7893422CD01A4B01211B68BD +:100FE0001E48DB68984725E0111C3039C8B2194B00 +:100FF000092804D81E683201114319601AE0111C37 +:101000004139052903D81868373A010106E0111C57 +:101010006139052904D81D68573A29010A4308E0B7 +:101020002C2A03D10E4A1E68166001E008490A7096 +:1010300000221A600B4B1A6801321A600A4B1A68B8 +:101040000132F2E57C020020BD140000BF14000054 +:10105000240200208402002088000020C314000025 +:1010600078020020300200202002002010B51C4B26 +:1010700001201A78022402431A701A4B0F221978A1 +:101080009143197019782143197017490C7820433E +:10109000087019780A401A701A7820210A431A70C9 +:1010A000124B04211A6A0A431A62114B114A5A80E0 +:1010B0005A7852B2002AFBDBC4220F480F49920330 +:1010C000FEF7EEFF0E4A002313700E4A13700E4A0D +:1010D00013700E4A13700E4A13700E4A137010BD2F +:1010E0004A440041354400414B4400410004004063 +:1010F000000C0040144000000008004204C500003D +:101100008C020020130300208D020020900200209A +:10111000140300201103002008B5C1B20248FEF7F5 +:10112000EDFF012008BDC04600080042024B187EBA +:101130004007C00F7047C0460008004208B5FFF7DF +:10114000F5FF0028FBD00248FEF7DEFF08BDC046D1 +:101150000008004208B5FFF7E9FF0023984205D0D8 +:10116000FFF7ECFF031C233B5A425341181C08BDF8 +:1011700070B5041C0D1C4618B44204D02078FFF74B +:10118000CBFF0134F8E7281C70BD10B5041CFFF735 +:10119000D5FF2070012010BD0B0A5840034B4000C2 +:1011A000C05A0902484080B27047C046F614000099 +:1011B000F7B50024051C0F1C261CBC4220D0FFF7ED +:1011C000BDFF114BC0B21B780190002B1AD1311C0E +:1011D000FFF7E2FF0D4B061C1A88002A04D10C4AC7 +:1011E00011782A1C002907D001996A1C2970802FC8 +:1011F00002D11988013919800134A4B2151CDCE729 +:10120000301C00E00120FEBD110300208E020020F2 +:1012100012030020F0B53E4E85B0002203900C1C56 +:1012200032703C4B914201D1012201E03A490C80DD +:101230001A707F231C4201D080349C43FFF77EFF4D +:101240003378C0B2002B07D000253570FFF776FF4A +:101250003378C0B2AB4236D1432803D0712853D083 +:101260001528EBD1012300930120FFF755FF0098CB +:10127000FFF752FF00998025C843C0B2FFF74CFF2B +:10128000039B00270293244A1388002B1DD1214978 +:1012900001930978002918D10198FFF73DFF391C07 +:1012A0000198FFF779FF013D071C002DEBD1000AE3 +:1012B000C0B2FFF731FFF8B2FFF72EFFFFF73EFF96 +:1012C0003378002B0AD035701FE00299013B097872 +:1012D0001380029B019101330293DDE7C0B206281F +:1012E00007D1009B03990133DBB280310093803C2E +:1012F0000391002CB8D10420FFF70EFFFFF71EFF6B +:10130000044B01251C7000E00025281C05B0F0BD31 +:1013100011030020120300208E020020F0B5384C8B +:1013200087B0002301902370994201D1012301E08D +:10133000344A1180344A642613704320FFF7ECFED0 +:10134000324FFFF7F3FE002803D1002F03D0013FF7 +:10135000F7E7002F03D1013E002EEED14DE001252D +:10136000FFF7ECFE2378002B38D1C0B202900128A1 +:1013700005D004283DD10620FFF7CEFE39E005AEAA +:101380000221301CFFF714FF01988021FFF710FFA6 +:1013900023780390002B18D1FFF7D0FE0702FFF748 +:1013A000CDFEBFB223783F18BFB2012B0DD0039BF7 +:1013B0009F4207D13378AB4204D1EB437278DBB262 +:1013C0009A4204D01820FFF7A7FE002303E006206E +:1013D000FFF7A2FE029B2278002A02D00026267088 +:1013E0000BE0012B05D1019A6B1C8032DDB201921A +:1013F000B6E7054A002313700126301C07B0F0BD84 +:10140000110300208E0200201203002000350C0082 +:1014100010B50023934203D0CC5CC4540133F9E7E8 +:1014200010BD031C8218934202D019700133FAE7F1 +:1014300070470000F8B5C046F8BC08BC9E4670472F +:10144000F8B5C046F8BC08BC9E46704712010002C1 +:101450000200004041234E00000200000001000095 +:101460000800000010000000200000004000000004 +:1014700080000000000100000002000000040000E5 +:10148000191100003D1100002D1100007111000024 +:101490008B110000151200001D13000076002000C3 +:1014A0004E6F7620323420323031350031313A33CC +:1014B000343A303800580A0D00590A0D005A0023FA +:1014C0000A0D003E00322E30000000003D0A0000F0 +:1014D000590A0000750A0000990A0000B50A0000C8 +:1014E000990A0000DD0A00005B41726475696E6F45 +:1014F0003A58595A5D000000211042206330844060 +:10150000A550C660E770088129914AA16BB18CC1D2 +:10151000ADD1CEE1EFF13112100273325222B55249 +:101520009442F772D662399318837BB35AA3BDD322 +:101530009CC3FFF3DEE36224433420040114E66419 +:10154000C774A44485546AA54BB528850995EEE572 +:10155000CFF5ACC58DD55336722611163006D77629 +:10156000F6669556B4465BB77AA719973887DFF7C2 +:10157000FEE79DD7BCC7C448E5588668A7784008F1 +:10158000611802282338CCC9EDD98EE9AFF9488912 +:1015900069990AA92BB9F55AD44AB77A966A711A89 +:1015A000500A333A122AFDDBDCCBBFFB9EEB799B62 +:1015B000588B3BBB1AABA66C877CE44CC55C222CD9 +:1015C000033C600C411CAEED8FFDECCDCDDD2AADB2 +:1015D0000BBD688D499D977EB66ED55EF44E133E69 +:1015E000322E511E700E9FFFBEEFDDDFFCCF1BBF02 +:1015F0003AAF599F788F8891A981CAB1EBA10CD1DC +:101600002DC14EF16FE18010A100C230E3200450E3 +:10161000254046706760B9839893FBA3DAB33DC356 +:101620001CD37FE35EF3B1029012F322D232354233 +:10163000145277625672EAB5CBA5A89589856EF5E6 +:101640004FE52CD50DC5E234C324A0148104667483 +:10165000476424540544DBA7FAB79987B8975FE736 +:101660007EF71DC73CD7D326F2369106B0165766D3 +:101670007676154634564CD96DC90EF92FE9C899BE +:10168000E9898AB9ABA94458654806782768C01823 +:10169000E1088238A3287DCB5CDB3FEB1EFBF98B96 +:1016A000D89BBBAB9ABB754A545A376A167AF10A73 +:1016B000D01AB32A923A2EFD0FED6CDD4DCDAABDA6 +:1016C0008BADE89DC98D267C076C645C454CA23CC3 +:1016D000832CE01CC10C1FEF3EFF5DCF7CDF9BAF76 +:1016E000BABFD98FF89F176E367E554E745E932E13 +:0C16F000B23ED10EF01E00000000000011 +:1016FC0009024300020100803209040000010202C9 +:10170C000000052400100104240200052406000139 +:10171C000524010001070583030800FF09040100EB +:10172C00020A0000000705810240000007050202C2 +:10173C004000000000C20100000008006900000029 +:08174C00410000000000000054 +:04000003000005E90B +:00000001FF diff --git a/bootloaders/mkr1000/samd21_sam_ba_genuino_mkr1000.bin b/bootloaders/mkr1000/samd21_sam_ba_genuino_mkr1000.bin new file mode 100755 index 000000000..95d794698 Binary files /dev/null and b/bootloaders/mkr1000/samd21_sam_ba_genuino_mkr1000.bin differ diff --git a/bootloaders/mkr1000/samd21_sam_ba_genuino_mkr1000.hex b/bootloaders/mkr1000/samd21_sam_ba_genuino_mkr1000.hex new file mode 100644 index 000000000..bf4a61e53 --- /dev/null +++ b/bootloaders/mkr1000/samd21_sam_ba_genuino_mkr1000.hex @@ -0,0 +1,376 @@ +:10000000FC7F0020E9050000D5050000D9050000AF +:1000100000000000000000000000000000000000E0 +:10002000000000000000000000000000DD050000EE +:100030000000000000000000E1050000E5050000F0 +:1000400010B5064C2378002B07D1054B002B02D0AE +:10005000044800E000BF0123237010BD58000020B9 +:1000600000000000F816000008B5084B002B03D074 +:100070000748084900E000BF07480368002B03D089 +:10008000064B002B00D0984708BDC046000000007A +:10009000F81600005C000020540000200000000062 +:1000A00010B5C3699C07FCD403680224A343036012 +:1000B000C46901231C42FBD1046823430360036825 +:1000C000DC07FCD4C46901231C42FBD1C469DC40B9 +:1000D0001C42F7D1084B1A430260C3695A07FCD48B +:1000E000C0239B0243608181C3699C07FCD40368E1 +:1000F00002221343036010BD04000040037EDA07B0 +:10010000FCD5018570470000027E01235107FBD515 +:10011000428B1A4207D1428BDA401A4203D1428BFA +:1001200092081A4202D0034B01221A70008DC0B20D +:100130007047C0467400002070B50368041C988B9B +:100140001A1C0821FF32084228D0988B174D014312 +:10015000802099839872112353704021144B917120 +:1001600050715E68C0202E40800506435E605E6967 +:100170003540284358610F4818600F4818615D6882 +:100180000E4828408025AD02284358605868800BEF +:100190008003586000235171237105E0137ADA0659 +:1001A00002D5201C00F0A0FA207970BDFFFFFF8F60 +:1001B0008C0100208C0000200C010020FF3F00F08B +:1001C000002303714371044B016083600B780222AA +:1001D00013430B707047C0463901000038B5364BE9 +:1001E0002021DA6901200A43DA61344B06241A78A7 +:1001F00002431A70324B0F22197891431970197803 +:10020000214319702F490C782043087019780A404F +:100210001A701A7860210A431A702B4B2B4A5A80A5 +:100220005A7852B2002AFBDB294B01211A780A4383 +:100230001A709A78D107FCD426480268510B1F2205 +:100240001140914200D1052111408C011D8D2249A0 +:100250002940214319850468A10C0A401F2A00D1B6 +:100260001D221C8D1F210A408C4322431A850268DF +:100270000721D20D0A408A4200D103220A40188D7C +:100280001103164A02400A431A8519787F220A4050 +:100290001A701A78042112480A431A7058621A898F +:1002A0000C218A431A811A8901218A431A8100216B +:1002B000802201F0B6F838BD0004004058440041E7 +:1002C0003C44004159440041000C004006400000FD +:1002D00000500041246080003FF8FFFFFF8FFFFFC8 +:1002E0008C010020F7B5141C234A5F0101971D1CE7 +:1002F000D319061C5869271C4000400F03301033E7 +:10030000C74006D00F1C8022596812060A435A6063 +:1003100009E02F1C7B1E9F41184BBF01FF18381CA2 +:10032000221C01F075F8019913480835421817612D +:10033000131C5269A104920B890C92030A435A615F +:1003400059690F4A02200A405A616B01F318D979A2 +:10035000032211400143D8799043021C0A43DA7109 +:100360005979802252420A435A716B01F318DB79A2 +:100370009A07FAD5201CFEBD8C0100200C0100203C +:10038000FF3F00F0F8B51E4E041C3378151C002BFF +:1003900012D11C4B1C4A1A645A6C920B92035A6479 +:1003A000586C1A4A02405A64A2235B00E25C402067 +:1003B0000243E254012333704827FF37E25D0123F3 +:1003C00013401AD00F4B5A6C9204920CAA4202D2DC +:1003D0005D6CAD04AD0C081C2A1C0B4901F018F82B +:1003E000E25D03231A4001210A43E15D99430B1C9E +:1003F0001343E3550023337000E01D1C281CF8BD97 +:10040000750000208C010020CC000020FF3F00F090 +:10041000FF30827930239A43131C2022002900D117 +:1004200010221343837170470C4BFF305A6902212D +:10043000920B92035A61027A03231A400A43017A0B +:1004400099430B1C13430372827980235B4213434D +:100450008371037A9A07FCD57047C0468C0100204F +:1004600080235B421943C9B28172704770B5A023E3 +:1004700003225B00C254134B134A5C6CC02114402E +:1004800089050C4346255C64FF35402444550F4DD7 +:1004900030261D6490256D0046555D6B154029433F +:1004A000922559636D0080214155094D1D63B0258A +:1004B0006D0044555C6F22405A67B2235B00C15403 +:1004C00070BDC0468C010020FFFFFF8FCC000020D4 +:1004D0004C01002030B5364A1E235168082099434C +:1004E00002231943516033498A6902438A613248C1 +:1004F000324A9082908A03439382D3689807FCD54E +:100500002F4B012018701878C40704D52C48407868 +:1005100040B20028F7DB01209860587840B20028EC +:10052000FBDB284C26484460587840B20028FBDBAF +:1005300082242348E4014480587840B20028FBDB41 +:10054000908C8024A0439084D068C506FCD51E4CB6 +:100550001A48C462D4681948E506FBD5848C1B4D43 +:100560002C438484D4681548E506FBD5848C022589 +:100570002C438484D0680406FCD51048C068450626 +:10058000F8D5D068C406FCD500229A605A7852B2D9 +:10059000002AFBDB0E480A4A50605A7852B2002A01 +:1005A000FBDB00230B724B728B72CB7230BDC046EB +:1005B00000400041000400400C060000000800401C +:1005C000000C004001050100B805FF7D040A000091 +:1005D000000703000EBEFEE70DBEFEE705BEFEE708 +:1005E00002BEFEE701BEFEE70E4A0F4838B5824262 +:1005F00004D10E4A0E4B93420ED10AE00D4C9442A8 +:10060000F7D00023D1188842F3D9E55804330D60A0 +:10061000F8E700F011F804E09342FAD2002102C397 +:10062000FAE7FEE7000000205800002098030020B1 +:1006300058000020FC16000010B5244B0022197849 +:1006400001231940224B0AD11868224A904201D155 +:10065000196014E01A60204A013A002AFCD11A609D +:100660001E4B1968181C4A1C09D0FF22134206D1E0 +:1006700081F3088893431A4A936043681847FFF749 +:1006800029FF62B600F0F2FC00F0C8F9041CA36870 +:10069000201C9847134B002801D001221A701A78A9 +:1006A000002A05D0002000F035FA00F091FAFCE7AE +:1006B0001B78002BEBD100F04DFD0028E7D0012086 +:1006C00000F028FA00F084FAFCE7C0463804004045 +:1006D000FC7F00203581730748E8010000200000FE +:1006E00000ED00E076000020F8B50468051C201C31 +:1006F000FF30037AB64A10210B430372B54F1378CB +:10070000B5493B705378B54E0B7093783380D178F0 +:10071000338809020B4333801179B14B1980517929 +:100720001F8809020F431F809779AE490F80D27945 +:100730000F8812023A430A8040224271A648A54F10 +:1007400002783878A84F12020243181CBA4200D12E +:1007500099E01EDC802149008A4200D158E107DC83 +:10076000812A6AD0822A6ED0802A00D050E164E0CB +:1007700081235B009A4200D1AFE000DA23E1C0237D +:100780009B009A4200D143E1984B9A4200D11AE172 +:100790003EE190231B019A4242D015DCD023DB00BE +:1007A0009A4222D088231B019A4242D0A023DB0028 +:1007B0009A4200D02CE1201CFFF736FE31882868D1 +:1007C00089B2FFF74DFE27E1894B9A4200D1FAE04A +:1007D00000DC1DE1874B9A4200D1E8E0864B9A424B +:1007E00000D015E133886B71EDE033881B0A012BD3 +:1007F00008D10B8812222868934201D80A8892B245 +:100800007E49DCE033881B0A022B00D000E10B8814 +:1008100043222868934201D80A8892B27849CEE0F0 +:100820003388201C2B71FFF7FFFD201CFFF71EFEF5 +:10083000F2E0291C01C90122C1E0724900230B80AA +:1008400028680222BCE06F4900220A8018885022E2 +:1008500010406D4A10701E880F2030401880188894 +:10086000032800D9D4E012781B8808335B01E41810 +:10087000A379002A01D09B0600E0DB06DB0F0B808A +:10088000286802229BE019887F2291435E4AC9B200 +:10089000117018880F21014019803188002900D07B +:1008A000B6E01988002900D1B2E01988032900D9DF +:1008B000AEE012781B8808335B01E318002A05D0EC +:1008C0005A7930218A4320210A4304E05A793021A1 +:1008D0008A43102002435A7175E002887F239A43AD +:1008E000494BD2B21A7001880F220A400280328826 +:1008F000002A00D08CE00288002A00D188E002881B +:10090000032A00D984E01B78002B27D00388083302 +:100910005B01E3189B79990655D50388302108338C +:100920005B01E3181A798A4320210A431A7103886C +:1009300008335B01E318DB795A0644D5038860214C +:1009400008335B01E318DA798A4340210A43DA71FC +:100950000388022208335B01E31826E0038808338A +:100960005B01E3189B79DF062DD50388302108331E +:100970005B01E3181A798A4310210A431A7103882C +:1009800008335B01E318DB7999061CD503886021E5 +:1009900008335B01E318DA798A4320210A43DA71CC +:1009A0000388012208335B01E3181A710BE00B88FE +:1009B00008222868934201D80A8892B2134900237A +:1009C000FFF790FC28E0201CFFF72EFD24E0C04636 +:1009D0008C0000208100002077000020780000209B +:1009E0007C0000207E0000200203000001030000C4 +:1009F00021200000A1210000212200004C14000051 +:100A0000000000207A000020800000204400002028 +:100A1000201C0121FFF7FCFCF8BDC04610B5054BBA +:100A2000054C2360FFF7DAFB201C2168FFF7C8FBA9 +:100A3000201C10BD005000410C02002007B5054BE2 +:100A40000122019001A91868131CFFF74BFC01203B +:100A50000EBDC0460C02002013B5054B6C46073492 +:100A60001868211C0122FFF78DFC207816BDC046B6 +:100A70000C02002010B5074C201CFFF75DFB031C87 +:100A80000020834205D022684823FF33D05C012335 +:100A9000184010BD0C02002010B5054A0C1C031CA8 +:100AA000191C10680123221CFFF71CFC201C10BD20 +:100AB0000C02002070B5084C061C201C0D1CFFF712 +:100AC0003BFB0023984205D02068311C2A1CFFF70D +:100AD00059FC031C181C70BD0C020020F8B50C4C0E +:100AE000051C201C0E1CFFF727FB0023271C341CB1 +:100AF00098420AD0002C07D0291C221C3868FFF726 +:100B000041FC241A2D18F5E7331C181CF8BDC0460B +:100B10000C020020012805D1054B064A1A60064B3D +:100B2000187004E0002802D1044A014B1A60704793 +:100B30007C0200208014000089000020CC140000FA +:100B400030B51A4B85B01B78002B29D0042901D170 +:100B5000026804E0022901D1028800E0027849001D +:100B600004A843180B3B5C1AA3420BD00F20104083 +:100B7000092802D83025284300E0373018701209C0 +:100B8000013BF1E701A830230370782343700A2268 +:100B900043189A700D22DA70054B04311B6801E08E +:100BA000034B1B68DB68984705B030BD8800002008 +:100BB0007C02002072B6EFF30883044A13600368D6 +:100BC00083F30888436818477047C04680020020B6 +:100BD000F0B58FB006A9CD4A0B1C31CA31C351CA3A +:100BE00051C360CA60C3CA4CCA48A3687A255B0374 +:100BF0005B0F9B005B58C8490360A26892B25343E5 +:100C00000A60C649C64A0B6000231360C54B1D70BD +:100C1000C54BC64D1B68281C1B6940219847C44B17 +:100C200000221860C34B1D60C34BC34DC04F1A60F8 +:100C3000286839688842EBD2BE4B1B681A78FF2AB5 +:100C400000D1F7E1232A00D0CEE1BC4E3378002B4F +:100C500005D0B54BBA481B680221DB689847B14BF9 +:100C60001B78532B38D13B682A6893421ED9B14870 +:100C700001322A609A1AB34B01681B680131016086 +:100C8000B14E9A4201D2326000E03360A44832682B +:100C90000068029000F0BCFB336829685A182A608B +:100CA000A44A1668F1181160A84A13702B68013B1A +:100CB0002B60A04B1A68013A1A60A44BA14A1B781A +:100CC00011688B4206D2984A954812680068C91A82 +:100CD00092699047C04676E1522B07D1904A924BD9 +:100CE00010681B68974A5B6911686BE14F2B05D14F +:100CF0008B4B944A1B6812681A7064E1482B05D12B +:100D0000874B904A1B6812681A805CE1572B05D10B +:100D1000834B8C4A1B6812681A6054E16F2B03D115 +:100D20007F4B0121186807E0682B08D17C4B854870 +:100D30001B6802211B880360FFF702FF43E1772B4A +:100D400006D1774B7F481B6804211B680360F3E7DB +:100D5000472B13D17B4B1868FFF72CFF7C4B1B688C +:100D600083F3088862B67B4B1B78002B00D12AE105 +:100D70006D4B06201B681B68984724E1542B04D157 +:100D800001233370684B1B685CE04E2B0BD133782A +:100D9000002B05D1644B6A481B680221DB68984729 +:100DA000002333700FE1562B50D15F4D01212B688A +:100DB0006948DB6898472B680321DB6867489847D8 +:100DC000674E2B68301CDB68012198472B680D218A +:100DD000DB68644898472B68301CDB680121984722 +:100DE000544F614B544E3B60002333603A1C311C1E +:100DF0001368581C10601B780393002B03D00B68FA +:100E000001330B60F4E72B683168DB68564898477C +:100E10002B685348DB68012198470398306053489A +:100E20003860444A1368591C11601A78424B002AF2 +:100E300003D01A6801321A60F3E72A681968D36888 +:100E400098472B68DB683E480221BBE03D4A582B9F +:100E500015D1304E314D366813682A68B10093427F +:100E600008D25808E06142482080207DC507FCD5A3 +:100E70005B18F4E72C4B3F481B68DB68A1E0592B5B +:100E800033D11268264B3C49002A02D11B680B6003 +:100E900026E00868196863688025AB4392086360A0 +:100EA000002A1DD0354B2380237DDE07FCD500238F +:100EB000184D2D680095AD08AB4202D3304D25800A +:100EC00006E09342FAD09D00465901334E51EFE7B8 +:100ED000257DEE07FCD59D0049194019D21ADFE7A0 +:100EE000114B28481B68DB686BE05A2B6BD10C4B0D +:100EF00017681D680026EF19BD4245D02878311CBF +:100F000000F04AF90135061CF6E7C04660140000FF +:100F100000400041340200202C0200202802002062 +:100F200078020020240200207C02002038020020E9 +:100F30001C02002020020020300200208800002037 +:100F4000C014000084020020880200201802002043 +:100F500080020020890000209C140000C5140000BD +:100F60009E140000E8140000A0140000AC1400005F +:100F700002A5FFFFB51400008400002044A5FFFF78 +:100F800004A5FFFFB91400002E4D2F482B68012146 +:100F9000DB68984707230F223240111C3609303195 +:100FA000092A00DD07311020C0186A468154013B30 +:100FB000F1D22B6804A8DB68082198472B682348E6 +:100FC000DB6803219847224D7A232B70214B0022A6 +:100FD0001A60214B1B7893422CD01A4B01211B68BD +:100FE0001E48DB68984725E0111C3039C8B2194B00 +:100FF000092804D81E683201114319601AE0111C37 +:101000004139052903D81868373A010106E0111C57 +:101010006139052904D81D68573A29010A4308E0B7 +:101020002C2A03D10E4A1E68166001E008490A7096 +:1010300000221A600B4B1A6801321A600A4B1A68B8 +:101040000132F2E57C020020BD140000BF14000054 +:10105000240200208402002088000020C314000025 +:1010600078020020300200202002002010B51C4B26 +:1010700001201A78022402431A701A4B0F221978A1 +:101080009143197019782143197017490C7820433E +:10109000087019780A401A701A7820210A431A70C9 +:1010A000124B04211A6A0A431A62114B114A5A80E0 +:1010B0005A7852B2002AFBDBC4220F480F49920330 +:1010C000FEF7EEFF0E4A002313700E4A13700E4A0D +:1010D00013700E4A13700E4A13700E4A137010BD2F +:1010E0004A440041354400414B4400410004004063 +:1010F000000C0040144000000008004204C500003D +:101100008C020020130300208D020020900200209A +:10111000140300201103002008B5C1B20248FEF7F5 +:10112000EDFF012008BDC04600080042024B187EBA +:101130004007C00F7047C0460008004208B5FFF7DF +:10114000F5FF0028FBD00248FEF7DEFF08BDC046D1 +:101150000008004208B5FFF7E9FF0023984205D0D8 +:10116000FFF7ECFF031C233B5A425341181C08BDF8 +:1011700070B5041C0D1C4618B44204D02078FFF74B +:10118000CBFF0134F8E7281C70BD10B5041CFFF735 +:10119000D5FF2070012010BD0B0A5840034B4000C2 +:1011A000C05A0902484080B27047C046F614000099 +:1011B000F7B50024051C0F1C261CBC4220D0FFF7ED +:1011C000BDFF114BC0B21B780190002B1AD1311C0E +:1011D000FFF7E2FF0D4B061C1A88002A04D10C4AC7 +:1011E00011782A1C002907D001996A1C2970802FC8 +:1011F00002D11988013919800134A4B2151CDCE729 +:10120000301C00E00120FEBD110300208E020020F2 +:1012100012030020F0B53E4E85B0002203900C1C56 +:1012200032703C4B914201D1012201E03A490C80DD +:101230001A707F231C4201D080349C43FFF77EFF4D +:101240003378C0B2002B07D000253570FFF776FF4A +:101250003378C0B2AB4236D1432803D0712853D083 +:101260001528EBD1012300930120FFF755FF0098CB +:10127000FFF752FF00998025C843C0B2FFF74CFF2B +:10128000039B00270293244A1388002B1DD1214978 +:1012900001930978002918D10198FFF73DFF391C07 +:1012A0000198FFF779FF013D071C002DEBD1000AE3 +:1012B000C0B2FFF731FFF8B2FFF72EFFFFF73EFF96 +:1012C0003378002B0AD035701FE00299013B097872 +:1012D0001380029B019101330293DDE7C0B206281F +:1012E00007D1009B03990133DBB280310093803C2E +:1012F0000391002CB8D10420FFF70EFFFFF71EFF6B +:10130000044B01251C7000E00025281C05B0F0BD31 +:1013100011030020120300208E020020F0B5384C8B +:1013200087B0002301902370994201D1012301E08D +:10133000344A1180344A642613704320FFF7ECFED0 +:10134000324FFFF7F3FE002803D1002F03D0013FF7 +:10135000F7E7002F03D1013E002EEED14DE001252D +:10136000FFF7ECFE2378002B38D1C0B202900128A1 +:1013700005D004283DD10620FFF7CEFE39E005AEAA +:101380000221301CFFF714FF01988021FFF710FFA6 +:1013900023780390002B18D1FFF7D0FE0702FFF748 +:1013A000CDFEBFB223783F18BFB2012B0DD0039BF7 +:1013B0009F4207D13378AB4204D1EB437278DBB262 +:1013C0009A4204D01820FFF7A7FE002303E006206E +:1013D000FFF7A2FE029B2278002A02D00026267088 +:1013E0000BE0012B05D1019A6B1C8032DDB201921A +:1013F000B6E7054A002313700126301C07B0F0BD84 +:10140000110300208E0200201203002000350C0082 +:1014100010B50023934203D0CC5CC4540133F9E7E8 +:1014200010BD031C8218934202D019700133FAE7F1 +:1014300070470000F8B5C046F8BC08BC9E4670472F +:10144000F8B5C046F8BC08BC9E46704712010002C1 +:101450000200004041234E02000200000001000093 +:101460000800000010000000200000004000000004 +:1014700080000000000100000002000000040000E5 +:10148000191100003D1100002D1100007111000024 +:101490008B110000151200001D13000076002000C3 +:1014A0004E6F7620323420323031350031313A33CC +:1014B000353A313600580A0D00590A0D005A0023FA +:1014C0000A0D003E00322E30000000003D0A0000F0 +:1014D000590A0000750A0000990A0000B50A0000C8 +:1014E000990A0000DD0A00005B41726475696E6F45 +:1014F0003A58595A5D000000211042206330844060 +:10150000A550C660E770088129914AA16BB18CC1D2 +:10151000ADD1CEE1EFF13112100273325222B55249 +:101520009442F772D662399318837BB35AA3BDD322 +:101530009CC3FFF3DEE36224433420040114E66419 +:10154000C774A44485546AA54BB528850995EEE572 +:10155000CFF5ACC58DD55336722611163006D77629 +:10156000F6669556B4465BB77AA719973887DFF7C2 +:10157000FEE79DD7BCC7C448E5588668A7784008F1 +:10158000611802282338CCC9EDD98EE9AFF9488912 +:1015900069990AA92BB9F55AD44AB77A966A711A89 +:1015A000500A333A122AFDDBDCCBBFFB9EEB799B62 +:1015B000588B3BBB1AABA66C877CE44CC55C222CD9 +:1015C000033C600C411CAEED8FFDECCDCDDD2AADB2 +:1015D0000BBD688D499D977EB66ED55EF44E133E69 +:1015E000322E511E700E9FFFBEEFDDDFFCCF1BBF02 +:1015F0003AAF599F788F8891A981CAB1EBA10CD1DC +:101600002DC14EF16FE18010A100C230E3200450E3 +:10161000254046706760B9839893FBA3DAB33DC356 +:101620001CD37FE35EF3B1029012F322D232354233 +:10163000145277625672EAB5CBA5A89589856EF5E6 +:101640004FE52CD50DC5E234C324A0148104667483 +:10165000476424540544DBA7FAB79987B8975FE736 +:101660007EF71DC73CD7D326F2369106B0165766D3 +:101670007676154634564CD96DC90EF92FE9C899BE +:10168000E9898AB9ABA94458654806782768C01823 +:10169000E1088238A3287DCB5CDB3FEB1EFBF98B96 +:1016A000D89BBBAB9ABB754A545A376A167AF10A73 +:1016B000D01AB32A923A2EFD0FED6CDD4DCDAABDA6 +:1016C0008BADE89DC98D267C076C645C454CA23CC3 +:1016D000832CE01CC10C1FEF3EFF5DCF7CDF9BAF76 +:1016E000BABFD98FF89F176E367E554E745E932E13 +:0C16F000B23ED10EF01E00000000000011 +:1016FC0009024300020100803209040000010202C9 +:10170C000000052400100104240200052406000139 +:10171C000524010001070583030800FF09040100EB +:10172C00020A0000000705810240000007050202C2 +:10173C004000000000C20100000008006900000029 +:08174C00410000000000000054 +:04000003000005E90B +:00000001FF diff --git a/bootloaders/zero/Makefile b/bootloaders/zero/Makefile index eee929188..78b815f0e 100644 --- a/bootloaders/zero/Makefile +++ b/bootloaders/zero/Makefile @@ -21,19 +21,13 @@ ifeq ($(OS),Windows_NT) # Are we using mingw/msys/msys2/cygwin? ifeq ($(TERM),xterm) -# this is the path coming with night build -# T=$(shell cygpath -u $(LOCALAPPDATA)) -# this is the path till 1.6.5 r5 - T=$(shell cygpath -u $(APPDATA)) + T=$(shell cygpath -u $(LOCALAPPDATA)) MODULE_PATH?=$(T)/Arduino15/packages/arduino ARM_GCC_PATH?=$(MODULE_PATH)/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi- RM=rm SEP=/ else -# this is the path coming with night build -# MODULE_PATH?=$(LOCALAPPDATA)/Arduino15/packages/arduino -# this is the path till 1.6.5 r5 - MODULE_PATH?=$(APPDATA)/Arduino15/packages/arduino + MODULE_PATH?=$(LOCALAPPDATA)/Arduino15/packages/arduino ARM_GCC_PATH?=$(MODULE_PATH)/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi- RM=rm SEP=\\ @@ -75,9 +69,13 @@ CFLAGS+=-Os -DDEBUG=0 endif # Arduino Zero (PID == 0x004D) -CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x4D +CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x4D -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23 # Genuino Zero (PID == 0x024D) -# CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x02 -DUSB_PID_LOW=0x4D +# CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x02 -DUSB_PID_LOW=0x4D -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23 +# Arduino MKR1000 (PID == 0x004E) +# CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x4E -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23 +# Genuino MKR1000 (PID == 0x024E) +# CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x02 -DUSB_PID_LOW=0x4E -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23 INCLUDES=-I"$(MODULE_PATH)/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" -I"$(MODULE_PATH)/tools/CMSIS/4.0.0-atmel/Device/ATMEL/" diff --git a/bootloaders/zero/README.md b/bootloaders/zero/README.md index 44f4e4e02..ca57015b4 100644 --- a/bootloaders/zero/README.md +++ b/bootloaders/zero/README.md @@ -9,6 +9,10 @@ Multi-plaform GCC is provided by ARM here: https://launchpad.net/gcc-arm-embedde Atmel Studio contains both make and ARM GCC toolchain. You don't need to install them in this specific use case. +For all builds and platforms you will need to have the Arduino IDE installed and the board support +package for "Arduino SAMD Boards (32-bits ARM Cortex-M0+)". You can install the latter +from the former's "Boards Manager" UI. + ### Windows * Native command line diff --git a/bootloaders/zero/sam_ba_serial.c b/bootloaders/zero/sam_ba_serial.c index a06de01dc..09607ecf6 100644 --- a/bootloaders/zero/sam_ba_serial.c +++ b/bootloaders/zero/sam_ba_serial.c @@ -108,8 +108,8 @@ void serial_open(void) /* Wait for synchronization */ } - /* Baud rate 115200 - clock 8MHz -> BAUD value-50436 */ - uart_basic_init(BOOT_USART_MODULE, 50436, BOOT_USART_PAD_SETTINGS); + /* Baud rate 115200 - clock 48MHz -> BAUD value-63018 */ + uart_basic_init(BOOT_USART_MODULE, 63018, BOOT_USART_PAD_SETTINGS); //Initialize flag b_sharp_received = false; diff --git a/bootloaders/zero/sam_ba_usb.c b/bootloaders/zero/sam_ba_usb.c index 090375c7f..687e065e9 100644 --- a/bootloaders/zero/sam_ba_usb.c +++ b/bootloaders/zero/sam_ba_usb.c @@ -38,8 +38,8 @@ const char devDescriptor[] = 0x00, // bDeviceSubclass: CDC class sub code 0x00, // bDeviceProtocol: CDC Device protocol 0x40, // bMaxPacketSize0 - 0x41, // idVendor L - 0x23, // idVendor H + USB_VID_LOW, // idVendor L + USB_VID_HIGH, // idVendor H USB_PID_LOW, // idProduct L USB_PID_HIGH, // idProduct H 0x00, // bcdDevice L, here matching SAM-BA version diff --git a/bootloaders/zero/samd21_sam_ba.bin b/bootloaders/zero/samd21_sam_ba.bin old mode 100644 new mode 100755 index d727d0707..690328564 Binary files a/bootloaders/zero/samd21_sam_ba.bin and b/bootloaders/zero/samd21_sam_ba.bin differ diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 1be6d7171..3bafdb5fc 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -114,6 +114,11 @@ void loop( void ) ; #define bit(b) (1UL << (b)) +#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) +// Interrupts +#define digitalPinToInterrupt(P) ( P ) +#endif + // USB Device #include "USB/USBDesc.h" #include "USB/USBCore.h" diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index 7c3a76ad2..62508e786 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -68,7 +68,7 @@ class HardwareSerial : public Stream { public: virtual void begin(unsigned long); - virtual void begin(unsigned long baudrate, uint8_t config); + virtual void begin(unsigned long baudrate, uint16_t config); virtual void end(); virtual int available(void) = 0; virtual int peek(void) = 0; diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 98eb4fd6e..05a1f1882 100644 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -188,7 +188,8 @@ size_t Print::println(const Printable& x) // Private Methods ///////////////////////////////////////////////////////////// -size_t Print::printNumber(unsigned long n, uint8_t base) { +size_t Print::printNumber(unsigned long n, uint8_t base) +{ char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. char *str = &buf[sizeof(buf) - 1]; @@ -198,9 +199,9 @@ size_t Print::printNumber(unsigned long n, uint8_t base) { if (base < 2) base = 10; do { - unsigned long m = n; + char c = n % base; n /= base; - char c = m - base * n; + *--str = c < 10 ? c + '0' : c + 'A' - 10; } while(n); diff --git a/cores/arduino/SERCOM.cpp b/cores/arduino/SERCOM.cpp index 34d3aa18b..71900689e 100644 --- a/cores/arduino/SERCOM.cpp +++ b/cores/arduino/SERCOM.cpp @@ -43,28 +43,21 @@ void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint if ( mode == UART_INT_CLOCK ) { - uint16_t sampleRateValue ; + uint16_t sampleRateValue; - if ( sampleRate == SAMPLE_RATE_x16 ) - { - sampleRateValue = 16 ; - } - else - { - if ( sampleRate == SAMPLE_RATE_x8 ) - { - sampleRateValue = 8 ; - } - else - { - sampleRateValue = 3 ; - } + if (sampleRate == SAMPLE_RATE_x16) { + sampleRateValue = 16; + } else { + sampleRateValue = 8; } - // Asynchronous arithmetic mode - // 65535 * ( 1 - sampleRateValue * baudrate / SystemCoreClock); - // 65535 - 65535 * (sampleRateValue * baudrate / SystemCoreClock)); - sercom->USART.BAUD.reg = 65535.0f * ( 1.0f - (float)(sampleRateValue) * (float)(baudrate) / (float)(SystemCoreClock)); + // Asynchronous fractional mode (Table 24-2 in datasheet) + // BAUD = fref / (sampleRateValue * fbaud) + // (multiply by 8, to calculate fractional piece) + uint32_t baudTimes8 = (SystemCoreClock * 8) / (sampleRateValue * baudrate); + + sercom->USART.BAUD.FRAC.FP = (baudTimes8 % 8); + sercom->USART.BAUD.FRAC.BAUD = (baudTimes8 / 8); } } void SERCOM::initFrame(SercomUartCharSize charSize, SercomDataOrder dataOrder, SercomParityMode parityMode, SercomNumberStopBit nbStopBits) @@ -112,7 +105,7 @@ void SERCOM::enableUART() void SERCOM::flushUART() { // Wait for transmission to complete - while(sercom->USART.INTFLAG.bit.DRE != SERCOM_USART_INTFLAG_DRE); + while(!sercom->USART.INTFLAG.bit.TXC); } void SERCOM::clearStatusUART() @@ -168,8 +161,8 @@ uint8_t SERCOM::readDataUART() int SERCOM::writeDataUART(uint8_t data) { - //Flush UART buffer - flushUART(); + // Wait for data register to be empty + while(!isDataRegisterEmptyUART()); //Put data into DATA register sercom->USART.DATA.reg = (uint16_t)data; @@ -416,7 +409,7 @@ void SERCOM::initSlaveWIRE( uint8_t ucAddress ) sercom->I2CS.CTRLA.bit.MODE = I2C_SLAVE_OPERATION ; sercom->I2CS.ADDR.reg = SERCOM_I2CS_ADDR_ADDR( ucAddress & 0x7Ful ) | // 0x7F, select only 7 bits - SERCOM_I2CS_ADDR_ADDRMASK( 0x3FFul ) ; // 0x3FF all bits set + SERCOM_I2CS_ADDR_ADDRMASK( 0x00ul ) ; // 0x00, only match exact address // Set the interrupt register sercom->I2CS.INTENSET.reg = SERCOM_I2CS_INTENSET_PREC | // Stop @@ -490,8 +483,8 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag // 7-bits address + 1-bits R/W address = (address << 0x1ul) | flag; - // Wait idle bus mode - while ( !isBusIdleWIRE() ); + // Wait idle or owner bus mode + while ( !isBusIdleWIRE() && !isBusOwnerWIRE() ); // Send start and address sercom->I2CM.ADDR.bit.ADDR = address; @@ -585,6 +578,11 @@ bool SERCOM::isBusIdleWIRE( void ) return sercom->I2CM.STATUS.bit.BUSSTATE == WIRE_IDLE_STATE; } +bool SERCOM::isBusOwnerWIRE( void ) +{ + return sercom->I2CM.STATUS.bit.BUSSTATE == WIRE_OWNER_STATE; +} + bool SERCOM::isDataReadyWIRE( void ) { return sercom->I2CS.INTFLAG.bit.DRDY; diff --git a/cores/arduino/SERCOM.h b/cores/arduino/SERCOM.h index 58953d019..67527f96f 100644 --- a/cores/arduino/SERCOM.h +++ b/cores/arduino/SERCOM.h @@ -86,9 +86,8 @@ typedef enum typedef enum { - SAMPLE_RATE_x16 = 0, //Arithmetic - SAMPLE_RATE_x8 = 0x2, //Arithmetic - SAMPLE_RATE_x3 = 0x3 //Arithmetic + SAMPLE_RATE_x16 = 0x1, //Fractional + SAMPLE_RATE_x8 = 0x3, //Fractional } SercomUartSampleRate; typedef enum @@ -199,6 +198,7 @@ class SERCOM bool isMasterWIRE( void ) ; bool isSlaveWIRE( void ) ; bool isBusIdleWIRE( void ) ; + bool isBusOwnerWIRE( void ) ; bool isDataReadyWIRE( void ) ; bool isStopDetectedWIRE( void ) ; bool isRestartDetectedWIRE( void ) ; diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 0f1016848..5a111dce9 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -58,6 +58,8 @@ static volatile LineInfo _usbLineInfo = { 0x00 // lineState }; +static volatile int32_t breakValue = -1; + static CDCDescriptor _cdcInterface = { D_IAD(0, 2, CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0), @@ -134,6 +136,12 @@ bool CDC_Setup(USBSetup& setup) } return false; } + + if (CDC_SEND_BREAK == r) + { + breakValue = ((uint16_t)setup.wValueH << 8) | setup.wValueL; + return false; + } } return false; } @@ -158,7 +166,9 @@ void Serial_::accept(void) uint8_t buffer[CDC_SERIAL_BUFFER_SIZE]; uint32_t len = usb.recv(CDC_ENDPOINT_OUT, &buffer, CDC_SERIAL_BUFFER_SIZE); - noInterrupts(); + uint8_t enableInterrupts = ((__get_PRIMASK() & 0x1) == 0); + __disable_irq(); + ring_buffer *ringBuffer = &cdc_rx_buffer; uint32_t i = ringBuffer->head; @@ -175,7 +185,9 @@ void Serial_::accept(void) ringBuffer->full = true; } ringBuffer->head = i; - interrupts(); + if (enableInterrupts) { + __enable_irq(); + } } int Serial_::available(void) @@ -289,6 +301,50 @@ Serial_::operator bool() return result; } +int32_t Serial_::readBreak() { + uint8_t enableInterrupts = ((__get_PRIMASK() & 0x1) == 0); + + // disable interrupts, + // to avoid clearing a breakValue that might occur + // while processing the current break value + __disable_irq(); + + int32_t ret = breakValue; + + breakValue = -1; + + if (enableInterrupts) { + // re-enable the interrupts + __enable_irq(); + } + + return ret; +} + +unsigned long Serial_::baud() { + return _usbLineInfo.dwDTERate; +} + +uint8_t Serial_::stopbits() { + return _usbLineInfo.bCharFormat; +} + +uint8_t Serial_::paritytype() { + return _usbLineInfo.bParityType; +} + +uint8_t Serial_::numbits() { + return _usbLineInfo.bDataBits; +} + +bool Serial_::dtr() { + return _usbLineInfo.lineState & 0x1; +} + +bool Serial_::rts() { + return _usbLineInfo.lineState & 0x2; +} + Serial_ SerialUSB(USBDevice); #endif diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index f4a0babf8..1de826608 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -126,6 +126,46 @@ class Serial_ : public Stream virtual size_t write(const uint8_t *buffer, size_t size); using Print::write; // pull in write(str) from Print operator bool(); + + // This method allows processing "SEND_BREAK" requests sent by + // the USB host. Those requests indicate that the host wants to + // send a BREAK signal and are accompanied by a single uint16_t + // value, specifying the duration of the break. The value 0 + // means to end any current break, while the value 0xffff means + // to start an indefinite break. + // readBreak() will return the value of the most recent break + // request, but will return it at most once, returning -1 when + // readBreak() is called again (until another break request is + // received, which is again returned once). + // This also mean that if two break requests are received + // without readBreak() being called in between, the value of the + // first request is lost. + // Note that the value returned is a long, so it can return + // 0-0xffff as well as -1. + int32_t readBreak(); + + // These return the settings specified by the USB host for the + // serial port. These aren't really used, but are offered here + // in case a sketch wants to act on these settings. + uint32_t baud(); + uint8_t stopbits(); + uint8_t paritytype(); + uint8_t numbits(); + bool dtr(); + bool rts(); + enum { + ONE_STOP_BIT = 0, + ONE_AND_HALF_STOP_BIT = 1, + TWO_STOP_BITS = 2, + }; + enum { + NO_PARITY = 0, + ODD_PARITY = 1, + EVEN_PARITY = 2, + MARK_PARITY = 3, + SPACE_PARITY = 4, + }; + private: USBDeviceClass &usb; RingBuffer *_cdc_rx_buffer; diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index cd356d578..09cfa6fee 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -28,6 +28,14 @@ USBDevice_SAMD21G18x usbd; +/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */ +#define TX_RX_LED_PULSE_MS 100 +#ifdef PIN_LED_TXL +static volatile uint8_t txLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ +#endif +#ifdef PIN_LED_RXL +static volatile uint8_t rxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ +#endif static char isRemoteWakeUpEnabled = 0; static char isEndpointHalt = 0; @@ -90,18 +98,18 @@ bool USBDeviceClass::sendStringDescriptor(const uint8_t *string, uint8_t maxlen) if (maxlen < 2) return false; - uint16_t buff[maxlen/2]; - int l = 1; + uint8_t buffer[maxlen]; + buffer[0] = strlen((const char*)string) * 2 + 2; + buffer[1] = 0x03; - maxlen -= 2; - while (*string && maxlen>0) - { - buff[l++] = (uint8_t)(*string++); - maxlen -= 2; + uint8_t i; + for (i = 2; i < maxlen && *string; i++) { + buffer[i++] = *string++; + if (i == maxlen) break; + buffer[i] = 0; } - buff[0] = (3<<8) | (l*2); - return USBDevice.sendControl((uint8_t*)buff, l*2); + return USBDevice.sendControl(buffer, i); } bool _dry_run = false; @@ -273,6 +281,18 @@ void USBDeviceClass::handleEndpoint(uint8_t ep) void USBDeviceClass::init() { +#ifdef PIN_LED_TXL + txLEDPulse = 0; + pinMode(PIN_LED_TXL, OUTPUT); + digitalWrite(PIN_LED_TXL, HIGH); +#endif + +#ifdef PIN_LED_RXL + rxLEDPulse = 0; + pinMode(PIN_LED_RXL, OUTPUT); + digitalWrite(PIN_LED_RXL, HIGH); +#endif + // Enable USB clock PM->APBBMASK.reg |= PM_APBBMASK_USB; @@ -522,6 +542,11 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len) if (available(ep) < len) len = available(ep); +#ifdef PIN_LED_RXL + digitalWrite(PIN_LED_RXL, LOW); + rxLEDPulse = TX_RX_LED_PULSE_MS; +#endif + armRecv(ep); usbd.epBank0DisableTransferComplete(ep); @@ -620,6 +645,11 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len) } #endif +#ifdef PIN_LED_TXL + digitalWrite(PIN_LED_TXL, LOW); + txLEDPulse = TX_RX_LED_PULSE_MS; +#endif + // Flash area while (len != 0) { @@ -826,6 +856,17 @@ void USBDeviceClass::ISRHandler() if (usbd.isStartOfFrameInterrupt()) { usbd.ackStartOfFrameInterrupt(); + + // check whether the one-shot period has elapsed. if so, turn off the LED +#ifdef PIN_LED_TXL + if (txLEDPulse && !(--txLEDPulse)) + digitalWrite(PIN_LED_TXL, HIGH); +#endif + +#ifdef PIN_LED_RXL + if (rxLEDPulse && !(--rxLEDPulse)) + digitalWrite(PIN_LED_RXL, HIGH); +#endif } // Endpoint 0 Received Setup interrupt diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h index 853f305ae..1b575f91d 100644 --- a/cores/arduino/USB/USBCore.h +++ b/cores/arduino/USB/USBCore.h @@ -68,6 +68,7 @@ #define CDC_SET_LINE_CODING 0x20 #define CDC_GET_LINE_CODING 0x21 #define CDC_SET_CONTROL_LINE_STATE 0x22 +#define CDC_SEND_BREAK 0x23 #define MSC_RESET 0xFF #define MSC_GET_MAX_LUN 0xFE @@ -251,13 +252,13 @@ typedef struct _Pragma("pack()") #define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \ - { 18, 1, 0x110, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } + { 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } /* Table 9-8. Standard Device Descriptor * bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0, * idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */ #define D_CONFIG(_totalLength,_interfaces) \ - { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_SELF_POWERED, USB_CONFIG_POWER_MA(500) } + { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) } /* Table 9-10. Standard Configuration Descriptor * bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration * bmAttributes, bMaxPower */ @@ -275,7 +276,7 @@ _Pragma("pack()") #define D_IAD(_firstInterface, _count, _class, _subClass, _protocol) \ { 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 } -/* iadclasscode_r10.pdf, Table 9�Z. Standard Interface Association Descriptor +/* iadclasscode_r10.pdf, Table 9\96Z. Standard Interface Association Descriptor * bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass, bFunctionProtocol, iFunction */ // Functional Descriptor General Format diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 6f24bed9e..7a718e2c1 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -34,7 +34,7 @@ void Uart::begin(unsigned long baudrate) begin(baudrate, (uint8_t)SERIAL_8N1); } -void Uart::begin(unsigned long baudrate, uint8_t config) +void Uart::begin(unsigned long baudrate, uint16_t config) { pinPeripheral(uc_pinRX, g_APinDescription[uc_pinRX].ulPinType); pinPeripheral(uc_pinTX, g_APinDescription[uc_pinTX].ulPinType); @@ -93,7 +93,7 @@ size_t Uart::write(const uint8_t data) return 1; } -SercomNumberStopBit Uart::extractNbStopBit(uint8_t config) +SercomNumberStopBit Uart::extractNbStopBit(uint16_t config) { switch(config & HARDSER_STOP_BIT_MASK) { @@ -106,7 +106,7 @@ SercomNumberStopBit Uart::extractNbStopBit(uint8_t config) } } -SercomUartCharSize Uart::extractCharSize(uint8_t config) +SercomUartCharSize Uart::extractCharSize(uint16_t config) { switch(config & HARDSER_DATA_MASK) { @@ -126,7 +126,7 @@ SercomUartCharSize Uart::extractCharSize(uint8_t config) } } -SercomParityMode Uart::extractParity(uint8_t config) +SercomParityMode Uart::extractParity(uint16_t config) { switch(config & HARDSER_PARITY_MASK) { diff --git a/cores/arduino/Uart.h b/cores/arduino/Uart.h index 3c88d6711..7115da740 100644 --- a/cores/arduino/Uart.h +++ b/cores/arduino/Uart.h @@ -29,7 +29,7 @@ class Uart : public HardwareSerial public: Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, SercomUartTXPad _padTX); void begin(unsigned long baudRate); - void begin(unsigned long baudrate, uint8_t config); + void begin(unsigned long baudrate, uint16_t config); void end(); int available(); int peek(); @@ -51,7 +51,7 @@ class Uart : public HardwareSerial SercomRXPad uc_padRX; SercomUartTXPad uc_padTX; - SercomNumberStopBit extractNbStopBit(uint8_t config); - SercomUartCharSize extractCharSize(uint8_t config); - SercomParityMode extractParity(uint8_t config); + SercomNumberStopBit extractNbStopBit(uint16_t config); + SercomUartCharSize extractCharSize(uint16_t config); + SercomParityMode extractParity(uint16_t config); }; diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index a1f1de9e2..70d9acd01 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -57,7 +57,11 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) uint32_t config; uint32_t pos; +#if ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606 + EExt_Interrupts in = g_APinDescription[pin].ulExtInt; +#else EExt_Interrupts in = digitalPinToInterrupt(pin); +#endif if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; @@ -116,7 +120,11 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) */ void detachInterrupt(uint32_t pin) { +#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) + EExt_Interrupts in = g_APinDescription[pin].ulExtInt; +#else EExt_Interrupts in = digitalPinToInterrupt(pin); +#endif if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI) return; diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index b04798087..b7d3852ba 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -81,7 +81,7 @@ class String inline unsigned int length(void) const {return len;} // creates a copy of the assigned value. if the value is null or - // invalid, or if the memory allocation fails, the string will be + // invalid, or if the memory allocation fails, the string will be // marked as invalid ("if (s)" will be false). String & operator = (const String &rhs); String & operator = (const char *cstr); @@ -92,10 +92,10 @@ class String #endif // concatenate (works w/ built-in types) - + // returns true on success, false on failure (in which case, the string - // is left unchanged). if the argument is null or invalid, the - // concatenation is considered unsucessful. + // is left unchanged). if the argument is null or invalid, the + // concatenation is considered unsucessful. unsigned char concat(const String &str); unsigned char concat(const char *cstr); unsigned char concat(char c); @@ -107,7 +107,7 @@ class String unsigned char concat(float num); unsigned char concat(double num); unsigned char concat(const __FlashStringHelper * str); - + // if there's not enough memory for the concatenated value, the string // will be left unchanged (but this isn't signalled in any way) String & operator += (const String &rhs) {concat(rhs); return (*this);} @@ -161,6 +161,8 @@ class String void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const {getBytes((unsigned char *)buf, bufsize, index);} const char * c_str() const { return buffer; } + const char* begin() { return c_str(); } + const char* end() { return c_str() + length(); } // search int indexOf( char ch ) const; diff --git a/cores/arduino/avr/dtostrf.c b/cores/arduino/avr/dtostrf.c index 259caa5b3..de164277b 100644 --- a/cores/arduino/avr/dtostrf.c +++ b/cores/arduino/avr/dtostrf.c @@ -20,6 +20,8 @@ #include char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { + asm(".global _printf_float"); + char fmt[20]; sprintf(fmt, "%%%d.%df", width, prec); sprintf(sout, fmt, val); diff --git a/cores/arduino/avr/pgmspace.h b/cores/arduino/avr/pgmspace.h index 68ff49718..d1599f9f3 100644 --- a/cores/arduino/avr/pgmspace.h +++ b/cores/arduino/avr/pgmspace.h @@ -44,8 +44,8 @@ typedef int16_t prog_int16_t; typedef uint16_t prog_uint16_t; typedef int32_t prog_int32_t; typedef uint32_t prog_uint32_t; -typedef int32_t prog_int64_t; -typedef uint32_t prog_uint64_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; typedef const void* int_farptr_t; typedef const void* uint_farptr_t; diff --git a/cores/arduino/startup.c b/cores/arduino/startup.c index 4ffdae28f..3e01e79ae 100644 --- a/cores/arduino/startup.c +++ b/cores/arduino/startup.c @@ -223,4 +223,9 @@ void SystemInit( void ) linearity |= ((*((uint32_t *) ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); + + /* + * 9) Disable automatic NVM write operations + */ + NVMCTRL->CTRLB.bit.MANW = 1; } diff --git a/drivers/arduino-samd.cat b/drivers/arduino-samd.cat new file mode 100644 index 000000000..aae96d327 Binary files /dev/null and b/drivers/arduino-samd.cat differ diff --git a/drivers/arduino-samd.inf b/drivers/arduino-samd.inf new file mode 100644 index 000000000..1599d4600 --- /dev/null +++ b/drivers/arduino-samd.inf @@ -0,0 +1,112 @@ +; +; Copyright 2016 Arduino LLC (http://www.arduino.cc/) +; +; Arduino is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; This program 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 General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +; +; As a special exception, you may use this file as part of a free software +; library without restriction. Specifically, if other files instantiate +; templates or use macros or inline functions from this file, or you compile +; this file and link it with other files to produce an executable, this +; file does not by itself cause the resulting executable to be covered by +; the GNU General Public License. This exception does not however +; invalidate any other reasons why the executable file might be covered by +; the GNU General Public License. +; + +[Strings] +DriverPackageDisplayName="Arduino USB Driver (for SAMD boards)" +ManufacturerName="Arduino LLC (www.arduino.cc)" +ServiceName="USB RS-232 Emulation Driver" +bossa.name="Bossa Program Port" +mkr1000.sketch.name="Arduino MKR1000" +mkr1000.bootloader.name="Arduino MKR1000 bootloader" +zero.edbg.name="Atmel Corp. EDBG CMSIS-DAP" +zero.sketch.name="Arduino Zero" +zero.bootloader.name="Arduino Zero bootloader" +sme_fox.sketch.name="SmartEverything Fox" +sme_fox.bootloader.name="SmartEverything Fox bootloader" + +[DefaultInstall] +CopyINF=arduino-samd.inf + +[Version] +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Signature="$Windows NT$" +Provider=%ManufacturerName% +DriverPackageDisplayName=%DriverPackageDisplayName% +CatalogFile=arduino-samd.cat +; DriverVer date is MM/DD/YYYY +DriverVer=02/11/2016,1.0.0.0 + +[Manufacturer] +%ManufacturerName%=DeviceList, NTamd64, NTia64 + +[DestinationDirs] +FakeModemCopyFileSection=12 +DefaultDestDir=12 + +[DeviceList] +%bossa.name%=DriverInstall, USB\VID_03EB&PID_6124 +%mkr1000.sketch.name%=DriverInstall, USB\VID_2341&PID_804E&MI_00 +%mkr1000.bootloader.name%=DriverInstall, USB\VID_2341&PID_004E +%zero.edbg.name%=DriverInstall, USB\VID_03EB&PID_2157&MI_01 +%zero.sketch.name%=DriverInstall, USB\VID_2341&PID_804D&MI_00 +%zero.bootloader.name%=DriverInstall, USB\VID_2341&PID_004D +%sme_fox.sketch.name%=DriverInstall, USB\VID_2341&PID_E002&MI_00 +%sme_fox.bootloader.name%=DriverInstall, USB\VID_2341&PID_E001 + +[DeviceList.NTamd64] +%bossa.name%=DriverInstall, USB\VID_03EB&PID_6124 +%mkr1000.sketch.name%=DriverInstall, USB\VID_2341&PID_804E&MI_00 +%mkr1000.bootloader.name%=DriverInstall, USB\VID_2341&PID_004E +%zero.edbg.name%=DriverInstall, USB\VID_03EB&PID_2157&MI_01 +%zero.sketch.name%=DriverInstall, USB\VID_2341&PID_804D&MI_00 +%zero.bootloader.name%=DriverInstall, USB\VID_2341&PID_004D +%sme_fox.sketch.name%=DriverInstall, USB\VID_2341&PID_E002&MI_00 +%sme_fox.bootloader.name%=DriverInstall, USB\VID_2341&PID_E001 + +[DeviceList.NTia64] +%bossa.name%=DriverInstall, USB\VID_03EB&PID_6124 +%mkr1000.sketch.name%=DriverInstall, USB\VID_2341&PID_804E&MI_00 +%mkr1000.bootloader.name%=DriverInstall, USB\VID_2341&PID_004E +%zero.edbg.name%=DriverInstall, USB\VID_03EB&PID_2157&MI_01 +%zero.sketch.name%=DriverInstall, USB\VID_2341&PID_804D&MI_00 +%zero.bootloader.name%=DriverInstall, USB\VID_2341&PID_004D +%sme_fox.sketch.name%=DriverInstall, USB\VID_2341&PID_E002&MI_00 +%sme_fox.bootloader.name%=DriverInstall, USB\VID_2341&PID_E001 + +[DriverInstall] +include=mdmcpq.inf,usb.inf +CopyFiles = FakeModemCopyFileSection +AddReg=DriverAddReg + +[DriverAddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.Services] +include=mdmcpq.inf +AddService=usbser, 0x00000002, DriverService + +[DriverService] +DisplayName=%ServiceName% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\usbser.sys +LoadOrderGroup=Base + diff --git a/drivers/dpinst-amd64.exe b/drivers/dpinst-amd64.exe new file mode 100644 index 000000000..0507e7388 Binary files /dev/null and b/drivers/dpinst-amd64.exe differ diff --git a/drivers/dpinst-x86.exe b/drivers/dpinst-x86.exe new file mode 100644 index 000000000..41a890d11 Binary files /dev/null and b/drivers/dpinst-x86.exe differ diff --git a/drivers/genuino-samd.cat b/drivers/genuino-samd.cat new file mode 100644 index 000000000..f8172e4ce Binary files /dev/null and b/drivers/genuino-samd.cat differ diff --git a/drivers/genuino-samd.inf b/drivers/genuino-samd.inf new file mode 100644 index 000000000..3ecce79dd --- /dev/null +++ b/drivers/genuino-samd.inf @@ -0,0 +1,96 @@ +; +; Copyright 2016 Arduino LLC (http://www.arduino.cc/) +; +; Arduino is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; This program 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 General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +; +; As a special exception, you may use this file as part of a free software +; library without restriction. Specifically, if other files instantiate +; templates or use macros or inline functions from this file, or you compile +; this file and link it with other files to produce an executable, this +; file does not by itself cause the resulting executable to be covered by +; the GNU General Public License. This exception does not however +; invalidate any other reasons why the executable file might be covered by +; the GNU General Public License. +; + +[Strings] +DriverPackageDisplayName="Genuino USB Driver (for SAMD boards)" +ManufacturerName="Arduino LLC (www.arduino.cc)" +ServiceName="USB RS-232 Emulation Driver" +mkr1000.sketch.name="Genuino MKR1000" +mkr1000.bootloader.name="Genuino MKR1000 bootloader" +zero.sketch.name="Genuino Zero" +zero.bootloader.name="Genuino Zero bootloader" + +[DefaultInstall] +CopyINF=genuino-samd.inf + +[Version] +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Signature="$Windows NT$" +Provider=%ManufacturerName% +DriverPackageDisplayName=%DriverPackageDisplayName% +CatalogFile=genuino-samd.cat +; DriverVer date is MM/DD/YYYY +DriverVer=02/11/2016,1.0.0.0 + +[Manufacturer] +%ManufacturerName%=DeviceList, NTamd64, NTia64 + +[DestinationDirs] +FakeModemCopyFileSection=12 +DefaultDestDir=12 + +[DeviceList] +%mkr1000.sketch.name%=DriverInstall, USB\VID_2341&PID_824E&MI_00 +%mkr1000.bootloader.name%=DriverInstall, USB\VID_2341&PID_024E +%zero.sketch.name%=DriverInstall, USB\VID_2341&PID_824D&MI_00 +%zero.bootloader.name%=DriverInstall, USB\VID_2341&PID_024D + +[DeviceList.NTamd64] +%mkr1000.sketch.name%=DriverInstall, USB\VID_2341&PID_824E&MI_00 +%mkr1000.bootloader.name%=DriverInstall, USB\VID_2341&PID_024E +%zero.sketch.name%=DriverInstall, USB\VID_2341&PID_824D&MI_00 +%zero.bootloader.name%=DriverInstall, USB\VID_2341&PID_024D + +[DeviceList.NTia64] +%mkr1000.sketch.name%=DriverInstall, USB\VID_2341&PID_824E&MI_00 +%mkr1000.bootloader.name%=DriverInstall, USB\VID_2341&PID_024E +%zero.sketch.name%=DriverInstall, USB\VID_2341&PID_824D&MI_00 +%zero.bootloader.name%=DriverInstall, USB\VID_2341&PID_024D + +[DriverInstall] +include=mdmcpq.inf,usb.inf +CopyFiles = FakeModemCopyFileSection +AddReg=DriverAddReg + +[DriverAddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.Services] +include=mdmcpq.inf +AddService=usbser, 0x00000002, DriverService + +[DriverService] +DisplayName=%ServiceName% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\usbser.sys +LoadOrderGroup=Base + diff --git a/libraries/USBHost/src/Usb.cpp b/libraries/USBHost/src/Usb.cpp index cdde1a670..be1d800f6 100644 --- a/libraries/USBHost/src/Usb.cpp +++ b/libraries/USBHost/src/Usb.cpp @@ -36,7 +36,6 @@ USBHost::USBHost() : bmHubPre(0) { uint32_t USBHost::Init() { //devConfigIndex = 0; // Init host stack - init(); bmHubPre = 0; UHD_Init(); return 0; @@ -143,7 +142,7 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t if (rcode) { TRACE_USBHOST(printf("/!\\ USBHost::ctrlReq : EP0 allocation error: %lu\r\n", rcode);) - //USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode"); + //USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode"); return rcode; } @@ -263,6 +262,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr continue; } if(rcode) { + uhd_freeze_pipe(pep->epAddr); //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode); return(rcode);// break; //should be 0, indicating ACK. Else return error code. } @@ -305,6 +305,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr break; } // if } //while( 1 ) + uhd_freeze_pipe(pep->epAddr); return ( rcode); } @@ -422,6 +423,16 @@ uint32_t USBHost::dispatchPkt(uint32_t token, uint32_t epAddr, uint32_t nak_limi return 0; } + //case hrNAK: + if((USB->HOST.HostPipe[epAddr].PINTFLAG.reg & USB_HOST_PINTFLAG_TRFAIL) ) { + USB->HOST.HostPipe[epAddr].PINTFLAG.reg = USB_HOST_PINTFLAG_TRFAIL; + nak_count++; + if(nak_limit && (nak_count == nak_limit)) { + rcode = USB_ERRORFLOW; + return (rcode); + } + } + //case hrNAK: if( (usb_pipe_table[epAddr].HostDescBank[0].STATUS_BK.reg & USB_ERRORFLOW ) ) { nak_count++; @@ -495,7 +506,6 @@ void USBHost::Task(void) //USB state machine // Init USB stack and driver UHD_Init(); - init(); // Free all USB resources for (uint32_t i = 0; i < USB_NUMDEVICES; ++i) @@ -710,7 +720,8 @@ uint32_t USBHost::Configuring(uint32_t parent, uint32_t port, uint32_t lowspeed) epInfo.epAddr = 0; epInfo.maxPktSize = 8; - epInfo.epAttribs = 0; + epInfo.bmSndToggle = 0; + epInfo.bmRcvToggle = 0; epInfo.bmNakPower = USB_NAK_MAX_POWER; //delay(2000); diff --git a/libraries/USBHost/src/adk.cpp b/libraries/USBHost/src/adk.cpp index 165f50c3d..8602e1a65 100644 --- a/libraries/USBHost/src/adk.cpp +++ b/libraries/USBHost/src/adk.cpp @@ -45,7 +45,8 @@ ready(false) { for (uint32_t i = 0; i < ADK_MAX_ENDPOINTS; i++) { epInfo[i].epAddr = 0; epInfo[i].maxPktSize = (i) ? 0 : 8; - epInfo[i].epAttribs = 0; + epInfo[i].bmSndToggle = 0; + epInfo[i].bmRcvToggle = 0; epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER; }//for(uint32_t i=0; ibEndpointAddress & 0x0F); epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; + epInfo[index].bmSndToggle = 0; + epInfo[index].bmRcvToggle = 0; bNumEP++; diff --git a/libraries/USBHost/src/hidboot.cpp b/libraries/USBHost/src/hidboot.cpp index ea59f39fb..f477d2c7f 100644 --- a/libraries/USBHost/src/hidboot.cpp +++ b/libraries/USBHost/src/hidboot.cpp @@ -181,16 +181,19 @@ uint8_t KeyboardReportParser::HandleLockingKeys(HID *hid, uint8_t key) { const uint8_t KeyboardReportParser::numKeys[10] = { '!', '@', '#', '$', '%', '^', '&', '*', '(', ')'}; const uint8_t KeyboardReportParser::symKeysUp[12] = { '_', '+', '{', '}', '|', '~', ':', '"', '~', '<', '>', '?'}; const uint8_t KeyboardReportParser::symKeysLo[12] = { '-', '=', '[', ']', '\\', ' ', ';', '\'', '`', ',', '.', '/'}; -const uint8_t KeyboardReportParser::padKeys[5] = { '/', '*', '-', '+', 0x13}; +const uint8_t KeyboardReportParser::padKeys[5] = { '/', '*', '-', '+', 0x0d}; #define VALUE_WITHIN(v,l,h) (((v)>=(l)) && ((v)<=(h))) uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) { uint8_t shift = (mod & 0x22); + uint8_t ctrl = (mod & 0x11); // [a-z] if (VALUE_WITHIN(key, 0x04, 0x1d)) { + // [^a-^z] + if (ctrl) return (key - 3); // Upper case letters - if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && (mod & 2)) || - (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && (mod & 2) == 0)) + if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && shift) || + (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && shift == 0)) return (key - 4 + 'A'); // Lower case letters @@ -198,6 +201,7 @@ uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) { return (key - 4 + 'a'); }// Numbers else if (VALUE_WITHIN(key, 0x1e, 0x27)) { + if (ctrl && (key == 0x23)) return (0x1E); /* RS ^^ */ if (shift) return ((uint8_t)pgm_read_byte(&getNumKeys()[key - 0x1e])); else @@ -206,14 +210,27 @@ uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) { else if(VALUE_WITHIN(key, 0x59, 0x61)) { if(kbdLockingKeys.kbdLeds.bmNumLock == 1) return (key - 0x59 + '1'); - } else if(VALUE_WITHIN(key, 0x2d, 0x38)) + } else if(VALUE_WITHIN(key, 0x2d, 0x38)) { + if (ctrl) { + switch (key) { + case 0x2d: return (0x1f); /* US ^_ */ + case 0x2f: return (0x1b); /* ESC ^[ */ + case 0x30: return (0x1d); /* GS ^] */ + case 0x31: return (0x1c); /* FS ^\ */ + default: return (0x00); + } + } return ((shift) ? (uint8_t)pgm_read_byte(&getSymKeysUp()[key - 0x2d]) : (uint8_t)pgm_read_byte(&getSymKeysLo()[key - 0x2d])); - else if(VALUE_WITHIN(key, 0x54, 0x58)) + } else if(VALUE_WITHIN(key, 0x54, 0x58)) return (uint8_t)pgm_read_byte(&getPadKeys()[key - 0x54]); else { switch(key) { case UHS_HID_BOOT_KEY_SPACE: return (0x20); - case UHS_HID_BOOT_KEY_ENTER: return (0x13); + case UHS_HID_BOOT_KEY_ENTER: return (0x0d); + case UHS_HID_BOOT_KEY_ESCAPE: return (0x1b); + case UHS_HID_BOOT_KEY_DELETE: return (0x08); + case UHS_HID_BOOT_KEY_DELETE_FORWARD: return (0x7f); + case UHS_HID_BOOT_KEY_TAB: return (0x09); case UHS_HID_BOOT_KEY_ZERO2: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '0': 0); case UHS_HID_BOOT_KEY_PERIOD: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '.': 0); } diff --git a/libraries/USBHost/src/hidboot.h b/libraries/USBHost/src/hidboot.h index 1aa98e1af..8fcb190d2 100644 --- a/libraries/USBHost/src/hidboot.h +++ b/libraries/USBHost/src/hidboot.h @@ -25,6 +25,10 @@ e-mail : support@circuitsathome.com #define UHS_HID_BOOT_KEY_ZERO 0x27 #define UHS_HID_BOOT_KEY_ENTER 0x28 +#define UHS_HID_BOOT_KEY_ESCAPE 0x29 +#define UHS_HID_BOOT_KEY_DELETE 0x2a // Backspace +#define UHS_HID_BOOT_KEY_DELETE_FORWARD 0x4C // Delete +#define UHS_HID_BOOT_KEY_TAB 0x2b #define UHS_HID_BOOT_KEY_SPACE 0x2c #define UHS_HID_BOOT_KEY_CAPS_LOCK 0x39 #define UHS_HID_BOOT_KEY_SCROLL_LOCK 0x47 @@ -240,7 +244,8 @@ void HIDBoot::Initialize() { for(int i = 0; i < totalEndpoints(BOOT_PROTOCOL); i++) { epInfo[i].epAddr = 0; epInfo[i].maxPktSize = (i) ? 0 : 8; - epInfo[i].epAttribs = 0; + epInfo[i].bmSndToggle = 0; + epInfo[i].bmRcvToggle = 0; epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER; } bNumEP = 1; @@ -535,7 +540,8 @@ void HIDBoot::EndpointXtract(uint32_t conf, uint32_t iface, uint3 // Fill in the endpoint info structure epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F); epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize; - epInfo[bNumEP].epAttribs = 0; + epInfo[bNumEP].bmSndToggle = 0; + epInfo[bNumEP].bmRcvToggle = 0; epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT; bNumEP++; diff --git a/libraries/USBHost/src/hiduniversal.cpp b/libraries/USBHost/src/hiduniversal.cpp index 69630893e..7c6764b9e 100644 --- a/libraries/USBHost/src/hiduniversal.cpp +++ b/libraries/USBHost/src/hiduniversal.cpp @@ -60,7 +60,8 @@ void HIDUniversal::Initialize() { for(uint8_t i = 0; i < totalEndpoints; i++) { epInfo[i].epAddr = 0; epInfo[i].maxPktSize = (i) ? 0 : 8; - epInfo[i].epAttribs = 0; + epInfo[i].bmSndToggle = 0; + epInfo[i].bmRcvToggle = 0; epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER; } bNumEP = 1; @@ -324,7 +325,8 @@ void HIDUniversal::EndpointXtract(uint32_t conf, uint32_t iface, uint32_t alt, u // Fill in the endpoint info structure epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F); epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize; - epInfo[bNumEP].epAttribs = 0; + epInfo[bNumEP].bmSndToggle = 0; + epInfo[bNumEP].bmRcvToggle = 0; epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT; // Fill in the endpoint index list diff --git a/libraries/USBHost/src/printhex.h b/libraries/USBHost/src/printhex.h index 98c1ae602..60dcd064f 100644 --- a/libraries/USBHost/src/printhex.h +++ b/libraries/USBHost/src/printhex.h @@ -20,6 +20,8 @@ e-mail : support@circuitsathome.com #else #define __PRINTHEX_H__ +#include + void E_Notifyc(char c, int lvl); template diff --git a/libraries/USBHost/src/usbhub.cpp b/libraries/USBHost/src/usbhub.cpp index 1f6aa712b..670c848c5 100644 --- a/libraries/USBHost/src/usbhub.cpp +++ b/libraries/USBHost/src/usbhub.cpp @@ -28,12 +28,14 @@ qNextPollTime(0), bPollEnable(false) { epInfo[0].epAddr = 0; epInfo[0].maxPktSize = 8; - epInfo[0].epAttribs = 0; + epInfo[0].bmSndToggle = 0; + epInfo[0].bmRcvToggle = 0; epInfo[0].bmNakPower = USB_NAK_MAX_POWER; epInfo[1].epAddr = 1; epInfo[1].maxPktSize = 8; //kludge - epInfo[1].epAttribs = 0; + epInfo[1].bmSndToggle = 0; + epInfo[1].bmRcvToggle = 0; epInfo[1].bmNakPower = USB_NAK_NOWAIT; if(pUsb) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 635b1e6d8..7857a3d0b 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -71,6 +71,8 @@ uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) size_t byteRead = 0; + rxBuffer.clear(); + if(sercom->startTransmissionWIRE(address, WIRE_READ_FLAG)) { // Read first data @@ -85,7 +87,11 @@ uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) } sercom->prepareNackBitWIRE(); // Prepare NACK to stop slave transmission //sercom->readDataWIRE(); // Clear data register to send NACK - sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); // Send Stop + + if (stopBit) + { + sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); // Send Stop + } } return byteRead; @@ -131,7 +137,11 @@ uint8_t TwoWire::endTransmission(bool stopBit) return 3 ; // Nack or error } } - sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); + + if (stopBit) + { + sercom->prepareCommandBitsWire(WIRE_MASTER_ACT_STOP); + } return 0; } diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index ab7ccae60..ddf565bf8 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -57,6 +57,10 @@ class TwoWire : public Stream void onReceive(void(*)(int)); void onRequest(void(*)(void)); + inline size_t write(unsigned long n) { return write((uint8_t)n); } + inline size_t write(long n) { return write((uint8_t)n); } + inline size_t write(unsigned int n) { return write((uint8_t)n); } + inline size_t write(int n) { return write((uint8_t)n); } using Print::write; void onService(void); @@ -106,6 +110,23 @@ class TwoWire : public Stream //static const uint32_t XMIT_TIMEOUT = 100000; }; -extern TwoWire Wire; +#if WIRE_INTERFACES_COUNT > 0 + extern TwoWire Wire; +#endif +#if WIRE_INTERFACES_COUNT > 1 + extern TwoWire Wire1; +#endif +#if WIRE_INTERFACES_COUNT > 2 + extern TwoWire Wire2; +#endif +#if WIRE_INTERFACES_COUNT > 3 + extern TwoWire Wire3; +#endif +#if WIRE_INTERFACES_COUNT > 4 + extern TwoWire Wire4; +#endif +#if WIRE_INTERFACES_COUNT > 5 + extern TwoWire Wire5; +#endif #endif diff --git a/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.pde b/libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino similarity index 100% rename from libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.pde rename to libraries/Wire/examples/SFRRanger_reader/SFRRanger_reader.ino diff --git a/libraries/Wire/examples/digital_potentiometer/digital_potentiometer.pde b/libraries/Wire/examples/digital_potentiometer/digital_potentiometer.ino similarity index 100% rename from libraries/Wire/examples/digital_potentiometer/digital_potentiometer.pde rename to libraries/Wire/examples/digital_potentiometer/digital_potentiometer.ino diff --git a/libraries/Wire/examples/master_reader/master_reader.pde b/libraries/Wire/examples/master_reader/master_reader.ino similarity index 100% rename from libraries/Wire/examples/master_reader/master_reader.pde rename to libraries/Wire/examples/master_reader/master_reader.ino diff --git a/libraries/Wire/examples/master_writer/master_writer.pde b/libraries/Wire/examples/master_writer/master_writer.ino similarity index 100% rename from libraries/Wire/examples/master_writer/master_writer.pde rename to libraries/Wire/examples/master_writer/master_writer.ino diff --git a/libraries/Wire/examples/slave_receiver/slave_receiver.pde b/libraries/Wire/examples/slave_receiver/slave_receiver.ino similarity index 100% rename from libraries/Wire/examples/slave_receiver/slave_receiver.pde rename to libraries/Wire/examples/slave_receiver/slave_receiver.ino diff --git a/libraries/Wire/examples/slave_sender/slave_sender.pde b/libraries/Wire/examples/slave_sender/slave_sender.ino similarity index 100% rename from libraries/Wire/examples/slave_sender/slave_sender.pde rename to libraries/Wire/examples/slave_sender/slave_sender.ino diff --git a/platform.txt b/platform.txt index 730c8f8d0..85fb16e42 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=Arduino SAMD (32-bits ARM Cortex-M0+) Boards -version=1.6.2 +version=1.6.6 # Compile variables # ----------------- @@ -86,6 +86,8 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -D recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}" ## Create archives +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value +archive_file_path={build.path}/{archive_file} recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects @@ -117,6 +119,8 @@ tools.bossac.upload.params.verbose=-i -d tools.bossac.upload.params.quiet= tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R +tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R + # # OpenOCD sketch upload # @@ -140,4 +144,3 @@ tools.openocd.erase.pattern= tools.openocd.bootloader.params.verbose=-d2 tools.openocd.bootloader.params.quiet=-d0 tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown" - diff --git a/post_install.bat b/post_install.bat new file mode 100644 index 000000000..73e16e148 --- /dev/null +++ b/post_install.bat @@ -0,0 +1,10 @@ +@echo off +set ARGS=/A /SE /SW /SA +if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( + drivers\dpinst-amd64.exe %ARGS% +) ELSE IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( + drivers\dpinst-amd64.exe %ARGS% +) ELSE ( + drivers\dpinst-x86.exe %ARGS% +) +exit /b 0 diff --git a/variants/arduino_zero/variant.h b/variants/arduino_zero/variant.h index 50ba88772..de4e0828a 100644 --- a/variants/arduino_zero/variant.h +++ b/variants/arduino_zero/variant.h @@ -19,8 +19,8 @@ #ifndef _VARIANT_ARDUINO_ZERO_ #define _VARIANT_ARDUINO_ZERO_ -// The definitions here needs a SAMD core >=1.6.3 -#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10603 +// The definitions here needs a SAMD core >=1.6.6 +#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10606 /*---------------------------------------------------------------------------- * Definitions @@ -54,9 +54,10 @@ extern "C" // Number of pins defined in PinDescription array #define PINS_COUNT (26u) -#define NUM_DIGITAL_PINS (14u) +#define NUM_DIGITAL_PINS (20u) #define NUM_ANALOG_INPUTS (6u) #define NUM_ANALOG_OUTPUTS (1u) +#define analogInputToDigitalPin(p) ((p < 6u) ? (p) + 14u : -1) #define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) ) #define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin ) @@ -75,9 +76,6 @@ extern "C" */ // #define digitalPinToTimer(P) -// Interrupts -#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt ) - // LEDs #define PIN_LED_13 (13u) #define PIN_LED_RXL (25u) @@ -96,13 +94,15 @@ extern "C" #define PIN_A3 (17ul) #define PIN_A4 (18ul) #define PIN_A5 (19ul) - -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 ; +#define PIN_DAC0 (14ul) + +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 DAC0 = PIN_DAC0; #define ADC_RESOLUTION 12 // Other pins @@ -151,6 +151,9 @@ static const uint8_t SCK = PIN_SPI_SCK ; #define PERIPH_WIRE sercom3 #define WIRE_IT_HANDLER SERCOM3_Handler +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + /* * USB */ diff --git a/variants/mkr1000/debug_scripts/variant.gdb b/variants/mkr1000/debug_scripts/variant.gdb new file mode 100644 index 000000000..3c37ffde2 --- /dev/null +++ b/variants/mkr1000/debug_scripts/variant.gdb @@ -0,0 +1,31 @@ +# +# Arduino Zero OpenOCD script. +# +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# Define 'reset' command +define reset + +info reg + +break main + +# End of 'reset' command +end + +target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" diff --git a/variants/mkr1000/linker_scripts/gcc/flash_with_bootloader.ld b/variants/mkr1000/linker_scripts/gcc/flash_with_bootloader.ld new file mode 100644 index 000000000..4475f9511 --- /dev/null +++ b/variants/mkr1000/linker_scripts/gcc/flash_with_bootloader.ld @@ -0,0 +1,211 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/mkr1000/linker_scripts/gcc/flash_without_bootloader.ld b/variants/mkr1000/linker_scripts/gcc/flash_without_bootloader.ld new file mode 100644 index 000000000..0162f0774 --- /dev/null +++ b/variants/mkr1000/linker_scripts/gcc/flash_without_bootloader.ld @@ -0,0 +1,212 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + * __ram_end__ + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) ; + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + __ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ; + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/variants/mkr1000/openocd_scripts/arduino_zero.cfg b/variants/mkr1000/openocd_scripts/arduino_zero.cfg new file mode 100644 index 000000000..36c65c32d --- /dev/null +++ b/variants/mkr1000/openocd_scripts/arduino_zero.cfg @@ -0,0 +1,30 @@ +# +# Arduino Zero OpenOCD script. +# +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +source [find interface/cmsis-dap.cfg] + +# chip name +set CHIPNAME at91samd21g18 +set ENDIAN little + +# choose a port here +set telnet_port 0 + +source [find target/at91samdXX.cfg] diff --git a/variants/mkr1000/pins_arduino.h b/variants/mkr1000/pins_arduino.h new file mode 100644 index 000000000..db0e40c3d --- /dev/null +++ b/variants/mkr1000/pins_arduino.h @@ -0,0 +1,21 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +// API compatibility +#include "variant.h" + diff --git a/variants/mkr1000/variant.cpp b/variants/mkr1000/variant.cpp new file mode 100644 index 000000000..932e94268 --- /dev/null +++ b/variants/mkr1000/variant.cpp @@ -0,0 +1,180 @@ +/* + 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" + +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 | | *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) | | | + +------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+ + | | ATWINC1501B SPI | | | | | | | | | | | | | | + | 26 | | PA12 | WINC MOSI | 12 | | | | | *2/00 | 4/00 | TCC2/0 | TCC0/6 | | AC/CMP0 | + | 27 | | PA13 | WINC SCK | 13 | | | | | *2/01 | 4/01 | TCC2/1 | TCC0/7 | | AC/CMP1 | + | 28 | | PA14 | WINC SSN | 14 | | | | | 2/02 | 4/02 | TC3/0 | TCC0/4 | | GCLK_IO0 | + | 29 | | PA15 | WINC MISO | 15 | | | | | *2/03 | 4/03 | TC3/1 | TCC0/5 | | GCLK_IO1 | + +------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+ + | | ATWINC1501B PINS | | | | | | | | | | | | | | + | 30 | | PA27 | WINC RESETN_WIFI| 15 | | | | | | | | | | GCLK_IO0 | + | 31 | | PA28 | WINC CHIP_EN | 08 | | | | | | | | | | GCLK_IO0 | + | 32 | | PB08 | WINC WAKE | 08 | 02 | | Y14 | | | 4/00 | TC4/0 | | | | + | 33 | | PB09 | WINC IRQN | *09 | 03 | | Y15 | | | 4/01 | TC4/1 | | | | + +------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+ + | | 32768Hz Crystal | | | | | | | | | | | | | | + | 34 | | PA00 | XIN32 | 00 | | | | | | 1/00 | TCC2/0 | | | | + | 35 | | PA01 | XOUT32 | 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_NONE }, + { PORTA, 28, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, + { PORTB, 8, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, + { PORTB, 9, PIO_DIGITAL, (PIN_ATTR_NONE ), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, 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 }, +}; + +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); + +// Serial1 +Uart Serial1(&sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX); + +void SERCOM5_Handler() +{ + Serial1.IrqHandler(); +} + diff --git a/variants/mkr1000/variant.h b/variants/mkr1000/variant.h new file mode 100644 index 000000000..145e47753 --- /dev/null +++ b/variants/mkr1000/variant.h @@ -0,0 +1,191 @@ +/* + 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.6 +#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10606 + +#include + +// 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 (22u) +#define NUM_ANALOG_INPUTS (7u) +#define NUM_ANALOG_OUTPUTS (1u) +#define analogInputToDigitalPin(p) ((p < 7u) ? (p) + 15u : -1) + +// 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) + +// 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) +#define PIN_DAC0 (15u) + +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A6 = PIN_A6; +static const uint8_t DAC0 = PIN_DAC0; +#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 (24u) +#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: Connected to WINC1501B +#define PIN_SPI1_MISO (29u) +#define PIN_SPI1_MOSI (26u) +#define PIN_SPI1_SCK (27u) +#define PIN_SPI1_SS (28u) +#define PERIPH_SPI1 sercom2 +#define PAD_SPI1_TX SPI_PAD_0_SCK_1 +#define PAD_SPI1_RX SERCOM_RX_PAD_3 +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; + +// 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 +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +// USB +// --- +#define PIN_USB_DM (22ul) +#define PIN_USB_DP (23ul) +#define PIN_USB_HOST_ENABLE (24ul) + +// Needed for WINC1501B (WiFi101) library +// -------------------------------------- +#define WINC1501_RESET_PIN (30u) +#define WINC1501_CHIP_EN_PIN (31u) +#define WINC1501_INTN_PIN (33u) +#define WINC1501_SPI SPI1 +#define WINC1501_SPI_CS_PIN PIN_SPI1_SS + + +// 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) +#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 +