diff options
Diffstat (limited to 'bootloaders')
-rw-r--r-- | bootloaders/diskloader/DiskLoader-Leonardo.hex | 300 | ||||
-rw-r--r-- | bootloaders/diskloader/src/DiskLoader.cpp | 48 |
2 files changed, 189 insertions, 159 deletions
diff --git a/bootloaders/diskloader/DiskLoader-Leonardo.hex b/bootloaders/diskloader/DiskLoader-Leonardo.hex index 6683263..b5b257f 100644 --- a/bootloaders/diskloader/DiskLoader-Leonardo.hex +++ b/bootloaders/diskloader/DiskLoader-Leonardo.hex @@ -1,6 +1,6 @@ :10700000BDC00000E0C00000DEC00000DCC0000029
:10701000DAC00000D8C00000D6C00000D4C0000014
-:10702000D2C00000D0C000008AC30000FCC3000032
+:10702000D2C00000D0C00000BCC300002EC40000CD
:10703000CAC00000C8C00000C6C00000C4C0000034
:10704000C2C00000C0C00000BEC00000BCC0000044
:10705000BAC00000B8C00000B6C00000B4C0000054
@@ -9,7 +9,7 @@ :10708000A2C00000A0C000009EC000009CC0000084
:107090009AC0000098C0000096C0000094C0000094
:1070A00092C0000090C000008EC0000011241FBEDE
-:1070B000CFEFDAE0DEBFCDBFF7C0080B000202025F
+:1070B000CFEFDAE0DEBFCDBF23C1080B0002020232
:1070C0000100090400000102020000052400100173
:1070D0000524010101042402060524060001070518
:1070E000810310004009040100020A0000000705A6
@@ -21,152 +21,158 @@ :107140006400750069006E006F0020004C004C0068
:1071500043001201000200000040412334000001FE
:10716000010200011201000202000040412334002C
-:1071700000010102000100C18081033C11241FBEF7
-:10718000CFEFDAE0DEBFCDBF11E0A0E0B1E0E2E892
+:1071700000010102000100C18081353C11241FBEC5
+:10718000CFEFDAE0DEBFCDBF11E0A0E0B1E0E6EE88
:10719000FAE702C005900D92A830B107D9F711E0C7
-:1071A000A8E0B1E001C01D92A539B107E1F711E7F0
-:1071B000CCE7D1E703C02297FE015DD4CA37D107DF
-:1071C000D1F772D05CC41CCFFC0180818E5F8083BC
-:1071D00080E86AEB70E742E450E063C2FC01818121
+:1071A000A8E0B1E001C01D92A739B107E1F711E7EE
+:1071B000CCE7D1E703C02297FE018FD4CA37D107AD
+:1071C000D1F79ED08EC41CCFFC0180818E5F80835E
+:1071D00080E86AEB70E742E450E095C2FC018181EF
:1071E0009081913A49F48132C1F480E060E071E02D
-:1071F00047E050E056D20FC0913279F4803231F43A
-:1072000080E091E067E070E088D205C0823229F426
-:1072100082818093070181E0089580E00895FF92C4
-:107220000F931F93CF93DF93982F8B01FF2480E759
-:107230006030780738F4FF24F39483E0FB018093F7
-:107240005700E895C42FD0E0892F68E071E0AE01C7
-:107250001AD1FF2019F107B600FCFDCFD595C795CF
-:107260004C2FF801A8E0B1E020E031E009C08D9199
-:107270009D910C0130935700E895112432962F5FB1
-:107280002417A8F385E0F80180935700E89507B626
-:1072900000FCFDCF81E180935700E895DF91CF910D
-:1072A0001F910F91FF90089588E10FB6F894809395
-:1072B0006000109260000FBE3F9A209A6E9A90E88C
-:1072C000909361001092610081E885BF95BF01E055
-:1072D00005BF02E005BF769A289A479884E991E0B5
-:1072E0007CD2789484E18093880180E18093890145
-:1072F000CC24DD2430E9A32E31E0B32E99249394DD
-:1073000002C0CC24DD2482E0B5D08823E1F382E002
-:107310000FD1E82E8CEF90E7FC0124913196029674
-:1073200044912E1511F02223B9F710928B0110927F
-:107330008A0150E082E068E071E0A5D0F1E4EF1648
-:1073400079F4609108016058633028F0683111F0D9
-:1073500064E001C063E0C62FD0E0C15FDE4810C02A
-:1073600026E5E21681F480910801803319F0FF24AC
-:10737000F39428C080910A01C82FD0E0C45FDE4892
-:10738000FF24F39427C085E7E81629F423E0F22EC2
-:10739000CCE0D1E71FC0E5E5EE1639F4C090080156
-:1073A000D0900901CC0CDD1C0CC0F4E6EF1631F4D2
-:1073B00082E0B6014091090132DF03C024E7E21602
-:1073C00021F0FF24C3E1D1E705C0F0900901E601F7
-:1073D000CF0CD11C08E813E1015010400930110511
-:1073E00009F433C082E046D0882309F02EC0F4CFE0
-:1073F000809709F086CF83E068E871E041E050E0D3
-:10740000BFD0FF2029F04F2D50E083E8BE01B8D057
-:1074100083E469E871E041E050E0B2D081E5E8162C
-:1074200009F071CF88EE93E0F5013197F1F70197FC
-:10743000D9F701E005BF00E005BF9092E00010928F
-:10744000E200EE27FF2709945ECF82E071D0EFEFD4
-:107450008F3F9E0709F0CCCFCECFFC0104C08091B6
-:10746000F100819361506623D1F7289884E68093D8
-:107470008D0108959FB7F89487708093E9008091FB
-:10748000F2009FBF0895FB019FB7F8948770809327
-:10749000E90034E62BE610C08091E80085FFFCCFC0
-:1074A000289830938D018091F10081938091E800BC
-:1074B00085FD02C02093E800415050408FEF4F3FC0
-:1074C000580751F79FBF0895282F80918E01882378
-:1074D000C1F057FF1AC015C0289890938D01809174
-:1074E000F1008193E217F307B9F74115510539F01F
-:1074F0008091F200882319F48BE68093E800AFBFF7
-:1075000002C04FEF5FEFCA010895AFB7F89427703C
-:107510002093E9008091F200282F30E024173507EE
-:107520000CF4A901FB019B01240F311D94E6DACF75
-:10753000DF93CF930F92CDB7DEB7BE016F5F7F4F62
-:1075400041E050E0C1DF019719F08FEF9FEF02C0DB
-:10755000898190E00F90CF91DF9108952FB7F89433
-:1075600087708093E9008091E80085FD02C090E07B
-:1075700004C08091F20090E4981B2FBF892F0895DA
-:107580005F926F927F928F929F92AF92BF92CF92B3
-:10759000DF92EF92FF920F931F93CF93DF93F82E1A
-:1075A0006A0180918E01882319F44FEF5FEF68C064
-:1075B0008B01EA0157E0E52EEF208F2D90E040E2AD
-:1075C000842E912C882299223AE3532E20E4A22E75
-:1075D000B12CA822B92280EA682E8FE0782E43C011
-:1075E0008F2DBCDF282F882321F4C3010197F1F7E9
-:1075F0003AC090E0C817D9070CF42C2FC21BD10950
-:107600004FB7F894E092E9008114910421F406C088
-:107610001092F10021502223D9F719C0F7FC03C0C2
-:10762000F801922F10C0C801322F06C0FC0101964C
-:10763000E491E093F10031503323C1F706C081910A
-:107640008093F10091509923D1F7020F111D809181
-:10765000E80085FF05C0209729F4A114B10411F0BA
-:107660005092E8004FBF209709F0BACFF6FE03C052
-:107670008AE38093E800769884E680938C01A601E3
-:10768000CA01DF91CF911F910F91FF90EF90DF9092
-:10769000CF90BF90AF909F908F907F906F905F90B2
-:1076A00008950F931F93182FFB01A0919101B091A2
-:1076B0009201BA010EEF2AC017FF02C0949101C0D7
-:1076C000908120918F01309190012A173B07ACF4F3
-:1076D0008091E8008570E1F38091E80082FF03C0AB
-:1076E0004FEF5FEF16C09093F100C90101968F73C1
-:1076F0009070892B11F40093E8002F5F3F4F309377
-:10770000900120938F016150704031966115710591
-:1077100099F6CA011F910F910895CF93DF939C01B1
-:10772000EB018091E80082FFFCCFC9016C2F95DE50
-:107730008BEF8093E800CE01DF91CF9108951F92E7
-:107740000F920FB60F9211242F933F938F93809136
-:10775000E1001092E100282F83FF0FC01092E90092
-:1077600081E08093EB001092EC0082E38093ED00C7
-:1077700010928E0188E08093F00022FF26C083E003
-:107780008093E9008091F200882319F08AE38093C6
-:10779000E80080918C01882351F080918C01815008
-:1077A00080938C0180918C01882309F4769A8091D2
-:1077B0008D01882351F080918D01815080938D013E
-:1077C00080918D01882309F4289A8F913F912F9100
-:1077D0000F900FBE0F901F90189510928E0181E0B0
-:1077E0008093D70080EA8093D80082E189BD09B4F4
-:1077F00000FEFDCF80E98093D8008CE08093E2000A
-:107800001092E00008950895DF93CF930F92CDB7C3
-:10781000DEB71982CE010196D7DC898190E00F9006
-:10782000CF91DF9108951F920F920FB60F921124FE
-:10783000EF92FF921F932F933F934F935F936F931A
-:107840007F938F939F93AF93BF93EF93FF93DF93B8
-:10785000CF93CDB7DEB76197DEBFCDBF1092E90001
-:107860008091E80083FFECC0CE01019668E0F5DD71
-:1078700082EF8093E800998197FF05C08091E8002E
-:1078800080FFFCCF03C08EEF8093E800292F30E00B
-:10789000C90180769070892B09F0B3C08A81882352
-:1078A00029F41092F1001092F100BFC0813009F468
-:1078B000BCC0833009F4B9C0853049F48091E80038
-:1078C00080FFFCCF8B8180688093E300AEC0863060
-:1078D00009F06DC01C81EF80F8841230A9F5109278
-:1078E000E9001092900110928F0110929201109273
-:1078F00091018ADF99E0FE013996DF01292F1D925F
-:107900002A95E9F799871A8791E09E8790E8988BE6
-:107910009AEF998B20918F0130919001275F3F4F13
-:107920003C872B878D871092E9001092900110926E
-:107930008F01F0929201E092910180E0BF0149E055
-:1079400050E0AFDE61DF71C01092E900109290014B
-:1079500010928F01F0929201E0929101113071F436
-:1079600088E0E816F10411F41093930180919301DB
-:10797000882309F062C0E2E5F1E713C0133009F093
-:1079800058C08B81882319F4E4E1F1E70AC0823002
-:1079900019F4E8E1F1E705C0813009F04AC0EAE3F3
-:1079A000F1E7449150E080E8BF017BDE3EC08730C4
-:1079B00009F43FC0883021F481E08093F10035C0A4
-:1079C000893099F523703070232B99F5E7E7F1E7BB
-:1079D00091E031E026E39093E9003093EB0084914D
-:1079E0008093EC002093ED009F5F3196943099F7DF
-:1079F0008EE78093EA001092EA008B8180938E01DB
-:107A000014C08F8198851092E90010929001109215
-:107A10008F0190939201809391018D81882349F485
-:107A2000CE010196DBDB882321F08EEF8093E80006
-:107A300007C081E28093EB0003C0E4E6F1E7B1CF39
-:107A40006196DEBFCDBFCF91DF91FF91EF91BF91E6
-:107A5000AF919F918F917F916F915F914F913F91E6
-:107A60002F911F91FF90EF900F900FBE0F901F90DE
-:107A70001895EE0FFF1F0590F491E02D0994F894EE
-:027A8000FFCF36
-:087A820000E10000000000001B
+:1071F00047E050E088D20FC0913279F4803231F408
+:1072000080E091E067E070E0BAD205C0823229F4F4
+:1072100082818093070181E0089580E008952091A4
+:107220008C0130918D012F5F3F4F30938D01209362
+:107230008C01C901892F99278695982F803418F0E1
+:107240008FE7891B982F990F921710F4479808958C
+:10725000479A08954798289A769AF89401E005BFCE
+:1072600000E005BF81E08093E0001092E200EE278D
+:10727000FF2709940895FF920F931F93CF93DF93F5
+:10728000982F8B01FF2480E76030780738F4FF24C3
+:10729000F39483E0FB0180935700E895C42FD0E07E
+:1072A000892F68E071E0AE0120D1FF2019F107B607
+:1072B00000FCFDCFD595C7954C2FF801A8E0B1E0B3
+:1072C00020E031E009C08D919D910C013093570071
+:1072D000E895112432962F5F2417A8F385E0F80172
+:1072E00080935700E89507B600FCFDCF81E18093BD
+:1072F0005700E895DF91CF911F910F91FF9008956E
+:1073000088E10FB6F89480936000109260000FBE81
+:107310003F9A209A6E9A90E89093610010926100D3
+:1073200081E885BF95BF01E005BF02E005BF769A01
+:10733000289A479886E991E082D2789484E18093F4
+:10734000880180E180938901CC24DD2470E9A72E97
+:1073500071E0B72E02C0CC24DD2482E0BDD08823AA
+:1073600009F492C082E016D1E82E8CEF90E7FC0180
+:1073700024913196029644912E1511F02223B9F7EB
+:1073800010928B0110928A0150E082E068E071E077
+:10739000ACD0F1E4EF1679F46091080160586330E5
+:1073A00028F0683111F064E001C063E0062F10E0BE
+:1073B000015F1E4809C026E5E21681F480910801AC
+:1073C000803329F003E111E7FF24F3942EC080916C
+:1073D0000A01082F10E0045F1E48F6CF85E7E81683
+:1073E00029F40CE011E763E0F62E1FC0E5E5EE1688
+:1073F00039F4C0900801D0900901CC0CDD1C0CC000
+:10740000F4E6EF1631F482E0B6014091090133DF72
+:1074100003C024E7E21621F003E111E7FF2405C0D1
+:10742000F09009018601CF0CD11CC8E8D3E1219767
+:10743000C930D10509F43BC082E04ED0882309F061
+:1074400036C0F5CF809709F086CF83E068E871E019
+:1074500041E050E0C7D0FF2029F04F2D50E083E8F5
+:10746000B801C0D083E469E871E041E050E0BAD0EF
+:1074700081E5E81609F071CF88EE93E0F5013197C8
+:10748000F1F70197D9F711C0CADEC5010197F1F7ED
+:1074900080918A0190918B01019790938B01809349
+:1074A0008A010196019709F058CFD4DE56CF82E0C9
+:1074B00071D0EFEF8F3F9E0709F0C4CFC6CFFC011C
+:1074C00004C08091F100819361506623D1F7289820
+:1074D00084E680938F0108959FB7F8948770809316
+:1074E000E9008091F2009FBF0895FB019FB7F894D7
+:1074F00087708093E90034E62BE610C08091E800A5
+:1075000085FFFCCF289830938F018091F100819303
+:107510008091E80085FD02C02093E8004150504072
+:107520008FEF4F3F580751F79FBF0895282F809145
+:1075300090018823C1F057FF1AC015C02898909376
+:107540008F018091F1008193E217F307B9F741159C
+:10755000510539F08091F200882319F48BE680936D
+:10756000E800AFBF02C04FEF5FEFCA010895AFB7A9
+:10757000F89427702093E9008091F200282F30E0E2
+:10758000241735070CF4A901FB019B01240F311DC1
+:1075900094E6DACFDF93CF930F92CDB7DEB7BE017B
+:1075A0006F5F7F4F41E050E0C1DF019719F08FEF2F
+:1075B0009FEF02C0898190E00F90CF91DF910895F5
+:1075C0002FB7F89487708093E9008091E80085FDDB
+:1075D00002C090E004C08091F20090E4981B2FBF9D
+:1075E000892F08955F926F927F928F929F92AF92B0
+:1075F000BF92CF92DF92EF92FF920F931F93CF93A0
+:10760000DF93F82E6A0180919001882319F44FEFDF
+:107610005FEF68C08B01EA0157E0E52EEF208F2D68
+:1076200090E040E2842E912C882299223AE3532E56
+:1076300020E4A22EB12CA822B92280EA682E8FE085
+:10764000782E43C08F2DBCDF282F882321F4C3015F
+:107650000197F1F73AC090E0C817D9070CF42C2F26
+:10766000C21BD1094FB7F894E092E900811491044C
+:1076700021F406C01092F10021502223D9F719C03D
+:10768000F7FC03C0F801922F10C0C801322F06C0CA
+:10769000FC010196E491E093F10031503323C1F7EE
+:1076A00006C081918093F10091509923D1F7020F88
+:1076B000111D8091E80085FF05C0209729F4A114D1
+:1076C000B10411F05092E8004FBF209709F0BACFF3
+:1076D000F6FE03C08AE38093E800769884E6809300
+:1076E0008E01A601CA01DF91CF911F910F91FF90EA
+:1076F000EF90DF90CF90BF90AF909F908F907F9052
+:107700006F905F9008950F931F93182FFB01A09126
+:107710009301B0919401BA010EEF2AC017FF02C085
+:10772000949101C0908120919101309192012A178A
+:107730003B07ACF48091E8008570E1F38091E800AC
+:1077400082FF03C04FEF5FEF16C09093F100C901B5
+:1077500001968F739070892B11F40093E8002F5FCE
+:107760003F4F3093920120939101615070403196C8
+:107770006115710599F6CA011F910F910895CF9374
+:10778000DF939C01EB018091E80082FFFCCFC901EF
+:107790006C2F95DE8BEF8093E800CE01DF91CF91C7
+:1077A00008951F920F920FB60F9211242F933F93BB
+:1077B0008F938091E1001092E100282F83FF0FC08A
+:1077C0001092E90081E08093EB001092EC0082E3DC
+:1077D0008093ED001092900188E08093F00022FFEA
+:1077E00026C083E08093E9008091F200882319F09D
+:1077F0008AE38093E80080918E01882351F0809184
+:107800008E01815080938E0180918E01882309F42E
+:10781000769A80918F01882351F080918F01815059
+:1078200080938F0180918F01882309F4289A8F918A
+:107830003F912F910F900FBE0F901F9018951092AF
+:10784000900181E08093D70080EA8093D80082E1A4
+:1078500089BD09B400FEFDCF80E98093D8008CE09B
+:107860008093E2001092E00008950895DF93CF9393
+:107870000F92CDB7DEB71982CE010196A5DC8981C2
+:1078800090E00F90CF91DF9108951F920F920FB665
+:107890000F921124EF92FF921F932F933F934F93D8
+:1078A0005F936F937F938F939F93AF93BF93EF9368
+:1078B000FF93DF93CF93CDB7DEB76197DEBFCDBF28
+:1078C0001092E9008091E80083FFECC0CE010196A0
+:1078D00068E0F5DD82EF8093E800998197FF05C0AD
+:1078E0008091E80080FFFCCF03C08EEF8093E8001A
+:1078F000292F30E0C90180769070892B09F0B3C040
+:107900008A81882329F41092F1001092F100BFC0FF
+:10791000813009F4BCC0833009F4B9C0853049F422
+:107920008091E80080FFFCCF8B8180688093E3002A
+:10793000AEC0863009F06DC01C81EF80F884123033
+:10794000A9F51092E9001092920110929101109203
+:107950009401109293018ADF99E0FE013996DF01CC
+:10796000292F1D922A95E9F799871A8791E09E871A
+:1079700090E8988B9AEF998B209191013091920128
+:10798000275F3F4F3C872B878D871092E90010922D
+:10799000920110929101F0929401E092930180E0A3
+:1079A000BF0149E050E0AFDE61DF71C01092E90035
+:1079B0001092920110929101F0929401E092930141
+:1079C000113071F488E0E816F10411F41093950178
+:1079D00080919501882309F062C0E2E5F1E713C0C8
+:1079E000133009F058C08B81882319F4E4E1F1E7E2
+:1079F0000AC0823019F4E8E1F1E705C0813009F0EE
+:107A00004AC0EAE3F1E7449150E080E8BF017BDE41
+:107A10003EC0873009F43FC0883021F481E0809374
+:107A2000F10035C0893099F523703070232B99F51A
+:107A3000E7E7F1E791E031E026E39093E900309346
+:107A4000EB0084918093EC002093ED009F5F3196D2
+:107A5000943099F78EE78093EA001092EA008B81C8
+:107A60008093900114C08F8198851092E900109244
+:107A700092011092910190939401809393018D81D2
+:107A8000882349F4CE010196A9DB882321F08EEFEB
+:107A90008093E80007C081E28093EB0003C0E4E636
+:107AA000F1E7B1CF6196DEBFCDBFCF91DF91FF91FE
+:107AB000EF91BF91AF919F918F917F916F915F9166
+:107AC0004F913F912F911F91FF90EF900F900FBE1C
+:107AD0000F901F901895EE0FFF1F0590F491E02D69
+:067AE0000994F894FFCFA9
+:087AE60000E1000000000000B7
:040000030000700089
:00000001FF
diff --git a/bootloaders/diskloader/src/DiskLoader.cpp b/bootloaders/diskloader/src/DiskLoader.cpp index e984375..30ac1b6 100644 --- a/bootloaders/diskloader/src/DiskLoader.cpp +++ b/bootloaders/diskloader/src/DiskLoader.cpp @@ -23,7 +23,7 @@ u8 _flashbuf[128]; u8 _inSync; u8 _ok; u16 do_reset = 0; -volatile u16 _timeout; +volatile u16 _timeout = 0; void Program(u8 ep, u16 page, u8 count) { @@ -49,6 +49,20 @@ void Program(u8 ep, u16 page, u8 count) boot_rww_enable (); } +u16 _pulse; +void LEDPulse() +{ + _pulse += 1; + u8 p = _pulse >> 9; + if (p > 63) + p = 127-p; + p += p; + if (((u8)_pulse) > p) + L_LED_OFF(); + else + L_LED_ON(); +} + #define HW_VER 0x02 #define SW_MAJOR 0x01 #define SW_MINOR 0x10 @@ -95,6 +109,19 @@ const u8 _consts[] = void start_sketch() { + L_LED_OFF(); + RX_LED_OFF(); + TX_LED_OFF(); + /* move interrupts to application section: + * uses inline assembly because the procedure must be completed in four cycles. + */ + cli(); // disable interrupts first + asm volatile ( + "ldi r16, 0x01\n" // (1<<IVCE) /* Enable change of interrupt vectors */ + "out 0x35, r16\n" // MCUCR + "ldi r16, 0x00\n" // (1<<IVSEL) /* Move interrupts to application flash section */ + "out 0x35, r16\n" // MCUCR + ); UDCON = 1; // Detatch USB UDIEN = 0; asm volatile ( // Reset vector to run firmware @@ -133,7 +160,7 @@ int main() u8* packet = _flashbuf; u16 address = 0; for (;;) - { + { if (USB_Available(CDC_RX)) { u8 cmd = USB_Recv(CDC_RX); @@ -208,19 +235,16 @@ int main() if ('Q' == cmd) { _delay_ms(100); - /* move interrupts to application section: - * uses inline assembly because the procedure must be completed in four cycles. - */ - cli(); // disable interrupts - asm volatile ( - "ldi r16, 0x01\n" // (1<<IVCE) /* Enable change of interrupt vectors */ - "out 0x35, r16\n" // MCUCR - "ldi r16, 0x00\n" // (1<<IVSEL) /* Move interrupts to application flash section */ - "out 0x35, r16\n" // MCUCR - ); start_sketch(); } } + else + { + LEDPulse(); + _delay_us(100); + if (_timeout-- == 1) + start_sketch(); + } } } } |