ISP example program.
Dependencies: SLCD mbed USBLocalFileSystem
FRDM-KL46Z | LPC810 | |
---|---|---|
UART RXD | PTE23 | p2(P0_4) |
UART TXD | PTE22 | p8(P0_0) |
nRESET | D6 | p1(P0_5) |
nISP | D8 | p5(P0_1) |
GND | GND | p7 |
3.3V | P3V3 | p6 |
Copy binary image to the disk called LPC81ISP.
Push sw1 or sw3, start write to LPC810 flash.
Diff: main.cpp
- Revision:
- 2:eafc1c6787c7
- Parent:
- 1:cccfc461c61f
diff -r cccfc461c61f -r eafc1c6787c7 main.cpp --- a/main.cpp Sun Feb 16 12:56:12 2014 +0000 +++ b/main.cpp Sun May 04 00:36:04 2014 +0000 @@ -1,6 +1,5 @@ #ifdef TARGET_KL46Z -#include "RamDisk.h" -#include "Storage.h" +#include "USBLocalFileSystem.h" #include "BaseLpcIsp.h" #include "SLCD.h" @@ -23,7 +22,7 @@ } } virtual void infoSLCD(const char* s) { slcd.puts(s); } -} lpc(PTE22, PTE23, PTB0, PTB1); // TX,RX,nRESET,nISP +} lpc(PTE22, PTE23, D6, D8); // TX,RX,nRESET,nISP __IO bool write_start = false; void swIRQ() { @@ -42,17 +41,12 @@ sw1.rise(swIRQ); sw3.rise(swIRQ); - RamDisk* ramdisk = new RamDisk; - USBStorage2* usb = new USBStorage2(ramdisk); - LocalStorage* local = NULL; + USBLocalFileSystem* usb_local = new USBLocalFileSystem(); // RamDisk(64KB) slcd.puts("REDY"); write_start = false; while(1) { if (write_start) { - if (local) { - delete local; - } - local = new LocalStorage(ramdisk); + usb_local->remount(); mystring filename; if (LocalStorage::find_bin(filename)) { pc.printf("bin filename=[%s]\n", filename.c_str()); @@ -64,19 +58,23 @@ } write_start = false; } - if (usb->readable()) { - lpc.putc(usb->getc()); + if (usb_local->readable()) { + lpc.putc(usb_local->getc()); } if (lpc.readable()) { - usb->putc(lpc.getc()); + usb_local->putc(lpc.getc()); } if (pc.readable()) { switch(pc.getc()) { - case 'd': ramdisk->dump(0); break; - case 'D': ramdisk->dump(1); break; - case 'w': write_start = true; break; + case 'w': + case 'W': + write_start = true; + break; + default: + break; } } } } -#endif +#endif // TARGET_KL46Z +