Generic Pelion Device Management example for various Renesas-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:

https://os.mbed.com/media/cache/platforms/GR-LYCHEE_and_cam.png.250x250_q85.png https://os.mbed.com/media/cache/platforms/GR-PEACH_C_trans.png.250x250_q85.png

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

Example functionality

This example showcases the following device functionality:

  • On user button click, increment Pelion LWM2M button resource.
  • Allow the user to change the state of the board LED from Pelion LWM2M led_state resource and PUT request.

Instructions to use this program with Mbed CLI


1. Import the application into your desktop:

mbed import https://os.mbed.com/teams/Renesas/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)

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 - for more information please contact Renesas (https://en-support.renesas.com/mytickets)

Files at this revision

API Documentation at this revision

Comitter:
screamer
Date:
Tue Feb 19 23:22:35 2019 +0000
Branch:
smcc-2.1.1.3
Parent:
3:c8de11b0ce7c
Child:
5:ca229d710930
Commit message:
Updated to SMCC 2.1.1.3 and Mbed OS 5.11.4

Changed in this revision

bootloader/bootloader_app.json Show annotated file Show diff for this revision Revisions of this file
bootloader/mbed-bootloader-GR_LYCHEE.bin Show annotated file Show diff for this revision Revisions of this file
bootloader/mbed-bootloader-RZ_A1H.bin Show diff for this revision Revisions of this file
drivers/network/COMPONENT_WIFI_ESP32.lib Show annotated file Show diff for this revision Revisions of this file
drivers/network/esp32-driver.lib Show diff for this revision Revisions of this file
drivers/storage/MySystemStorage.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-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
mbed_app_prod.json Show diff for this revision Revisions of this file
mbed_cloud_client_user_config.h Show diff for this revision Revisions of this file
mbed_cloud_dev_credentials.c 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
update_default_resources.c Show annotated file Show diff for this revision Revisions of this file
--- a/bootloader/bootloader_app.json	Wed Dec 26 12:33:36 2018 +0900
+++ b/bootloader/bootloader_app.json	Tue Feb 19 23:22:35 2019 +0000
@@ -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,42 +42,30 @@
         "*": {
             "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)",
-            "update-client.storage-size"       : "(1024*1024*2)",
-            "update-client.storage-locations"  : 1,
-            "update-client.firmware-header-version": "2"
+            "platform.stdio-flush-at-exit"     : false
         },
-        "RZ_A1H": {
+       "GR_LYCHEE": {
+            "target.components_add"            : ["SD"],
+            "sd.SPI_MOSI"                      : "P5_6",
+            "sd.SPI_MISO"                      : "P5_7",
+            "sd.SPI_CLK"                       : "P5_4",
+            "sd.SPI_CS"                        : "P5_5",
             "flash-start-address"              : "0x18000000",
             "flash-size"                       : "(8*1024*1024)",
             "nvstore.area_1_address"           : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
             "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.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",
-            "sd.SPI_MOSI": "P8_5",
-            "sd.SPI_MISO": "P8_6",
-            "sd.SPI_CLK":  "P8_3",
-            "sd.SPI_CS":   "P8_4"
-        },
-        "GR_LYCHEE": {
-            "flash-start-address"              : "0x18000000",
-            "flash-size"                       : "(8*1024*1024)",
-            "nvstore.area_1_address"           : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
-            "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",
-            "sd.SPI_MOSI": "P5_6",
-            "sd.SPI_MISO": "P5_7",
-            "sd.SPI_CLK":  "P5_4",
-            "sd.SPI_CS":   "P5_5"
+            "max-application-size"             : "DEFAULT_MAX_APPLICATION_SIZE"
         }
     }
 }
