richlink

Files at this revision

API Documentation at this revision

Comitter:
wright0418
Date:
Wed Jun 16 11:05:30 2021 +0000
Parent:
32:9dfefb53a199
Commit message:
2 test

Changed in this revision

epy_main.cpp Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
diff -r 9dfefb53a199 -r e09fff6b149f epy_main.cpp
--- a/epy_main.cpp	Sun Jun 13 04:11:43 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/* ePy-Lite BLE usage example
- * Copyright (c) 2021 Richlink Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "mbed.h"
-#include "USBSerial.h"
-#include "epy_lite_io.h"
-
-#if MBED_MAJOR_VERSION < 6
-#error "Mbed OS version requires 6 or later."
-#endif
-
-#include "SPIFBlockDevice.h"
-
-// Disable Write Protection and Hold functions
-DigitalOut spif_wp(SPIFLASH_WP, 1);
-DigitalOut spif_hold(SPIFLASH_HOLD, 1);
-
-/*
-BlockDevice *bd = new SPIFBlockDevice(MBED_CONF_SPIF_DRIVER_SPI_MOSI,
-                                      MBED_CONF_SPIF_DRIVER_SPI_MISO,
-                                      MBED_CONF_SPIF_DRIVER_SPI_CLK,
-                                      MBED_CONF_SPIF_DRIVER_SPI_CS);
-*/
-BlockDevice *bd = new SPIFBlockDevice(SPIFLASH_MOSI,
-                                      SPIFLASH_MISO,
-                                      SPIFLASH_CLK,
-                                      SPIFLASH_CS);
-
-// This example uses LittleFileSystem as the default file system
-#include "LittleFileSystem.h"
-LittleFileSystem fs("fs");
-
-// Uncomment the following two lines and comment the previous two to use FAT file system.
-// #include "FATFileSystem.h"
-// FATFileSystem fs("fs");
-
-
-USBSerial *_console;
-
-BufferedSerial *_ble_serial;
-ATCmdParser *_parser;
-
-Ticker flipper;
-DigitalOut _led(LED_Y, 0);
-DigitalOut _ledr(LED_R, 0);
-DigitalOut _ledb(LED_B, 0);
-
-void flip_led()
-{
-    _led = !_led;
-}
-
-void ble_recv()
-{
-    unsigned char c;
-
-    while(_ble_serial->readable()) {
-        _ledb = !_ledb;
-        _ble_serial->read(&c, 1);
-        _console->write(&c, 1);
-    }
-}
-
-void console_recv()
-{
-    static bool pt_mode = false;
-    unsigned char c;
-
-    while(_console->readable()) {
-        _ledr = !_ledr;
-        _console->read(&c, 1);
-        if (pt_mode == true)
-        {
-            if (c == '\r')
-            {
-                _console->write("\r\n", 2); // echo to console
-                _ble_serial->write("\r\n", 2);
-            }
-            else if (c == 0x03) // Ctrl-C
-            {
-                pt_mode = false;
-                _console->printf("\r\nExit pass-through Mode\r\n");
-            }
-            else
-            {
-                _console->write(&c, 1);     // echo to console
-                _ble_serial->write(&c, 1);
-            }
-        }
-        else {
-            if (c == '?')
-            {
-                _console->printf("\r\n ? : print this menu");
-                _console->printf("\r\n p : enter pass-through mode. Press CTRL-C to exit the mode");
-                _console->printf("\r\n v : send AT+VERSION");
-                _console->printf("\r\n a : send AT+ADDR=?");
-                _console->printf("\r\n r : send AT+RESET");
-                _console->printf("\r\n d : send AT+MODE_DATA");
-                _console->printf("\r\n c : send !CCMD@");
-                _console->printf("\r\n");
-            }
-            else if (c == 'p')
-            {
-                pt_mode = true;
-                _console->printf("\r\nEnter pass-through mode...\r\n");
-            }
-            else if (c == 'v')
-            {
-                //_ble_serial->write("AT+VERSION\r\n", 12);
-                _ble_serial->write("AT+VERSION", 10);
-                ThisThread::sleep_for(2ms);
-                _ble_serial->write("\r\n", 2);
-            }
-            else if (c == 'a')
-            {
-                _ble_serial->write("AT+ADDR=?\r\n", 11);
-            }
-            else if (c == 'r')
-            {
-                _ble_serial->write("AT+RESET\r\n", 10);
-            }
-            else if (c == 'd')
-            {
-                _ble_serial->write("AT+MODE_DATA\r\n", 14);
-            }
-            else if (c == 'c')
-            {
-                _ble_serial->write("!CCMD@", 6);
-            }
-        }
-    }
-}
-
-int main()
-{
-    flipper.attach(&flip_led, 1s);
-
-    _console = new USBSerial(true);
-    _ble_serial = new BufferedSerial(BLE_UART_TX, BLE_UART_RX, BLE_DEFAULT_BAUD_RATE);
-    _parser = new ATCmdParser(_ble_serial, "\r\n");
-    //_parser->debug_on( 0 );
-    //_parser->set_delimiter( "\r\n" );
-
-#if 1
-    // Try SPI Flash
-
-    bd->init();
-    _console->printf("spif size: %llu\r\n",         bd->size());
-    _console->printf("spif read size: %llu\r\n",    bd->get_read_size());
-    _console->printf("spif program size: %llu\r\n", bd->get_program_size());
-    _console->printf("spif erase size: %llu\r\n",   bd->get_erase_size());    
-    _console->printf("Mounting the filesystem... ");
-    int err = fs.mount(bd);
-    _console->printf("%s\r\n", (err ? "Fail :(" : "OK"));
-    if (err) {
-        // Reformat if we can't mount the filesystem
-        // this should only happen on the first boot
-        _console->printf("No filesystem found, formatting... ");
-        err = fs.reformat(bd);
-        _console->printf("%s\r\n", (err ? "Fail :(" : "OK"));
-        if (err) {
-            //error("error: %s (%d)\r\n", strerror(-err), err);
-             _console->printf("error: %s (%d)\r\n", strerror(-err), err);
-        }
-    }
-
-#endif
-
-#if 1
-//    _console->attach(&console_recv);
-//    _ble_serial->attach(&ble_recv, Serial::RxIrq);
-    _console->printf("\r\nStart ...");
-    _console->printf("\r\nPress ? to show menu ...\r\n");
-
-    ThisThread::sleep_for(1s);
-
-    //_ble_serial->write("AT+ADDR=?\r\n", 11);
-    //ThisThread::sleep_for(1s);
-    //_ble_serial->write("AT+VERSION\r\n", 12);
-
-    while(1)
-    {
-        console_recv();
-        ble_recv();    
-    }
-#endif
-
-    _console->printf("\r\nATCmdParser on ePy-Lite example\r\n");
-    ThisThread::sleep_for(2s);
-
-#if 0
-    if (_parser->recv("READY OK"))
-    {
-        _console->printf("\r\nModule is ready!");
-    }
-#endif
-
-#if 0
-    // Assume BLE module is in DATA mode, switch to CMD mode
-    if (_parser->send("!CCMD@") && _parser->recv("OK"))
-    {
-        _console->printf("\r\nSwitch to CMD mode success.");
-    }
-    else {
-        _console->printf("\r\nSwitch to Cmd mode timeout.");
-        // Assume already in CMD mode
-    }
-#endif
-
-    //Now get the FW version number of BLE module by sending an AT command 
-    _console->printf("\r\nATCmdParser: Retrieving FW version");
-
-#if 0
-    while(true)
-    {
-        char s[256];
-        if(_parser->read(s, 256) < 0)
-            break;
-
-        _console->printf("%s\r\n", s);
-    }
-    _parser->write("AT+VERSION\r\n",12);
-#endif
-
-    _parser->write("AT+VERSION\r\n",12);
-    
-    int ver_major, ver_minor, ver_patch;
-    if(_parser->recv("VERSION %d.%d.%d OK", &ver_major, &ver_minor, &ver_patch) /* && _parser->recv("OK") */) {
-        _console->printf("\r\nATCmdParser: FW version: %d.%d.%d", ver_major, ver_minor, ver_patch);
-        _console->printf("\r\nATCmdParser: Retrieving FW version success");
-    } else { 
-        _console->printf("\r\nATCmdParser: Retrieving FW version failed");
-        return -1;
-    }
-
-    _parser->write("AT+ADDR=?\r\n",11);
-
-#if 1
-    if (_parser->recv("MAC_ADD"))
-    {
-        char mac_addr[20];
-        _parser->read(mac_addr, 14);
-        _console->printf("\r\nMAC Addr is %s\r\n", mac_addr);
-
-    }
-#else
-    long int mac_addr;
-    if(_parser->recv("MAC_ADDR %lx OK", &mac_addr) /* && _parser->recv("OK") */)
-    {
-        _console->printf("\r\nATCmdParser: MAC Address : %lx", mac_addr);
-        _console->printf("\r\nATCmdParser: Retrieving MAC Address success");
-    } else { 
-        _console->printf("\r\nATCmdParser: Retrieving FW version failed");
-        return -1;
-    }
-#endif
-
-    _console->printf("\r\nDone\r\n");
-}
diff -r 9dfefb53a199 -r e09fff6b149f main.cpp
--- a/main.cpp	Sun Jun 13 04:11:43 2021 +0000
+++ b/main.cpp	Wed Jun 16 11:05:30 2021 +0000
@@ -1,137 +1,272 @@
-#include <algorithm>
-#include "mbed.h"
-#include "mbed_stats.h"
-#include "TCPSocket.h"
+/* ePy-Lite BLE usage example
+ * Copyright (c) 2021 Richlink Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-#define MBED_HEAP_STATS_ENABLED 1
-#define USE_HTTP_1_1
-//#define LOCAL_LAN
+#include "mbed.h"
+#include "USBSerial.h"
+#include "epy_lite_io.h"
 
-namespace {
-    // Test connection information
-#ifndef LOCAL_LAN
-const char *HTTP_SERVER_NAME = "www.ifconfig.io"; 
-#else
-const char *HTTP_SERVER_NAME = "pt22_winserver2.nuvoton.com";
+#if MBED_MAJOR_VERSION < 6
+#error "Mbed OS version requires 6 or later."
 #endif
 
-#ifndef LOCAL_LAN
-const char *HTTP_SERVER_FILE_PATH = "/method";
-const int HTTP_SERVER_PORT = 80;
-#else
-const char *HTTP_SERVER_FILE_PATH = "/examples/arm_mbed/method.txt";
-const int HTTP_SERVER_PORT = 8080;
-#endif
+#include "SPIFBlockDevice.h"
+
+// Disable Write Protection and Hold functions
+DigitalOut spif_wp(SPIFLASH_WP, 1);
+DigitalOut spif_hold(SPIFLASH_HOLD, 1);
+
+/*
+BlockDevice *bd = new SPIFBlockDevice(MBED_CONF_SPIF_DRIVER_SPI_MOSI,
+                                      MBED_CONF_SPIF_DRIVER_SPI_MISO,
+                                      MBED_CONF_SPIF_DRIVER_SPI_CLK,
+                                      MBED_CONF_SPIF_DRIVER_SPI_CS);
+*/
+BlockDevice *bd = new SPIFBlockDevice(SPIFLASH_MOSI,
+                                      SPIFLASH_MISO,
+                                      SPIFLASH_CLK,
+                                      SPIFLASH_CS);
+
+// This example uses LittleFileSystem as the default file system
+#include "LittleFileSystem.h"
+LittleFileSystem fs("fs");
+
+// Uncomment the following two lines and comment the previous two to use FAT file system.
+// #include "FATFileSystem.h"
+// FATFileSystem fs("fs");
 
 
-    const int RECV_BUFFER_SIZE = 512;
+USBSerial *_console;
+
+BufferedSerial *_ble_serial;
+ATCmdParser *_parser;
 
