semihost server example program
Dependencies: SWD mbed USBLocalFileSystem BaseDAP USBDAP
LPCXpresso LPC11U68 | LPCXpresso LPC1549 | FRDM-KL46Z | EA LPC4088 QSB app-board | LPC1768 app-board | LPC810 | LPC1114FN28 | |
---|---|---|---|---|---|---|---|
server | server | server | server | server | client | client | |
SWDIO | D12 | D12 | D12 | p25 | p21 | p4(P0_2) | p12 |
SWCLK | D10 | D10 | D10 | p26 | p22 | p3(P0_3) | p3 |
nRESET *option | D6 | D6 | D6 | p34 | p30 | p1(P0_5) | p23 |
GND | GND | GND | GND | p1 | p1 | p7 | p22 |
3.3V | P3V3 | P3V3 | P3V3 | p44 | p40 | p6 | p21 |
flash write | SW2(P0_1) | SW3(P1_9) | SW1 | p14 joystick center | p14 joystick center |
client example:
Import programlpc810-semihost_helloworld
semihost client example program
Diff: tests/mydebug.cpp
- 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)