Generic Pelion Device Management example for various Nuvoton-based boards.

DEPRECATED

This example application is not maintained and not recommended. It uses an old version of Mbed OS, Pelion DM, and Arm toolchain. It doesn't work with Mbed Studio.

Please use: https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-pelion/

This example is known to work great on the following platforms:

Follow the Quick-Start instructions: https://cloud.mbed.com/quick-start

https://os.mbed.com/media/cache/platforms/NuMaker-IoT-M487_board_front_small.jpg.250x250_q85.jpghttps://os.mbed.com/media/cache/platforms/NuMaker-PFM-M487.png.170x170_q85.png https://os.mbed.com/media/cache/platforms/NuMaker-PFM-NUC472Small.png.170x170_q85.png

Example functionality

This example showcases the following device functionality:

  • On timer button increment, simulate Pelion LWM2M button resource change

Use this example with Mbed CLI


1. Import the application into your desktop:

mbed import https://os.mbed.com/teams/Nuvoton/code/pelion-example-common
cd pelion-example-common


2. Install the CLOUD_SDK_API_KEY

mbed config -G CLOUD_SDK_API_KEY <PELION_DM_API_KEY>

For instructions on how to generate your API key, please see the documentation.

3. Initialize firmware credentials (done once per repository). You can use the following command:

mbed dm init -d "<your company name in Pelion DM>" --model-name "<product model identifier>" -q --force

If above command do not work for your Mbed CLI, please consider upgrading Mbed CLI to version 1.8.x or above.

4. Compile and program:

mbed compile -t <toolchain> -m <TARGET_BOARD>

(supported toolchains : GCC_ARM / ARM / IAR)

5. Copy the binary file pelion-example-common.bin to your mbed device.

Note

This platform and application is suitable for evaluation and initial development. For production purposes, we recommend to use a different variant with built-in security features

Files at this revision

API Documentation at this revision

Comitter:
cyliang
Date:
Tue Apr 16 10:53:01 2019 +0800
Parent:
1:4ab753b55a48
Commit message:
SMCC 2.2.1.2 migration for 3 NuMaker platforms

Changed in this revision

bootloader/bootloader_app.json Show annotated file Show diff for this revision Revisions of this file
bootloader/mbed-bootloader-NUMAKER_IOT_M487.bin Show annotated file Show diff for this revision Revisions of this file
bootloader/mbed-bootloader-NUMAKER_PFM_M487.bin Show annotated file Show diff for this revision Revisions of this file
bootloader/mbed-bootloader-NUMAKER_PFM_NUC472.bin Show annotated file Show diff for this revision Revisions of this file
drivers/storage/COMPONENT_NUSD.lib Show annotated file Show diff for this revision Revisions of this file
drivers/storage/MySystemStorage.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib 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
simple-mbed-cloud-client.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 4ab753b55a48 -r f07ccb7164d3 bootloader/bootloader_app.json
--- a/bootloader/bootloader_app.json	Tue Dec 18 00:18:07 2018 +0800
+++ b/bootloader/bootloader_app.json	Tue Apr 16 10:53:01 2019 +0800
@@ -12,7 +12,7 @@
         "ARM_UC_FEATURE_CRYPTO_PAL=0",
         "ARM_UC_FEATURE_CRYPTO_MBEDTLS=1",
         "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE",
-        "DEFAULT_MAX_APPLICATION_SIZE=(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - MBED_CONF_APP_APPLICATION_START_ADDRESS)",
+        "DEFAULT_MAX_APPLICATION_SIZE=(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - MBED_CONF_APP_APPLICATION_START_ADDRESS - NVSTORE_AREA_1_SIZE - NVSTORE_AREA_2_SIZE)",
         "DISABLE_ERROR_DESCRIPTION=1",
         "Mutex=PlatformMutex"
     ],
