Norimasa Okamoto / Mbed 2 deprecated lpcterm2

Dependencies:   SWD mbed USBLocalFileSystem BaseDAP USBDAP

Files at this revision

API Documentation at this revision

Comitter:
va009039
Date:
Thu Mar 20 03:46:47 2014 +0000
Parent:
12:2a7ca1f9619b
Child:
14:e6acf863207e
Commit message:
run on LPCXpresso LPC1549

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
USBMSD2/USB_CDC.h Show annotated file Show diff for this revision Revisions of this file
main_LPC1549.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice.lib	Thu Feb 27 14:35:22 2014 +0000
+++ b/USBDevice.lib	Thu Mar 20 03:46:47 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/va009039/code/USBDevice/#6dcb8023e437
+http://mbed.org/users/va009039/code/USBDevice/#b5a68b899fd1
--- a/USBMSD2/USB_CDC.h	Thu Feb 27 14:35:22 2014 +0000
+++ b/USBMSD2/USB_CDC.h	Thu Mar 20 03:46:47 2014 +0000
@@ -25,7 +25,7 @@
 #define CDC_EPINT_IN   EP1IN
 #define CDC_EPBULK_IN  EP5IN 
 #define CDC_EPBULK_OUT EP5OUT
-#elif defined(TARGET_LPC1347)||defined(TARGET_LPC11U24)||defined(TARGET_LPC11U35_401)
+#elif defined(TARGET_LPC1347)||defined(TARGET_LPC11U24)||defined(TARGET_LPC11U35_401)||defined(TARGET_LPC1549)
 #define CDC_EPINT_IN   EP1IN
 #define CDC_EPBULK_IN  EP3IN 
 #define CDC_EPBULK_OUT EP3OUT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main_LPC1549.cpp	Thu Mar 20 03:46:47 2014 +0000
@@ -0,0 +1,76 @@
+// main_LPC1549.cpp 2014/3/20
+#if defined(TARGET_LPC1549)
+#include "Target2.h"
+#include "Flash.h"
+#include "RamDisk.h"
+#include "Storage.h"
+#include "Semihost.h"
+
+Serial pc(USBTX,USBRX);
+SWD swd(D12,D10,D6); // SWDIO,SWCLK,nReset
+InterruptIn sw3(P1_9);
+DigitalOut led_disk(LED1);
+DigitalOut led_flash(LED2);
+#define LED_ON  0
+#define LED_OFF 1
+
+void callback_disk() {
+    led_disk = !led_disk;
+}
+
+void callback_flash() {
+    led_flash = !led_flash;
+}
+
+__IO bool write_start = false;
+void swIRQ() {
+    wait_ms(100);
+    write_start = true;
+}
+
+int main() {
+    pc.baud(9600);
+    pc.printf("%s\n", __FILE__);
+    led_disk = LED_OFF;
+    led_flash = LED_OFF;
+
+    sw3.mode(PullUp);
+    sw3.rise(swIRQ);
+        
+    RamDisk* ramdisk = new RamDisk;
+    ramdisk->attachEvent(callback_disk);
+    USBStorage2* usb = new USBStorage2(ramdisk);
+    LocalStorage* local = NULL;
+    Target2* lpc = new Target2(&swd);
+    lpc->setup();
+    Semihost semihost(lpc, &pc, usb);
+    semihost.mount("/local");
+    lpc->resume(); // C_DEBUGEN ON
+    while(1) {
+        if (write_start) {
+            if (local) {
+                delete local;
+            }    
+            local = new LocalStorage(ramdisk);     
+            mystring filename;
+            if (LocalStorage::find_bin(filename)) {
+                pc.printf("*** bin filename=[%s]\n", filename.c_str());
+                lpc->setup();
+                Flash flash(lpc, &pc);
+                flash.attachEvent(callback_flash);
+                if (flash.init()) {
+                    flash.write(filename.c_str());
+                    flash.verify(filename.c_str());
+                }
+            } else {
+                pc.printf("*** binary image file not found.\n");
+            }
+            lpc->SoftwareReset();    
+            lpc->HardwareReset();
+            led_flash = LED_OFF;
+            write_start = false;
+        }
+        semihost.poll();
+    }        
+}
+#endif // TARGET_LPC1549
--- a/mbed.bld	Thu Feb 27 14:35:22 2014 +0000
+++ b/mbed.bld	Thu Mar 20 03:46:47 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079
\ No newline at end of file