Skip to content

Commit 746ba56

Browse files
author
Janne Kiiskilä
authored
Merge pull request #53 from ARMmbed/README-fixes
Readme fixes
2 parents 6cd2c84 + 0cb69f5 commit 746ba56

File tree

1 file changed

+48
-46
lines changed

1 file changed

+48
-46
lines changed

README.md

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Pelion Client Mbed OS Example
22

3-
This is a simplified example with the following features:
4-
- Mbed OS 5.13 and Pelion Device Management Client 3.3.0
3+
This is a simplified example for Mbed OS with the following features:
4+
- Mbed OS 5.14.1 and Pelion Device Management Client 4.0.0
55
- Support for FW Update
66
- 200 lines of code + credential sources
77

8-
Note this application is considered **alpha** and given early access to Mbed Partners.
8+
There is an example of the client for multiple operating systems in [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example) repository. The underlying client library is the same for both. This Mbed OS only example is simpler as it only supports one OS, but if you want to do development in Linux and Mbed OS at the same time - you should use the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example).
99

1010
## Supported platforms
1111

@@ -16,8 +16,8 @@ Platform | Connectivity | Storage for credentials
1616
NXP K64F | Ethernet | Internal Flash | Internal Flash |
1717
NXP K66F | Ethernet | Internal Flash | Internal Flash |
1818
ST NUCLEO_F429ZI | Ethernet | Internal Flash | Internal Flash |
19-
ST NUCLEO_F411RE | WiFi IDW01M1 | SD card | SD card |
20-
Ublox UBLOX_EVK_ODIN_W2 | WiFi | SD card | SD card |
19+
ST NUCLEO_F411RE | Wi-Fi IDW01M1 | SD card | SD card |
20+
Ublox UBLOX_EVK_ODIN_W2 | Wi-Fi | SD card | SD card |
2121

2222
<span class="notes">**(*) Note**: the platforms require further testing</span>
2323

@@ -28,23 +28,25 @@ This section is intended for developers to get started, import the example appli
2828
## Requirements
2929