-    // Test related data
-    const char *HTTP_OK_STR = "200 OK";
-    const char *HTTP_EXPECT_STR = "GET";
+Ticker flipper;
+DigitalOut _led(LED_Y, 0);
+DigitalOut _ledr(LED_R, 0);
+DigitalOut _ledb(LED_B, 0);
 
-    // Test buffers
-    char buffer[RECV_BUFFER_SIZE] = {0};
+void flip_led()
+{
+    _led = !_led;
 }
 
-bool find_substring(const char *first, const char *last, const char *s_first, const char *s_last) {
-    const char *f = std::search(first, last, s_first, s_last);
-    return (f != last);
+void ble_recv()
+{
+    unsigned char c;
+
+    while(_ble_serial->readable()) {
+        _ledb = !_ledb;
+        _ble_serial->read(&c, 1);
+        _console->write(&c, 1);
+    }
 }
 
-int main() {
-#if MBED_HEAP_STATS_ENABLED
-    mbed_stats_heap_t heap_stats;
-#endif
-
-#ifdef MBED_MAJOR_VERSION
-    printf("Mbed OS version %d.%d.%d\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
-#endif
+void console_recv()
+{
+    static bool pt_mode = false;
+    unsigned char c;
 
-    printf("Start WiFi test \r\n");
-     
-    bool result = true;
-    int rc = 0;
+    while(_console->readable()) {
+        _ledr = !_ledr;
+        _console->read(&c, 1);
+        if (pt_mode == true)
+        {
+            if (c == '\r')
+            {
+                _console->write("\r\n", 2); // echo to console
+                _ble_serial->write("\r\n", 2);
+            }
+            else if (c == 0x03) // Ctrl-C
+            {
+                pt_mode = false;
+                _console->printf("\r\nExit pass-through Mode\r\n");
+            }
+            else
+            {
+                _console->write(&c, 1);     // echo to console
+                _ble_serial->write(&c, 1);
+            }
+        }
+        else {
+            if (c == '?')
+            {
+                _console->printf("\r\n ? : print this menu");
+                _console->printf("\r\n p : enter pass-through mode. Press CTRL-C to exit the mode");
+                _console->printf("\r\n v : send AT+VERSION");
+                _console->printf("\r\n a : send AT+ADDR=?");
+                _console->printf("\r\n r : send AT+RESET");
+                _console->printf("\r\n d : send AT+MODE_DATA");
+                _console->printf("\r\n c : send !CCMD@");
+                _console->printf("\r\n");
+            }
+            else if (c == 'p')
+            {
+                pt_mode = true;
+                _console->printf("\r\nEnter pass-through mode...\r\n");
+            }
+            else if (c == 'v')
+            {
+                //_ble_serial->write("AT+VERSION\r\n", 12);
+                _ble_serial->write("AT+VERSION", 10);
+                ThisThread::sleep_for(2ms);
+                _ble_serial->write("\r\n", 2);
+            }
+            else if (c == 'a')
+            {
+                _ble_serial->write("AT+ADDR=?\r\n", 11);
+            }
+            else if (c == 'r')
+            {
+                _ble_serial->write("AT+RESET\r\n", 10);
+            }
+            else if (c == 'd')
+            {
+                _ble_serial->write("AT+MODE_DATA\r\n", 14);
+            }
+            else if (c == 'c')
+            {
+                _ble_serial->write("!CCMD@", 6);
+            }
+        }
+    }
+}
 
-    printf("Start Connection ... \r\n");
+int main()
+{
+    flipper.attach(&flip_led, 1s);
+
+    _console = new USBSerial(true);
+    _ble_serial = new BufferedSerial(BLE_UART_TX, BLE_UART_RX, BLE_DEFAULT_BAUD_RATE);
+    _parser = new ATCmdParser(_ble_serial, "\r\n");
+    //_parser->debug_on( 0 );
+    //_parser->set_delimiter( "\r\n" );
+
+#if 1
+    // Try SPI Flash
 
-    NetworkInterface *network_interface = NetworkInterface::get_default_instance();
-    if (NULL == network_interface) {
-        printf("NULL network interface! Exiting application....\r\n");
-        return 0;
+    bd->init();
+    _console->printf("spif size: %llu\r\n",         bd->size());
+    _console->printf("spif read size: %llu\r\n",    bd->get_read_size());
+    _console->printf("spif program size: %llu\r\n", bd->get_program_size());
+    _console->printf("spif erase size: %llu\r\n",   bd->get_erase_size());    
+    _console->printf("Mounting the filesystem... ");
+    int err = fs.mount(bd);
+    _console->printf("%s\r\n", (err ? "Fail :(" : "OK"));
+    if (err) {
+        // Reformat if we can't mount the filesystem
+        // this should only happen on the first boot
+        _console->printf("No filesystem found, formatting... ");
+        err = fs.reformat(bd);
+        _console->printf("%s\r\n", (err ? "Fail :(" : "OK"));
+        if (err) {
+            //error("error: %s (%d)\r\n", strerror(-err), err);
+             _console->printf("error: %s (%d)\r\n", strerror(-err), err);
+        }
     }
 
-    printf("\n\rUsing WiFi \r\n");
-    printf("\n\rConnecting to WiFi..\r\n");
-    rc = network_interface->connect();
-    if(rc == 0) {
-        printf("\n\rConnected to Network successfully\r\n");
-    } else {
-        printf("\n\rConnection to Network Failed %d! Exiting application....\r\n", rc);
-        return 0;
-    }    
-    
-    SocketAddress a;
-    network_interface->get_ip_address(&a);
-    printf("TCP client IP Address is %s\r\n", a.get_ip_address());
-    
-    //TCPSocket sock(network_interface);
-    TCPSocket sock;
-    sock.open(network_interface);
+#endif
+
+#if 1
+//    _console->attach(&console_recv);
+//    _ble_serial->attach(&ble_recv, Serial::RxIrq);
+    _console->printf("\r\nStart ...");
+    _console->printf("\r\nPress ? to show menu ...\r\n");
+
+    ThisThread::sleep_for(1s);
+
+    //_ble_serial->write("AT+ADDR=?\r\n", 11);
+    //ThisThread::sleep_for(1s);
+    //_ble_serial->write("AT+VERSION\r\n", 12);
 
-    printf(" HTTP Connection ... \r\n");
-    network_interface->gethostbyname(HTTP_SERVER_NAME, &a);
-    a.set_port(HTTP_SERVER_PORT);
-    if (sock.connect(a) == 0) {    
-        printf("HTTP: Connected to %s:%d\r\n", HTTP_SERVER_NAME, HTTP_SERVER_PORT);
+    while(1)
+    {
+        console_recv();
+        ble_recv();    
+    }
+#endif
+
+    _console->printf("\r\nATCmdParser on ePy-Lite example\r\n");
+    ThisThread::sleep_for(2s);
+
+#if 0
+    if (_parser->recv("READY OK"))
+    {
+        _console->printf("\r\nModule is ready!");
+    }
+#endif
 
-        // We are constructing GET command like this:
-#ifndef USE_HTTP_1_1
-        // GET http://www.ifconfig.io/method HTTP/1.0\n\n
-        strcpy(buffer, "GET http://");
-        strcat(buffer, HTTP_SERVER_NAME);
-        strcat(buffer, HTTP_SERVER_FILE_PATH);
-        strcat(buffer, " HTTP/1.0\n\n");       
-#else
-       // GET /method HTTP/1.1\r\nHost: ifconfig.io\r\nConnection: close\r\n\r\n"
-        strcpy(buffer, "GET ");
-        strcat(buffer, HTTP_SERVER_FILE_PATH);   
-        strcat(buffer, " HTTP/1.1\r\nHost: ");
-        strcat(buffer, HTTP_SERVER_NAME);
-        strcat(buffer, "\r\nConnection: close\r\n\r\n");
+#if 0
+    // Assume BLE module is in DATA mode, switch to CMD mode
+    if (_parser->send("!CCMD@") && _parser->recv("OK"))
+    {
+        _console->printf("\r\nSwitch to CMD mode success.");
+    }
+    else {
+        _console->printf("\r\nSwitch to Cmd mode timeout.");
+        // Assume already in CMD mode
+    }
 #endif
-        
-        // Send GET command
-        sock.send(buffer, strlen(buffer));
+
+    //Now get the FW version number of BLE module by sending an AT command 
+    _console->printf("\r\nATCmdParser: Retrieving FW version");
+
+#if 0
+    while(true)
+    {
+        char s[256];
+        if(_parser->read(s, 256) < 0)
+            break;
 
-        // Server will respond with HTTP GET's success code
-        const int ret = sock.recv(buffer, sizeof(buffer) - 1);
-        buffer[ret] = '\0';
-        
-        // Find 200 OK HTTP status in reply
-        bool found_200_ok = find_substring(buffer, buffer + ret, HTTP_OK_STR, HTTP_OK_STR + strlen(HTTP_OK_STR));
-        // Find "deny" string in reply
-        bool found_expect = find_substring(buffer, buffer + ret, HTTP_EXPECT_STR, HTTP_EXPECT_STR + strlen(HTTP_EXPECT_STR));
+        _console->printf("%s\r\n", s);
+    }
+    _parser->write("AT+VERSION\r\n",12);
+#endif
 
-        if (!found_200_ok) result = false;
-        if (!found_expect) result = false;
-
-        printf("HTTP: Received %d chars from server\r\n", ret);
-        printf("HTTP: Received 200 OK status ... %s\r\n", found_200_ok ? "[OK]" : "[FAIL]");
-        printf("HTTP: Received '%s' status ... %s\r\n", HTTP_EXPECT_STR, found_expect ? "[OK]" : "[FAIL]");
-        printf("HTTP: Received massage:\r\n\r\n");
-        printf("%s", buffer);
+    _parser->write("AT+VERSION\r\n",12);
+    
+    int ver_major, ver_minor, ver_patch;
+    if(_parser->recv("VERSION %d.%d.%d OK", &ver_major, &ver_minor, &ver_patch) /* && _parser->recv("OK") */) {
+        _console->printf("\r\nATCmdParser: FW version: %d.%d.%d", ver_major, ver_minor, ver_patch);
+        _console->printf("\r\nATCmdParser: Retrieving FW version success");
+    } else { 
+        _console->printf("\r\nATCmdParser: Retrieving FW version failed");
+        return -1;
     }
 
-#if MBED_HEAP_STATS_ENABLED
-    mbed_stats_heap_get(&heap_stats);
-    printf("Current heap: %lu\r\n", heap_stats.current_size);
-    printf("Max heap size: %lu\r\n", heap_stats.max_size);
+    _parser->write("AT+ADDR=?\r\n",11);
+
+#if 1
+    if (_parser->recv("MAC_ADD"))
+    {
+        char mac_addr[20];
+        _parser->read(mac_addr, 14);
+        _console->printf("\r\nMAC Addr is %s\r\n", mac_addr);
+
+    }
+#else
+    long int mac_addr;
+    if(_parser->recv("MAC_ADDR %lx OK", &mac_addr) /* && _parser->recv("OK") */)
+    {
+        _console->printf("\r\nATCmdParser: MAC Address : %lx", mac_addr);
+        _console->printf("\r\nATCmdParser: Retrieving MAC Address success");
+    } else { 
+        _console->printf("\r\nATCmdParser: Retrieving FW version failed");
+        return -1;
+    }
 #endif
- 
-    printf(" Close socket & disconnect ... \r\n");
-    sock.close();
 
-    network_interface->disconnect();
-    printf(" End \r\n");
+    _console->printf("\r\nDone\r\n");
 }
diff -r 9dfefb53a199 -r e09fff6b149f mbed_app.json
--- a/mbed_app.json	Sun Jun 13 04:11:43 2021 +0000
+++ b/mbed_app.json	Wed Jun 16 11:05:30 2021 +0000
@@ -3,83 +3,22 @@
         "*": {
             "platform.stdio-baud-rate"              : 115200,
             "platform.stdio-convert-newlines"       : true,
-            "platform.heap-stats-enabled"           : 1,
-            "nsapi.default-wifi-security"           : "WPA_WPA2",
-            "nsapi.default-wifi-ssid"               : "\"SSID\"",
-            "nsapi.default-wifi-password"           : "\"Password\""
-        },
-        "NUMAKER_PFM_NANO130": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "D1",
-            "esp8266.rx"                            : "D0",
-            "esp8266.rts"                           : "PB_6",
-            "esp8266.cts"                           : "PB_7",
-            "esp8266.rst"                           : "D2",
-            "esp8266.provide-default"               : true
+            "platform.heap-stats-enabled"           : 1
         },
-        "NUMAKER_PFM_NUC472": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "PD_15",
-            "esp8266.rx"                            : "PF_0",
-            "esp8266.rts"                           : "PD_14",
-            "esp8266.cts"                           : "PD_13",
-            "esp8266.rst"                           : "D2",
-            "esp8266.provide-default"               : true
-        },
-        "NUMAKER_PFM_M453": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "A3",
-            "esp8266.rx"                            : "A2",
-            "esp8266.rts"                           : "A5",
-            "esp8266.cts"                           : "A4",
-            "esp8266.rst"                           : "D2",
-            "esp8266.provide-default"               : true
+        "NUMAKER_IOT_M487": {
+            "target.components_add"             : ["SPIF"],
+            "spif-driver.SPI_MOSI"              : "PC_0",
+            "spif-driver.SPI_MISO"              : "PC_1",
+            "spif-driver.SPI_CLK"               : "PC_2",
+            "spif-driver.SPI_CS"                : "PC_3"
         },
         "NUMAKER_PFM_M487": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "D1",
-            "esp8266.rx"                            : "D0",
-            "esp8266.rts"                           : "A2",
-            "esp8266.cts"                           : "A3",
-            "esp8266.rst"                           : "D2",
-            "esp8266.provide-default"               : true
-        },
-        "NUMAKER_IOT_M487": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "PH_8",
-            "esp8266.rx"                            : "PH_9",
-            "esp8266.rts"                           : "A2",
-            "esp8266.cts"                           : "A3",
-            "esp8266.rst"                           : "PH_3",
-            "esp8266.provide-default"               : true
-        },
-        "NU_PFM_M2351_NPSA_NS": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "PD_1",
-            "esp8266.rx"                            : "PD_0",
-            "esp8266.rts"                           : "PD_3",
-            "esp8266.cts"                           : "PD_2",
-            "esp8266.rst"                           : "NC",
-            "esp8266.pwr"                           : "PD_7",
-            "esp8266.provide-default"               : true
-        },
-        "NU_M2354_NPSA_NS": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "PC_7",
-            "esp8266.rx"                            : "PC_6",
-            "esp8266.rts"                           : "PE_13",
-            "esp8266.cts"                           : "PC_8",
-            "esp8266.rst"                           : "PC_13",
-            "esp8266.provide-default"               : true
-        },
-        "NUMAKER_IOT_M263A": {
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                            : "PC_7",
-            "esp8266.rx"                            : "PC_6",
-            "esp8266.rts"                           : "PE_13",
-            "esp8266.cts"                           : "PC_8",
-            "esp8266.rst"                           : "PE_12",
-            "esp8266.provide-default"               : true
+            "target.components_add"             : ["SPIF"],
+            "spif-driver.SPI_MOSI"              : "PC_0",
+            "spif-driver.SPI_MISO"              : "PC_1",
+            "spif-driver.SPI_CLK"               : "PC_2",
+            "spif-driver.SPI_CS"                : "PC_3"
         }
+
     }
 }