ISP example program.

Dependencies:   SLCD mbed USBLocalFileSystem

/media/uploads/va009039/lpc81isp-360x240.jpg

FRDM-KL46ZLPC810
UART RXDPTE23p2(P0_4)
UART TXDPTE22p8(P0_0)
nRESETD6p1(P0_5)
nISPD8p5(P0_1)
GNDGNDp7
3.3VP3V3p6

Copy binary image to the disk called LPC81ISP.
Push sw1 or sw3, start write to LPC810 flash.

Revision:
2:eafc1c6787c7
Parent:
1:cccfc461c61f
--- 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
+