Binary file bootloader/mbed-bootloader-GR_LYCHEE.bin has changed
Binary file bootloader/mbed-bootloader-RZ_A1H.bin has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/network/COMPONENT_WIFI_ESP32.lib	Tue Feb 19 23:22:35 2019 +0000
@@ -0,0 +1,1 @@
+https://github.com/d-kato/esp32-driver/#ccbe1eda4920dd4bed7c08fe40a7fdca83e1b77e
--- a/drivers/network/esp32-driver.lib	Wed Dec 26 12:33:36 2018 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://github.com/d-kato/esp32-driver/#fd159f64c1e2394d9c9add7403b48ee965342dc0
\ No newline at end of file
--- a/drivers/storage/MySystemStorage.cpp	Wed Dec 26 12:33:36 2018 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0
- * 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 "BlockDevice.h"
-#include "FileSystem.h"
-#include "FATFileSystem.h"
-#include "LittleFileSystem.h"
-
-#if COMPONENT_SPIF
-#include "SPIFBlockDevice.h"
-#endif
-
-#if COMPONENT_QSPIF
-#include "QSPIFBlockDevice.h"
-#endif
-
-#if COMPONENT_DATAFLASH
-#include "DataFlashBlockDevice.h"
-#endif
-
-#if COMPONENT_SD
-#include "SDBlockDevice.h"
-#endif
-
-#if COMPONENT_FLASHIAP
-#include "FlashIAPBlockDevice.h"
-#endif
-
-#if COMPONENT_NUSD
-#include "NuSDBlockDevice.h"
-#endif
-
-using namespace mbed;
-
-// Align a value to a specified size.
-// Parameters :
-// val           - [IN]   Value.
-// size          - [IN]   Size.
-// Return        : Aligned value.
-static inline uint32_t align_up(uint32_t val, uint32_t size)
-{
-    return (((val - 1) / size) + 1) * size;
-}
-
-BlockDevice *BlockDevice::get_default_instance()
-{
-#if COMPONENT_SPIF
-
-    static SPIFBlockDevice default_bd(
-        MBED_CONF_SPIF_DRIVER_SPI_MOSI,
-        MBED_CONF_SPIF_DRIVER_SPI_MISO,
-        MBED_CONF_SPIF_DRIVER_SPI_CLK,
-        MBED_CONF_SPIF_DRIVER_SPI_CS,
-        MBED_CONF_SPIF_DRIVER_SPI_FREQ
-    );
-
-    return &default_bd;
-
-#elif COMPONENT_QSPIF
-
-    static QSPIFBlockDevice default_bd(
-        MBED_CONF_QSPIF_QSPI_IO0,
-        MBED_CONF_QSPIF_QSPI_IO1,
-        MBED_CONF_QSPIF_QSPI_IO2,
-        MBED_CONF_QSPIF_QSPI_IO3,
-        MBED_CONF_QSPIF_QSPI_SCK,
-        MBED_CONF_QSPIF_QSPI_CSN,
-        MBED_CONF_QSPIF_QSPI_POLARITY_MODE,
-        MBED_CONF_QSPIF_QSPI_FREQ
-    );
-
-    return &default_bd;
-
-#elif COMPONENT_DATAFLASH
-
-    static DataFlashBlockDevice default_bd(
-        MBED_CONF_DATAFLASH_SPI_MOSI,
-        MBED_CONF_DATAFLASH_SPI_MISO,
-        MBED_CONF_DATAFLASH_SPI_CLK,
-        MBED_CONF_DATAFLASH_SPI_CS
-    );
-
-    return &default_bd;
-
-#elif COMPONENT_SD
-
-    static SDBlockDevice default_bd(
-        MBED_CONF_SD_SPI_MOSI,
-        MBED_CONF_SD_SPI_MISO,
-        MBED_CONF_SD_SPI_CLK,
-        MBED_CONF_SD_SPI_CS
-    );
-
-    return &default_bd;
-
-#elif COMPONENT_NUSD
-
-    static NuSDBlockDevice default_bd;
-
-    return &default_bd;
-
-#elif COMPONENT_FLASHIAP
-
-#if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF)
-
-    size_t flash_size;
-    uint32_t start_address;
-    uint32_t bottom_address;
-    FlashIAP flash;
-
-    int ret = flash.init();
-    if (ret != 0) {
-        return 0;
-    }
-
-    //Find the start of first sector after text area
-    bottom_address = align_up(FLASHIAP_ROM_END, flash.get_sector_size(FLASHIAP_ROM_END));
-    start_address = flash.get_flash_start();
-    flash_size = flash.get_flash_size();
-
-    ret = flash.deinit();
-
-    static FlashIAPBlockDevice default_bd(bottom_address, start_address + flash_size - bottom_address);
-
-#else
-
-    static FlashIAPBlockDevice default_bd;
-
-#endif
-
-    return &default_bd;
-
-#else
-
-    return NULL;
-
-#endif
-
-}
-
-FileSystem *FileSystem::get_default_instance()
-{
-#if COMPONENT_SPIF || COMPONENT_QSPIF || COMPONENT_DATAFLASH || COMPONENT_NUSD
-
-    static LittleFileSystem flash("flash", BlockDevice::get_default_instance());
-    flash.set_as_default();
-
-    return &flash;
-
-#elif COMPONENT_SD
-
-    static FATFileSystem sdcard("sd", BlockDevice::get_default_instance());
-    sdcard.set_as_default();
-
-    return &sdcard;
-
-#elif COMPONENT_FLASHIAP
-
-    static LittleFileSystem flash("flash", BlockDevice::get_default_instance());
-    flash.set_as_default();
-
-    return &flash;
-
-#else
-
-    return NULL;
-
-#endif
-
-}
--- a/main.cpp	Wed Dec 26 12:33:36 2018 +0900
+++ b/main.cpp	Tue Feb 19 23:22:35 2019 +0000
@@ -20,68 +20,71 @@
 #include "mbed.h"
 #include "simple-mbed-cloud-client.h"
 #include "FATFileSystem.h"
