aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2012-01-24 18:04:10 -0500
committerZach Eveland <zeveland@blacklabel-development.com>2012-01-24 18:04:10 -0500
commit45d3b102956c74f837eb0297af45939ca46b09a0 (patch)
tree214ee5479addd44cc7ca17dce2f0cc7ce3196c38
parent014466a7880e1424aaeedd66c269ea1197624535 (diff)
Caterina now cleanly hands off operation to the sketch
had to remove TIMER1 operation from bootloader - was interfering with normal sketch operation
-rwxr-xr-xbootloaders/caterina_LUFA/Caterina.c55
-rw-r--r--bootloaders/caterina_LUFA/Caterina.hex436
-rw-r--r--cores/arduino/CDC.cpp5
3 files changed, 234 insertions, 262 deletions
diff --git a/bootloaders/caterina_LUFA/Caterina.c b/bootloaders/caterina_LUFA/Caterina.c
index 9e1dbbc..f95613f 100755
--- a/bootloaders/caterina_LUFA/Caterina.c
+++ b/bootloaders/caterina_LUFA/Caterina.c
@@ -58,23 +58,16 @@ static bool RunBootloader = true;
void StartSketch()
{
+ cli();
/* Relocate the interrupt vector table to the application section */
-// MCUCR = (1 << IVCE); // these two lines are for moving interrupts to bootloader, not application
-// MCUCR = (1 << IVSEL);
- __asm__ volatile (
- "ldi r16, 0x01\n"
- "out 0x35, r16\n"
- "ldi r16, 0x00\n"
- "out 0x35, r16\n"
- ::);
+ MCUCR = (1 << IVCE);
+ MCUCR = 0;
- UDCON = 1; // Detach USB
- UDIEN = 0;
- __asm__ volatile ( // Reset vector to run firmware
- "clr r30\n"
- "clr r31\n"
- "ijmp\n"
- ::);
+// UDCON = 1; // Detach USB
+// UDIEN = 0;
+
+ /* jump to beginning of application space */
+ __asm__ volatile("jmp 0x0000");
}
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
@@ -83,12 +76,7 @@ void StartSketch()
*/
int main(void)
{
-// 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();
-// if (MCUSR_state & (1<<WDRF) && (pgm_read_word(0) != 0xFFFF)) {
-// StartSketch(); // if the reset was caused by WDT and if a sketch is already present then run the sketch instead of the bootloader
-// }
+ wdt_disable();
/* Setup hardware required for the bootloader */
SetupHardware();
@@ -96,25 +84,20 @@ int main(void)
/* Enable global interrupts so that the USB stack can function */
sei();
- DDRD |= (1<<6); // turn on LED attached to D12 - used to track bootloader progress
- PORTD |= (1<<6);
-
while (RunBootloader)
{
CDC_Task();
USB_USBTask();
+ /* time out and start the sketch if one is present
+ * TODO - handle ctr now that TIMER1 is gone */
+// if (ctr++ > 10000 && pgm_read_word(0) != 0xFFFF)
+// RunBootloader = false;
}
- PORTD &= ~(1<<6); // turn off LED attached to D12
-
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
- /* Enable the watchdog and force a timeout to reset the AVR */
-// wdt_enable(WDTO_250MS);
-
-// for (;;);
-
+ /* Jump to beginning of application space to run the sketch - do not reset */
StartSketch();
}
@@ -134,16 +117,6 @@ void SetupHardware(void)
/* Initialize USB Subsystem */
USB_Init();
-
- /* Bootloader active LED toggle timer initialization */
- TIMSK1 = (1 << TOIE1);
- TCCR1B = ((1 << CS11) | (1 << CS10));
-}
-
-/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
-ISR(TIMER1_OVF_vect, ISR_BLOCK)
-{
- PORTD ^= (1<<6); // toggle LED on D12
}
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
diff --git a/bootloaders/caterina_LUFA/Caterina.hex b/bootloaders/caterina_LUFA/Caterina.hex
index 4d0f17d..c3c1d93 100644
--- a/bootloaders/caterina_LUFA/Caterina.hex
+++ b/bootloaders/caterina_LUFA/Caterina.hex
@@ -1,232 +1,228 @@
:1070000055C000006EC000006CC000006AC00000E7
:1070100068C0000066C0000064C0000062C00000DC
-:1070200060C000005EC000003AC400005AC000000A
+:1070200060C000005EC000001FC400005AC0000025
:1070300058C0000056C0000054C0000052C00000FC
:1070400050C000004EC000004CC000004AC000000C
-:1070500056C0000046C0000044C0000042C000000E
+:1070500048C0000046C0000044C0000042C000001C
:1070600040C000003EC000003CC000003AC000002C
:1070700038C0000036C0000034C0000032C000003C
:1070800030C000002EC000002CC000002AC000004C
:1070900028C0000026C0000024C0000022C000005C
:1070A00020C000001EC000001CC0000011241FBE34
-:1070B000CFEFDAE0DEBFCDBF11E0A0E0B1E0E2EC5F
+:1070B000CFEFDAE0DEBFCDBF11E0A0E0B1E0ECE859
:1070C000FDE702C005900D92AC38B107D9F711E089
-:1070D000ACE8B1E001C01D92AA39B107E1F71CD3B9
-:1070E0006EC68ECF01E005BF00E005BF81E0809352
-:1070F000E0001092E200EE27FF27099408951F9206
-:107100000F920FB60F9211248F939F938BB190E43F
-:1071100089278BB99F918F910F900FBE0F901F9071
-:10712000189584E08093E9000DC08091E8008B778A
-:107130008093E80003C08EB3882351F08091E8006B
-:1071400082FFF9CF8091E80085FFEFCF8091F100B9
-:107150000895982F83E08093E9008091E80085FDF1
-:107160000DC08091E8008E778093E80003C08EB355
-:10717000882331F08091E80080FFF9CF9093F100EF
-:1071800008954F925F926F927F928F929F92AF92EB
-:10719000BF92CF92DF92EF92FF920F931F93CF9304
-:1071A000DF9384E08093E9008091E80082FF45C28C
-:1071B000B8DF182F853419F41092080103C0843504
-:1071C00019F4AFDF8DE00FC28C34E1F38035D1F3D9
-:1071D000843721F484E4BDDF80E005C2813611F4F8
-:1071E00089E501C28134B1F49CDF182F9ADF90E069
-:1071F000880F991FAA2797FDA095BA2F312F330F1B
-:1072000020E0442737FD4095542F822B932BA42B4D
-:10721000B52BBAC1803711F483E5E5C1833549F454
-:10722000C0E0D1E0899195DF21E0C730D207D1F7E6
-:10723000DBC1863521F481E38CDF80E3D4C1833761
-:1072400031F487E886DF85E984DF8EE1CCC18536BD
-:10725000B9F4E0E0F0E093E085E090935700E89522
-:1072600007B600FCFDCF80935700E89507B600FCF9
-:10727000FDCFE058FF4FA0E7E030FA0771F7A2CF4B
-:107280008C3651F44EDF809599E0E1E0F0E0082E75
-:1072900090935700E89596CF823739F4E1E0F0E01B
-:1072A00089E08093570084919EC1863439F4E0E0F0
-:1072B000F0E089E080935700849195C18E3439F4D1
-:1072C000E3E0F0E089E08093570084918CC1813540
-:1072D00039F4E2E0F0E089E080935700849183C1C3
-:1072E000823631F489E535DF80E033DF80E87BC129
-:1072F000823419F0873609F0DBC013DF082F11DF65
-:10730000F82E0FDF682E8554823008F06BC1902F65
-:1073100080E0CF2DD0E0C82BD92B173609F04BC019
-:1073200081E180935700E895DD24CC24C3943FC0CD
-:10733000E0908C01F0908D0100918E0110918F01F1
-:10734000B6E46B16D9F4ED2DF0E0EE29FF29E491B7
-:107350008E2FFFDEDD2081F082E090E0A0E0B0E043
-:10736000E80EF91E0A1F1B1FE0928C01F0928D019E
-:1073700000938E0110938F01DC2418C0D801C7013F
-:10738000B695A7959795879504D5E3DE82E090E0C2
-:10739000A0E0B0E0E80EF91E0A1F1B1FE0928C016E
-:1073A000F0928D0100938E0110938F012197209709
-:1073B00009F0BECF19C180908C0190908D01A090F2
-:1073C0008E01B0908F0196E4691609F05DC083E0EC
-:1073D000F40180935700E89507B600FCFDCF54C038
-:1073E000F6E46F1661F5772031F1E0908C01F090B2
-:1073F0008D0100918E0110918F0193DED82ECC2447
-:10740000852D90E08C299D29F7010C0140925700B1
-:10741000E895112482E090E0A0E0B0E0E80EF91ECB
-:107420000A1F1B1FE0928C01F0928D0100938E01C8
-:1074300010938F0102C075DE582E742423C0E09093
-:107440008C01F0908D0100918E0110918F011695A5
-:107450000795F794E79465DE682FC701A2D4809161
-:107460008C0190918D01A0918E01B0918F010296B7
-:10747000A11DB11D80938C0190938D01A0938E016D
-:10748000B0938F01219704C055247724442443945A
-:10749000209709F0A5CF96E4691609F093CE85E010
-:1074A000F40180935700E89507B600FCFDCF8ACE23
-:1074B000833471F400918C0110918D0132DE90E0E3
-:1074C00021E0F8010C0120935700E89511247ACEB1
-:1074D000833619F5E0908C01F0908D0100918E01BA
-:1074E00010918F011EDEF701E16090E021E00C01B8
-:1074F00020935700E895112482E090E0A0E0B0E0EE
-:10750000E80EF91E0A1F1B1FE0928C01F0928D01FC
-:1075100000938E0110938F0155CE8D3661F4E0916A
-:107520008C01F0918D0185E080935700E89507B6B6
-:1075300000FCFDCF47CE823551F4E0918C01F091F3
-:107540008D0105911491812F04DE802F4CC084346D
-:1075500021F5E0908C01F0908D0100918E01109149
-:107560008F0116950795F794E794DBDD682FC70127
-:1075700018D480918C0190918D01A0918E01B091D1
-:107580008F010296A11DB11D80938C0190938D01F6
-:10759000A0938E01B0938F0115CE843609F5E0904B
-:1075A0008C01F0908D0100918E0110918F01D80116
-:1075B000C701B695A79597958795EBD3CADD82E06D
-:1075C00090E0A0E0B0E0E80EF91E0A1F1B1FE09259
-:1075D0008C01F0928D0100938E0110938F0104C0F5
-:1075E0008B3111F08FE3B5DD83E08093E90090915A
-:1075F000E8008091E8008E778093E80095FF04C052
-:1076000010C08EB38823C9F08091E80080FFF9CFC5
-:107610008091E8008E778093E80003C08EB38823C2
-:1076200061F08091E80080FFF9CF84E08093E90069
-:107630008091E8008B778093E800DF91CF911F91D4
-:107640000F91FF90EF90DF90CF90BF90AF909F9001
-:107650008F907F906F905F904F90089590919201DE
-:10766000892F8F77813249F5809193018032A1F083
-:10767000813219F5913A09F58091E800877F80936E
-:10768000E80089E091E067E070E0BAD18091E8001D
-:107690008B778093E8000895913279F48091E80027
-:1076A000877F8093E80089E091E067E070E00CD28A
-:1076B0008091E8008E778093E800089582E061EC85
-:1076C00042E064D083E061E842E160D084E060E8B9
-:1076D00042E15CC01F9384B7877F84BF88E10FB607
-:1076E000F89480936000109260000FBE80E090E0FC
-:1076F00020E80FB6F89420936100809361000FBEDC
-:1077000011E015BF82E085BFB2D010936F0083E017
-:10771000809381001F910895DDDF7894569A5E9AD8
-:1077200002C02FDD24D3809108018823D1F75E9811
-:107730008091E00081608093E000D4DC80E090E004
-:107740000895FA01923071F0933089F0913029F464
-:1077500080E191E022E130E015C080E090E020E09F
-:1077600030E010C082E291E02EE330E00BC08823CD
-:1077700029F480E691E024E030E004C084E691E062
-:1077800026E230E091838083C90108958093E90067
-:107790008091EB0081608093EB001092ED0060938C
-:1077A000EC004093ED008091EE00881F8827881F31
-:1077B00008958091920188238CF403C08EB38823AE
-:1077C000B1F08091E80082FFF9CF8091E8008B77DB
-:1077D0008093E80008958EB3882349F08091E800F3
-:1077E00080FFF9CF8091E8008E778093E8000895BC
-:1077F000EF92FF920F931F9345D04CD008ED10E00D
-:10780000F80180818F778083808180688083808188
-:107810008F7D808319BC1EBA1092900180EEE82EF5
-:10782000F12CF70180818B7F8083F801808181605A
-:10783000808380E060E042E0A9DFE1EEF0E080815B
-:107840008E7F8083E2EEF0E08081816080838081A2
-:1078500088608083F70180818E7F8083F80180813A
-:10786000806180831F910F91FF90EF900895E7ED65
-:10787000F0E08081816080838AE482BF81E0809330
-:107880009101B6CFE8EDF0E080818E7F8083109289
-:10789000E20008951092DA001092E10008951F921C
-:1078A0000F920FB60F9211242F933F934F935F9334
-:1078B0006F937F938F939F93AF93BF93EF93FF93B8
-:1078C0008091DA0080FF1BC08091D80080FF17C034
-:1078D0008091DA008E7F8093DA008091D90080FF5A
-:1078E0000BC080E189BD82E189BD09B400FEFDCFF6
-:1078F00081E08EBB3BD203C019BC1EBA37D2809147
-:10790000E10080FF17C08091E20080FF13C08091EA
-:10791000E2008E7F8093E2008091E200806180939C
-:10792000E2008091D80080628093D80019BC85E085
-:107930008EBB1CD28091E10084FF2CC08091E200BC
-:1079400084FF28C080E189BD82E189BD09B400FEC1
-:10795000FDCF8091D8008F7D8093D8008091E10089
-:107960008F7E8093E1008091E2008F7E8093E20021
-:107970008091E20081608093E200809190018823F1
-:1079800031F48091E30087FD02C081E001C084E012
-:107990008EBBECD18091E10083FF21C08091E20099
-:1079A00083FF1DC08091E100877F8093E10082E02A
-:1079B0008EBB109290018091E1008E7F8093E10058
-:1079C0008091E2008E7F8093E2008091E2008061EE
-:1079D0008093E20080E060E042E0D8DEC7D1FF9112
-:1079E000EF91BF91AF919F918F917F916F915F9137
-:1079F0004F913F912F910F900FBE0F901F901895B0
-:107A00009C0140919801509199014617570718F42D
-:107A1000F90190E044C06115710511F0AB01F8CF98
-:107A20008091E8008E778093E80040E050E0F0CF4E
-:107A30008EB3882309F444C0853009F443C0809193
-:107A4000E80083FF02C081E008958091E80082FD94
-:107A500031C08091E80080FF22C08091F3009091B6
-:107A6000F200782F60E0292F30E0262B372B07C05B
-:107A700081918093F100415050402F5F3F4F41155D
-:107A8000510519F02830310598F390E02830310580
-:107A900009F491E08091E8008E778093E800411529
-:107AA000510531F6992321F605C08EB3882341F0A4
-:107AB000853041F08091E80082FFF7CF80E00895A3
-:107AC00082E0089583E008959C016115710529F411
-:107AD0008091E8008B778093E800F90126C08EB38F
-:107AE000882391F1853091F18091E80083FF02C0F5
-:107AF00081E008958091E80082FFF1CF06C0809177
-:107B0000F10081936150704059F02091F300809111
-:107B1000F200322F20E090E0822B932B892B79F713
-:107B20008091E8008B778093E80061157105B9F6C4
-:107B300005C08EB3882341F0853041F08091E80084
-:107B400080FFF7CF80E0089582E0089583E00895F4
-:107B50000F931F93DF93CF9300D0CDB7DEB7E2E949
-:107B6000F1E08091F100819381E0EA39F807C9F7EB
-:107B700075DD8091E80083FFE4C0809192019091CF
-:107B80009301953009F46DC0963040F4913081F145
-:107B9000913070F0933009F0D4C02AC0983009F4C5
-:107BA000A3C0993009F4B2C0963009F0CAC07CC0B5
-:107BB000803809F4C6C0823809F0C3C080919601AC
-:107BC00087708093E9008091EB001092E90020918A
-:107BD000E800277F2093E80090E025E096958795C0
-:107BE0002A95E1F781708093F1001092F10087C02F
-:107BF000882319F0823009F0A4C08F71823009F017
-:107C0000A0C080919401882331F5209196012770BE
-:107C100009F497C02093E9008091EB0080FF1BC01E
-:107C2000933021F48091EB00806213C08091EB00CF
-:107C300080618093EB0081E090E002C0880F991F83
-:107C40002A95E2F78093EA001092EA008091EB0017
-:107C500088608093EB001092E9008091E800877FB4
-:107C600051C0882309F06DC0109194011F770FB7A0
-:107C7000F8948091E800877F8093E8009ADD8091F6
-:107C8000E80080FFFCCF8091E3008078812B809317
-:107C9000E30080688093E300112311F482E001C0C7
-:107CA00083E08EBB0FBF4DC08058823008F049C0C2
-:107CB000809194019091950160919601AE014F5F82
-:107CC0005F4F3FDDBC01009709F43BC08091E800A5
-:107CD000877F8093E80089819A8192DE8091E80015
-:107CE0008B778093E8002DC0803859F58091E800AB
-:107CF000877F8093E800809190018093F1008091CC
-:107D0000E8008E778093E80054DD1BC08823C9F417
-:107D1000909194019230A8F48091E800877F80933D
-:107D2000E8009093900145DD80919001882331F423
-:107D30008091E30087FD02C081E001C084E08EBB3A
-:107D4000BDDC8091E80083FF0AC08091EB00806277
-:107D50008093EB008091E800877F8093E8000F908C
-:107D60000F90CF91DF911F910F91089508951F9368
-:107D70008EB3882361F01091E9001092E9008091A0
-:107D8000E80083FF01C0E4DE17701093E9001F9143
-:107D90000895F999FECF92BD81BDF89A992780B5D3
-:107DA0000895262FF999FECF1FBA92BD81BD20BD3F
-:107DB0000FB6F894FA9AF99A0FBE01960895F894BE
-:027DC000FFCFF3
-:107DC2004C554641434443000100000000000008B6
-:107DD2001201100102000008EB034A200100000119
-:107DE200000109023E000201008032090400000184
-:107DF20002020100052400100104240204052406E5
-:107E02000001070582030800FF09040100020A00BD
-:107E1200000007050402100001070583021000019B
-:107E220004030904260341005600520020004300C7
-:107E320044004300200042006F006F0074006C0099
-:0C7E42006F006100640065007200000029
+:1070D000ACE8B1E001C01D92AA39B107E1F7FCD2DA
+:1070E00053C68ECFF89481E085BF15BE0C94000086
+:1070F000089584E08093E9000DC08091E8008B77CB
+:107100008093E80003C08EB3882351F08091E8009B
+:1071100082FFF9CF8091E80085FFEFCF8091F100E9
+:107120000895982F83E08093E9008091E80085FD21
+:107130000DC08091E8008E778093E80003C08EB385
+:10714000882331F08091E80080FFF9CF9093F1001F
+:1071500008954F925F926F927F928F929F92AF921B
+:10716000BF92CF92DF92EF92FF920F931F93CF9334
+:10717000DF9384E08093E9008091E80082FF45C2BC
+:10718000B8DF182F853419F41092080103C0843534
+:1071900019F4AFDF8DE00FC28C34E1F38035D1F309
+:1071A000843721F484E4BDDF80E005C2813611F428
+:1071B00089E501C28134B1F49CDF182F9ADF90E099
+:1071C000880F991FAA2797FDA095BA2F312F330F4B
+:1071D00020E0442737FD4095542F822B932BA42B7E
+:1071E000B52BBAC1803711F483E5E5C1833549F485
+:1071F000C0E0D1E0899195DF21E0C730D207D1F717
+:10720000DBC1863521F481E38CDF80E3D4C1833791
+:1072100031F487E886DF85E984DF8EE1CCC18536ED
+:10722000B9F4E0E0F0E093E085E090935700E89552
+:1072300007B600FCFDCF80935700E89507B600FC29
+:10724000FDCFE058FF4FA0E7E030FA0771F7A2CF7B
+:107250008C3651F44EDF809599E0E1E0F0E0082EA5
+:1072600090935700E89596CF823739F4E1E0F0E04B
+:1072700089E08093570084919EC1863439F4E0E020
+:10728000F0E089E080935700849195C18E3439F401
+:10729000E3E0F0E089E08093570084918CC1813570
+:1072A00039F4E2E0F0E089E080935700849183C1F3
+:1072B000823631F489E535DF80E033DF80E87BC159
+:1072C000823419F0873609F0DBC013DF082F11DF95
+:1072D000F82E0FDF682E8554823008F06BC1902F96
+:1072E00080E0CF2DD0E0C82BD92B173609F04BC04A
+:1072F00081E180935700E895DD24CC24C3943FC0FE
+:10730000E0908C01F0908D0100918E0110918F0121
+:10731000B6E46B16D9F4ED2DF0E0EE29FF29E491E7
+:107320008E2FFFDEDD2081F082E090E0A0E0B0E073
+:10733000E80EF91E0A1F1B1FE0928C01F0928D01CE
+:1073400000938E0110938F01DC2418C0D801C7016F
+:10735000B695A7959795879501D5E3DE82E090E0F5
+:10736000A0E0B0E0E80EF91E0A1F1B1FE0928C019E
+:10737000F0928D0100938E0110938F012197209739
+:1073800009F0BECF19C180908C0190908D01A09022
+:107390008E01B0908F0196E4691609F05DC083E01C
+:1073A000F40180935700E89507B600FCFDCF54C068
+:1073B000F6E46F1661F5772031F1E0908C01F090E2
+:1073C0008D0100918E0110918F0193DED82ECC2477
+:1073D000852D90E08C299D29F7010C0140925700E2
+:1073E000E895112482E090E0A0E0B0E0E80EF91EFC
+:1073F0000A1F1B1FE0928C01F0928D0100938E01F9
+:1074000010938F0102C075DE582E742423C0E090C3
+:107410008C01F0908D0100918E0110918F011695D5
+:107420000795F794E79465DE682FC7019FD4809194
+:107430008C0190918D01A0918E01B0918F010296E7
+:10744000A11DB11D80938C0190938D01A0938E019D
+:10745000B0938F01219704C055247724442443948A
+:10746000209709F0A5CF96E4691609F093CE85E040
+:10747000F40180935700E89507B600FCFDCF8ACE53
+:10748000833471F400918C0110918D0132DE90E013
+:1074900021E0F8010C0120935700E89511247ACEE1
+:1074A000833619F5E0908C01F0908D0100918E01EA
+:1074B00010918F011EDEF701E16090E021E00C01E8
+:1074C00020935700E895112482E090E0A0E0B0E01E
+:1074D000E80EF91E0A1F1B1FE0928C01F0928D012D
+:1074E00000938E0110938F0155CE8D3661F4E0919B
+:1074F0008C01F0918D0185E080935700E89507B6E7
+:1075000000FCFDCF47CE823551F4E0918C01F09123
+:107510008D0105911491812F04DE802F4CC084349D
+:1075200021F5E0908C01F0908D0100918E01109179
+:107530008F0116950795F794E794DBDD682FC70157
+:1075400015D480918C0190918D01A0918E01B09104
+:107550008F010296A11DB11D80938C0190938D0126
+:10756000A0938E01B0938F0115CE843609F5E0907B
+:107570008C01F0908D0100918E0110918F01D80146
+:10758000C701B695A79597958795E8D3CADD82E0A0
+:1075900090E0A0E0B0E0E80EF91E0A1F1B1FE09289
+:1075A0008C01F0928D0100938E0110938F0104C025
+:1075B0008B3111F08FE3B5DD83E08093E90090918A
+:1075C000E8008091E8008E778093E80095FF04C082
+:1075D00010C08EB38823C9F08091E80080FFF9CFF6
+:1075E0008091E8008E778093E80003C08EB38823F3
+:1075F00061F08091E80080FFF9CF84E08093E9009A
+:107600008091E8008B778093E800DF91CF911F9104
+:107610000F91FF90EF90DF90CF90BF90AF909F9031
+:107620008F907F906F905F904F900895909192010E
+:10763000892F8F77813249F5809193018032A1F0B3
+:10764000813219F5913A09F58091E800877F80939E
+:10765000E80089E091E067E070E0B7D18091E80050
+:107660008B778093E8000895913279F48091E80057
+:10767000877F8093E80089E091E067E070E009D2BD
+:107680008091E8008E778093E800089582E061ECB5
+:1076900042E061D083E061E842E15DD084E060E8EF
+:1076A00042E159C084B7877F84BF88E10FB6F89460
+:1076B00080936000109260000FBE80E090E020E8B0
+:1076C0000FB6F89420936100809361000FBE81E0B3
+:1076D00085BF82E085BFB0C088E10FB6F894809383
+:1076E0006000109260000FBEDDDF789402C031DDD3
+:1076F00023D3809108018823D1F78091E000816035
+:107700008093E000EFDC80E090E00895FA01923091
+:1077100071F0933089F0913029F480E191E022E119
+:1077200030E015C080E090E020E030E010C082E260
+:1077300091E02EE330E00BC0882329F480E691E04D
+:1077400024E030E004C084E691E026E230E091835A
+:107750008083C90108958093E9008091EB008160E6
+:107760008093EB001092ED006093EC004093ED00ED
+:107770008091EE00881F8827881F089580919201CC
+:1077800088238CF403C08EB38823B1F08091E80085
+:1077900082FFF9CF8091E8008B778093E80008950D
+:1077A0008EB3882349F08091E80080FFF9CF809163
+:1077B000E8008E778093E8000895EF92FF920F9390
+:1077C0001F9345D04CD008ED10E0F80180818F77F1
+:1077D000808380818068808380818F7D808319BCD5
+:1077E0001EBA1092900180EEE82EF12CF7018081F4
+:1077F0008B7F8083F80180818160808380E060E0FE
+:1078000042E0A9DFE1EEF0E080818E7F8083E2EE4E
+:10781000F0E0808181608083808188608083F701CF
+:1078200080818E7F8083F8018081806180831F91B9
+:107830000F91FF90EF900895E7EDF0E08081816077
+:1078400080838AE482BF81E080939101B6CFE8ED26
+:10785000F0E080818E7F80831092E2000895109284
+:10786000DA001092E10008951F920F920FB60F9266
+:1078700011242F933F934F935F936F937F938F9335
+:107880009F93AF93BF93EF93FF938091DA0080FFB4
+:107890001BC08091D80080FF17C08091DA008E7FD6
+:1078A0008093DA008091D90080FF0BC080E189BD10
+:1078B00082E189BD09B400FEFDCF81E08EBB3BD2E1
+:1078C00003C019BC1EBA37D28091E10080FF17C0F7
+:1078D0008091E20080FF13C08091E2008E7F809350
+:1078E000E2008091E20080618093E2008091D80004
+:1078F00080628093D80019BC85E08EBB1CD2809139
+:10790000E10084FF2CC08091E20084FF28C080E168
+:1079100089BD82E189BD09B400FEFDCF8091D80008
+:107920008F7D8093D8008091E1008F7E8093E1006D
+:107930008091E2008F7E8093E2008091E20081607E
+:107940008093E20080919001882331F48091E300DC
+:1079500087FD02C081E001C084E08EBBECD1809144
+:10796000E10083FF21C08091E20083FF1DC0809170
+:10797000E100877F8093E10082E08EBB109290014E
+:107980008091E1008E7F8093E1008091E2008E7F04
+:107990008093E2008091E20080618093E20080E0C9
+:1079A00060E042E0D8DEC7D1FF91EF91BF91AF9187
+:1079B0009F918F917F916F915F914F913F912F9107
+:1079C0000F900FBE0F901F9018959C014091980149
+:1079D000509199014617570718F4F90190E044C0F7
+:1079E0006115710511F0AB01F8CF8091E8008E7739
+:1079F0008093E80040E050E0F0CF8EB3882309F494
+:107A000044C0853009F443C08091E80083FF02C080
+:107A100081E008958091E80082FD31C08091E80006
+:107A200080FF22C08091F3009091F200782F60E0F7
+:107A3000292F30E0262B372B07C081918093F1004E
+:107A4000415050402F5F3F4F4115510519F02830EC
+:107A5000310598F390E02830310509F491E08091E8
+:107A6000E8008E778093E8004115510531F699239F
+:107A700021F605C08EB3882341F0853041F0809116
+:107A8000E80082FFF7CF80E0089582E0089583E068
+:107A900008959C016115710529F48091E8008B77A8
+:107AA0008093E800F90126C08EB3882391F18530D8
+:107AB00091F18091E80083FF02C081E008958091F8
+:107AC000E80082FFF1CF06C08091F1008193615000
+:107AD000704059F02091F3008091F200322F20E0A5
+:107AE00090E0822B932B892B79F78091E8008B779C
+:107AF0008093E80061157105B9F605C08EB388233F
+:107B000041F0853041F08091E80080FFF7CF80E0C0
+:107B1000089582E0089583E008950F931F93DF9303
+:107B2000CF9300D0CDB7DEB7E2E9F1E08091F1006C
+:107B3000819381E0EA39F807C9F778DD8091E800A0
+:107B400083FFE4C08091920190919301953009F4F4
+:107B50006DC0963040F4913081F1913070F09330E7
+:107B600009F0D4C02AC0983009F4A3C0993009F4B0
+:107B7000B2C0963009F0CAC07CC0803809F4C6C0D3
+:107B8000823809F0C3C08091960187708093E90024
+:107B90008091EB001092E9002091E800277F20936C
+:107BA000E80090E025E0969587952A95E1F78170A9
+:107BB0008093F1001092F10087C0882319F0823081
+:107BC00009F0A4C08F71823009F0A0C080919401A7
+:107BD000882331F520919601277009F497C02093EE
+:107BE000E9008091EB0080FF1BC0933021F480916D
+:107BF000EB00806213C08091EB0080618093EB000A
+:107C000081E090E002C0880F991F2A95E2F78093E7
+:107C1000EA001092EA008091EB0088608093EB000C
+:107C20001092E9008091E800877F51C0882309F015
+:107C30006DC0109194011F770FB7F8948091E80000
+:107C4000877F8093E8009ADD8091E80080FFFCCF79
+:107C50008091E3008078812B8093E300806880939B
+:107C6000E300112311F482E001C083E08EBB0FBF5B
+:107C70004DC08058823008F049C0809194019091A5
+:107C8000950160919601AE014F5F5F4F3FDDBC01F2
+:107C9000009709F43BC08091E800877F8093E8005B
+:107CA00089819A8192DE8091E8008B778093E80049
+:107CB0002DC0803859F58091E800877F8093E800D7
+:107CC000809190018093F1008091E8008E778093FD
+:107CD000E80054DD1BC08823C9F4909194019230D0
+:107CE000A8F48091E800877F8093E800909390014A
+:107CF00045DD80919001882331F48091E30087FD78
+:107D000002C081E001C084E08EBBC0DC8091E8004D
+:107D100083FF0AC08091EB0080628093EB0080912A
+:107D2000E800877F8093E8000F900F90CF91DF915C
+:107D30001F910F91089508951F938EB3882361F0CA
+:107D40001091E9001092E9008091E80083FF01C0E2
+:107D5000E4DE17701093E9001F910895F999FECFA2
+:107D600092BD81BDF89A992780B50895262FF9997B
+:107D7000FECF1FBA92BD81BD20BD0FB6F894FA9A0E
+:0C7D8000F99A0FBE01960895F894FFCF09
+:107D8C004C554641434443000100000000000008EC
+:107D9C001201100102000008EB034A20010000014F
+:107DAC00000109023E0002010080320904000001BA
+:107DBC00020201000524001001042402040524061B
+:107DCC000001070582030800FF09040100020A00F4
+:107DDC0000000705040210000107058302100001D2
+:107DEC0004030904260341005600520020004300FE
+:107DFC0044004300200042006F006F0074006C00D0
+:0C7E0C006F00610064006500720000005F
:040000030000700089
:00000001FF
diff --git a/cores/arduino/CDC.cpp b/cores/arduino/CDC.cpp
index 8605ce3..eb1b2c5 100644
--- a/cores/arduino/CDC.cpp
+++ b/cores/arduino/CDC.cpp
@@ -27,7 +27,10 @@ void Reboot()
{
USB.detach();
cli();
- asm volatile("jmp 0x7800"); // jump to bootloader - DiskLoader takes up last 2 kB
+
+ // Reset the microcontroller to run the bootloader
+ wdt_enable(WDTO_250MS);
+ for (;;);
}
// Define constants and variables for buffering incoming serial data. We're