diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-12-31 12:19:08 -0500 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-12-31 12:19:08 -0500 |
commit | 28e9e122af24e63e84d5bcd2c619b76c490970fc (patch) | |
tree | 7174e8418fc8e6658bc7e2b260d0096d607803b3 /bootloaders/diskloader | |
parent | cbce8ed4bf330973a999220dd11444b6d1181d53 (diff) |
reset the Leonardo board when leaving the bootloader, before starting the sketch
Done so all IO and other registers are properly reinitialized when a new sketch is uploaded or when an existing sketch is started. Uses a watchdog timeout with a 15 ms period to accomplish the reset. Bootloader checks the reason for reset and only enumerates as bootloader and enters the programming loop if reset was NOT caused by WDT.
Diffstat (limited to 'bootloaders/diskloader')
-rw-r--r-- | bootloaders/diskloader/DiskLoader-Leonardo.hex | 371 | ||||
-rw-r--r-- | bootloaders/diskloader/src/DiskLoader.cpp | 18 | ||||
-rw-r--r-- | bootloaders/diskloader/src/USBCore.cpp | 4 |
3 files changed, 203 insertions, 190 deletions
diff --git a/bootloaders/diskloader/DiskLoader-Leonardo.hex b/bootloaders/diskloader/DiskLoader-Leonardo.hex index e14aa31..74f18d0 100644 --- a/bootloaders/diskloader/DiskLoader-Leonardo.hex +++ b/bootloaders/diskloader/DiskLoader-Leonardo.hex @@ -1,145 +1,145 @@ -:200000000C946F010C9497010C9497010C9497010C9497010C9497010C9497010C94970148 -:200020000C9497010C9497010C94FE040C9489050C9497010C9497010C9497010C949701A0 -:200040000C9497010C9497010C9497010C9497010C9497010C9497010C9497010C94B301C4 -:200060000C9497010C9497010C9497010C9497010C9497010C9497010C9497010C949701C0 -:200080000C9497010C9497010C9497010C9497010C9497010C9497010C9497010C949701A0 -:2000A0000C9497010C9497010C94970100000000240027002A002D003000000000002500A1 +:200000000C946E010C9496010C9496010C9496010C9496010C9496010C9496010C94960150 +:200020000C9496010C9496010C94FD040C9488050C9496010C9496010C9496010C949601A8 +:200040000C9496010C9496010C9496010C9496010C9496010C9496010C9496010C94B201CC +:200060000C9496010C9496010C9496010C9496010C9496010C9496010C9496010C949601C8 +:200080000C9496010C9496010C9496010C9496010C9496010C9496010C9496010C949601A8 +:2000A0000C9496010C9496010C94960100000000240027002A002D003000000000002500A4 :2000C00028002B002E003100000000002300260029002C002F00040404040403040502027D :2000E0000202040302020202060606060606040402020204040802011040804010204080A8 :200100004080080204018040201002011080102040400000000200080E0000030401000BB2 -:2001200000000000070605040100080A0B0C0D09040309042203410072006400750069003B -:200140006E006F0020004C0065006F006E006100720064006F0018034100720064007500C7 -:2001600069006E006F0020004C004C0043001201000200000040412334000001010200014C -:2001800012010002020000404123340000010102000100C18081C1080B00020202010009C5 -:2001A0000400000102020000052400100105240101010424020605240600010705810310D0 -:2001C000004009040100020A000000070502024000000705830240000005010902A10109E8 -:2001E00001A1008501050919012903150025019503750181029501750581030501093009DB -:200200003109381581257F750895038106C0C005010906A1018502050719E029E715002589 -:200220000175019508810295017508810395067508150025650507190029658100C00904D8 -:20024000020001030000000921010100012265000705840340000100000000000000002AE6 -:200260002B280000000000000000000000000000000000000000002C9EB4A0A1A2A434A64C -:20028000A7A5AE362D3738271E1F20212223242526B333B62EB7B89F8485868788898A8B25 -:2002A0008C8D8E8F909192939495969798999A9B9C9D2F3130A3AD350405060708090A0B7C -:2002C0000C0D0E0F101112131415161718191A1B1C1DAFB1B0B5000058041C07F00711243D -:2002E0001FBECFEFDAE0DEBFCDBF11E0A0E0B1E0EAE9F1E102C005900D92A632B107D9F783 -:2003000011E0A6E2B1E001C01D92A139B107E1F712E0CEEDD2E004C02297FE010E94C708AD -:20032000C83DD107C9F70E9479030C94CB080C9400008DE061E00E94460368EE73E080E04D -:2003400090E00E94FB018DE060E00E94460368EE73E080E090E00E94FB0108958DE061E095 -:200360000E94C20208951F920F920FB60F9211242F933F938F939F93AF93BF9380912A01D5 -:2003800090912B01A0912C01B0912D0130912E010196A11DB11D232F2D5F2D3720F02D575A -:2003A0000196A11DB11D20932E0180932A0190932B01A0932C01B0932D0180912601909181 -:2003C0002701A0912801B09129010196A11DB11D8093260190932701A0932801B0932901BF -:2003E000BF91AF919F918F913F912F910F900FBE0F901F9018959B01AC017FB7F89480910A -:20040000260190912701A0912801B091290166B5A89B05C06F3F19F00196A11DB11D7FBF6C -:20042000BA2FA92F982F8827860F911DA11DB11D62E0880F991FAA1FBB1F6A95D1F7BC01FE -:200440002DC0FFB7F8948091260190912701A0912801B0912901E6B5A89B05C0EF3F19F04D -:200460000196A11DB11DFFBFBA2FA92F982F88278E0F911DA11DB11DE2E0880F991FAA1FB3 -:20048000BB1FEA95D1F7861B970B885E9340C8F2215030404040504068517C4F21153105A4 -:2004A0004105510571F60895789484B5826084BD84B5816084BD85B5826085BD85B5816060 -:2004C00085BDEEE6F0E0808181608083E1E8F0E01082808182608083808181608083E0E893 -:2004E000F0E0808181608083E1EBF0E0808184608083E0EBF0E0808181608083E1E9F0E0A9 -:20050000808182608083808181608083E0E9F0E080818160808320EC30E0F9018081806893 -:20052000808380818F7B8083A2ECB0E08C9188608C938C918B7F8C93E1ECF0E080818460A0 -:200540008083808182608083808181608083E3ECF0E0808181608083F90180818260808369 -:200560008C9181608C93EAE7F0E08081846080838081826080838081816080838081806821 -:2005800080830895482F50E0CA018C509F4FFC0124914A525F4FFA0184918823C1F0E82F00 -:2005A000F0E0EE0FFF1FE455FF4FA591B491662341F49FB7F8948C91209582238C939FBFBA -:2005C00008959FB7F8948C91822B8C939FBF08958730C1F1883080F48330F9F0843030F4AF -:2005E000813029F1823009F050C024C08430C9F0863009F04AC022C08A3091F18B3030F46E -:20060000883031F1893009F040C026C08C3091F18C3060F18E30C9F533C0809180008F7717 -:2006200003C0809180008F7D80938000089584B58F7702C084B58F7D84BD08958091B00045 -:200640008F7703C08091B0008F7D8093B0000895809190008F7707C0809190008F7D03C0C6 -:2006600080919000877F8093900008958091C0008F7703C08091C0008F7D8093C0000895AC -:200680008091C200877F8093C2000895FF920F931F93F62E482F50E0CA018E5E9E4FFC01BE -:2006A0002491CA018C509F4FFC0114914A525F4FFA0104910023C9F0222319F0822F0E94F7 -:2006C000E802E02FF0E0EE0FFF1FE654FF4FA591B4919FB7F894FF2021F48C9110958123B7 -:2006E00002C08C91812B8C939FBF1F910F91FF900895CF93DF930E94540287E391E00E942D -:200700003F040E94AE01C0E0D0E00E9499012097E1F30E940000F9CF282F8091310188237F -:20072000C1F057FF1AC015C02898909330018091F1008193E217F307B9F74115510539F061 -:200740008091F200882319F48BE68093E800AFBF02C04FEF5FEFCA010895AFB7F8942770C5 -:200760002093E9008091F200282F30E0241735070CF4A901FB019B01240F311D94E6DACF16 -:20078000DF93CF930F92CDB7DEB7BE016F5F7F4F41E050E00E948C03019719F02FEF3FEF01 -:2007A00003C08981282F30E0C9010F90CF91DF910895FF920F931F93F82E142F052F4091DC -:2007C000340150913501212F302FC901DC01FB016EEF29C0F7FE02C0949101C090812091D6 -:2007E00032013091330124173507ACF48091E8008570E1F38091E80082FF03C02FEF3FEF6F -:2008000017C09093F100C90101968F739070892B11F46093E8002F5F3F4F30933301209330 -:200820003201119731961097A9F6812F902F9C01C9011F910F91FF9008959C018091E800E8 -:2008400082FFFCCFF901260F311D03C08091F1008193E217F307D1F7289884E680933001CD -:200860008BEF8093E800CB0108958093E9008091F200882319F08AE38093E8000895109240 -:20088000310181E08093D70080EA8093D80082E189BD09B400FEFDCF80E98093D8008CE096 -:2008A0008093E2001092E000559A209A0895089508955F926F927F928F929F92AF92BF925A -:2008C000CF92DF92EF92FF920F931F93CF93DF93E82E842E752E80913101882371F18B01C5 -:2008E000242F352FC901EC017AEFF72E67E0962E9E2050E4552E8E2D90E040E2A42EB12C80 -:20090000A822B9223AE3632E20E4C22ED12CC822D92258C09FB7F8949092E9008091E800B0 -:2009200085FD02C020E004C08091F200252D281B9FBF222361F4FA9419F42FEF3FEF4DC02B -:2009400061E070E080E090E00E94FB013BC0822F90E0C817D9070CF42C2FC21BD1094FB7A5 -:20096000F8949092E900A114B10421F406C01092F10021502223D9F719C0E7FC03C0F8010A -:20098000922F10C0C801322F06C0FC010196E491E093F10031503323C1F706C081918093EF -:2009A000F10091509923D1F7020F111D8091E80085FF05C0209729F4C114D10411F06092EF -:2009C000E8004FBF209709F0A5CF5D9884E680932F01282D372DC9019C01C901DF91CF91A1 -:2009E0001F910F91FF90EF90DF90CF90BF90AF909F908F907F906F905F9008951F920F9203 -:200A00000FB60F9211241F932F933F934F935F936F937F938F939F93AF93BF93EF93FF9311 -:200A20008091E1001092E100982F83FF0FC01092E90081E08093EB001092EC0082E3809339 -:200A4000ED001092310188E08093F00092FF36C083E08093E9008091F200882349F08AE330 -:200A60008093E80005C08CE791E00E945F0701C012E09FB7F8941093E9008091F2009FBF48 -:200A8000882389F780912F01882351F080912F01815080932F0180912F01882309F45D9AC9 -:200AA00080913001882351F08091300181508093300180913001882309F4289AFF91EF91F5 -:200AC000BF91AF919F918F917F916F915F914F913F912F911F910F900FBE0F901F901895AF -:200AE0000F931F93DF93CF930F92CDB7DEB719828E010F5F1F4FC8010E947E07C8010E94B3 -:200B00008F08898190E00F90CF91DF911F910F9108951F920F920FB60F921124EF92FF9269 -:200B20001F932F933F934F935F936F937F938F939F93AF93BF93EF93FF93DF93CF93CDB733 -:200B4000DEB76197DEBFCDBF1092E9008091E80083FF0FC1FE0131969E01275F3F4F03C0CD -:200B60008091F1008193E217F307D1F7289884E68093300182EF8093E800998197FF05C055 -:200B80008091E80080FFFCCF03C08EEF8093E800292F30E0C90180769070892B09F0C2C080 -:200BA0008A81882329F41092F1001092F100D6C0813009F4D3C0833009F4D0C0853049F433 -:200BC0008091E80080FFFCCF8B8180688093E300C5C0863009F07CC01C81EF80F8841230AE -:200BE000C1F51092E900109233011092320110923501109234010E94700599E0FE013996FC -:200C0000DF01292F1D922A95E9F799871A8791E09E8790E8988B9AEF998B2091320130910A -:200C20003301275F3F4F3C872B878D871092E9001092330110923201F0923501E09234014E -:200C400080E0BF0149E050E00E94D9030E94700585C01092E9001092330110923201F09289 -:200C60003501E0923401123241F482E290E00E948708892B09F476C071C0113079F488E0EB -:200C8000E816F10419F481E08093360180913601882309F06BC0EEE6F1E013C0133009F0DE -:200CA00061C08B81882319F4E0E3F1E00AC0823019F4E4E3F1E005C0813009F053C0E6E54D -:200CC000F1E0449180E8BF0150E00E94D90346C0873009F447C0883021F481E08093F100A5 -:200CE0003DC08930D9F523703070232BD9F5E3E9F1E091E031E026E39093E9003093EB003F -:200D000084918093EC002093ED009F5F3196953099F78EE78093EA001092EA008B818093E8 -:200D200031011CC08F8198851092E900109233011092320190933501809334018D818823E8 -:200D400029F4CE0101960E94920706C0823051F4CE0101960E94D407882321F08EEF8093E9 -:200D6000E80007C081E28093EB0003C0E0E8F1E0A8CF6196DEBFCDBFCF91DF91FF91EF9190 -:200D8000BF91AF919F918F917F916F915F914F913F912F911F91FF90EF900F900FBE0F903A -:200DA0001F901895209178013091790180917A0190917B01281B390B2F733070C901089519 -:200DC000209178013091790180917A0190917B012817390719F42FEF3FEF09C0E0917A01F8 -:200DE000F0917B01E85CFE4F8081282F30E0C9010895209178013091790180917A01909184 -:200E00007B012817390719F42FEF3FEF13C0E0917A01F0917B01E85CFE4F208180917A0104 -:200E200090917B0101968F73907090937B0180937A0130E0C901089510927F0110927E0195 -:200E400088EE93E0A0E0B0E08093800190938101A0938201B09383018EE091E090937D0163 -:200E600080937C0108950F931F93DF93CF930F92CDB7DEB78C01698380910701882369F0CD -:200E800083E0BE016F5F7F4F41E050E00E9459041816190614F49C0107C081E090E0F801C1 -:200EA0009383828320E030E0C9010F90CF91DF911F910F91089583E00E943504089582E0A4 -:200EC0000E94C003482F20917801309179012F5F3F4F2F73307080917A0190917B0128170B -:200EE000390759F0E0917801F0917901E85CFE4F408330937901209378010895FC0180812C -:200F00008E5F808380E867E971E042E450E00E94D903089587E391E00E945704F8940C9463 -:200F2000003C0895CF93DF93EC0189819881913A51F4813269F580E060E071E047E050E08B -:200F40000E94D90323C0913219F5803239F480E091E067E070E00E941D0418C08232C1F414 -:200F600080910701882379F08091000190910101A0910201B0910301805B9440A040B04017 -:200F800011F40E948A078A818093070181E001C080E0DF91CF910895DC01ED91FC91048098 -:200FA000F581E02D09950895FC0191818081813A31F4913089F080E0933089F40DC0813229 -:200FC00069F49B3021F482818093080105C09A3029F482818093090181E0089580E00895EE -:200FE00010928A0110928E0110928D0180E291E090938C0180938B011092900110928F01DC -:201000000895EF92FF920F931F93DF93CF930F92CDB7DEB789838B017A0184E0BE016F5F3B -:201020007F4F41E050E00E94590484E4B801A7010E9459040F90CF91DF911F910F91FF907C -:20104000EF90089582E048E050E00E9401080895EF92FF920F931F93DF93CF93CDB7DEB71F -:2010600028970FB6F894DEBF0FBECDBF7C019E012F5F3F4F88E0F90111928A95E9F7F70136 -:20108000A481B581109759F0ED91FC9111970190F081E02DCD0170E0A901099518C067FDA1 -:2010A00007C0E62FF0E0E95AFD4F6491662341F481E090E0F7019383828320E030E019C075 -:2010C00067FF04C08981826089836F776B83C7018E010F5F1F4FB8010E94220888E0F80101 -:2010E00011928A95E9F7C701B8010E94220821E030E0C90128960FB6F894DEBF0FBECDBF21 -:20110000CF91DF911F910F91FF90EF90089580E869ED71E045E650E00E94D9030895FC0182 -:2011200080818F5F808380E86EE372E049E150E00E94D9030895CF92DF92EF92FF920F93B7 -:201140001F93CF93DF937C016B018A01C0E0D0E00FC0D6016D916D01D701ED91FC910190BF -:20116000F081E02DC7010995C80FD91F015010400115110571F7CE01DF91CF911F910F9198 -:20118000FF90EF90DF90CF900895EE0FFF1F0590F491E02D0994F894FFCF00E100000000BC -:2011A000000001010000000033079B08D206F906E0065B075F0700000000CC079B08280825 +:200120000000070605040100080A0B0C0D09040309042203410072006400750069006E00CD +:200140006F0020004C0065006F006E006100720064006F00180341007200640075006900CC +:200160006E006F0020004C004C0043001201000200000040412334000001010200011201A2 +:200180000002020000404123340000010102000100C18081C1080B000202020100090400D4 +:2001A000000102020000052400100105240101010424020605240600010705810310004094 +:2001C00009040100020A000000070502024000000705830240000005010902A1010901A186 +:2001E000008501050919012903150025019503750181029501750581030501093009310943 +:20020000381581257F750895038106C0C005010906A1018502050719E029E715002501754D +:20022000019508810295017508810395067508150025650507190029658100C0090402004C +:2002400001030000000921010100012265000705840340000100000000000000002A2B2895 +:200260000000000000000000000000000000000000000000002C9EB4A0A1A2A434A6A7A553 +:20028000AE362D3738271E1F20212223242526B333B62EB7B89F8485868788898A8B8C8D58 +:2002A0008E8F909192939495969798999A9B9C9D2F3130A3AD350405060708090A0B0C0D7C +:2002C0000E0F101112131415161718191A1B1C1DAFB1B0B5000057041B07EF0711241FBE7C +:2002E000CFEFDAE0DEBFCDBF11E0A0E0B1E0E8E9F1E102C005900D92A632B107D9F711E071 +:20030000A6E2B1E001C01D92A139B107E1F712E0CCEDD2E004C02297FE010E94C608C63D9E +:20032000D107C9F70E9478030C94CA080C9400008DE061E00E94450368EE73E080E090E0E5 +:200340000E94FA018DE060E00E94450368EE73E080E090E00E94FA0108958DE061E00E9466 +:20036000C10208951F920F920FB60F9211242F933F938F939F93AF93BF9380912A01909157 +:200380002B01A0912C01B0912D0130912E010196A11DB11D232F2D5F2D3720F02D570196E4 +:2003A000A11DB11D20932E0180932A0190932B01A0932C01B0932D018091260190912701F0 +:2003C000A0912801B09129010196A11DB11D8093260190932701A0932801B0932901BF9197 +:2003E000AF919F918F913F912F910F900FBE0F901F9018959B01AC017FB7F8948091260133 +:2004000090912701A0912801B091290166B5A89B05C06F3F19F00196A11DB11D7FBFBA2FAA +:20042000A92F982F8827860F911DA11DB11D62E0880F991FAA1FBB1F6A95D1F7BC012DC0FA +:20044000FFB7F8948091260190912701A0912801B0912901E6B5A89B05C0EF3F19F00196A3 +:20046000A11DB11DFFBFBA2FA92F982F88278E0F911DA11DB11DE2E0880F991FAA1FBB1F70 +:20048000EA95D1F7861B970B885E9340C8F2215030404040504068517C4F21153105410538 +:2004A000510571F60895789484B5826084BD84B5816084BD85B5826085BD85B5816085BD64 +:2004C000EEE6F0E0808181608083E1E8F0E01082808182608083808181608083E0E8F0E005 +:2004E000808181608083E1EBF0E0808184608083E0EBF0E0808181608083E1E9F0E0808178 +:2005000082608083808181608083E0E9F0E080818160808320EC30E0F90180818068808391 +:2005200080818F7B8083A2ECB0E08C9188608C938C918B7F8C93E1ECF0E0808184608083A0 +:20054000808182608083808181608083E3ECF0E0808181608083F9018081826080838C914F +:2005600081608C93EAE7F0E08081846080838081826080838081816080838081806880833B +:200580000895482F50E0CA018C509F4FFC0124914A525F4FFA0184918823C1F0E82FF0E033 +:2005A000EE0FFF1FE455FF4FA591B491662341F49FB7F8948C91209582238C939FBF0895ED +:2005C0009FB7F8948C91822B8C939FBF08958730C1F1883080F48330F9F0843030F481309B +:2005E00029F1823009F050C024C08430C9F0863009F04AC022C08A3091F18B3030F4883067 +:2006000031F1893009F040C026C08C3091F18C3060F18E30C9F533C0809180008F7703C00C +:20062000809180008F7D80938000089584B58F7702C084B58F7D84BD08958091B0008F7702 +:2006400003C08091B0008F7D8093B0000895809190008F7707C0809190008F7D03C08091BB +:200660009000877F8093900008958091C0008F7703C08091C0008F7D8093C00008958091AC +:20068000C200877F8093C2000895FF920F931F93F62E482F50E0CA018E5E9E4FFC0124911A +:2006A000CA018C509F4FFC0114914A525F4FFA0104910023C9F0222319F0822F0E94E702C3 +:2006C000E02FF0E0EE0FFF1FE654FF4FA591B4919FB7F894FF2021F48C911095812302C0DF +:2006E0008C91812B8C939FBF1F910F91FF900895CF93DF930E94530287E391E00E943E04AE +:200700000E94AD01C0E0D0E00E9498012097E1F30E940000F9CF282F809131018823C1F013 +:2007200057FF1AC015C02898909330018091F1008193E217F307B9F74115510539F0809101 +:20074000F200882319F48BE68093E800AFBF02C04FEF5FEFCA010895AFB7F8942770209323 +:20076000E9008091F200282F30E0241735070CF4A901FB019B01240F311D94E6DACFDF9357 +:20078000CF930F92CDB7DEB7BE016F5F7F4F41E050E00E948B03019719F02FEF3FEF03C0B1 +:2007A0008981282F30E0C9010F90CF91DF910895FF920F931F93F82E142F052F409134016A +:2007C00050913501212F302FC901DC01FB016EEF29C0F7FE02C0949101C0908120913201D8 +:2007E0003091330124173507ACF48091E8008570E1F38091E80082FF03C02FEF3FEF17C0CB +:200800009093F100C90101968F739070892B11F46093E8002F5F3F4F3093330120933201D4 +:20082000119731961097A9F6812F902F9C01C9011F910F91FF9008959C018091E80082FF9A +:20084000FCCFF901260F311D03C08091F1008193E217F307D1F7289884E6809330018BEFD4 +:200860008093E800CB0108958093E9008091F200882319F08AE38093E80008951092310188 +:2008800081E08093D70080EA8093D80082E189BD09B400FEFDCF80E98093D8008CE08093B5 +:2008A000E2001092E000559A209A0895089508955F926F927F928F929F92AF92BF92CF920C +:2008C000DF92EF92FF920F931F93CF93DF93E82E842E752E80913101882371F18B01242FD3 +:2008E000352FC901EC017AEFF72E67E0962E9E2050E4552E8E2D90E040E2A42EB12CA82209 +:20090000B9223AE3632E20E4C22ED12CC822D92258C09FB7F8949092E9008091E80085FDF8 +:2009200002C020E004C08091F200252D281B9FBF222361F4FA9419F42FEF3FEF4DC061E06C +:2009400070E080E090E00E94FA013BC0822F90E0C817D9070CF42C2FC21BD1094FB7F8945B +:200960009092E900A114B10421F406C01092F10021502223D9F719C0E7FC03C0F801922FD5 +:2009800010C0C801322F06C0FC010196E491E093F10031503323C1F706C081918093F100BF +:2009A00091509923D1F7020F111D8091E80085FF05C0209729F4C114D10411F06092E800F8 +:2009C0004FBF209709F0A5CF5D9884E680932F01282D372DC9019C01C901DF91CF911F91D9 +:2009E0000F91FF90EF90DF90CF90BF90AF909F908F907F906F905F9008951F920F920FB6EE +:200A00000F9211241F932F933F934F935F936F937F938F939F93AF93BF93EF93FF938091C5 +:200A2000E1001092E100982F83FF0FC01092E90081E08093EB001092EC0082E38093ED005D +:200A40001092310188E08093F00092FF36C083E08093E9008091F200882349F08AE380930A +:200A6000E80005C08CE791E00E945E0701C012E09FB7F8941093E9008091F2009FBF8823B1 +:200A800089F780912F01882351F080912F01815080932F0180912F01882309F45D9A809163 +:200AA0003001882351F08091300181508093300180913001882309F4289AFF91EF91BF91B6 +:200AC000AF919F918F917F916F915F914F913F912F911F910F900FBE0F901F9018950F935D +:200AE0001F93DF93CF930F92CDB7DEB719828E010F5F1F4FC8010E947D07C8010E948E08C0 +:200B0000898190E00F90CF91DF911F910F9108951F920F920FB60F921124EF92FF921F934E +:200B20002F933F934F935F936F937F938F939F93AF93BF93EF93FF93DF93CF93CDB7DEB750 +:200B40006197DEBFCDBF1092E9008091E80083FF0FC1FE0131969E01275F3F4F03C0809151 +:200B6000F1008193E217F307D1F7289884E68093300182EF8093E800998197FF05C0809155 +:200B8000E80080FFFCCF03C08EEF8093E800292F30E0C90180769070892B09F0C2C08A8186 +:200BA000882329F41092F1001092F100D6C0813009F4D3C0833009F4D0C0853049F480912D +:200BC000E80080FFFCCF8B8180688093E300C5C0863009F07CC01C81EF80F8841230C1F509 +:200BE0001092E900109233011092320110923501109234010E946F0599E0FE013996DF01D3 +:200C0000292F1D922A95E9F799871A8791E09E8790E8988B9AEF998B2091320130913301B6 +:200C2000275F3F4F3C872B878D871092E9001092330110923201F0923501E092340180E022 +:200C4000BF0149E050E00E94D8030E946F0585C01092E9001092330110923201F0923501B5 +:200C6000E0923401123241F482E290E00E948608892B09F476C071C0113079F488E0E81624 +:200C8000F10419F481E08093360180913601882309F06BC0ECE6F1E013C0133009F061C0BD +:200CA0008B81882319F4EEE2F1E00AC0823019F4E2E3F1E005C0813009F053C0E4E5F1E094 +:200CC000449180E8BF0150E00E94D80346C0873009F447C0883021F481E08093F1003DC07A +:200CE0008930D9F523703070232BD9F5E1E9F1E091E031E026E39093E9003093EB00849129 +:200D00008093EC002093ED009F5F3196953099F78EE78093EA001092EA008B8180933101CB +:200D20001CC08F8198851092E900109233011092320190933501809334018D81882329F4FD +:200D4000CE0101960E94910706C0823051F4CE0101960E94D307882321F08EEF8093E80020 +:200D600007C081E28093EB0003C0EEE7F1E0A8CF6196DEBFCDBFCF91DF91FF91EF91BF911B +:200D8000AF919F918F917F916F915F914F913F912F911F91FF90EF900F900FBE0F901F90DB +:200DA0001895209178013091790180917A0190917B01281B390B2F733070C9010895209117 +:200DC00078013091790180917A0190917B012817390719F42FEF3FEF09C0E0917A01F09128 +:200DE0007B01E85CFE4F8081282F30E0C9010895209178013091790180917A0190917B0189 +:200E00002817390719F42FEF3FEF13C0E0917A01F0917B01E85CFE4F208180917A0190915F +:200E20007B0101968F73907090937B0180937A0130E0C901089510927F0110927E0188EE40 +:200E400093E0A0E0B0E08093800190938101A0938201B09383018EE091E090937D018093C6 +:200E60007C0108950F931F93DF93CF930F92CDB7DEB78C01698380910701882369F083E07D +:200E8000BE016F5F7F4F41E050E00E9458041816190614F49C0107C081E090E0F80193830F +:200EA000828320E030E0C9010F90CF91DF911F910F91089583E00E943404089582E00E9419 +:200EC000BF03482F20917801309179012F5F3F4F2F73307080917A0190917B01281739076E +:200EE00059F0E0917801F0917901E85CFE4F408330937901209378010895FC0180818E5F7F +:200F0000808380E865E971E042E450E00E94D803089587E391E00E945604F8940C94003C18 +:200F20000895CF93DF93EC0189819881913A51F4813269F580E060E071E047E050E00E9425 +:200F4000D80323C0913219F5803239F480E091E067E070E00E941C0418C08232C1F48091A7 +:200F60000701882379F08091000190910101A0910201B0910301805B9440A040B04011F423 +:200F80000E9489078A818093070181E001C080E0DF91CF910895DC01ED91FC910480F58128 +:200FA000E02D09950895FC0191818081813A31F4913089F080E0933089F40DC0813269F442 +:200FC0009B3021F482818093080105C09A3029F482818093090181E0089580E008951092A9 +:200FE0008A0110928E0110928D0180E291E090938C0180938B011092900110928F010895E1 +:20100000EF92FF920F931F93DF93CF930F92CDB7DEB789838B017A0184E0BE016F5F7F4F0A +:2010200041E050E00E94580484E4B801A7010E9458040F90CF91DF911F910F91FF90EF90CD +:20104000089582E048E050E00E9400080895EF92FF920F931F93DF93CF93CDB7DEB72897E0 +:201060000FB6F894DEBF0FBECDBF7C019E012F5F3F4F88E0F90111928A95E9F7F701A481D0 +:20108000B581109759F0ED91FC9111970190F081E02DCD0170E0A901099518C067FD07C0FF +:2010A000E62FF0E0EB5AFD4F6491662341F481E090E0F7019383828320E030E019C067FFD4 +:2010C00004C08981826089836F776B83C7018E010F5F1F4FB8010E94210888E0F8011192C5 +:2010E0008A95E9F7C701B8010E94210821E030E0C90128960FB6F894DEBF0FBECDBFCF9165 +:20110000DF911F910F91FF90EF90089580E867ED71E045E650E00E94D8030895FC018081E4 +:201120008F5F808380E86CE372E049E150E00E94D8030895CF92DF92EF92FF920F931F9309 +:20114000CF93DF937C016B018A01C0E0D0E00FC0D6016D916D01D701ED91FC910190F08100 +:20116000E02DC7010995C80FD91F015010400115110571F7CE01DF91CF911F910F91FF907A +:20118000EF90DF90CF900895EE0FFF1F0590F491E02D0994F894FFCF00E10000000000004B +:2011A00001010000000032079A08D106F806DF065A075E0700000000CB079A082708FFFF31 :2011C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F :2011E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F :20120000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEE @@ -958,7 +958,7 @@ :2077A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9 :2077C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9 :2077E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9 -:2078000011241FBECFEFDAE0DEBFCDBFFFC0410142144505560455026403740300001E95D2 +:2078000011241FBECFEFDAE0DEBFCDBF0BC1410142144505560455026403740300001E95C5 :2078200087020110030000C18081C106C0FF0A000CA10185037508150026FF00954009018D :207840008102954009029102C0040309041A03300030003000300030003000300030003190 :20786000003700300031003803410072006400750069006E006F0020004C0065006F006EB5 @@ -970,49 +970,50 @@ :20792000058302400000090402000103000000092101010001221E000705840340004000EA :2079400020918A0130918B012C5F3F4F30938B0120938A01C901892F99278695982F803420 :2079600018F08FE7891B982F990F921710F447980895479A08955D9A289A81E08093E000C2 -:207980001092E200EE27FF27099408950F931F93CF93DF93982FEB01042F10E088E76030F1 -:2079A000780730F411E083E0FB0180935700E895892F68E071E0402FF8D0112311F107B672 -:2079C00000FCFDCF402F4695FE01A8E0B1E020E031E009C08D919D910C0130935700E895B3 -:2079E000112432962F5F2417A8F385E0FE0180935700E89507B600FCFDCF81E1809357008A -:207A0000E895DF91CF911F910F91089588E10FB6F89480936000109260000FBE5D9A289A77 -:207A200047983F9A209A559A90E8909361001092610081E885BF95BF9FD084E18093880175 -:207A400080E180938901E0E0F0E0859194918F5F9F4F19F081E080938F01EE24FF24BB2460 -:207A6000B39454EFC52E51E0D52E13D2082F8EE098E7FC012491319602964491201711F02E -:207A80002223B9F7109291011092900182E068E071E08BD0013479F460910801605863304D -:207AA00028F0683111F064E001C063E0C62FD0E0CF5DD7480EC0063571F4809108018033A1 -:207AC00011F011E022C080910A01C82FD0E0C25ED74811E022C0053721F413E0CEE1D8E74B -:207AE0001CC0053539F4E0900801F0900901EE0CFF1C0AC0043631F482E0B701409109010D -:207B000045DF02C0043721F010E0C5E2D8E705C010910901E701E10EF11CBBD18097B1F441 -:207B200083E068E871E041E050E059D0112329F0412F50E083E8BE0152D083E469E871E085 -:207B400041E050E04CD0013509F08FCFD0929101C0929001B0928F01EE24FF2486CFFC01FB -:207B6000289884E680938D0104C08091F100819361506623D1F7089510929101109290015A -:207B800010928E0110928F0181E08093D70080EA8093D80082E189BD09B400FEFDCF80E949 -:207BA0008093D8001092E0000895FB018093E90024E69BE611C08091E80085FFFCCF28985F -:207BC00020938D018091F10081938091E80085FD02C09093E8004150442369F70895982F4A -:207BE000FB01282F207287708093E90064E63AE317C08091E80085FFFCCF97FF02C08491BA -:207C000001C080813196211180E05D9860938C018093F1008091E80085FD02C03093E800E8 -:207C2000415050408FEF4F3F580719F796FF03C08AE38093E800089580919301813299F466 -:207C40005D9884E680938C0120E030E003C080818093F100F901E050FF4F2F5F3F4F283061 -:207C60003105A9F714C0803261F48091E80082FFFCCF80E091E067E072DF8BEF8093E80030 -:207C800006C0823221F4809194018093070181E0089520919501223289F1213081F48091AA -:207CA000980190919901089711F420939A0180919A01882309F04FC0E9ECF8E74EC022300B -:207CC00021F484E6EBEDF8E71CC0233009F041C080919401882319F4E9E4F8E73EC082308B -:207CE00019F4E7E6F8E739C0833019F4EDE4F8E734C0813071F5EFE9F8E72FC081E0EBE283 -:207D0000F8E790919801382F981708F4392F90918C0120E04EEF8091E8008570E1F3809192 -:207D2000E80082FD12C02F5F84915D988093F100822F8F7311F44093E800319694E6231780 -:207D400050F390938C0181E0089590938C0180E0089580E00895E7EBF8E78491D2CF10927F -:207D6000E9008091E80083FF61C082E991E068E0F6DE82EF8093E8008091920187FF05C02B -:207D80008091E80080FFFCCF03C08EEF8093E80080919301853051F48091E80080FFFCCF83 -:207DA0008091940180688093E30039C08930E1F48091940180938E01E7E2F8E791E031E046 -:207DC00026E39093E9003093EB0084918093EC002093ED009F5F3196953099F78EE780938A -:207DE000EA001092EA001BC0883049F490918E015D9884E680938C019093F10010C08823FF -:207E000039F45D9884E680938C011092F10007C0863011F43EDF01C00FDF882321F08EEF1C -:207E20008093E800089581E28093EB0008958091E1001092E100282F83FF0CC01092E90007 -:207E400081E08093EB001092EC0082E38093ED0010928E0122FF1CC080918C01882331F038 -:207E6000815080938C01882309F45D9A80918D01882331F0815080938D01882309F4289AAB -:207E800080918F01882321F4109291011092900108951F93CF93DF9312E0C0E9D1E05FDF6D -:207EA000C6DF1093E9008091E80085FF13C0289884E680938D019091F1008091E80085FDE9 -:207EC00003C08BE68093E800892F90E0DF91CF911F9108958091900190919101019790931E -:207EE0009101809390018091900190919101892B09F441DDCE010197F1F722DDD0CF00E15A -:067F00000000000000007B +:207980001092E200EE27FF270994089528E088E190E00FB6F894A895809360000FBE20938C +:2079A0006000FFCF0F931F93CF93DF93982FEB01042F10E088E76030780730F411E083E0A5 +:2079C000FB0180935700E895892F68E071E0402F06D1112311F107B600FCFDCF402F469528 +:2079E000FE01A8E0B1E020E031E009C08D919D910C0130935700E895112432962F5F2417DF +:207A0000A8F385E0FE0180935700E89507B600FCFDCF81E180935700E895DF91CF911F9132 +:207A20000F91089584B794B7977F94BF98E10FB6F89490936000109260000FBE5D9A289A45 +:207A4000479883FF08C0E0E0F0E0859194918F5F9F4F09F090DF3F9A209A559A90E89093D1 +:207A600061001092610081E885BF95BF9FD084E18093880180E180938901E0E0F0E085918D +:207A800094918F5F9F4F19F081E080938F01EE24FF24BB24B39454EFC52E51E0D52E13D22E +:207AA000082F8EE098E7FC012491319602964491201711F02223B9F7109291011092900128 +:207AC00082E068E071E08BD0013479F4609108016058633028F0683111F064E001C063E06F +:207AE000C62FD0E0CF5DD7480EC0063571F480910801803311F011E022C080910A01C82F74 +:207B0000D0E0C25ED74811E022C0053721F413E0CEE1D8E71CC0053539F4E0900801F090B5 +:207B20000901EE0CFF1C0AC0043631F482E0B7014091090137DF02C0043721F010E0C5E24D +:207B4000D8E705C010910901E701E10EF11CBBD18097B1F483E068E871E041E050E059D04C +:207B6000112329F0412F50E083E8BE0152D083E469E871E041E050E04CD0013509F08FCFC9 +:207B8000D0929101C0929001B0928F01EE24FF2486CFFC01289884E680938D0104C0809115 +:207BA000F100819361506623D1F70895109291011092900110928E0110928F0181E08093E3 +:207BC000D70080EA8093D80082E189BD09B400FEFDCF80E98093D8001092E0000895FB01DA +:207BE0008093E90024E69BE611C08091E80085FFFCCF289820938D018091F10081938091BD +:207C0000E80085FD02C09093E8004150442369F70895982FFB01282F207287708093E90099 +:207C200064E63AE317C08091E80085FFFCCF97FF02C0849101C080813196211180E05D9841 +:207C400060938C018093F1008091E80085FD02C03093E800415050408FEF4F3F580719F71C +:207C600096FF03C08AE38093E800089580919301813299F45D9884E680938C0120E030E0B3 +:207C800003C080818093F100F901E050FF4F2F5F3F4F28303105A9F714C0803261F480916E +:207CA000E80082FFFCCF80E091E067E072DF8BEF8093E80006C0823221F48091940180936A +:207CC000070181E0089520919501223289F1213081F48091980190919901089711F4209307 +:207CE0009A0180919A01882309F04FC0E9ECF8E74EC0223021F484E6EBEDF8E71CC0233011 +:207D000009F041C080919401882319F4E9E4F8E73EC0823019F4E7E6F8E739C0833019F43D +:207D2000EDE4F8E734C0813071F5EFE9F8E72FC081E0EBE2F8E790919801382F981708F409 +:207D4000392F90918C0120E04EEF8091E8008570E1F38091E80082FD12C02F5F84915D982C +:207D60008093F100822F8F7311F44093E800319694E6231750F390938C0181E008959093FD +:207D80008C0180E0089580E00895E7EBF8E78491D2CF1092E9008091E80083FF61C082E963 +:207DA00091E068E0F6DE82EF8093E8008091920187FF05C08091E80080FFFCCF03C08EEF58 +:207DC0008093E80080919301853051F48091E80080FFFCCF8091940180688093E30039C049 +:207DE0008930E1F48091940180938E01E7E2F8E791E031E026E39093E9003093EB008491AB +:207E00008093EC002093ED009F5F3196953099F78EE78093EA001092EA001BC0883049F4DB +:207E200090918E015D9884E680938C019093F10010C0882339F45D9884E680938C01109236 +:207E4000F10007C0863011F43EDF01C00FDF882321F08EEF8093E800089581E28093EB00B1 +:207E600008958091E1001092E100282F83FF0CC01092E90081E08093EB001092EC0082E36E +:207E80008093ED0010928E0122FF1CC080918C01882331F0815080938C01882309F45D9A3A +:207EA00080918D01882331F0815080938D01882309F4289A80918F01882321F410929101E6 +:207EC0001092900108951F93CF93DF9312E0C0E9D1E05FDFC6DF1093E9008091E80085FF14 +:207EE00013C0289884E680938D019091F1008091E80085FD03C08BE68093E800892F90E000 +:207F0000DF91CF911F9108958091900190919101019790939101809390018091900190913B +:1A7F20009101892B09F432DDCE010197F1F708DDD0CF00E100000000000041 :00000001FF diff --git a/bootloaders/diskloader/src/DiskLoader.cpp b/bootloaders/diskloader/src/DiskLoader.cpp index 6580618..09f59a7 100644 --- a/bootloaders/diskloader/src/DiskLoader.cpp +++ b/bootloaders/diskloader/src/DiskLoader.cpp @@ -56,7 +56,7 @@ void Program(u8 ep, u16 page, u8 count) boot_rww_enable (); } - +void StartSketch(); int USBGetChar(); #define getch USBGetChar @@ -111,10 +111,15 @@ int main(void) __attribute__ ((naked)); // STK500v1 main loop, very similar to optiboot in protocol and implementation int main() { + uint8_t MCUSR_state = MCUSR; // store the reason for the reset + MCUSR &= ~(1 << WDRF); // must clear the watchdog reset flag before disabling and reenabling WDT wdt_disable(); TXLED0; RXLED0; - LED0; + LED0; + if (MCUSR_state & (1<<WDRF) && (pgm_read_word(0) != -1)) { + StartSketch(); // if the reset was caused by WDT and if a sketch is already present then run the sketch instead of the bootloader + } BOARD_INIT(); USBInit(); @@ -225,7 +230,7 @@ void LEDPulse() LED1; } -void Reboot() +void StartSketch() { TXLED0; // switch off the RX and TX LEDs before starting the user sketch RXLED0; @@ -237,3 +242,10 @@ void Reboot() "ijmp\n" ::); } + +void Reset() +{ + wdt_enable(WDTO_15MS); + for (;;) + ; +} diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp index 208121e..0467e46 100644 --- a/bootloaders/diskloader/src/USBCore.cpp +++ b/bootloaders/diskloader/src/USBCore.cpp @@ -34,7 +34,7 @@ u8 TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ u8 RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ -void Reboot(); +void Reset(); //================================================================== //================================================================== @@ -500,7 +500,7 @@ int USBGetChar() } if (!--_timeout) { - Reboot(); // USB not connected, run firmware + Reset(); } _delay_us(100); // stretch out the bootloader period to about 5 seconds after enumeration |