+#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", bd);
+#else
+// Use LittleFileSystem for non-SD block devices to enable wear leveling and other functions
+LittleFileSystem fs("fs", bd);
+#endif
+
+#if USE_BUTTON == 1
+InterruptIn button(BUTTON1);
+#endif /* USE_BUTTON */
+
+// Default LED to use for PUT/POST example
+DigitalOut led(LED1);
+
+// 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();
-
-InterruptIn btn(USER_BUTTON0);
-// Declaring pointers for access to Pelion Device Management Client resources outside of main()
-MbedCloudClientResource *button_res;
-MbedCloudClientResource *pattern_res;
-
-void button_press() {
-    int v = button_res->get_value_int() + 1;
-
-    button_res->set_value(v);
-
-    printf("User 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);
 }
 
 /**
@@ -98,23 +101,38 @@
  * @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");
 
-    // Connect to the internet (DHCP is expected to be on)
-    nsapi_error_t status = net->connect();
+#if USE_BUTTON == 1
+    // If the User button is pressed ons start, then format storage.
+    if (button.read() == MBED_CONF_APP_BUTTON_PRESSED_STATE) {
+        printf("User button is pushed on start. 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");
+    }
+#endif /* USE_BUTTON */
 
-    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();
@@ -130,31 +148,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();
 
-    // Setup the button
-    btn.mode(PullUp);
-
-    // The button fall handler is placed in the event queue so it will run in
-    // thread context instead of ISR context, which allows safely updating the cloud resource
-    btn.fall(eventQueue.event(&button_press));
+#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(&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
+
+#endif /* MBED_TEST_MODE */
--- a/mbed-os.lib	Wed Dec 26 12:33:36 2018 +0900
+++ b/mbed-os.lib	Tue Feb 19 23:22:35 2019 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#2fd0c5cfbd83fce62da6308f9d64c0ab64e1f0d6
+https://github.com/ARMmbed/mbed-os/#ecb3c8c837162c73537bd0f3592c6e2a42994045
--- a/mbed_app.json	Wed Dec 26 12:33:36 2018 +0900
+++ b/mbed_app.json	Tue Feb 19 23:22:35 2019 +0000
@@ -1,59 +1,33 @@
 {
-    "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"           : "\"SSID\"",
-            "nsapi.default-wifi-password"       : "\"PASSWORD\""
-        },
-        "RZ_A1H": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["SD"],
-            "target.macros_add"                 : ["MBEDTLS_TEST_NULL_ENTROPY", "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES"],
-            "target.network-default-interface-type" : "ETHERNET",
-            "flash-start-address"               : "0x18000000",
-            "flash-size"                        : "(8*1024*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-RZ_A1H.bin",
-            "target.header_offset"              : "0x10000",
-            "target.app_offset"                 : "0x10400",
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
+            "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\""
         },
         "GR_LYCHEE": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["SD"],
