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
tests/test_USBLocalFileSystem.cpp@18:5ed1759e863b, 2014-06-22 (annotated)
- Committer:
- va009039
- Date:
- Sun Jun 22 12:04:16 2014 +0000
- Revision:
- 18:5ed1759e863b
- Parent:
- 17:4e1205ce031f
add LPC11U68 interface.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 17:4e1205ce031f | 1 | // test_USBLocalFileSystem.cpp 2014/5/3 |
va009039 | 17:4e1205ce031f | 2 | #if 0 |
va009039 | 17:4e1205ce031f | 3 | #include "USBLocalFileSystem.h" |
va009039 | 17:4e1205ce031f | 4 | #include "mytest.h" |
va009039 | 17:4e1205ce031f | 5 | |
va009039 | 17:4e1205ce031f | 6 | #define USE_SD 1 |
va009039 | 17:4e1205ce031f | 7 | |
va009039 | 17:4e1205ce031f | 8 | #if defined(TARGET_LPC11U35_401) |
va009039 | 17:4e1205ce031f | 9 | Serial pc(P0_19,P0_18); // tx,rx |
va009039 | 17:4e1205ce031f | 10 | DigitalOut led_disk(P0_20); |
va009039 | 17:4e1205ce031f | 11 | DigitalOut led_flash(P0_21); |
va009039 | 17:4e1205ce031f | 12 | #else |
va009039 | 17:4e1205ce031f | 13 | #error target error |
va009039 | 17:4e1205ce031f | 14 | #endif |
va009039 | 17:4e1205ce031f | 15 | |
va009039 | 17:4e1205ce031f | 16 | void callback_disk() { |
va009039 | 17:4e1205ce031f | 17 | led_disk = !led_disk; |
va009039 | 17:4e1205ce031f | 18 | } |
va009039 | 17:4e1205ce031f | 19 | |
va009039 | 17:4e1205ce031f | 20 | USBLocalFileSystem* usb_local; |
va009039 | 17:4e1205ce031f | 21 | |
va009039 | 17:4e1205ce031f | 22 | TEST(USBLocalFileSystem,test1) { |
va009039 | 17:4e1205ce031f | 23 | #if USE_SD |
va009039 | 17:4e1205ce031f | 24 | usb_local = new USBLocalFileSystem(P1_15,P0_14,P0_23,P0_17); // mosi,miso,clk,cs |
va009039 | 17:4e1205ce031f | 25 | #else |
va009039 | 17:4e1205ce031f | 26 | usb_local = new USBLocalFileSystem(); // RamDisk(64KB) |
va009039 | 17:4e1205ce031f | 27 | #endif |
va009039 | 17:4e1205ce031f | 28 | usb_local->attachEvent(callback_disk); |
va009039 | 17:4e1205ce031f | 29 | } |
va009039 | 17:4e1205ce031f | 30 | |
va009039 | 17:4e1205ce031f | 31 | TEST(USBLocalFileSystem,test2) { |
va009039 | 17:4e1205ce031f | 32 | #if USE_SD |
va009039 | 17:4e1205ce031f | 33 | mystring filename; |
va009039 | 17:4e1205ce031f | 34 | ASSERT_TRUE(LocalStorage::find_bin(filename)); |
va009039 | 17:4e1205ce031f | 35 | TEST_PRINT("*** bin filename=[%s]\n", filename.c_str()); |
va009039 | 17:4e1205ce031f | 36 | |
va009039 | 17:4e1205ce031f | 37 | FILE* fp = fopen("/local/result.txt", "a"); |
va009039 | 17:4e1205ce031f | 38 | ASSERT_TRUE(fp); |
va009039 | 17:4e1205ce031f | 39 | fprintf(fp, "*** bin filename=[%s]\n", filename.c_str()); |
va009039 | 17:4e1205ce031f | 40 | fclose(fp); |
va009039 | 17:4e1205ce031f | 41 | #endif |
va009039 | 17:4e1205ce031f | 42 | } |
va009039 | 17:4e1205ce031f | 43 | |
va009039 | 17:4e1205ce031f | 44 | TEST(USBLocalFileSystem,test3) { |
va009039 | 17:4e1205ce031f | 45 | FILE* fp = fopen("/local/result.txt", "a"); |
va009039 | 17:4e1205ce031f | 46 | ASSERT_TRUE(fp); |
va009039 | 17:4e1205ce031f | 47 | fprintf(fp, "%s %s\n", __DATE__,__TIME__); |
va009039 | 17:4e1205ce031f | 48 | fclose(fp); |
va009039 | 17:4e1205ce031f | 49 | } |
va009039 | 17:4e1205ce031f | 50 | |
va009039 | 17:4e1205ce031f | 51 | int main() { |
va009039 | 17:4e1205ce031f | 52 | //pc.baud(921600); |
va009039 | 17:4e1205ce031f | 53 | pc.baud(9600); |
va009039 | 17:4e1205ce031f | 54 | DBG("%s", __FILE__); |
va009039 | 17:4e1205ce031f | 55 | |
va009039 | 17:4e1205ce031f | 56 | RUN_ALL_TESTS(); |
va009039 | 17:4e1205ce031f | 57 | while(1) { |
va009039 | 17:4e1205ce031f | 58 | led_flash = !led_flash; |
va009039 | 17:4e1205ce031f | 59 | wait_ms(200); |
va009039 | 17:4e1205ce031f | 60 | } |
va009039 | 17:4e1205ce031f | 61 | //exit(0); |
va009039 | 17:4e1205ce031f | 62 | } |
va009039 | 17:4e1205ce031f | 63 | #endif |