@@ -42,6 +42,8 @@
         "*": {
             "target.features_remove"           : ["LWIP"],
             "target.features_add"              : ["COMMON_PAL"],
+            "target.extra_labels_remove"       : ["PSA"],
+            "target.components_remove"         : ["FLASHIAP"],
             "platform.stdio-baud-rate"         : 115200,
             "platform.stdio-flush-at-exit"     : false,
             "update-client.storage-address"    : "(1024*1024*64)",
@@ -58,6 +60,10 @@
             "nvstore.area_1_size"              : "(4*1024)",
             "nvstore.area_2_address"           : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
             "nvstore.area_2_size"              : "(4*1024)",
+            "update-client.storage-address"    : "(64*1024*1024)",
+            "update-client.storage-size"       : "(2*1024*1024)",
+            "update-client.storage-locations"  : 1,
+            "update-client.firmware-header-version": "2",
             "update-client.application-details": "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
             "application-start-address"        : "(MBED_CONF_APP_FLASH_START_ADDRESS + 65*1024)",
             "max-application-size"             : "DEFAULT_MAX_APPLICATION_SIZE"
@@ -71,6 +77,10 @@
             "nvstore.area_1_size"              : "(4*1024)",
             "nvstore.area_2_address"           : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
             "nvstore.area_2_size"              : "(4*1024)",
+            "update-client.storage-address"    : "(64*1024*1024)",
+            "update-client.storage-size"       : "(2*1024*1024)",
+            "update-client.storage-locations"  : 1,
+            "update-client.firmware-header-version": "2",
             "update-client.application-details": "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
             "application-start-address"        : "(MBED_CONF_APP_FLASH_START_ADDRESS + 65*1024)",
             "max-application-size"             : "DEFAULT_MAX_APPLICATION_SIZE"
@@ -84,6 +94,10 @@
             "nvstore.area_1_size"              : "(4*1024)",
             "nvstore.area_2_address"           : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
             "nvstore.area_2_size"              : "(4*1024)",
+            "update-client.storage-address"    : "(64*1024*1024)",
+            "update-client.storage-size"       : "(2*1024*1024)",
+            "update-client.storage-locations"  : 1,
+            "update-client.firmware-header-version": "2",
             "update-client.application-details": "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
             "application-start-address"        : "(MBED_CONF_APP_FLASH_START_ADDRESS + 65*1024)",
             "max-application-size"             : "DEFAULT_MAX_APPLICATION_SIZE"
diff -r 4ab753b55a48 -r f07ccb7164d3 bootloader/mbed-bootloader-NUMAKER_IOT_M487.bin
Binary file bootloader/mbed-bootloader-NUMAKER_IOT_M487.bin has changed
diff -r 4ab753b55a48 -r f07ccb7164d3 bootloader/mbed-bootloader-NUMAKER_PFM_M487.bin
Binary file bootloader/mbed-bootloader-NUMAKER_PFM_M487.bin has changed
diff -r 4ab753b55a48 -r f07ccb7164d3 bootloader/mbed-bootloader-NUMAKER_PFM_NUC472.bin
Binary file bootloader/mbed-bootloader-NUMAKER_PFM_NUC472.bin has changed
diff -r 4ab753b55a48 -r f07ccb7164d3 drivers/storage/COMPONENT_NUSD.lib
--- a/drivers/storage/COMPONENT_NUSD.lib	Tue Dec 18 00:18:07 2018 +0800
+++ b/drivers/storage/COMPONENT_NUSD.lib	Tue Apr 16 10:53:01 2019 +0800
@@ -1,1 +1,1 @@
-https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#9557d57c58fb42f70908ee794498e94f39ef2721
+https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#620965ef5b323ed1c80c3ada9241daf49e487a41
diff -r 4ab753b55a48 -r f07ccb7164d3 drivers/storage/MySystemStorage.cpp
--- a/drivers/storage/MySystemStorage.cpp	Tue Dec 18 00:18:07 2018 +0800
+++ b/drivers/storage/MySystemStorage.cpp	Tue Apr 16 10:53:01 2019 +0800
@@ -152,14 +152,14 @@
 
 FileSystem *FileSystem::get_default_instance()
 {
-#if COMPONENT_SPIF || COMPONENT_QSPIF || COMPONENT_DATAFLASH || COMPONENT_NUSD
+#if COMPONENT_SPIF || COMPONENT_QSPIF || COMPONENT_DATAFLASH
 
     static LittleFileSystem flash("flash", BlockDevice::get_default_instance());
     flash.set_as_default();
 
     return &flash;
 
-#elif COMPONENT_SD
+#elif COMPONENT_SD || COMPONENT_NUSD
 
     static FATFileSystem sdcard("sd", BlockDevice::get_default_instance());
     sdcard.set_as_default();
diff -r 4ab753b55a48 -r f07ccb7164d3 main.cpp
--- a/main.cpp	Tue Dec 18 00:18:07 2018 +0800
+++ b/main.cpp	Tue Apr 16 10:53:01 2019 +0800
@@ -20,69 +20,71 @@
 #include "mbed.h"
 #include "simple-mbed-cloud-client.h"
 #include "FATFileSystem.h"
-
-//Test SAM
+#include "LittleFileSystem.h"
+
+// Default network interface object. Don't forget to change the WiFi SSID/password in mbed_app.json if you're using WiFi.
+NetworkInterface *net = NetworkInterface::get_default_instance();
+
+// Default block device available on the target board
+BlockDevice *bd = BlockDevice::get_default_instance();
+
+#if COMPONENT_SD || COMPONENT_NUSD
+// Use FATFileSystem for SD card type blockdevices
+FATFileSystem fs("fs");
+#else
+// Use LittleFileSystem for non-SD block devices to enable wear leveling and other functions
+LittleFileSystem fs("fs");
+#endif
+
+#if USE_BUTTON == 1
+InterruptIn button(SW2); //(BUTTON1);
+#endif /* USE_BUTTON */
+
+// Default LED to use for PUT/POST example
+DigitalOut led(LED1, 0);
+
+// Declaring pointers for access to Pelion Device Management Client resources outside of main()
+MbedCloudClientResource *button_res;
+MbedCloudClientResource *led_res;
+MbedCloudClientResource *post_res;
+
 // An event queue is a very useful structure to debounce information between contexts (e.g. ISR and normal threads)
 // This is great because things such as network operations are illegal in ISR, so updating a resource in a button's fall() function is not allowed
 EventQueue eventQueue;
 
-// Default block device
-BlockDevice *bd = BlockDevice::get_default_instance();
-FATFileSystem fs("fs");
-
-// Default network interface object
-NetworkInterface *net = NetworkInterface::get_default_instance();
-
-// Declaring pointers for access to Pelion Device Management Client resources outside of main()
-MbedCloudClientResource *button_res;
-MbedCloudClientResource *pattern_res;
-
-// This function gets triggered by the timer. It's easy to replace it by an InterruptIn and fall() mode on a real button
-void fake_button_press() {
-    int v = button_res->get_value_int() + 1;
-
-    button_res->set_value(v);
-
-    printf("Simulated button clicked %d times\n", v);
+/**
+ * PUT handler - sets the value of the built-in LED
+ * @param resource The resource that triggered the callback
+ * @param newValue Updated value for the resource
+ */
+void put_callback(MbedCloudClientResource *resource, m2m::String newValue) {
+    printf("PUT received. New value: %s\n", newValue.c_str());
+    led = atoi(newValue.c_str());
 }
 
 /**
- * PUT handler
- * @param resource The resource that triggered the callback
- * @param newValue Updated value for the resource
- */
-void pattern_updated(MbedCloudClientResource *resource, m2m::String newValue) {
-    printf("PUT received, new value: %s\n", newValue.c_str());
-}
-
-/**
- * POST handler
+ * POST handler - prints the content of the payload
  * @param resource The resource that triggered the callback
  * @param buffer If a body was passed to the POST function, this contains the data.
  *               Note that the buffer is deallocated after leaving this function, so copy it if you need it longer.
  * @param size Size of the body
  */
-void blink_callback(MbedCloudClientResource *resource, const uint8_t *buffer, uint16_t size) {
-    printf("POST received. Going to blink LED pattern: %s\n", pattern_res->get_value().c_str());
-
-    static DigitalOut augmentedLed(LED1); // LED that is used for blinking the pattern
+void post_callback(MbedCloudClientResource *resource, const uint8_t *buffer, uint16_t size) {
+    printf("POST received (length %u). Payload: ", size);
+    for (size_t ix = 0; ix < size; ix++) {
+        printf("%02x ", buffer[ix]);
+    }
+    printf("\n");
+}
 
-    // Parse the pattern string, and toggle the LED in that pattern
-    string s = std::string(pattern_res->get_value().c_str());
-    size_t i = 0;
-    size_t pos = s.find(':');
-    while (pos != string::npos) {
-        wait_ms(atoi(s.substr(i, pos - i).c_str()));
-        augmentedLed = !augmentedLed;
-
-        i = ++pos;
-        pos = s.find(':', pos);
-
-        if (pos == string::npos) {
-            wait_ms(atoi(s.substr(i, s.length()).c_str()));
-            augmentedLed = !augmentedLed;
-        }
-    }
+/**
+ * Button handler
+ * This function will be triggered either by a physical button press or by a ticker every 5 seconds (see below)
+ */
+void button_press() {
+    int v = button_res->get_value_int() + 1;
+    button_res->set_value(v);
+    printf("Button clicked %d times\n", v);
 }
 
 /**
@@ -99,23 +101,50 @@
  * @param endpoint Information about the registered endpoint such as the name (so you can find it back in portal)
  */
 void registered(const ConnectorClientEndpointInfo *endpoint) {
-    printf("Connected to Pelion Device Management. Endpoint Name: %s\n", endpoint->internal_endpoint_name.c_str());
+    printf("Registered to Pelion Device Management. Endpoint Name: %s\n", endpoint->internal_endpoint_name.c_str());
 }
 
 int main(void) {
-    printf("Starting Simple Pelion Device Management Client example\n");
-    printf("Connecting to the network...\n");
+    printf("\nStarting Simple Pelion Device Management Client example\n");
+
+    int storage_status = fs.mount(bd);
+    if (storage_status != 0) {
+        printf("Storage mounting failed.\n");
+    }
+
+#if USE_BUTTON == 1
+    // If the User button is pressed ons start, then format storage.
+    bool btn_pressed = (button.read() == MBED_CONF_APP_BUTTON_PRESSED_STATE);
+    if (btn_pressed) {
+        printf("User button is pushed on start...\n");
+    }
+#else
+    bool btn_pressed = FALSE;
+#endif /* USE_BUTTON */
 
-    // Connect to the internet (DHCP is expected to be on)
-    nsapi_error_t status = net->connect();
+    if (storage_status || btn_pressed) {
+        printf("Formatting the storage...\n");
+        int storage_status = StorageHelper::format(&fs, bd);
+        if (storage_status != 0) {
+            printf("ERROR: Failed to reformat the storage (%d).\n", storage_status);
+        }
+    } else {
+        printf("You can hold the user button during boot to format the storage and change the device identity.\n");
+    }
 
-    if (status != NSAPI_ERROR_OK) {
-        printf("Connecting to the network failed %d!\n", status);
-        return -1;
+    // Connect to the Internet (DHCP is expected to be on)
+    printf("Connecting to the network using the default network interface...\n");
+    net = NetworkInterface::get_default_instance();
+
+    nsapi_error_t net_status = NSAPI_ERROR_NO_CONNECTION;
+    while ((net_status = net->connect()) != NSAPI_ERROR_OK) {
+        printf("Unable to connect to network (%d). Retrying...\n", net_status);
     }
 
     printf("Connected to the network successfully. IP address: %s\n", net->get_ip_address());
 
+    printf("Initializing Pelion Device Management Client...\n");
+
     // SimpleMbedCloudClient handles registering over LwM2M to Pelion Device Management
     SimpleMbedCloudClient client(net, bd, &fs);
     int client_status = client.init();
@@ -131,29 +160,36 @@
     button_res->observable(true);
     button_res->attach_notification_callback(button_callback);
 
-    pattern_res = client.create_resource("3201/0/5853", "blink_pattern");
-    pattern_res->set_value("500:500:500:500:500:500:500:500");
-    pattern_res->methods(M2MMethod::GET | M2MMethod::PUT);
-    pattern_res->attach_put_callback(pattern_updated);
+    led_res = client.create_resource("3201/0/5853", "led_state");
+    led_res->set_value(led.read());
+    led_res->methods(M2MMethod::GET | M2MMethod::PUT);
+    led_res->attach_put_callback(put_callback);
 
-    MbedCloudClientResource *blink_res = client.create_resource("3201/0/5850", "blink_action");
-    blink_res->methods(M2MMethod::POST);
-    blink_res->attach_post_callback(blink_callback);
+    post_res = client.create_resource("3300/0/5605", "execute_function");
+    post_res->methods(M2MMethod::POST);
+    post_res->attach_post_callback(post_callback);
 
-    printf("Initialized Pelion Client. Registering...\n");
+    printf("Initialized Pelion Device Management Client. Registering...\n");
 
     // Callback that fires when registering is complete
     client.on_registered(&registered);
 
-    // Register with Pelion Device Management
+    // Register with Pelion DM
     client.register_and_connect();
 
-    // Placeholder for callback to update local resource when GET comes.
+#if USE_BUTTON == 1
+    // The button fires on an interrupt context, but debounces it to the eventqueue, so it's safe to do network operations
+    button.fall(eventQueue.event(&button_press));
+    printf("Press the user button to increment the LwM2M resource value...\n");
+#else
     // The timer fires on an interrupt context, but debounces it to the eventqueue, so it's safe to do network operations
     Ticker timer;
-    timer.attach(eventQueue.event(&fake_button_press), 5.0);
+    timer.attach(eventQueue.event(&button_press), 5.0);
+    printf("Simulating button press every 5 seconds...\n");
+#endif /* USE_BUTTON */
 
     // You can easily run the eventQueue in a separate thread if required
     eventQueue.dispatch_forever();
 }
-#endif
\ No newline at end of file
+
+#endif /* MBED_TEST_MODE */
diff -r 4ab753b55a48 -r f07ccb7164d3 mbed-os.lib
--- a/mbed-os.lib	Tue Dec 18 00:18:07 2018 +0800
+++ b/mbed-os.lib	Tue Apr 16 10:53:01 2019 +0800
@@ -1,2 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#2fd0c5cfbd83fce62da6308f9d64c0ab64e1f0d6
-
+https://github.com/ARMmbed/mbed-os/#51d55508e8400b60af467005646c4e2164738d48
diff -r 4ab753b55a48 -r f07ccb7164d3 mbed_app.json
--- a/mbed_app.json	Tue Dec 18 00:18:07 2018 +0800
+++ b/mbed_app.json	Tue Apr 16 10:53:01 2019 +0800
@@ -1,127 +1,104 @@
 {
-    "macros": [
-        "ARM_UC_USE_PAL_BLOCKDEVICE=1",
-        "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE",
-        "MBED_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
-        "MBED_CLOUD_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
-        "PAL_USER_DEFINED_CONFIGURATION=\"sotp_fs_config_MbedOS.h\"",
-        "PAL_FS_MOUNT_POINT_PRIMARY=\"/fs\"",
-        "MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\"",
-        "PAL_DTLS_PEER_MIN_TIMEOUT=5000"
-    ],
     "target_overrides": {
         "*": {
-            "platform.stdio-baud-rate"          : 115200,
-            "platform.stdio-convert-newlines"   : true,
-            "update-client.storage-address"     : "(1024*1024*64)",
-            "update-client.storage-size"        : "(1024*1024*2)",
-            "update-client.storage-locations"   : "1",
-            "mbed-trace.enable"                 : null,
-            "nsapi.default-wifi-security"       : "WPA_WPA2",
-            "nsapi.default-wifi-ssid"           : "\"\"",
-            "nsapi.default-wifi-password"       : "\"\""
+            "target.components_remove"                  : ["FLASHIAP"],
+            "platform.stdio-baud-rate"                  : 115200,
+            "platform.stdio-convert-newlines"           : true,
+            "mbed-trace.enable"                         : null,
+            "nsapi.default-wifi-security"               : "WPA_WPA2",
+            "nsapi.default-wifi-ssid"                   : "\"SSID\"",
+            "nsapi.default-wifi-password"               : "\"Password\""
         },
         "NUMAKER_PFM_NUC472": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["NUSD"],
-            "target.network-default-interface-type" : "ETHERNET",
-            "drivers.uart-serial-rxbuf-size"    : 1024,
-            "drivers.uart-serial-txbuf-size"    : 1024,
-            "flash-start-address"               : "0x0",
-            "flash-size"                        : "(512*1024)",
-            "sotp-section-1-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
-            "sotp-section-1-size"               : "(4*1024)",
-            "sotp-section-2-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
-            "sotp-section-2-size"               : "(4*1024)",
-            "sotp-num-sections"                 : 2,
-            "target.bootloader_img"             : "bootloader/mbed-bootloader-NUMAKER_PFM_NUC472.bin",
-            "target.header_offset"              : "0x10000",
-            "target.app_offset"                 : "0x10400",
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
+            "target.components_add"                     : ["NUSD"],
+            "target.network-default-interface-type"     : "ETHERNET",
+            "drivers.uart-serial-rxbuf-size"            : 1024,
+            "drivers.uart-serial-txbuf-size"            : 1024,
+            "device-management.flash-start-address"     : "0x0",
+            "device-management.flash-size"              : "(512*1024)",
+            "device-management.sotp-section-1-address"  : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
+            "device-management.sotp-section-1-size"     : "(4*1024)",
+            "device-management.sotp-section-2-address"  : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
+            "device-management.sotp-section-2-size"     : "(4*1024)",
+            "update-client.application-details"         : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
+            "update-client.storage-address"             : "(64*1024*1024)",
+            "update-client.storage-size"                : "(2*1024*1024)",
+            "update-client.storage-locations"           : "1",
+            "target.features_add"                       : ["BOOTLOADER"],
+            "target.bootloader_img"                     : "bootloader/mbed-bootloader-NUMAKER_PFM_NUC472.bin",
+            "target.header_offset"                      : "0x10000",
+            "target.app_offset"                         : "0x10400",
+            "button-pressed-state"                      : 0
         },
         "NUMAKER_PFM_M487": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.network-default-interface-type" : "ETHERNET",
-            "target.components_add"             : ["NUSD"],
-            "drivers.uart-serial-rxbuf-size"    : 1024,
-            "drivers.uart-serial-txbuf-size"    : 1024,
-            "flash-start-address"               : "0x0",
-            "flash-size"                        : "(512*1024)",
-            "sotp-section-1-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
-            "sotp-section-1-size"               : "(4*1024)",
-            "sotp-section-2-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
-            "sotp-section-2-size"               : "(4*1024)",
-            "sotp-num-sections"                 : 2,
-            "target.bootloader_img"             : "bootloader/mbed-bootloader-NUMAKER_PFM_M487.bin",
-            "target.header_offset"              : "0x10000",
-            "target.app_offset"                 : "0x10400",
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
+            "target.components_add"                     : ["NUSD"],
+            "target.network-default-interface-type"     : "ETHERNET",
+            "drivers.uart-serial-rxbuf-size"            : 1024,
+            "drivers.uart-serial-txbuf-size"            : 1024,
+            "device-management.flash-start-address"     : "0x0",
+            "device-management.flash-size"              : "(512*1024)",
+            "device-management.sotp-section-1-address"  : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
+            "device-management.sotp-section-1-size"     : "(4*1024)",
+            "device-management.sotp-section-2-address"  : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
+            "device-management.sotp-section-2-size"     : "(4*1024)",
+            "update-client.application-details"         : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
+            "update-client.storage-address"             : "(64*1024*1024)",
+            "update-client.storage-size"                : "(2*1024*1024)",
+            "update-client.storage-locations"           : "1",
+            "target.features_add"                       : ["BOOTLOADER"],
+            "target.bootloader_img"                     : "bootloader/mbed-bootloader-NUMAKER_PFM_M487.bin",
+            "target.header_offset"                      : "0x10000",
+            "target.app_offset"                         : "0x10400",
+            "button-pressed-state"                      : 0
         },
         "NUMAKER_IOT_M487": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["NUSD"],
-            "target.network-default-interface-type" : "WIFI",
-            "esp8266.tx"                        : "PH_8",
-            "esp8266.rx"                        : "PH_9",
-            "esp8266.provide-default"           : true,
-            "drivers.uart-serial-rxbuf-size"    : 1024,
-            "drivers.uart-serial-txbuf-size"    : 1024,
-            "flash-start-address"               : "0x0",
-            "flash-size"                        : "(512*1024)",
-            "sotp-section-1-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
-            "sotp-section-1-size"               : "(4*1024)",
-            "sotp-section-2-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
-            "sotp-section-2-size"               : "(4*1024)",
-            "sotp-num-sections"                 : 2,
-            "target.bootloader_img"             : "bootloader/mbed-bootloader-NUMAKER_IOT_M487.bin",
-            "target.header_offset"              : "0x10000",
-            "target.app_offset"                 : "0x10400",
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
+            "target.components_add"                     : ["NUSD"],
+            "target.network-default-interface-type"     : "WIFI",
+            "esp8266.tx"                                : "PH_8",
+            "esp8266.rx"                                : "PH_9",
+            "esp8266.provide-default"                   : true,
+            "drivers.uart-serial-rxbuf-size"            : 1024,
+            "drivers.uart-serial-txbuf-size"            : 1024,
+            "device-management.flash-start-address"     : "0x0",
+            "device-management.flash-size"              : "(512*1024)",
+            "device-management.sotp-section-1-address"  : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
+            "device-management.sotp-section-1-size"     : "(4*1024)",
+            "device-management.sotp-section-2-address"  : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
+            "device-management.sotp-section-2-size"     : "(4*1024)",
+            "update-client.application-details"         : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
+            "update-client.storage-address"             : "(64*1024*1024)",
+            "update-client.storage-size"                : "(2*1024*1024)",
+            "update-client.storage-locations"           : "1",
+            "target.features_add"                       : ["BOOTLOADER"],
+            "target.bootloader_img"                     : "bootloader/mbed-bootloader-NUMAKER_IOT_M487.bin",
+            "target.header_offset"                      : "0x10000",
+            "target.app_offset"                         : "0x10400",
+            "button-pressed-state"                      : 0
         }
-    },
+   },
     "config": {
         "format-storage-layer-on-error": {
             "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!",
             "value": 1
         },
-        "developer-mode": {
-            "help": "Enable Developer mode to skip Factory enrollment",
-            "value": 1
-        },
         "main-stack-size": {
             "value": 6000
         },
-        "flash-start-address": {
-            "help": "Start address of internal flash. Only used in this config to help the definition of other macros.",
-            "value": null
+        "use-button": {
+            "help": "Whether the target has a button",
+            "macro_name": "USE_BUTTON",
+            "value": true 
         },
-        "flash-size": {
-            "help": "Total size of internal flash. Only used in this config to help the definition of other macros.",
-            "value": null
+        "button-pressed-state": {
+            "help": "Value of the button when pressed",
+            "value": 1
         },
-        "sotp-section-1-address": {
-            "help": "Flash sector address for SOTP sector 1",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_ADDRESS",
+        "no_led": {
+            "help": "This flag disables the heartbeat thread in tests. This is useful for platforms that don't have an LED or the LED is used for other functionality like LED on the SPI clockline etc",
             "value": null
         },
-        "sotp-section-1-size": {
-            "help": "Flash sector size for SOTP sector 1",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_SIZE",
-            "value": null
-        },
-        "sotp-section-2-address": {
-            "help": "Flash sector address for SOTP sector 2",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_2_ADDRESS",
-            "value": null
-        },
-        "sotp-section-2-size": {
-            "help": "Flash sector size for SOTP sector 2",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_2_SIZE",
-            "value": null
-        },
-        "sotp-num-sections": {
-            "help": "Number of SOTP sections",
-            "macro_name": "PAL_INT_FLASH_NUM_SECTIONS",
+        "tests-fs-size": {
+            "help": "Maximum size of the file system used for tests",
             "value": null
         }
     }
diff -r 4ab753b55a48 -r f07ccb7164d3 simple-mbed-cloud-client.lib
--- a/simple-mbed-cloud-client.lib	Tue Dec 18 00:18:07 2018 +0800
+++ b/simple-mbed-cloud-client.lib	Tue Apr 16 10:53:01 2019 +0800
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/simple-mbed-cloud-client/#0995133c1d9ad3a3ceedae26c3ecf02e824e7fa5
+https://github.com/ARMmbed/simple-mbed-cloud-client/#2ad31604eb91b1facc11b2f9d1ba4e54a80d1384