-            "target.extra_labels_add"           : ["ESP32_DRIVER"],
-            "target.network-default-interface-type" : "WIFI",
-            "flash-start-address"               : "0x18000000",
-            "flash-size"                        : "(8*1024*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-GR_LYCHEE.bin",
-            "target.header_offset"              : "0x10000",
-            "target.app_offset"                 : "0x10400",
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
+            "target.features_add"                       : ["BOOTLOADER"],
+            "target.components_add"                     : ["SD"],
+            "target.components_add"                     : ["WIFI_ESP32"],
+            "target.network-default-interface-type"     : "WIFI",
+            "device-management.flash-start-address"     : "0x18000000",
+            "device-management.flash-size"              : "(8*1024*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.bootloader_img"                     : "bootloader/mbed-bootloader-GR_LYCHEE.bin",
+            "target.header_offset"                      : "0x10000",
+            "target.app_offset"                         : "0x10400",
+            "button-pressed-state"                      : 0
         }
     },
     "config": {
@@ -61,45 +35,21 @@
             "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
-        },
-        "flash-size": {
-            "help": "Total size of internal flash. Only used in this config to help the definition of other macros.",
-            "value": null
-        },
-        "sotp-section-1-address": {
-            "help": "Flash sector address for SOTP sector 1",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_ADDRESS",
-            "value": null
+        "use-button": {
+            "help": "Whether the target has a button",
+            "macro_name": "USE_BUTTON",
+            "value": true
         },
-        "sotp-section-1-size": {
-            "help": "Flash sector size for SOTP sector 1",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_SIZE",
-            "value": null
+        "button-pressed-state": {
+            "help": "Value of the button when pressed",
+            "value": 1
         },
-        "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",
+        "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
         }
     }
