NuMaker Pelion Device Management example

Fork of mbed-os-example-pelion by cc li

Committer:
ccli8
Date:
Wed Oct 09 14:19:44 2019 +0800
Revision:
0:f78ec4a22e67
Child:
4:e564fd8be648
Support Nuvoton targets

Based on mbed-os-pelion-example master/mbed-bootloader 4.1.0/mbed-cloud-client 4.0.0,
support Nuvoton targets:
1. Support Nuvoton targets:
- NUMAKER_PFM_NUC472
- NUMAKER_PFM_M487
- NUMAKER_IOT_M487 V1.3
Compared to V1.2, V1.3 adds support for ESP8266 RTS/CTS/RST pins. V1.3 is incompatible with V1.2 on ESP8266.
- NUMAKER_IOT_M263A
2. Change storage to NUSD (SD card in SDIO bus mode) from SD (SD card SPI bus mode)
(1) Add COMPONENT_NUSD.lib.
(2) Add component NUSD (target.components_add).
(3) Change default BlockDevice to NUSD:
Override BlockDevice::get_default_instance (nusd.provide-default-blockdevice).
Required since mbed-cloud-client 2.1.0 (arm_uc_blockdevice_ext) or in:
mbed-bootloader/modules/storage/pal-blockdevice/source/arm_uc_pal_blockdevice_mbed.cpp
(4) Enable kvstore with blockdevice type being "other".
i) Override get_other_blockdevice() (nusd.provide-kvstore-other-blockdevice).
ii) Configure storage type to "FILESYSTEM".
iii)Configure file system type to "LITTLE".
vi) Configure block device type to "other".
v) Configure external size to 64MiB, which cannot overlap with update-client.
storage-address/update-client.storage-size.
3. Change back UARTSerial tx/rx buffer size from 1024/1024 to 256/256. This can reduce
memory footprint by (1024 - 256) * 2 = 1.5KiB. Because this configuration influences
both ESP8266 and default console (platfrom/mbed_retarget.cpp), memory reduction can
achieve 1.5KiB x 2 = 3KiB.
4. Enlarge ESP8266 'send tcp data' timeout on Nuvoton targets
Pelion connection has some failure rate with this. Enlarging ESP8266_SEND_TIMEOUT
can just relieve the issue. A ticket has raised to address it:
https://github.com/ARMmbed/mbed-os/issues/11544
5. Requirements for mbed-os version:
- mbed-os 5.13.0 (or afterwards) to support kvstore with block device type being "other"
- mbed-os 5.13.1 (or afterwards) to fix 'undefined pal_plat_osEntropyInject(...)' error
- mbed-os 5.14.0 (or afterwards) to support NUMAKER_IOT_M263A

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ccli8 0:f78ec4a22e67 1 {
ccli8 0:f78ec4a22e67 2 "macros": [
ccli8 0:f78ec4a22e67 3 "MBED_TRACE_MAX_LEVEL=TRACE_LEVEL_INFO",
ccli8 0:f78ec4a22e67 4 "MBED_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
ccli8 0:f78ec4a22e67 5 "MBED_CLOUD_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
ccli8 0:f78ec4a22e67 6 "ARM_UC_USE_PAL_BLOCKDEVICE=1",
ccli8 0:f78ec4a22e67 7 "PAL_PLATFORM_DEFINED_CONFIGURATION=\"mbedOS_SST.h\"",
ccli8 0:f78ec4a22e67 8 "PAL_USER_DEFINED_CONFIGURATION=\"mbedOS_SST.h\""
ccli8 0:f78ec4a22e67 9 ],
ccli8 0:f78ec4a22e67 10 "target_overrides": {
ccli8 0:f78ec4a22e67 11 "*": {
ccli8 0:f78ec4a22e67 12 "target.features_add" : ["BOOTLOADER", "STORAGE"],
ccli8 0:f78ec4a22e67 13 "platform.stdio-baud-rate" : 115200,
ccli8 0:f78ec4a22e67 14 "platform.stdio-convert-newlines" : true,
ccli8 0:f78ec4a22e67 15 "platform.stdio-buffered-serial" : true,
ccli8 0:f78ec4a22e67 16 "platform.stdio-flush-at-exit" : true,
ccli8 0:f78ec4a22e67 17 "rtos.main-thread-stack-size" : 5120,
ccli8 0:f78ec4a22e67 18 "update-client.storage-locations" : 1,
ccli8 0:f78ec4a22e67 19 "mbed-trace.enable" : null,
ccli8 0:f78ec4a22e67 20 "events.shared-stacksize" : 2048,
ccli8 0:f78ec4a22e67 21 "nsapi.default-wifi-security" : "WPA_WPA2",
ccli8 0:f78ec4a22e67 22 "nsapi.default-wifi-ssid" : "\"SSID\"",
ccli8 0:f78ec4a22e67 23 "nsapi.default-wifi-password" : "\"PASSWORD\""
ccli8 0:f78ec4a22e67 24 },
ccli8 0:f78ec4a22e67 25 "NUMAKER_PFM_NUC472": {
ccli8 0:f78ec4a22e67 26 "target.network-default-interface-type" : "ETHERNET",
ccli8 0:f78ec4a22e67 27 "target.bootloader_img" : "bootloader/mbed-bootloader-nuc472-block_device-kvstore-v4.1.0.bin",
ccli8 0:f78ec4a22e67 28 "bootloader-size" : "(64*1024)",
ccli8 0:f78ec4a22e67 29 "target.header_offset" : "0x12000",
ccli8 0:f78ec4a22e67 30 "target.app_offset" : "0x12400",
ccli8 0:f78ec4a22e67 31 "target.components_add" : ["NUSD"],
ccli8 0:f78ec4a22e67 32 "nusd.provide-default-blockdevice" : true,
ccli8 0:f78ec4a22e67 33 "nusd.provide-kvstore-other-blockdevice" : true,
ccli8 0:f78ec4a22e67 34 "update-client.bootloader-details" : "0x0",
ccli8 0:f78ec4a22e67 35 "update-client.application-details" : "0x12000",
ccli8 0:f78ec4a22e67 36 "update-client.storage-address" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 37 "update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
ccli8 0:f78ec4a22e67 38 "update-client.storage-locations" : 1,
ccli8 0:f78ec4a22e67 39 "mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
ccli8 0:f78ec4a22e67 40 "storage.storage_type" : "FILESYSTEM",
ccli8 0:f78ec4a22e67 41 "storage_filesystem.filesystem" : "LITTLE",
ccli8 0:f78ec4a22e67 42 "storage_filesystem.blockdevice" : "other",
ccli8 0:f78ec4a22e67 43 "storage_filesystem.internal_base_address" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
ccli8 0:f78ec4a22e67 44 "storage_filesystem.rbp_internal_size" : "(2*4*1024)",
ccli8 0:f78ec4a22e67 45 "storage_filesystem.external_base_address" : "(0x0)",
ccli8 0:f78ec4a22e67 46 "storage_filesystem.external_size" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 47 "target.macros_add" : ["MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\""]
ccli8 0:f78ec4a22e67 48 },
ccli8 0:f78ec4a22e67 49 "NUMAKER_PFM_M487": {
ccli8 0:f78ec4a22e67 50 "target.network-default-interface-type" : "ETHERNET",
ccli8 0:f78ec4a22e67 51 "target.bootloader_img" : "bootloader/mbed-bootloader-m487-block_device-kvstore-v4.1.0.bin",
ccli8 0:f78ec4a22e67 52 "bootloader-size" : "(64*1024)",
ccli8 0:f78ec4a22e67 53 "target.header_offset" : "0x12000",
ccli8 0:f78ec4a22e67 54 "target.app_offset" : "0x12400",
ccli8 0:f78ec4a22e67 55 "target.components_add" : ["NUSD"],
ccli8 0:f78ec4a22e67 56 "nusd.provide-default-blockdevice" : true,
ccli8 0:f78ec4a22e67 57 "nusd.provide-kvstore-other-blockdevice" : true,
ccli8 0:f78ec4a22e67 58 "update-client.bootloader-details" : "0x0",
ccli8 0:f78ec4a22e67 59 "update-client.application-details" : "0x12000",
ccli8 0:f78ec4a22e67 60 "update-client.storage-address" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 61 "update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
ccli8 0:f78ec4a22e67 62 "update-client.storage-locations" : 1,
ccli8 0:f78ec4a22e67 63 "mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
ccli8 0:f78ec4a22e67 64 "storage.storage_type" : "FILESYSTEM",
ccli8 0:f78ec4a22e67 65 "storage_filesystem.filesystem" : "LITTLE",
ccli8 0:f78ec4a22e67 66 "storage_filesystem.blockdevice" : "other",
ccli8 0:f78ec4a22e67 67 "storage_filesystem.internal_base_address" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
ccli8 0:f78ec4a22e67 68 "storage_filesystem.rbp_internal_size" : "(2*4*1024)",
ccli8 0:f78ec4a22e67 69 "storage_filesystem.external_base_address" : "(0x0)",
ccli8 0:f78ec4a22e67 70 "storage_filesystem.external_size" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 71 "target.macros_add" : ["MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\""]
ccli8 0:f78ec4a22e67 72 },
ccli8 0:f78ec4a22e67 73 "NUMAKER_IOT_M487": {
ccli8 0:f78ec4a22e67 74 "target.network-default-interface-type" : "WIFI",
ccli8 0:f78ec4a22e67 75 "target.bootloader_img" : "bootloader/mbed-bootloader-m487_iot-block_device-kvstore-v4.1.0.bin",
ccli8 0:f78ec4a22e67 76 "bootloader-size" : "(64*1024)",
ccli8 0:f78ec4a22e67 77 "target.header_offset" : "0x12000",
ccli8 0:f78ec4a22e67 78 "target.app_offset" : "0x12400",
ccli8 0:f78ec4a22e67 79 "target.components_add" : ["NUSD"],
ccli8 0:f78ec4a22e67 80 "nusd.provide-default-blockdevice" : true,
ccli8 0:f78ec4a22e67 81 "nusd.provide-kvstore-other-blockdevice" : true,
ccli8 0:f78ec4a22e67 82 "update-client.bootloader-details" : "0x0",
ccli8 0:f78ec4a22e67 83 "update-client.application-details" : "0x12000",
ccli8 0:f78ec4a22e67 84 "update-client.storage-address" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 85 "update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
ccli8 0:f78ec4a22e67 86 "update-client.storage-locations" : 1,
ccli8 0:f78ec4a22e67 87 "mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
ccli8 0:f78ec4a22e67 88 "storage.storage_type" : "FILESYSTEM",
ccli8 0:f78ec4a22e67 89 "storage_filesystem.filesystem" : "LITTLE",
ccli8 0:f78ec4a22e67 90 "storage_filesystem.blockdevice" : "other",
ccli8 0:f78ec4a22e67 91 "storage_filesystem.internal_base_address" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
ccli8 0:f78ec4a22e67 92 "storage_filesystem.rbp_internal_size" : "(2*4*1024)",
ccli8 0:f78ec4a22e67 93 "storage_filesystem.external_base_address" : "(0x0)",
ccli8 0:f78ec4a22e67 94 "storage_filesystem.external_size" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 95 "esp8266.tx" : "PH_8",
ccli8 0:f78ec4a22e67 96 "esp8266.rx" : "PH_9",
ccli8 0:f78ec4a22e67 97 "esp8266.rts" : "A2",
ccli8 0:f78ec4a22e67 98 "esp8266.cts" : "A3",
ccli8 0:f78ec4a22e67 99 "esp8266.rst" : "PH_3",
ccli8 0:f78ec4a22e67 100 "esp8266.provide-default" : true,
ccli8 0:f78ec4a22e67 101 "target.macros_add" : ["MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\"", "ESP8266_SEND_TIMEOUT=8000"]
ccli8 0:f78ec4a22e67 102 },
ccli8 0:f78ec4a22e67 103 "NUMAKER_IOT_M263A": {
ccli8 0:f78ec4a22e67 104 "target.network-default-interface-type" : "WIFI",
ccli8 0:f78ec4a22e67 105 "target.bootloader_img" : "bootloader/mbed-bootloader-m263_iot-block_device-kvstore-v4.1.0.bin",
ccli8 0:f78ec4a22e67 106 "bootloader-size" : "(64*1024)",
ccli8 0:f78ec4a22e67 107 "target.header_offset" : "0x12000",
ccli8 0:f78ec4a22e67 108 "target.app_offset" : "0x12400",
ccli8 0:f78ec4a22e67 109 "target.components_add" : ["NUSD"],
ccli8 0:f78ec4a22e67 110 "nusd.provide-default-blockdevice" : true,
ccli8 0:f78ec4a22e67 111 "nusd.provide-kvstore-other-blockdevice" : true,
ccli8 0:f78ec4a22e67 112 "update-client.bootloader-details" : "0x0",
ccli8 0:f78ec4a22e67 113 "update-client.application-details" : "0x12000",
ccli8 0:f78ec4a22e67 114 "update-client.storage-address" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 115 "update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
ccli8 0:f78ec4a22e67 116 "update-client.storage-locations" : 1,
ccli8 0:f78ec4a22e67 117 "mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
ccli8 0:f78ec4a22e67 118 "storage.storage_type" : "FILESYSTEM",
ccli8 0:f78ec4a22e67 119 "storage_filesystem.filesystem" : "LITTLE",
ccli8 0:f78ec4a22e67 120 "storage_filesystem.blockdevice" : "other",
ccli8 0:f78ec4a22e67 121 "storage_filesystem.internal_base_address" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
ccli8 0:f78ec4a22e67 122 "storage_filesystem.rbp_internal_size" : "(2*4*1024)",
ccli8 0:f78ec4a22e67 123 "storage_filesystem.external_base_address" : "(0x0)",
ccli8 0:f78ec4a22e67 124 "storage_filesystem.external_size" : "(1024*1024*64)",
ccli8 0:f78ec4a22e67 125 "esp8266.tx" : "PC_7",
ccli8 0:f78ec4a22e67 126 "esp8266.rx" : "PC_6",
ccli8 0:f78ec4a22e67 127 "esp8266.rts" : "PE_13",
ccli8 0:f78ec4a22e67 128 "esp8266.cts" : "PC_8",
ccli8 0:f78ec4a22e67 129 "esp8266.rst" : "PE_12",
ccli8 0:f78ec4a22e67 130 "esp8266.provide-default" : true,
ccli8 0:f78ec4a22e67 131 "target.macros_add" : ["MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\"", "ESP8266_SEND_TIMEOUT=8000"]
ccli8 0:f78ec4a22e67 132 }
ccli8 0:f78ec4a22e67 133 },
ccli8 0:f78ec4a22e67 134 "config": {
ccli8 0:f78ec4a22e67 135 "bootloader-size": {
ccli8 0:f78ec4a22e67 136 "help" : "Helper macro to enable calculation of rom regions. target.header_offset and target.app_offset still needs to be calculated manually, though.",
ccli8 0:f78ec4a22e67 137 "value" : "(32*1024)",
ccli8 0:f78ec4a22e67 138 "macro_name": "MBED_BOOTLOADER_SIZE"
ccli8 0:f78ec4a22e67 139 }
ccli8 0:f78ec4a22e67 140 }
ccli8 0:f78ec4a22e67 141 }