semihost server example program

Dependencies:   SWD mbed USBLocalFileSystem BaseDAP USBDAP

/media/uploads/va009039/kl46z-lpc800-360x480.jpg

LPCXpresso
LPC11U68
LPCXpresso
LPC1549
FRDM-KL46ZEA LPC4088 QSB
app-board
LPC1768
app-board
LPC810LPC1114FN28
serverserverserverserverserverclientclient
SWDIOD12D12D12p25p21p4(P0_2)p12
SWCLKD10D10D10p26p22p3(P0_3)p3
nRESET
*option
D6D6D6p34p30p1(P0_5)p23
GNDGNDGNDGNDp1p1p7p22
3.3VP3V3P3V3P3V3p44p40p6p21
flash writeSW2(P0_1)SW3(P1_9)SW1p14
joystick
center
p14
joystick
center

client example:

Import programlpc810-semihost_helloworld

semihost client example program

Revision:
12:2a7ca1f9619b
Parent:
4:5e4107edcbdb
Child:
18:5ed1759e863b
--- a/tests/mydebug.cpp	Sun Feb 23 12:06:02 2014 +0000
+++ b/tests/mydebug.cpp	Thu Feb 27 14:35:22 2014 +0000
@@ -18,11 +18,11 @@
 
 void debug_dap_request(uint8_t* buf, int len)
 {
-    printf("uint8_t req[] = ");
+    debug("uint8_t req[] = ");
     for(int i = 0; i < len; i++) {
-        printf("%c0x%02x", i == 0 ? '{' : ',', buf[i]);
+        debug("%c0x%02x", i == 0 ? '{' : ',', buf[i]);
     }
-    printf("};\n");
+    debug("};\n");
     char* cmd;
     char* param = "";
     char tmp[128];
@@ -76,7 +76,7 @@
         case 0x0a: cmd = "ResetTarget"; break;
         case 0x10:
             cmd = "SWJ_Pins";
-            snprintf(tmp, sizeof(tmp), "wait: %d us", buf[3]|buf[4]<<8|buf[5]<<16|buf[6]<<24);
+            //snprintf(tmp, sizeof(tmp), "wait: %d us", buf[3]|buf[4]<<8|buf[5]<<16|buf[6]<<24);
             if (buf[2] & 0x01) {
                 strcat(tmp, " SWCLK_TCK ");
                 strcat(tmp, (buf[1] & 0x01) ? "ON" : "OFF");
@@ -105,18 +105,18 @@
             break;
         case 0x11: 
             cmd = "SWJ_Clock";
-            snprintf(tmp, sizeof(tmp), "%d Hz", buf[1]|buf[2]<<8|buf[3]<<16|buf[4]<<24);
+            //snprintf(tmp, sizeof(tmp), "%d Hz", buf[1]|buf[2]<<8|buf[3]<<16|buf[4]<<24);
             param = tmp;
             break;
         case 0x12:
             cmd = "SWJ_Sequence";
             count = buf[1];
-            snprintf(tmp, sizeof(tmp), "count: %d", count);
+            //snprintf(tmp, sizeof(tmp), "count: %d", count);
             param = tmp;
             break;
         case 0x13:
             cmd = "SWD_Configure";
-            snprintf(tmp, sizeof(tmp), "turnaround: %d, data_phase: %d", (buf[1]&0x03)+1, (buf[1]&0x04) ? 1 : 0); 
+            //snprintf(tmp, sizeof(tmp), "turnaround: %d, data_phase: %d", (buf[1]&0x03)+1, (buf[1]&0x04) ? 1 : 0); 
             param = tmp;
             break;
         case 0x14:
@@ -137,11 +137,11 @@
 
 void debug_dap_response(uint8_t* buf, int len)
 {
-    printf("uint8_t res[] = ");
+    debug("uint8_t res[] = ");
     for(int i = 0; i < len; i++) {
-        printf("%c0x%02x", i == 0 ? '{' : ',', buf[i]);
+        debug("%c0x%02x", i == 0 ? '{' : ',', buf[i]);
     }
-    printf("};\n");
+    debug("};\n");
 }
 
 void debug_swd_transfer(uint8_t request, uint32_t wdata, uint32_t rdata, uint8_t ack)