Skip to content

Commit 98a5b1f

Browse files
LiyouZhouevedon
authored andcommitted
Add an Example config case study (ARMmbed#153)
Add tutorial for changing various settings.
1 parent 66c6844 commit 98a5b1f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,62 @@ The firmware update candidates can be stored on an external sd card. The firmwar
156156
## Debug
157157

158158
Debug prints can be turned on by enabling the define `#define tr_debug(fmt, ...) printf("[DBG ] " fmt "\r\n", ##__VA_ARGS__)` in `source/bootloader_common.h` and setting the `ARM_UC_ALL_TRACE_ENABLE=1` macro on command line `mbed compile -DARM_UC_ALL_TRACE_ENABLE=1`.
159+
160+
## Example config case study
161+
162+
Scenario: Your target is NUCLEO_F429ZI. You have added extra functionality to the bootloader such that the size of the bootloader exceeded the default 32KiB. How to configure your bootloader and application so that everything still work together.
163+
164+
### STEP 1: Design flash layout
165+
166+
NUCLEO_F429ZI has 2MiB of flash, and its sector sizes are as follows: 4x16KiB, 1x64KiB, 7x128KiB, 4x16KiB, 1x64KiB, 7x128KiB.
167+
Because the bootloader is larger than 32KiB, it will take the first 3 sectors. The NVStore area can no longer take 2x16KiB sectors. Hence we will move NVSTORE to the last 2x128KiB sectors in the flash region. So we will end up with the following layout:
168+
169+
```
170+
0x00000000 - 0x0000C000 Bootloader
171+
0x0000C000 - 0x0000C400 Application Header
172+
0x0000C400 - 0x001C0000 Application
173+
0x001C0000 - 0x001E0000 NVSTORE_1
174+
0x001C0000 - 0x00200000 NVSTORE_2
175+
```
176+
177+
The update firmware candidate is still stored on sd-card.
178+
179+
### STEP 2: Configure the bootloader
180+
181+
Given the above flash layout the following configuration need to change in the mbed_app.json:
182+
183+
1. "nvstore.area_1_address": "(0x08000000+(2*1024-2*128)*1024)"
184+
1. "nvstore.area_1_size": "(128*1024)"
185+
1. "nvstore.area_2_address": "(0x08000000+(2*1024-128)*1024)"
186+
1. "nvstore.area_2_size": "(128*1024)"
187+
1. "update-client.application-details": "(0x08000000+3*16*1024)"
188+
1. "application-start-address": "(0x08000000+(3*16+1)*1024)"
189+
1. "max-application-size" : "((1024*2-128*2-3*16-1)*1024)"
190+
191+
Now compile your bootloader. Flash and run the bootloader, on the serial uart you will see the following printout:
192+
193+
> Layout: <layout_no> <boot_loader_info_address>
194+
195+
Keep a note of the `boot_loader_info_address` which we will use in the next step.
196+
197+
### STEP 3: Configure the Pelion Cloud Client Application
198+
199+
In mbed_app.json, change the following:
200+
201+
1. "update-client.application-details" : "(0x08000000+3*16*1024)"
202+
1. "update-client.bootloader-details" : "<boot_loader_info_address>"
203+
204+
In mbed_lib.json change the following:
205+
206+
1. "sotp-section-1-address": "(0x08000000+(2*1024-2*128)*1024)",
207+
1. "sotp-section-1-size": "(128*1024)",
208+
1. "sotp-section-2-address": "(0x08000000+(2*1024-128)*1024)",
209+
1. "sotp-section-2-size": "(128*1024)"
210+
211+
Also add the following in mbed_app.json:
212+
213+
1. "target.app_offset": "0x800c400",
214+
1. "target.header_offset": "0x800c000",
215+
1. "target.bootloader_img": "<path_to_your_newly_built_image>"
216+
217+
Now you can build the application following the [Pelion Device Management Platform Documentation](https://cloud.mbed.com/docs/current/updating-firmware/updating-end-to-end-tutorials.html).

0 commit comments

Comments
 (0)