From b28e6c2f9cc344cb2ba4ca080b97ad39aa6e2d0d Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Tue, 14 Feb 2012 09:59:48 -0500 Subject: Leonardo bootloader jumps straight to sketch for a power-on reset. Disconnect programmer after burning bootloader to get the full effect. ICSP and JTAG programmers do a hardware reset after any reset condition, confusing the firmware a little. --- bootloaders/caterina_LUFA/Caterina.c | 11 +- bootloaders/caterina_LUFA/Caterina.hex | 273 +++++++++++++++++---------------- 2 files changed, 148 insertions(+), 136 deletions(-) (limited to 'bootloaders') diff --git a/bootloaders/caterina_LUFA/Caterina.c b/bootloaders/caterina_LUFA/Caterina.c index 11404a7..b6fbd9b 100755 --- a/bootloaders/caterina_LUFA/Caterina.c +++ b/bootloaders/caterina_LUFA/Caterina.c @@ -110,6 +110,15 @@ int main(void) /* Watchdog may be configured with a 15 ms period so must disable it before doing anything else */ wdt_disable(); + /* Check the reason for the reset and act accordingly */ + uint8_t mcusr_state = MCUSR; // store the initial state of the Status register + MCUSR = 0; // clear all reset flags + // After a power-on reset skip the bootloader and jump straight to sketch + // if one exists. + if (mcusr_state & (1< 16000) + if (Timeout > 16000 && pgm_read_word(0) != 0xFFFF) RunBootloader = false; LEDPulse(); diff --git a/bootloaders/caterina_LUFA/Caterina.hex b/bootloaders/caterina_LUFA/Caterina.hex index ffdb83e..3657484 100644 --- a/bootloaders/caterina_LUFA/Caterina.hex +++ b/bootloaders/caterina_LUFA/Caterina.hex @@ -1,6 +1,6 @@ :1070000055C000006EC000006CC000006AC00000E7 :1070100068C0000066C0000064C0000062C00000DC -:1070200060C000005EC00000C4C400005AC0000080 +:1070200060C000005EC00000DCC400005AC0000068 :1070300058C0000056C0000054C0000052C00000FC :1070400050C0000078C000004CC000004AC00000E2 :1070500048C0000046C0000044C0000042C000001C @@ -9,10 +9,10 @@ :1070800030C000002EC000002CC000002AC000004C :1070900028C0000026C0000024C0000022C000005C :1070A00020C000001EC000001CC0000011241FBE34 -:1070B000CFEFDAE0DEBFCDBF11E0A0E0B1E0E6ED5A -:1070C000FEE702C005900D92A03CB107D9F711E090 +:1070B000CFEFDAE0DEBFCDBF11E0A0E0B1E0E6E067 +:1070C000FFE702C005900D92A03CB107D9F711E08F :1070D000A0ECB1E001C01D92A63DB107E1F78ED34F -:1070E000F8C68ECFF89410926F0010928100109223 +:1070E00010C78ECFF89410926F001092810010920A :1070F00085001092840081E085BF15BE47985D9A97 :10710000289A0C94000008952091CA013091CB0177 :107110002F5F3F4F3093CB012093CA01932F37FF4E @@ -66,7 +66,7 @@ :10741000FF29E4918E2FEBDEDD2081F082E090E009 :10742000A0E0B0E0E80EF91E0A1F1B1FE092C601A3 :10743000F092C7010093C8011093C901DC2418C061 -:10744000D801C701B695A795979587952CD5CFDE1E +:10744000D801C701B695A7959795879544D5CFDE06 :1074500082E090E0A0E0B0E0E80EF91E0A1F1B1FDA :10746000E092C601F092C7010093C8011093C901D0 :107470002197209709F0BECF7DC08090C6019090E3 @@ -80,7 +80,7 @@ :1074F0000093C8011093C90102C061DE582E7424A4 :1075000023C0E090C601F090C7010091C80110911E :10751000C90116950795F794E79451DE682FC701C6 -:10752000CAD48091C6019091C701A091C801B091C1 +:10752000E2D48091C6019091C701A091C801B091A9 :10753000C9010296A11DB11D8093C6019093C70198 :10754000A093C801B093C901219704C055247724A2 :1075500044244394209709F0A5CF96E4691641F49A @@ -97,12 +97,12 @@ :107600003DCE823551F4E091C601F091C70105915C :107610001491812FECDD802F4CC0843421F5E09053 :10762000C601F090C7010091C8011091C9011695DB -:107630000795F794E794C3DD682FC7013CD4809188 +:107630000795F794E794C3DD682FC70154D4809170 :10764000C6019091C701A091C801B091C9010296ED :10765000A11DB11D8093C6019093C701A093C801DD :10766000B093C9010BCE843609F5E090C601F090C5 :10767000C7010091C8011091C901D801C701B69591 -:10768000A795979587950FD4B2DD82E090E0A0E0B2 +:10768000A7959795879527D4B2DD82E090E0A0E09A :10769000B0E0E80EF91E0A1F1B1FE092C601F0922F :1076A000C7010093C8011093C90104C08B3111F0C8 :1076B0008FE39DDD83E08093E9009091E800809165 @@ -115,138 +115,141 @@ :107720006F905F904F9008959091CE01892F8F7741 :10773000813249F58091CF018032A1F0813219F573 :10774000913A09F58091E800877F8093E8008AE00C -:1077500091E067E070E0DED18091E8008B77809364 +:1077500091E067E070E0F6D18091E8008B7780934C :10776000E8000895913279F48091E800877F809352 -:10777000E8008AE091E067E070E030D28091E800B4 -:107780008E778093E800089582E061EC42E088D033 -:1077900083E061E842E184D084E060E842E180C0B7 +:10777000E8008AE091E067E070E048D28091E8009C +:107780008E778093E800089582E061EC42E0A0D01B +:1077900083E061E842E19CD084E060E842E198C087 :1077A00084B7877F84BF88E10FB6F8948093600028 :1077B000109260000FBE20E880E090E00FB6F894D1 :1077C00020936100809361000FBE81E085BF92E04D :1077D00095BF3F9A209A559AE1E6F0E02083108207 :1077E00047985D9A289A109289008AEF80938800C2 -:1077F00090936F0083E080938100C3C088E10FB64F -:10780000F89480936000109260000FBEC9DF7894F6 -:107810000CC00CDD36D38091C4019091C501815814 -:107820009E4310F0109209016FDC809109018823BA -:1078300081F78091E00081608093E00053DC80E07C -:1078400090E00895FA01923049F0933061F0913060 -:10785000F9F481E191E022E130E01EC083E291E0A1 -:107860002EE330E019C0882329F481E691E024E07A -:1078700030E012C0813029F485E691E022E230E068 -:107880000BC0823029F485EA91E028E130E004C0A1 -:1078900080E090E020E030E091838083C90108958A -:1078A0008093E9008091EB0081608093EB0010925F -:1078B000ED006093EC004093ED008091EE00881F96 -:1078C0008827881F08958091CE0188238CF403C0F7 -:1078D0008EB38823B1F08091E80082FFF9CF8091C8 -:1078E000E8008B778093E80008958EB3882349F0F1 -:1078F0008091E80080FFF9CF8091E8008E77809337 -:10790000E8000895EF92FF920F931F9345D04CD05B -:1079100008ED10E0F80180818F7780838081806896 -:10792000808380818F7D808319BC1EBA1092CC0128 -:1079300080EEE82EF12CF70180818B7F8083F801A7 -:1079400080818160808380E060E042E0A9DFE1EE39 -:10795000F0E080818E7F8083E2EEF0E080818160C4 -:107960008083808188608083F70180818E7F80831F -:10797000F8018081806180831F910F91FF90EF90CB -:107980000895E7EDF0E08081816080838AE482BF22 -:1079900081E08093CD01B6CFE8EDF0E080818E7F6D -:1079A00080831092E20008951092DA001092E100B4 -:1079B00008951F920F920FB60F9211242F933F93A9 -:1079C0004F935F936F937F938F939F93AF93BF93E7 -:1079D000EF93FF938091DA0080FF1BC08091D80065 -:1079E00080FF17C08091DA008E7F8093DA0080914B -:1079F000D90080FF0BC080E189BD82E189BD09B457 -:107A000000FEFDCF81E08EBB3BD203C019BC1EBA85 -:107A100037D28091E10080FF17C08091E20080FFA3 -:107A200013C08091E2008E7F8093E2008091E2009B -:107A300080618093E2008091D80080628093D800BA -:107A400019BC85E08EBB1CD28091E10084FF2CC064 -:107A50008091E20084FF28C080E189BD82E189BD78 -:107A600009B400FEFDCF8091D8008F7D8093D800AF -:107A70008091E1008F7E8093E1008091E2008F7E13 -:107A80008093E2008091E20081608093E200809127 -:107A9000CC01882331F48091E30087FD02C081E0AE -:107AA00001C084E08EBBECD18091E10083FF21C056 -:107AB0008091E20083FF1DC08091E100877F809369 -:107AC000E10082E08EBB1092CC018091E1008E7FBC -:107AD0008093E1008091E2008E7F8093E2008091AC -:107AE000E20080618093E20080E060E042E0D8DE66 -:107AF000C7D1FF91EF91BF91AF919F918F917F91EE -:107B00006F915F914F913F912F910F900FBE0F900A -:107B10001F9018959C014091D4015091D5014617B2 -:107B2000570718F4F90190E044C06115710511F090 -:107B3000AB01F8CF8091E8008E778093E80040E0B9 -:107B400050E0F0CF8EB3882309F444C0853009F4A7 -:107B500043C08091E80083FF02C081E008958091D6 -:107B6000E80082FD31C08091E80080FF22C0809152 -:107B7000F3009091F200782F60E0292F30E0262B5F -:107B8000372B07C081918093F100415050402F5F07 -:107B90003F4F4115510519F02830310598F390E019 -:107BA0002830310509F491E08091E8008E778093C8 -:107BB000E8004115510531F6992321F605C08EB331 -:107BC000882341F0853041F08091E80082FFF7CFB3 -:107BD00080E0089582E0089583E008959C01611596 -:107BE000710529F48091E8008B778093E800F90112 -:107BF00026C08EB3882391F1853091F18091E80001 -:107C000083FF02C081E008958091E80082FFF1CFF8 -:107C100006C08091F10081936150704059F020912D -:107C2000F3008091F200322F20E090E0822B932B22 -:107C3000892B79F78091E8008B778093E8006115B4 -:107C40007105B9F605C08EB3882341F0853041F047 -:107C50008091E80080FFF7CF80E0089582E00895EA -:107C600083E008950F931F93DF93CF9300D0CDB798 -:107C7000DEB7EEECF1E08091F100819381E0E63D2A -:107C8000F807C9F751DD8091E80083FFE4C08091D7 -:107C9000CE019091CF01953009F46DC0963040F43B -:107CA000913081F1913070F0933009F0D4C02AC046 -:107CB000983009F4A3C0993009F4B2C0963009F0A5 -:107CC000CAC07CC0803809F4C6C0823809F0C3C07D -:107CD0008091D20187708093E9008091EB0010922F -:107CE000E9002091E800277F2093E80090E025E05C -:107CF000969587952A95E1F781708093F10010920F -:107D0000F10087C0882319F0823009F0A4C08F7178 -:107D1000823009F0A0C08091D001882331F52091F4 -:107D2000D201277009F497C02093E9008091EB00FD -:107D300080FF1BC0933021F48091EB00806213C060 -:107D40008091EB0080618093EB0081E090E002C0C5 -:107D5000880F991F2A95E2F78093EA001092EA00B3 -:107D60008091EB0088608093EB001092E900809195 -:107D7000E800877F51C0882309F06DC01091D001C1 -:107D80001F770FB7F8948091E800877F8093E80011 -:107D90009ADD8091E80080FFFCCF8091E30080783D -:107DA000812B8093E30080688093E300112311F41A -:107DB00082E001C083E08EBB0FBF4DC0805882308F -:107DC00008F049C08091D0019091D1016091D20119 -:107DD000AE014F5F5F4F36DDBC01009709F43BC039 -:107DE0008091E800877F8093E80089819A8192DE04 -:107DF0008091E8008B778093E8002DC0803859F59A -:107E00008091E800877F8093E8008091CC01809387 -:107E1000F1008091E8008E778093E80054DD1BC06C -:107E20008823C9F49091D0019230A8F48091E800A1 -:107E3000877F8093E8009093CC0145DD8091CC0151 -:107E4000882331F48091E30087FD02C081E001C006 -:107E500084E08EBB99DC8091E80083FF0AC08091AA -:107E6000EB0080628093EB008091E800877F809335 -:107E7000E8000F900F90CF91DF911F910F9108951F -:107E800008951F938EB3882361F01091E90010923A -:107E9000E9008091E80083FF01C0E4DE17701093D1 -:107EA000E9001F910895F999FECF92BD81BDF89A1E -:107EB000992780B50895262FF999FECF1FBA92BD54 -:107EC00081BD20BD0FB6F894FA9AF99A0FBE0196BB -:067ED0000895F894FFCFB5 -:107ED6004341544552494E41000100000000000054 -:107EE60008120110010200000841230107010002E7 -:107EF60001000109023E000201008032090400006F -:107F060001020201000524001001042402040524D4 -:107F1600060001070582030800FF09040100020AA2 -:107F26000000000705040210000107058302100087 -:107F3600010403090422034100720064007500690C -:107F4600006E006F0020004C0065006F006E00613F -:107F560000720064006F0000001A03300030003029 -:107F66000030003000300030003000310034003581 -:107F760000320000001803410072006400750069B9 -:107F8600006E006F0020004C004C00430000000013 +:1077F00090936F0083E080938100DBC0CF93DF9391 +:1078000088E10FB6F89480936000109260000FBE7C +:1078100084B714BE80FF08C0E0E0F0E08591949149 +:107820008F5F9F4F09F05EDCBBDF7894E0E0F0E013 +:10783000C591D49110C0FADC3CD38091C4019091E1 +:10784000C50181589E4330F08FEFCF3FD80711F02C +:107850001092090159DC80910901882361F7809118 +:10786000E00081608093E0003DDC80E090E0DF910B +:10787000CF910895FA01923049F0933061F0913040 +:10788000F9F481E191E022E130E01EC083E291E071 +:107890002EE330E019C0882329F481E691E024E04A +:1078A00030E012C0813029F485E691E022E230E038 +:1078B0000BC0823029F485EA91E028E130E004C071 +:1078C00080E090E020E030E091838083C90108955A +:1078D0008093E9008091EB0081608093EB0010922F +:1078E000ED006093EC004093ED008091EE00881F66 +:1078F0008827881F08958091CE0188238CF403C0C7 +:107900008EB38823B1F08091E80082FFF9CF809197 +:10791000E8008B778093E80008958EB3882349F0C0 +:107920008091E80080FFF9CF8091E8008E77809306 +:10793000E8000895EF92FF920F931F9345D04CD02B +:1079400008ED10E0F80180818F7780838081806866 +:10795000808380818F7D808319BC1EBA1092CC01F8 +:1079600080EEE82EF12CF70180818B7F8083F80177 +:1079700080818160808380E060E042E0A9DFE1EE09 +:10798000F0E080818E7F8083E2EEF0E08081816094 +:107990008083808188608083F70180818E7F8083EF +:1079A000F8018081806180831F910F91FF90EF909B +:1079B0000895E7EDF0E08081816080838AE482BFF2 +:1079C00081E08093CD01B6CFE8EDF0E080818E7F3D +:1079D00080831092E20008951092DA001092E10084 +:1079E00008951F920F920FB60F9211242F933F9379 +:1079F0004F935F936F937F938F939F93AF93BF93B7 +:107A0000EF93FF938091DA0080FF1BC08091D80034 +:107A100080FF17C08091DA008E7F8093DA0080911A +:107A2000D90080FF0BC080E189BD82E189BD09B426 +:107A300000FEFDCF81E08EBB3BD203C019BC1EBA55 +:107A400037D28091E10080FF17C08091E20080FF73 +:107A500013C08091E2008E7F8093E2008091E2006B +:107A600080618093E2008091D80080628093D8008A +:107A700019BC85E08EBB1CD28091E10084FF2CC034 +:107A80008091E20084FF28C080E189BD82E189BD48 +:107A900009B400FEFDCF8091D8008F7D8093D8007F +:107AA0008091E1008F7E8093E1008091E2008F7EE3 +:107AB0008093E2008091E20081608093E2008091F7 +:107AC000CC01882331F48091E30087FD02C081E07E +:107AD00001C084E08EBBECD18091E10083FF21C026 +:107AE0008091E20083FF1DC08091E100877F809339 +:107AF000E10082E08EBB1092CC018091E1008E7F8C +:107B00008093E1008091E2008E7F8093E20080917B +:107B1000E20080618093E20080E060E042E0D8DE35 +:107B2000C7D1FF91EF91BF91AF919F918F917F91BD +:107B30006F915F914F913F912F910F900FBE0F90DA +:107B40001F9018959C014091D4015091D501461782 +:107B5000570718F4F90190E044C06115710511F060 +:107B6000AB01F8CF8091E8008E778093E80040E089 +:107B700050E0F0CF8EB3882309F444C0853009F477 +:107B800043C08091E80083FF02C081E008958091A6 +:107B9000E80082FD31C08091E80080FF22C0809122 +:107BA000F3009091F200782F60E0292F30E0262B2F +:107BB000372B07C081918093F100415050402F5FD7 +:107BC0003F4F4115510519F02830310598F390E0E9 +:107BD0002830310509F491E08091E8008E77809398 +:107BE000E8004115510531F6992321F605C08EB301 +:107BF000882341F0853041F08091E80082FFF7CF83 +:107C000080E0089582E0089583E008959C01611565 +:107C1000710529F48091E8008B778093E800F901E1 +:107C200026C08EB3882391F1853091F18091E800D0 +:107C300083FF02C081E008958091E80082FFF1CFC8 +:107C400006C08091F10081936150704059F02091FD +:107C5000F3008091F200322F20E090E0822B932BF2 +:107C6000892B79F78091E8008B778093E800611584 +:107C70007105B9F605C08EB3882341F0853041F017 +:107C80008091E80080FFF7CF80E0089582E00895BA +:107C900083E008950F931F93DF93CF9300D0CDB768 +:107CA000DEB7EEECF1E08091F100819381E0E63DFA +:107CB000F807C9F739DD8091E80083FFE4C08091BF +:107CC000CE019091CF01953009F46DC0963040F40B +:107CD000913081F1913070F0933009F0D4C02AC016 +:107CE000983009F4A3C0993009F4B2C0963009F075 +:107CF000CAC07CC0803809F4C6C0823809F0C3C04D +:107D00008091D20187708093E9008091EB001092FE +:107D1000E9002091E800277F2093E80090E025E02B +:107D2000969587952A95E1F781708093F1001092DE +:107D3000F10087C0882319F0823009F0A4C08F7148 +:107D4000823009F0A0C08091D001882331F52091C4 +:107D5000D201277009F497C02093E9008091EB00CD +:107D600080FF1BC0933021F48091EB00806213C030 +:107D70008091EB0080618093EB0081E090E002C095 +:107D8000880F991F2A95E2F78093EA001092EA0083 +:107D90008091EB0088608093EB001092E900809165 +:107DA000E800877F51C0882309F06DC01091D00191 +:107DB0001F770FB7F8948091E800877F8093E800E1 +:107DC0009ADD8091E80080FFFCCF8091E30080780D +:107DD000812B8093E30080688093E300112311F4EA +:107DE00082E001C083E08EBB0FBF4DC0805882305F +:107DF00008F049C08091D0019091D1016091D201E9 +:107E0000AE014F5F5F4F36DDBC01009709F43BC008 +:107E10008091E800877F8093E80089819A8192DED3 +:107E20008091E8008B778093E8002DC0803859F569 +:107E30008091E800877F8093E8008091CC01809357 +:107E4000F1008091E8008E778093E80054DD1BC03C +:107E50008823C9F49091D0019230A8F48091E80071 +:107E6000877F8093E8009093CC0145DD8091CC0121 +:107E7000882331F48091E30087FD02C081E001C0D6 +:107E800084E08EBB81DC8091E80083FF0AC0809192 +:107E9000EB0080628093EB008091E800877F809305 +:107EA000E8000F900F90CF91DF911F910F910895EF +:107EB00008951F938EB3882361F01091E90010920A +:107EC000E9008091E80083FF01C0E4DE17701093A1 +:107ED000E9001F910895F999FECF92BD81BDF89AEE +:107EE000992780B50895262FF999FECF1FBA92BD24 +:107EF00081BD20BD0FB6F894FA9AF99A0FBE01968B +:067F00000895F894FFCF84 +:107F06004341544552494E41000100000000000023 +:107F160008120110010200000841230107010002B6 +:107F260001000109023E000201008032090400003E +:107F360001020201000524001001042402040524A4 +:107F4600060001070582030800FF09040100020A72 +:107F56000000000705040210000107058302100057 +:107F660001040309042203410072006400750069DC +:107F7600006E006F0020004C0065006F006E00610F +:107F860000720064006F0000001A033000300030F9 +:107F96000030003000300030003000310034003551 +:107FA6000032000000180341007200640075006989 +:107FB600006E006F0020004C004C004300000000E3 :040000030000700089 :00000001FF -- cgit v1.2.3-18-g5258