-}
\ No newline at end of file
+}
--- a/mbed_app_prod.json	Wed Dec 26 12:33:36 2018 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-{
-    "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": {
-        "*": {
-            "target.OUTPUT_EXT"                 : "hex",
-            "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"           : "\"SSID\"",
-            "nsapi.default-wifi-password"       : "\"Password\""
-        },
-        "K64F": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["SD"],
-            "flash-start-address"               : "0x0",
-            "flash-size"                        : "(2048*1024)",
-            "sotp-section-1-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + 32*1024)",
-            "sotp-section-1-size"               : "(4*1024)",
-            "sotp-section-2-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + 36*1024)",
-            "sotp-section-2-size"               : "(4*1024)",
-            "sotp-num-sections"                 : 2,
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 40*1024)",
-            "client_app.partition_mode"         : "1",
-            "client_app.auto_partition"         : "1",
-            "client_app.pal_number_of_partition": "1",
-            "client_app.primary_partition_size" : "(1024*1024*1024)"
-        },
-        "K66F": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["SD"],
-            "flash-start-address"               : "0x0",
-            "flash-size"                        : "(2048*1024)",
-            "sotp-section-1-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + 32*1024)",
-            "sotp-section-1-size"               : "(4*1024)",
-            "sotp-section-2-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + 36*1024)",
-            "sotp-section-2-size"               : "(4*1024)",
-            "sotp-num-sections"                 : 2,
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
-            "client_app.partition_mode"         : "1",
-            "client_app.auto_partition"         : "1",
-            "client_app.pal_number_of_partition": "1",
-            "client_app.primary_partition_size" : "(1024*1024*1024)"
-        },
-        "NUCLEO_F429ZI": {
-            "target.features_add"               : ["BOOTLOADER"],
-            "target.components_add"             : ["SD"],
-            "flash-start-address"               : "0x08000000",
-            "flash-size"                        : "(2048*1024)",
-            "sotp-section-1-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + 32*1024)",
-            "sotp-section-1-size"               : "(16*1024)",
-            "sotp-section-2-address"            : "(MBED_CONF_APP_FLASH_START_ADDRESS + 48*1024)",
-            "sotp-section-2-size"               : "(16*1024)",
-            "sotp-num-sections"                 : 2,
-            "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
-            "client_app.partition_mode"         : "1",
-            "client_app.auto_partition"         : "1",
-            "client_app.pal_number_of_partition": "1",
-            "client_app.primary_partition_size" : "(1024*1024*4)"
-        }
-    },
-    "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": null
-        },
-        "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
-        },
-        "flash-size": {
-            "help": "Total size of internal flash. Only used in this config to help the definition of other macros.",
-            "value": null
-        },
-        "sotp-section-1-address": {
-            "help": "Flash sector address for SOTP sector 1",
-            "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_ADDRESS",
-            "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",
-            "value": null
-        }
-    }
-}
--- a/mbed_cloud_client_user_config.h	Wed Dec 26 12:33:36 2018 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-// ----------------------------------------------------------------------------
-// Copyright 2016-2017 ARM Ltd.
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-// 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.
-// ----------------------------------------------------------------------------
-
-// This file is a template and it's intented to be copied to the application
-// Enable this configuration
-
-#ifndef MBED_CLOUD_CLIENT_USER_CONFIG_H
-#define MBED_CLOUD_CLIENT_USER_CONFIG_H
-
-#ifdef MBED_CONF_APP_ENDPOINT_TYPE
-#define MBED_CLOUD_CLIENT_ENDPOINT_TYPE         MBED_CONF_APP_ENDPOINT_TYPE
-#else
-#define MBED_CLOUD_CLIENT_ENDPOINT_TYPE         "default"
-#endif
-
-// Enable either TCP or UDP, but no both
-#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP
-// MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP
-
-#define MBED_CLOUD_CLIENT_LIFETIME              3600
-
-#define MBED_CLOUD_CLIENT_SUPPORT_UPDATE
-#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE       1024
-
-// set flag to enable update support in mbed Cloud client
-#define MBED_CLOUD_CLIENT_SUPPORT_UPDATE
-
-// set download buffer size in bytes (min. 1024 bytes)
-
-// Use larger buffers in Linux //
-#ifdef __linux__
-#define MBED_CLOUD_CLIENT_UPDATE_BUFFER          (2 * 1024 * 1024)
-#else
-#define MBED_CLOUD_CLIENT_UPDATE_BUFFER          2048
-#endif
-
-// Developer flags for Update feature
-#if MBED_CONF_APP_DEVELOPER_MODE == 1
-    #define MBED_CLOUD_DEV_UPDATE_CERT
-    #define MBED_CLOUD_DEV_UPDATE_ID
-#endif // MBED_CONF_APP_DEVELOPER_MODE
-
-#endif // MBED_CLOUD_CLIENT_USER_CONFIG_H
-
--- a/mbed_cloud_dev_credentials.c	Wed Dec 26 12:33:36 2018 +0900
+++ b/mbed_cloud_dev_credentials.c	Tue Feb 19 23:22:35 2019 +0000
@@ -15,39 +15,39 @@
  */
 #ifndef __MBED_CLOUD_DEV_CREDENTIALS_H__
 #define __MBED_CLOUD_DEV_CREDENTIALS_H__
-
-#if MBED_CONF_APP_DEVELOPER_MODE == 1
+ 
+#if MBED_CONF_DEVICE_MANAGEMENT_DEVELOPER_MODE == 1
 #error "Replace mbed_cloud_dev_credentials.c with your own developer cert."
 #endif
