diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-10-26 12:53:57 -0400 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-10-26 12:53:57 -0400 |
commit | a52fb298607dfbd78b83e3d0787fdf5d508332d9 (patch) | |
tree | c95676e072bc9a37bf8a2bbf9f41ea6c867d21e5 /bootloaders/nuevo_diskloader/src/DiskLoader.cpp | |
parent | bdfae9f7b7b7e34bc00acdf2889ba3dfaa1f3e87 (diff) |
working (?!?!?!) bootloader. doesn't yet restart chip after upload completes.
Diffstat (limited to 'bootloaders/nuevo_diskloader/src/DiskLoader.cpp')
-rw-r--r-- | bootloaders/nuevo_diskloader/src/DiskLoader.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp index f611e17..a7ccde6 100644 --- a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp +++ b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp @@ -24,11 +24,12 @@ void entrypoint(void) u8 _flashbuf[128]; u8 _inSync; u8 _ok; +u16 do_reset = 0; volatile u16 _timeout; void Program(u8 ep, u16 page, u8 count) { - u8 write = page < 28*1024; // Don't write over firmware please + u8 write = page < 28*1024; // Don't write over bootloader please if (write) boot_page_erase(page); @@ -94,18 +95,18 @@ const u8 _consts[] = 0x00, // }; -int getch(void) -{ - u16 timeout; - u8 c; - for (timeout = 0; timeout; timeout--) - { - c = USB_Recv(CDC_RX); - if (c != -1) - return c; - } - return -1; -} +//int getch(void) +//{ +// u16 timeout; +// u8 c; +// for (timeout = 0; timeout; timeout--) +// { +// c = USB_Recv(CDC_RX); +// if (c != -1) +// return c; +// } +// return -1; +//} int main(void) __attribute__ ((naked)); @@ -245,8 +246,11 @@ int main() // Send ok USB_Send(CDC_TX|TRANSFER_RELEASE, &_ok, 1); - if ('Q' == cmd) + if ('Q' == cmd) + { + do_reset = 500; break; + } } } } |