3030
- Mbed CLI >= 1.10.0
31-
31+
3232
For instructions on installing and using Mbed CLI, please see our [documentation](https://os.mbed.com/docs/mbed-os/latest/tools/developing-mbed-cli.html).
33-
33+
3434
- Install the `CLOUD_SDK_API_KEY`
3535

3636
`mbed config -G CLOUD_SDK_API_KEY ak_1MDE1...<snip>`
3737

3838
You should generate your own API key. Pelion Device Management is available for any Mbed developer. Create a [free trial](https://os.mbed.com/pelion-free-tier).
3939

40-
For instructions on how to generate your API key, please see our [documentation](https://cloud.mbed.com/docs/current/integrate-web-app/api-keys.html#generating-an-api-key).
40+
For instructions on how to generate your API key, please see our [documentation](https://cloud.mbed.com/docs/current/integrate-web-app/api-keys.html#generating-an-api-key).
4141

4242
## Deploying
4343

4444
This repository is in the process of being updated and depends on few enhancements being deployed in mbed-cloud-client. In the meantime, follow these steps to import and apply the patches before compiling.
4545

46+
```
4647
mbed import mbed-os-pelion-example
4748
cd mbed-os-pelion-example
49+
```
4850

4951
## Compiling
5052

@@ -61,7 +63,7 @@ This repository is in the process of being updated and depends on few enhancemen
6163
- Press 'i' to print endpoint name
6264
- Press Ctrl-C to to unregister
6365
- Press 'r' to reset storage and reboot (warning: it generates a new device ID!)
64-
66+
6567
## Further information and requirements
6668

6769
Check the public tutorial for further information:
@@ -73,13 +75,13 @@ Check the public tutorial for further information:
7375
- Device initializes but can't register to Pelion
7476

7577
Error: `client_error(3) -> Bootstrap server URL is not correctly formed`
76-
78+
7779
Solution: Format the the storage by pressing 'r' in the serial terminal.
78-
80+
7981
# Porting process to add support for an Mbed Enabled board
8082

8183
There are many steps involved in this process. We generally recomend the following steps:
82-
84+
8385
1. Configure the application using `mbed_app.json`
8486
- Configure the default connectivity
8587
- Configure the KVSTORE area to store credentials (internal or external memory)
@@ -104,19 +106,19 @@ You can extend or override the default configuration using `mbed_app.json` in th
104106
### a. Connectivity
105107

106108
Specify the default IP connectivity type for your target. It's essential with targets that lack default connectivity set in `targets.json` or for targets that support multiple connectivity options. For example:
107-
109+
108110
"target.network-default-interface-type" : "ETHERNET",
109-
111+
110112
The possible options are `ETHERNET`, `WIFI` and `CELLULAR`.
111-
113+
112114
Depending on connectivity type, you might have to specify more configuration options. Review the [documentation](https://os.mbed.com/docs/mbed-os/latest/porting/porting-connectivity.html) for further information.
113115

114116
### b. Storage for credentials
115117

116118
Start by getting familiar with the multiple [storage options](https://os.mbed.com/docs/mbed-os/latest/reference/storage.html) and configurations supported in Mbed OS.
117119

118120
Then start designing the system memory map, the location of components (whether they are on internal or external memory), and the corresponding base addresses and sizes. You may want to create a diagram similar to the one below to help you to make design decisions:
119-
121+
120122
+--------------------------+
121123
| |
122124
| |
@@ -151,19 +153,19 @@ You can extend or override the default configuration using `mbed_app.json` in th
151153
In cases where the MCU has two separate memory banks, it's appropiate to allocate the bootloader and base application in one bank, and KVSTORE storage at the begining of the second bank followed by a firmware candidate storage.
152154

153155
- **Option 1:** Allocating credentials in internal memory
154-
156+
155157
**This is the preferred option whenever possible**. Make sure `TDB_INTERNAL` is the type of storage selected in `mbed_app.json`. Specify the base address depending on the available memory in the system. The size of this section should be aligned with the flash erase sector. The value should be multiple of 4 with a minimum of 24KB and upwards depending on the use case (for example the usage of certificate chain will increase the need of storage to hold those certificates). An example of this configuration can be seen for the `NUCLEO_F429ZI` platform in this application.
156158

157-
"storage.storage_type" : "TDB_INTERNAL"
159+
"storage.storage_type" : "TDB_INTERNAL"
158160
"storage_tdb_internal.internal_base_address": "(MBED_ROM_START+1024*1024)",
159161
"storage_tdb_internal.internal_size" : "(128*1024)",
160162

161163
- **Option 2:** Allocating credentials in external memory:
162-
164+
163165
This is possible when the platform has an storage device wired to the MCU (could be on-board or external component). Make sure `FILESYSTEM` is specified as type of storage. The blockdevice and filesystem should be one of the supported in Mbed OS (see [docs](https://os.mbed.com/docs/mbed-os/latest/porting/blockdevice-port.html)).
164-
166+
165167
An example of this configuration can be seen for the `K64F` platform in the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/mbed_app.json#L32)
166-
168+
167169
"storage.storage_type" : "FILESYSTEM",
168170
"storage_filesystem.blockdevice" : "SD",
169171
"storage_filesystem.filesystem" : "LITTLE",
@@ -175,15 +177,15 @@ You can extend or override the default configuration using `mbed_app.json` in th
175177
### c. Storage for firmware updates
176178

177179
Before enabling FW updates, it's recomended that the application is able to initialize the network and connect to Pelion DM.
178-
179-
Once the connection is successfull, you can follow the steps below to enable the platform to receive FW updates. Note the configuration for the application in this section should match with the one on the bootloader - see section below.
180-
180+
181+
Once the connection is successfull, you can follow the steps below to enable the platform to receive FW updates. Note the configuration for the application in this section should match with the one on the bootloader - see section below.
182+
181183
- Common configuration
182-
184+
183185
Regardless of where the firmware candidate is located (internal or external), there is a need to have a bootloader in place. The binary of the booloader can be specified with the `bootloader_img` option. The address and size of the bootloader determines the `application-details` and `bootloader-details` options. The value of `bootloader-details` can be obtained by running the binary on the target and observing the serial output.
184-
186+
185187
Review the [mbed-bootloader](https://github.com/ARMmbed/mbed-bootloader#configurations) guidelines on how these options should be selected. Review the [bootloader configuration](2.-Bootloader-configuration) section below for more information.
186-
188+
187189
Copy the compiled bootloader from `mbed-bootloader/BUILDS/<TARGET>/<TOOLCHAIN>-TINY/mbed-bootloader.bin` to `bootloader/mbed-bootloader-<TARGET>.bin`.
188190

189191
Edit `mbed-os-pelion-example/mbed_app.json` and modify the target configuration to match with the one in `bootloader_app.json`.
@@ -195,34 +197,34 @@ You can extend or override the default configuration using `mbed_app.json` in th
195197
- `target.app_offset` is relative offset to `flash-start-address` you specified in `mbed_app.json` and `bootloader_app.json`, and is the hex value of the offset specified by `application-start-address` in `bootloader_app.json`. For example, `(MBED_CONF_APP_FLASH_START_ADDRESS+65*1024)` dec equals `0x10400` hex.
196198

197199
- `target.header_offset` is also relative offset to the `flash-start-address` you specified in the `bootloader_app.json`, and is the hex value of the offset specified by `update-client.application-details`. For example, `(MBED_CONF_APP_FLASH_START_ADDRESS+64*1024)` dec equals `0x10000` hex.</span>
198-
200+
199201
An example of this configuration can be seen for the `NUCLEO_F429ZI` platform.
200-
202+
201203
"update-client.application-details" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
202204
"update-client.bootloader-details" : "0x08007300",
203205
"target.bootloader_img" : "bootloader/mbed-bootloader-<target>",
204206
"target.header_offset" : "0x8000",
205207
"target.app_offset" : "0x8400",
206-
208+
207209
- **Option 1:** Allocating the firmware update candidate in internal memory
208210

209211
**This is the preferred option whenever possible**. Make sure `ARM_UCP_FLASHIAP` is selected in `update-storage` in `mbed_app.json`. This area should be located at the end of the flash after the KVSTORE area. Specify the `storage-address`, `storage-size` and `storage-page` as required. The `application-details` option should point at the end of the bootloader area. An example of this configuration can be seen for the `NUCLEO_F429ZI` platform.
210-
212+
211213
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP",
212214
"update-client.storage-address" : "(MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS+MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
213215
"update-client.storage-size" : "(1024*1024-MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
214216
"update-client.storage-page" : 1,
215217

216218
- **Option 2:** Allocating the firmware update candidate in external memory
217-
219+
218220
When using an external device to the MCU to store the firmware candidate, make sure `ARM_UCP_FLASHIAP_BLOCKDEVICE` is specified as type of `update-storage`. Specify the `storage-address`, `storage-size` and `storage-page` as required.
219-
221+
220222
An example of this configuration can be seen for the `K64F` platform in the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/mbed_app.json#L32)
221-
223+
222224
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
223225
"update-client.storage-address" : "(1024*1024*64)",
224226
"update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
225-
227+
226228
## 2. Bootloader configuration
227229

228230
The bootloader is required to perform FW Updates. The steps below explain how to create a new configuration and binary for the bootloader.
@@ -231,25 +233,25 @@ The bootloader is required to perform FW Updates. The steps below explain how to
231233

232234
1. Edit the bootloader application configuration in this example (`bootloader/bootloader_app.json`) and add a new target entry. An example of this configuration can be seen for the `NUCLEO_F429ZI` platform:
233235

234-
"update-client.firmware-header-version": "2",
235-
"mbed-bootloader.use-kvstore-rot": 0,
236-
"mbed-bootloader.bootloader-size": "APPLICATION_SIZE",
236+
237+
"update-client.firmware-header-version" : "2",
238+
"mbed-bootloader.use-kvstore-rot" : 0,
239+
"mbed-bootloader.bootloader-size" : "APPLICATION_SIZE",
237240
"update-client.application-details" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
238241
"mbed-bootloader.application-start-address": "(MBED_CONF_UPDATE_CLIENT_APPLICATION_DETAILS + MBED_BOOTLOADER_ACTIVE_HEADER_REGION_SIZE)",
239242
"mbed-bootloader.max-application-size" : "(MBED_ROM_START + MBED_BOOTLOADER_FLASH_BANK_SIZE - MBED_CONF_MBED_BOOTLOADER_APPLICATION_START_ADDRESS)",
240243
"update-client.storage-address" : "(MBED_ROM_START + MBED_BOOTLOADER_FLASH_BANK_SIZE + KVSTORE_SIZE)",
241244
"update-client.storage-size" : "(MBED_BOOTLOADER_FLASH_BANK_SIZE - KVSTORE_SIZE)",
242245
"update-client.storage-locations" : 1,
243-
"kvstore-size": "2*64*1024",
244-
"update-client.storage-page": 1
245-
246+
"kvstore-size" : "2*64*1024",
247+
"update-client.storage-page" : 1
248+
246249
1. Compile the bootloader using the `bootloader_app.json` configuration you've just edited:
247250

248-
mbed compile -t <TOOLCHAIN> -m <TARGET> --profile=tiny.json --app-config=.../mbed-os-pelion-example/bootloader/bootloader_app.json>
251+
`mbed compile -t <TOOLCHAIN> -m <TARGET> --profile=tiny.json --app-config=.../mbed-os-pelion-example/bootloader/bootloader_app.json>`
249252

250253
<span class="notes">**Note:** `mbed-bootloader` is primarily optimized for `GCC_ARM`, so you may want to compile it with that toolchain.
251-
Before jumping to the next step, you should compile and flash the bootloader and then connect over the virtual serial port to ensure the bootloader is running correctly. You can ignore errors related to checksum verification or falure to jump to application - these are expected at this stage.</span>
252-
254+
Before jumping to the next step, you should compile and flash the bootloader and then connect over the virtual serial port to ensure the bootloader is running correctly. You can ignore errors related to checksum verification or failure to jump to application - these are expected at this stage.</span>
253255

254256
## Validation and testing
255257

@@ -262,8 +264,8 @@ In addition to having an example application succesfully connected to Pelion DM,
262264
- Mbed OS integration tests
263265

264266
See [mbed-os/TESTS/integration/README.md](https://github.com/ARMmbed/mbed-os/blob/sip-workshop/TESTS/integration/README.md) (sip-workshop branch)
265-
266-
`mbed test -t <toolchain> -m <platform> -n *integration-* -DINTEGRATION_TESTS -v `
267+
268+
`mbed test -t <toolchain> -m <platform> -n *integration-* -DINTEGRATION_TESTS -v`
267269

268270
- Pelion Client tests, including firmware update.
269271

0 commit comments

Comments
 (0)