-
+ 
 #include <inttypes.h>
-
+ 
 const char MBED_CLOUD_DEV_BOOTSTRAP_ENDPOINT_NAME[] = "";
 const char MBED_CLOUD_DEV_ACCOUNT_ID[] = "";
 const char MBED_CLOUD_DEV_BOOTSTRAP_SERVER_URI[] = "";
-
+ 
 const uint8_t MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_CERTIFICATE[] =
 { 0x0 };
-
+ 
 const uint8_t MBED_CLOUD_DEV_BOOTSTRAP_SERVER_ROOT_CA_CERTIFICATE[] =
 { 0x0 };
-
+ 
 const uint8_t MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_PRIVATE_KEY[] =
 { 0x0 };
-
+ 
 const char MBED_CLOUD_DEV_MANUFACTURER[] = "dev_manufacturer";
-
+ 
 const char MBED_CLOUD_DEV_MODEL_NUMBER[] = "dev_model_num";
-
+ 
 const char MBED_CLOUD_DEV_SERIAL_NUMBER[] = "0";
-
+ 
 const char MBED_CLOUD_DEV_DEVICE_TYPE[] = "dev_device_type";
-
+ 
 const char MBED_CLOUD_DEV_HARDWARE_VERSION[] = "dev_hardware_version";
-
+ 
 const uint32_t MBED_CLOUD_DEV_MEMORY_TOTAL_KB = 0;
 const uint32_t MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_CERTIFICATE_SIZE = sizeof(MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_CERTIFICATE);
 const uint32_t MBED_CLOUD_DEV_BOOTSTRAP_SERVER_ROOT_CA_CERTIFICATE_SIZE = sizeof(MBED_CLOUD_DEV_BOOTSTRAP_SERVER_ROOT_CA_CERTIFICATE);
 const uint32_t MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_PRIVATE_KEY_SIZE = sizeof(MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_PRIVATE_KEY);
-
-#endif //__MBED_CLOUD_DEV_CREDENTIALS_H__
+ 
+#endif //__MBED_CLOUD_DEV_CREDENTIALS_H__
\ No newline at end of file
--- a/simple-mbed-cloud-client.lib	Wed Dec 26 12:33:36 2018 +0900
+++ b/simple-mbed-cloud-client.lib	Tue Feb 19 23:22:35 2019 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/simple-mbed-cloud-client/#5c878b548b4d8870c5a172057002daf05504990d
+https://github.com/ARMmbed/simple-mbed-cloud-client/#f7e701889adb52935b77204190f347795cfd477a
--- a/update_default_resources.c	Wed Dec 26 12:33:36 2018 +0900
+++ b/update_default_resources.c	Tue Feb 19 23:22:35 2019 +0000
@@ -15,27 +15,27 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 // ----------------------------------------------------------------------------
-
+ 
 #ifdef MBED_CLOUD_CLIENT_USER_CONFIG_FILE
 #include MBED_CLOUD_CLIENT_USER_CONFIG_FILE
 #endif
-
+ 
 #include <stdint.h>
-
+ 
 #ifdef MBED_CLOUD_DEV_UPDATE_ID
 const uint8_t arm_uc_vendor_id[16] = { "dev_manufacturer" };
 const uint16_t arm_uc_vendor_id_size = sizeof(arm_uc_vendor_id);
-
+ 
 const uint8_t arm_uc_class_id[16]  = { "dev_model_number" };
 const uint16_t arm_uc_class_id_size = sizeof(arm_uc_class_id);
 #endif
-
+ 
 #ifdef MBED_CLOUD_DEV_UPDATE_CERT
 const uint8_t arm_uc_default_fingerprint[32] = { 0 };
 const uint16_t arm_uc_default_fingerprint_size =
     sizeof(arm_uc_default_fingerprint);
-
+ 
 const uint8_t arm_uc_default_certificate[1] = { 0 };
 const uint16_t arm_uc_default_certificate_size =
     sizeof(arm_uc_default_certificate);
-#endif
+#endif
\ No newline at end of file