diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-08-14 16:02:16 -0400 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-08-14 16:02:16 -0400 |
commit | b8a2daf8bcda528be820eb0b76e6b15961cd71c0 (patch) | |
tree | cfe3dbacbfa18b8a3fc1426f5ee8f92b82f01c78 /bootloaders | |
parent | 5b453fd6069349f3e08dbe72a32eb6a2a60a6afb (diff) |
LEDs for D13, TX, and RX are more in line with Uno-like behavior during sketch uploading.
D13 flashes on reboot, TX and RX flash with USB data transfer.
Diffstat (limited to 'bootloaders')
-rw-r--r-- | bootloaders/diskloader/DiskLoader.hex | 165 | ||||
-rw-r--r-- | bootloaders/diskloader/src/DiskLoader.cpp | 4 | ||||
-rw-r--r-- | bootloaders/diskloader/src/Platform.h | 8 | ||||
-rw-r--r-- | bootloaders/diskloader/src/USBCore.cpp | 13 |
4 files changed, 101 insertions, 89 deletions
diff --git a/bootloaders/diskloader/DiskLoader.hex b/bootloaders/diskloader/DiskLoader.hex index 5e1534b..62734a8 100644 --- a/bootloaders/diskloader/DiskLoader.hex +++ b/bootloaders/diskloader/DiskLoader.hex @@ -1,4 +1,4 @@ -:1078000011241FBECFEFDAE0DEBFCDBFD0C04101F3
+:1078000011241FBECFEFDAE0DEBFCDBFBAC0410109
:1078100042144505560455026403740300001E9586
:1078200087020110030000C18081C106C0FF0A0069
:107830000CA10185037508150026FF00954009017C
@@ -13,87 +13,86 @@ :1078C000040100020A000000070502024000000750
:1078D00005830240000009040200010300000009C2
:1078E0002101010001221E00070584034000400021
-:1078F00020918A0130918B012F5F3F4F30938B0194
-:1079000020938A01832F9927982F87FD9095990FAF
-:10791000921710F447980895479A089581E080934C
-:10792000E0001092E200EE27FF27099408950F93DC
-:107930001F93CF93DF93982FEB01042F10E088E77C
-:107940006030780730F411E083E0FB01809357004A
-:10795000E895892F68E071E0402FD8D0112311F10C
-:1079600007B600FCFDCF402F4695FE01A8E0B1E030
-:1079700020E031E009C08D919D910C0130935700BA
-:10798000E895112432962F5F2417A8F385E0FE01B5
-:1079900080935700E89507B600FCFDCF81E1809306
-:1079A0005700E895DF91CF911F910F9108953F9A6D
-:1079B000209A6E9A90E8909361001092610081E89D
-:1079C00085BF95BF8AD084E18093880180E1809350
-:1079D0008901E0E0F0E0859194918F5F9F4F19F06D
-:1079E00081E080938D01EE24FF24DD24D394D5D152
-:1079F000082F8EE098E7FC0124913196029644917D
-:107A0000201711F02223B9F710928F0110928E01E6
-:107A100082E068E071E07AD0013479F46091080185
-:107A20006058633028F0683111F064E001C063E011
-:107A3000C62FD0E0CF5DD7480EC0063571F48091D7
-:107A40000801803311F011E022C080910A01C82F93
-:107A5000D0E0C25ED74811E022C0053721F413E020
-:107A6000CEE1D8E71CC0053539F4E0900801F0906C
-:107A70000901EE0CFF1C0AC0043631F482E0B701A4
-:107A80004091090154DF02C0043721F010E0C5E243
-:107A9000D8E705C010910901E701E10EF11C7DD185
-:107AA0008097B1F483E068E871E041E050E044D0B1
-:107AB000112329F0412F50E083E8BE013DD083E43B
-:107AC00069E871E041E050E037D0013509F08FCF2F
-:107AD000D0928D01EE24FF248ACF10928F01109254
-:107AE0008E0110928C0110928D0181E08093D7005D
-:107AF00080EA8093D80082E189BD09B400FEFDCF01
-:107B000080E98093D8001092E0000895FB018093F3
-:107B1000E9009BE60EC08091E80085FFFCCF8091D4
-:107B2000F10081938091E80085FD02C09093E80008
-:107B30004150442381F70895982FFB01282F20728C
-:107B400087708093E9003AE314C08091E80085FFD4
-:107B5000FCCF97FF02C0849101C080813196211132
-:107B600080E08093F1008091E80085FD02C03093B1
-:107B7000E800415050408FEF4F3F580731F796FFD4
-:107B800003C08AE38093E8000895809191018132D7
-:107B900079F420E030E003C080818093F100F901A6
-:107BA000E050FF4F2F5F3F4F28303105A9F71EC02F
-:107BB0008032B1F48091E80082FFFCCF20E030E019
-:107BC00003C08091F1008083F901E050FF4F2F5FE7
-:107BD0003F4F28303105A9F78BEF8093E80006C0AE
-:107BE000823221F4809192018093070181E008950F
-:107BF00020919301223231F1213081F4809196015C
-:107C000090919701089711F4209398018091980121
-:107C1000882309F03AC0E9E7F8E739C0223021F4B7
-:107C200084E6EBE8F8E711C0233069F58091920112
-:107C3000882319F4E9E4F8E72AC0813021F5EDE45E
-:107C4000F8E725C081E0EBE2F8E790919601282F54
-:107C5000981708F4292F90E03EEF8091E800857096
-:107C6000E1F38091E80082FD0EC09F5F84918093D4
-:107C7000F100892F8F7311F43093E8003196921739
-:107C800060F381E0089580E00895E7E6F8E78491E5
-:107C9000DCCF1092E9008091E80083FF5FC0E0E94B
-:107CA000F1E003C08091F100819381E0E839F807A9
-:107CB000C9F782EF8093E8008091900187FF05C0AB
-:107CC0008091E80080FFFCCF03C08EEF8093E80036
-:107CD00080919101853051F48091E80080FFFCCFC4
-:107CE0008091920180688093E30031C08930E1F493
-:107CF0008091920180938C01E7E2F8E791E031E016
-:107D000026E39093E9003093EB0084918093EC009C
-:107D10002093ED009F5F3196953099F78EE7809321
-:107D2000EA001092EA0013C0883029F480918C0197
-:107D30008093F1000CC0882319F41092F10007C061
-:107D4000863011F455DF01C020DF882321F08EEF4B
-:107D50008093E800089581E28093EB00089580917C
-:107D6000E1001092E100282F83FF0CC01092E9007F
-:107D700081E08093EB001092EC0082E38093ED00B1
-:107D800010928C0122FF08C080918D01882321F47C
-:107D900010928F0110928E0108951F9312E079DFE7
-:107DA000DEDF1093E9008091E80085FF0DC090911F
-:107DB000F1008091E80085FD03C08BE68093E80028
-:107DC000892F90E01F91089584E6000000000000D4
-:107DD00000008150D1F780918E0190918F01019721
-:107DE00090938F0180938E0180918E0190918F01ED
-:0A7DF000892B09F493DD7CDDD2CF6E
-:087DFA0000E1000000000000A0
+:1078F00081E08093E0001092E200EE27FF270994D8
+:1079000008950F931F93CF93DF93982FEB01042FCC
+:1079100010E088E76030780730F411E083E0FB0185
+:1079200080935700E895892F68E071E0402FDBD005
+:10793000112311F107B600FCFDCF402F4695FE0143
+:10794000A8E0B1E020E031E009C08D919D910C01EB
+:1079500030935700E895112432962F5F2417A8F32F
+:1079600085E0FE0180935700E89507B600FCFDCF47
+:1079700081E180935700E895DF91CF911F910F919E
+:107980000895769A289A47983F9A209A6E9A90E896
+:10799000909361001092610081E885BF95BF8AD005
+:1079A00084E18093880180E180938901E0E0F0E048
+:1079B000859194918F5F9F4F19F081E080938B01A7
+:1079C000EE24FF24DD24D394DDD1082F8EE098E748
+:1079D000FC012491319602964491201711F0222344
+:1079E000B9F710928D0110928C0182E068E071E08D
+:1079F0007AD0013479F4609108016058633028F03E
+:107A0000683111F064E001C063E0C62FD0E0CF5DC3
+:107A1000D7480EC0063571F480910801803311F00B
+:107A200011E022C080910A01C82FD0E0C25ED74881
+:107A300011E022C0053721F413E0CEE1D8E71CC0E5
+:107A4000053539F4E0900801F0900901EE0CFF1CB7
+:107A50000AC0043631F482E0B7014091090151DFD8
+:107A600002C0043721F010E0C5E2D8E705C010914C
+:107A70000901E701E10EF11C85D18097B1F483E0A3
+:107A800068E871E041E050E045D0112329F0412F32
+:107A900050E083E8BE013ED083E469E871E041E054
+:107AA00050E038D0013509F08FCFD0928B01EE2411
+:107AB000FF248ACF10928D0110928C0110928A01BE
+:107AC00010928B0181E08093D70080EA8093D800E8
+:107AD00082E189BD09B400FEFDCF80E98093D80022
+:107AE0001092E0000895FB018093E9009BE60FC02F
+:107AF0008091E80085FFFCCF28988091F100819368
+:107B00008091E80085FD02C09093E8004150442335
+:107B100079F70895982FFB01282F207287708093A2
+:107B2000E9003AE315C08091E80085FFFCCF97FF9C
+:107B300002C0849101C080813196211180E0769845
+:107B40008093F1008091E80085FD02C03093E80049
+:107B5000415050408FEF4F3F580729F796FF03C021
+:107B60008AE38093E800089580918F01813281F447
+:107B7000769820E030E003C080818093F100F90125
+:107B8000E050FF4F2F5F3F4F28303105A9F71FC04E
+:107B90008032B9F48091E80082FFFCCF289820E081
+:107BA00030E003C08091F1008083F901E050FF4F85
+:107BB0002F5F3F4F28303105A9F78BEF8093E80006
+:107BC00006C0823221F4809190018093070181E008
+:107BD000089520919101223231F1213081F4809178
+:107BE000940190919501089711F42093960180914A
+:107BF0009601882309F03BC0E9E7F8E73AC0223054
+:107C000021F484E6EBE8F8E711C0233071F58091A8
+:107C10009001882319F4E9E4F8E72BC0813029F5B5
+:107C2000EDE4F8E726C081E0EBE2F8E790919401FB
+:107C3000282F981708F4292F90E03EEF8091E80054
+:107C40008570E1F38091E80082FD0FC09F5F849111
+:107C500076988093F100892F8F7311F43093E800A8
+:107C60003196921758F381E0089580E00895E7E691
+:107C7000F8E78491DBCF1092E9008091E80083FF60
+:107C800062C02898EEE8F1E003C08091F100819392
+:107C900081E0E639F807C9F782EF8093E800809128
+:107CA0008E0187FF05C08091E80080FFFCCF03C0F4
+:107CB0008EEF8093E80080918F01853051F48091A0
+:107CC000E80080FFFCCF8091900180688093E30002
+:107CD00033C08930E1F48091900180938A01E7E21A
+:107CE000F8E791E031E026E39093E9003093EB0070
+:107CF00084918093EC002093ED009F5F3196953046
+:107D000099F78EE78093EA001092EA0015C0883058
+:107D100031F480918A0176988093F1000DC0882318
+:107D200021F476981092F10007C0863011F451DFEB
+:107D300001C01ADF882321F08EEF8093E8000895B8
+:107D400081E28093EB0008958091E1001092E100C0
+:107D5000282F83FF0CC01092E90081E08093EB0094
+:107D60001092EC0082E38093ED0010928A0122FFD2
+:107D700008C080918B01882321F410928D0110920C
+:107D80008C0108951F9312E076DFDEDF1093E90087
+:107D90008091E80085FF0EC028989091F1008091B5
+:107DA000E80085FD03C08BE68093E800892F90E012
+:107DB0001F91089584E6000000000000000081503B
+:107DC000D1F7289A769A80918C0190918D01019734
+:107DD00090938D0180938C0180918C0190918D0105
+:0C7DE000892B91F6769A289A83DDCECF8D
+:087DEC0000E1000000000000AE
:040000030000780081
:00000001FF
diff --git a/bootloaders/diskloader/src/DiskLoader.cpp b/bootloaders/diskloader/src/DiskLoader.cpp index 3cb5caa..bc1e026 100644 --- a/bootloaders/diskloader/src/DiskLoader.cpp +++ b/bootloaders/diskloader/src/DiskLoader.cpp @@ -119,6 +119,9 @@ int main(void) __attribute__ ((naked)); // STK500v1 main loop, very similar to optiboot in protocol and implementation int main() { + TXLED0; + RXLED0; + LED0; BOARD_INIT(); USBInit(); @@ -236,6 +239,7 @@ void LEDPulse() void Reboot() { + /* TODO - ZE - this should probably be a WDT reset instead, right? */ UDCON = 1; // Detatch USB UDIEN = 0; asm volatile ( // Reset vector to run firmware diff --git a/bootloaders/diskloader/src/Platform.h b/bootloaders/diskloader/src/Platform.h index 3f55c68..004933e 100644 --- a/bootloaders/diskloader/src/Platform.h +++ b/bootloaders/diskloader/src/Platform.h @@ -33,10 +33,10 @@ typedef unsigned long u32; #define BOARD_INIT() DDRC |= (1<<7); DDRB |= (1<<0); DDRE |= (1<<6); CPU_PRESCALE(0); DISABLE_JTAG(); #define LED0 PORTC &= ~(1<<7) #define LED1 PORTC |= (1<<7) -#define TXLED0 PORTE &= ~(1<<6) -#define TXLED1 PORTE |= (1<<6) -#define RXLED0 PORTB &= ~(1<<0) -#define RXLED1 PORTB |= (1<<0) +#define TXLED0 PORTE |= (1<<6) +#define TXLED1 PORTE &= ~(1<<6) +#define RXLED0 PORTB |= (1<<0) +#define RXLED1 PORTB &= ~(1<<0) #define TRANSFER_PGM 0x80 #define TRANSFER_RELEASE 0x40 diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp index fbfad0e..52b960a 100644 --- a/bootloaders/diskloader/src/USBCore.cpp +++ b/bootloaders/diskloader/src/USBCore.cpp @@ -86,23 +86,27 @@ static inline void ClearOUT(void) static void Send(volatile const u8* data, u8 count) { + TXLED1; // light the TX LED while (count--) UEDATX = *data++; } void Recv(volatile u8* data, u8 count) { + RXLED1; // light the RX LED while (count--) *data++ = UEDATX; } static inline u8 Recv8() { + RXLED1; // light the RX LED return UEDATX; } static inline void Send8(u8 d) { + TXLED1; // light the TX LED UEDATX = d; } @@ -506,12 +510,17 @@ int USBGetChar() u8 temp = 0; for (temp=100; temp; temp--) asm volatile("nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t"::); + RXLED0; // we turn the RX and TX LEDs on in the relevant Send or Recv instruction + TXLED0; // we turn them off here after some time has passed to ensure a minimum on time. } - if (!--_timeout) + if (!--_timeout) { + TXLED0; // switch off the RX and TX LEDs before starting the user sketch + RXLED0; Reboot(); // USB not connected, run firmware + } - LEDPulse(); +// LEDPulse(); } return -1; } |