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

Committer:
Sam Chu
Date:
Tue Dec 18 00:07:56 2018 +0800
Revision:
0:e0138281f21d
Child:
2:f07ccb7164d3
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sam Chu 0:e0138281f21d 1 {
Sam Chu 0:e0138281f21d 2 "macros": [
Sam Chu 0:e0138281f21d 3 "ARM_UC_USE_PAL_BLOCKDEVICE=1",
Sam Chu 0:e0138281f21d 4 "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE",
Sam Chu 0:e0138281f21d 5 "MBED_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
Sam Chu 0:e0138281f21d 6 "MBED_CLOUD_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
Sam Chu 0:e0138281f21d 7 "PAL_USER_DEFINED_CONFIGURATION=\"sotp_fs_config_MbedOS.h\"",
Sam Chu 0:e0138281f21d 8 "PAL_FS_MOUNT_POINT_PRIMARY=\"/fs\"",
Sam Chu 0:e0138281f21d 9 "MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\"",
Sam Chu 0:e0138281f21d 10 "PAL_DTLS_PEER_MIN_TIMEOUT=5000"
Sam Chu 0:e0138281f21d 11 ],
Sam Chu 0:e0138281f21d 12 "target_overrides": {
Sam Chu 0:e0138281f21d 13 "*": {
Sam Chu 0:e0138281f21d 14 "platform.stdio-baud-rate" : 115200,
Sam Chu 0:e0138281f21d 15 "platform.stdio-convert-newlines" : true,
Sam Chu 0:e0138281f21d 16 "update-client.storage-address" : "(1024*1024*64)",
Sam Chu 0:e0138281f21d 17 "update-client.storage-size" : "(1024*1024*2)",
Sam Chu 0:e0138281f21d 18 "update-client.storage-locations" : "1",
Sam Chu 0:e0138281f21d 19 "mbed-trace.enable" : null,
Sam Chu 0:e0138281f21d 20 "nsapi.default-wifi-security" : "WPA_WPA2",
Sam Chu 0:e0138281f21d 21 "nsapi.default-wifi-ssid" : "\"\"",
Sam Chu 0:e0138281f21d 22 "nsapi.default-wifi-password" : "\"\""
Sam Chu 0:e0138281f21d 23 },
Sam Chu 0:e0138281f21d 24 "NUMAKER_PFM_NUC472": {
Sam Chu 0:e0138281f21d 25 "target.features_add" : ["BOOTLOADER"],
Sam Chu 0:e0138281f21d 26 "target.components_add" : ["NUSD"],
Sam Chu 0:e0138281f21d 27 "target.network-default-interface-type" : "ETHERNET",
Sam Chu 0:e0138281f21d 28 "drivers.uart-serial-rxbuf-size" : 1024,
Sam Chu 0:e0138281f21d 29 "drivers.uart-serial-txbuf-size" : 1024,
Sam Chu 0:e0138281f21d 30 "flash-start-address" : "0x0",
Sam Chu 0:e0138281f21d 31 "flash-size" : "(512*1024)",
Sam Chu 0:e0138281f21d 32 "sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
Sam Chu 0:e0138281f21d 33 "sotp-section-1-size" : "(4*1024)",
Sam Chu 0:e0138281f21d 34 "sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
Sam Chu 0:e0138281f21d 35 "sotp-section-2-size" : "(4*1024)",
Sam Chu 0:e0138281f21d 36 "sotp-num-sections" : 2,
Sam Chu 0:e0138281f21d 37 "target.bootloader_img" : "bootloader/mbed-bootloader-NUMAKER_PFM_NUC472.bin",
Sam Chu 0:e0138281f21d 38 "target.header_offset" : "0x10000",
Sam Chu 0:e0138281f21d 39 "target.app_offset" : "0x10400",
Sam Chu 0:e0138281f21d 40 "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
Sam Chu 0:e0138281f21d 41 },
Sam Chu 0:e0138281f21d 42 "NUMAKER_PFM_M487": {
Sam Chu 0:e0138281f21d 43 "target.features_add" : ["BOOTLOADER"],
Sam Chu 0:e0138281f21d 44 "target.network-default-interface-type" : "ETHERNET",
Sam Chu 0:e0138281f21d 45 "target.components_add" : ["NUSD"],
Sam Chu 0:e0138281f21d 46 "drivers.uart-serial-rxbuf-size" : 1024,
Sam Chu 0:e0138281f21d 47 "drivers.uart-serial-txbuf-size" : 1024,
Sam Chu 0:e0138281f21d 48 "flash-start-address" : "0x0",
Sam Chu 0:e0138281f21d 49 "flash-size" : "(512*1024)",
Sam Chu 0:e0138281f21d 50 "sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
Sam Chu 0:e0138281f21d 51 "sotp-section-1-size" : "(4*1024)",
Sam Chu 0:e0138281f21d 52 "sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
Sam Chu 0:e0138281f21d 53 "sotp-section-2-size" : "(4*1024)",
Sam Chu 0:e0138281f21d 54 "sotp-num-sections" : 2,
Sam Chu 0:e0138281f21d 55 "target.bootloader_img" : "bootloader/mbed-bootloader-NUMAKER_PFM_M487.bin",
Sam Chu 0:e0138281f21d 56 "target.header_offset" : "0x10000",
Sam Chu 0:e0138281f21d 57 "target.app_offset" : "0x10400",
Sam Chu 0:e0138281f21d 58 "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
Sam Chu 0:e0138281f21d 59 },
Sam Chu 0:e0138281f21d 60 "NUMAKER_IOT_M487": {
Sam Chu 0:e0138281f21d 61 "target.features_add" : ["BOOTLOADER"],
Sam Chu 0:e0138281f21d 62 "target.components_add" : ["NUSD"],
Sam Chu 0:e0138281f21d 63 "target.network-default-interface-type" : "WIFI",
Sam Chu 0:e0138281f21d 64 "esp8266.tx" : "PH_8",
Sam Chu 0:e0138281f21d 65 "esp8266.rx" : "PH_9",
Sam Chu 0:e0138281f21d 66 "esp8266.provide-default" : true,
Sam Chu 0:e0138281f21d 67 "drivers.uart-serial-rxbuf-size" : 1024,
Sam Chu 0:e0138281f21d 68 "drivers.uart-serial-txbuf-size" : 1024,
Sam Chu 0:e0138281f21d 69 "flash-start-address" : "0x0",
Sam Chu 0:e0138281f21d 70 "flash-size" : "(512*1024)",
Sam Chu 0:e0138281f21d 71 "sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
Sam Chu 0:e0138281f21d 72 "sotp-section-1-size" : "(4*1024)",
Sam Chu 0:e0138281f21d 73 "sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
Sam Chu 0:e0138281f21d 74 "sotp-section-2-size" : "(4*1024)",
Sam Chu 0:e0138281f21d 75 "sotp-num-sections" : 2,
Sam Chu 0:e0138281f21d 76 "target.bootloader_img" : "bootloader/mbed-bootloader-NUMAKER_IOT_M487.bin",
Sam Chu 0:e0138281f21d 77 "target.header_offset" : "0x10000",
Sam Chu 0:e0138281f21d 78 "target.app_offset" : "0x10400",
Sam Chu 0:e0138281f21d 79 "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)"
Sam Chu 0:e0138281f21d 80 }
Sam Chu 0:e0138281f21d 81 },
Sam Chu 0:e0138281f21d 82 "config": {
Sam Chu 0:e0138281f21d 83 "format-storage-layer-on-error": {
Sam Chu 0:e0138281f21d 84 "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!",
Sam Chu 0:e0138281f21d 85 "value": 1
Sam Chu 0:e0138281f21d 86 },
Sam Chu 0:e0138281f21d 87 "developer-mode": {
Sam Chu 0:e0138281f21d 88 "help": "Enable Developer mode to skip Factory enrollment",
Sam Chu 0:e0138281f21d 89 "value": 1
Sam Chu 0:e0138281f21d 90 },
Sam Chu 0:e0138281f21d 91 "main-stack-size": {
Sam Chu 0:e0138281f21d 92 "value": 6000
Sam Chu 0:e0138281f21d 93 },
Sam Chu 0:e0138281f21d 94 "flash-start-address": {
Sam Chu 0:e0138281f21d 95 "help": "Start address of internal flash. Only used in this config to help the definition of other macros.",
Sam Chu 0:e0138281f21d 96 "value": null
Sam Chu 0:e0138281f21d 97 },
Sam Chu 0:e0138281f21d 98 "flash-size": {
Sam Chu 0:e0138281f21d 99 "help": "Total size of internal flash. Only used in this config to help the definition of other macros.",
Sam Chu 0:e0138281f21d 100 "value": null
Sam Chu 0:e0138281f21d 101 },
Sam Chu 0:e0138281f21d 102 "sotp-section-1-address": {
Sam Chu 0:e0138281f21d 103 "help": "Flash sector address for SOTP sector 1",
Sam Chu 0:e0138281f21d 104 "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_ADDRESS",
Sam Chu 0:e0138281f21d 105 "value": null
Sam Chu 0:e0138281f21d 106 },
Sam Chu 0:e0138281f21d 107 "sotp-section-1-size": {
Sam Chu 0:e0138281f21d 108 "help": "Flash sector size for SOTP sector 1",
Sam Chu 0:e0138281f21d 109 "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_SIZE",
Sam Chu 0:e0138281f21d 110 "value": null
Sam Chu 0:e0138281f21d 111 },
Sam Chu 0:e0138281f21d 112 "sotp-section-2-address": {
Sam Chu 0:e0138281f21d 113 "help": "Flash sector address for SOTP sector 2",
Sam Chu 0:e0138281f21d 114 "macro_name": "PAL_INTERNAL_FLASH_SECTION_2_ADDRESS",
Sam Chu 0:e0138281f21d 115 "value": null
Sam Chu 0:e0138281f21d 116 },
Sam Chu 0:e0138281f21d 117 "sotp-section-2-size": {
Sam Chu 0:e0138281f21d 118 "help": "Flash sector size for SOTP sector 2",
Sam Chu 0:e0138281f21d 119 "macro_name": "PAL_INTERNAL_FLASH_SECTION_2_SIZE",
Sam Chu 0:e0138281f21d 120 "value": null
Sam Chu 0:e0138281f21d 121 },
Sam Chu 0:e0138281f21d 122 "sotp-num-sections": {
Sam Chu 0:e0138281f21d 123 "help": "Number of SOTP sections",
Sam Chu 0:e0138281f21d 124 "macro_name": "PAL_INT_FLASH_NUM_SECTIONS",
Sam Chu 0:e0138281f21d 125 "value": null
Sam Chu 0:e0138281f21d 126 }
Sam Chu 0:e0138281f21d 127 }
Sam Chu 0:e0138281f21d 128 }