Skip to content

Commit 31319a8

Browse files
authored
Feature/stop configs (ARMmbed#88)
* fix stm based platfrom addresses The start of flash is 0x0800000 Add () around defines to be safe * improve make release script - Deal with multiple configs for the same board - Add validation of config make sure settings match - use bootloader binary naming scheme: mbed-bootloader-{target}-{storage option}-{rot option}-{version description} * Update documentation
1 parent c865a77 commit 31319a8

File tree

5 files changed

+283
-104
lines changed

5 files changed

+283
-104
lines changed

README.md

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ The interface between the bootloader and an 'update-client' have been described
2020
## Configurations
2121

2222
User **must** set in `mbed_app.json`:
23-
1. `firmware_metadata_header_address`, Offset at which the metadata header of the active firmware is written. **Must align to flash erase boundary**
24-
1. `firmware_metadata_header_size`, Size of the active metadata header region. The application starts at `firmware_metadata_header_address + firmware_metadata_header_size`. **Must align to vector table size boundary and flash erase boundary**
25-
1. `update-client.application-details`, This is the same as `firmware_metadata_header_address` but needs to be configured to allow the dependency module of bootloader to pick up this configuration.
26-
1. `update-client.storage-address`, The offset from the begining of sd block device where the firmware candidates are stored.
27-
1. `update-client.storage-size`, total size on the block device reserved for firmware storage
23+
1. `update-client.application-details`, Address at which the metadata header of the active firmware is written. **Must align to flash erase boundary**
24+
1. `application-start-address`, Address at which The application starts **Must align to vector table size boundary and flash write page boundary**. It is assumed the region between `update-client.application-details` and `application-start-address` contains only the header. MUST be the same as "target.mbed_app_start" in the application.
25+
1. `update-client.storage-address`, The address in sd block device or internal flash where the firmware candidates are stored. **Must align to flash erase boundary**
26+
1. `update-client.storage-size`, total size on the block device or internal flash reserved for firmware storage. It will be rounded up to align with flash erase sector size automatically.
27+
1. `update-client.storage-locations`, The number of slots in the firmware storage.
28+
1. `update-client.storage-page`, The write page size of the underlying storage.
29+
30+
If you are using SOTP to provide the RoT, you must set the following:
31+
- "sotp-section-1-address", "sotp-section-1-size", "sotp-section-2-address", "sotp-section-2-size"
32+
The addresses **Must align to flash erase boundary**. The sizes must be full sector sized and at least 1k large.
2833

2934
All these configurations must be set the same in the mbed cloud client when compiling the corresponding application for successful update operation.
3035

@@ -35,28 +40,37 @@ User **may** set in `mbed_app.json`:
3540
1. `SHOW_PROGRESS_BAR`, Set to 1 to print a progress bar for various processes.
3641

3742
## Flash Layout
38-
### The expected flash layout
43+
### The flash layout for K64F with SOTP and firmware storage on internal flash
3944
```
4045
+--------------------------+
46+
| LittelFS |
47+
| (Does not concern |
48+
| Bootloader) | update-client.storage-address
49+
+--------------------------+ <-+ +
50+
| | update-client.storage-size
4151
| |
4252
| |
53+
|Firmware Candidate Storage|
4354
| |
44-
| |
45-
+--------------------------+
46-
| |
4755
| |
4856
| |
49-
| Active App |
57+
+--------------------------+ <-+ update-client.storage-address
5058
| |
5159
| |
52-
   |                         | firmware_metadata_header_address
53-
   +--------------------------+ <-+   +
54-
   |                         | firmware_metadata_header_size
55-
|Active App Metadata Header|
5660
| |
57-
+--------------------------+ <-+ firmware_metadata_header_address
61+
| Active App |
5862
| |
59-
+--------------------------+
63+
| |
64+
   |                         |
65+
   +--------------------------+ <-+ application-start-address
66+
   |                         |
67+
|Active App Metadata Header|
68+
| |
69+
+--------------------------+ <-+ update-client.application-details
70+
| SOTP_2 |
71+
+--------------------------+ <-+ sotp-section-2-address
72+
| SOTP_1 |
73+
+--------------------------+ <-+ sotp-section-1-address
6074
| |
6175
| Bootloader |
6276
| |
@@ -67,17 +81,19 @@ User **may** set in `mbed_app.json`:
6781
### Alignment
6882
**Flash Erase Boundary**: Flash can usually only be erased in blocks of specific sizes, this is platform specific and hence many regions need to align to this boundary.
6983

84+
**Flash Page Boundary**: Flash can usually only be written in blocks of specific sizes, this is platform specific and hence many regions need to align to this boundary.
85+
7086
**Vector Table Size Boundary**: The ARM architecture dictates that the Vector table of the application must be placed at an address that aligns to the next power of 2 of the size of the vector table.
7187

7288
## External Storage
7389

74-
The firmware update candidates are currently stored on an external sd card. The firmware is stored sequencially on the block device. The expected layout is as follows:
90+
The firmware update candidates can be stored on an external sd card. The firmware is stored sequentially on the block device. The expected layout is as follows:
7591
```
7692
+--------------------------+<-+ End of SD card block device
7793
| |
7894
+--------------------------+<-+ update-client.storage-size + update-client.storage-address
7995
| |
80-
   +--------------------------+
96+
   +--------------------------+
8197
   |                         |
8298
| Firmware Candidate 1 |
8399
| |

configs/internal_flash_config.json renamed to configs/internal_flash_sotp.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
"update-client.firmware-header-version": "2"
5151
},
5252
"K64F": {
53-
"sotp-section-1-address" : "32*1024",
54-
"sotp-section-1-size" : "4*1024",
55-
"sotp-section-2-address" : "36*1024",
56-
"sotp-section-2-size" : "4*1024",
57-
"update-client.application-details": "40*1024",
58-
"application-start-address" : "41*1024",
53+
"sotp-section-1-address" : "( 32*1024)",
54+
"sotp-section-1-size" : "( 4*1024)",
55+
"sotp-section-2-address" : "( 36*1024)",
56+
"sotp-section-2-size" : "( 4*1024)",
57+
"update-client.application-details": "( 40*1024)",
58+
"application-start-address" : "( 41*1024)",
5959
"max-application-size" : "(MBED_CONF_UPDATE_CLIENT_STORAGE_ADDRESS-MBED_CONF_APP_APPLICATION_START_ADDRESS)",
60-
"update-client.storage-address" : "436*1024",
61-
"update-client.storage-size" : "388*1024",
60+
"update-client.storage-address" : "(436*1024)",
61+
"update-client.storage-size" : "(388*1024)",
6262
"update-client.storage-locations" : 1,
6363
"update-client.storage-page" : 8
6464
}

mbed_app.json

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -48,82 +48,82 @@
4848
"target.features_add": ["COMMON_PAL"],
4949
"platform.stdio-baud-rate": 115200,
5050
"platform.stdio-flush-at-exit": false,
51-
"update-client.storage-address": "1024*1024*64",
52-
"update-client.storage-size": "1024*1024",
51+
"update-client.storage-address": "(1024*1024*64)",
52+
"update-client.storage-size": "(1024*1024)",
5353
"update-client.storage-locations": 1,
5454
"update-client.firmware-header-version": "2"
5555
},
5656
"K64F": {
57-
"sotp-section-1-address" : "32*1024",
58-
"sotp-section-1-size" : "4*1024",
59-
"sotp-section-2-address" : "36*1024",
60-
"sotp-section-2-size" : "4*1024",
61-
"update-client.application-details": "40*1024",
62-
"application-start-address" : "41*1024",
57+
"sotp-section-1-address" : "(32*1024)",
58+
"sotp-section-1-size" : "( 4*1024)",
59+
"sotp-section-2-address" : "(36*1024)",
60+
"sotp-section-2-size" : "( 4*1024)",
61+
"update-client.application-details": "(40*1024)",
62+
"application-start-address" : "(41*1024)",
6363
"max-application-size" : "(1024*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
6464
},
6565
"K66F": {
66-
"sotp-section-1-address" : "32*1024",
67-
"sotp-section-1-size" : "4*1024",
68-
"sotp-section-2-address" : "36*1024",
69-
"sotp-section-2-size" : "4*1024",
70-
"update-client.application-details": "40*1024",
71-
"application-start-address" : "41*1024",
66+
"sotp-section-1-address" : "(32*1024)",
67+
"sotp-section-1-size" : "( 4*1024)",
68+
"sotp-section-2-address" : "(36*1024)",
69+
"sotp-section-2-size" : "( 4*1024)",
70+
"update-client.application-details": "(40*1024)",
71+
"application-start-address" : "(41*1024)",
7272
"max-application-size" : "(2048*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
7373
},
7474
"KW24D": {
75-
"sotp-section-1-address" : "32*1024",
76-
"sotp-section-1-size" : "2*1024",
77-
"sotp-section-2-address" : "34*1024",
78-
"sotp-section-2-size" : "2*1024",
79-
"update-client.application-details": "36*1024",
80-
"application-start-address" : "37*1024",
75+
"sotp-section-1-address" : "(32*1024)",
76+
"sotp-section-1-size" : "( 2*1024)",
77+
"sotp-section-2-address" : "(34*1024)",
78+
"sotp-section-2-size" : "( 2*1024)",
79+
"update-client.application-details": "(36*1024)",
80+
"application-start-address" : "(37*1024)",
8181
"max-application-size" : "(512*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
8282
},
8383
"NUCLEO_L476RG": {
84-
"sotp-section-1-address" : "32*1024",
85-
"sotp-section-1-size" : "2*1024",
86-
"sotp-section-2-address" : "34*1024",
87-
"sotp-section-2-size" : "2*1024",
88-
"update-client.application-details": "36*1024",
89-
"application-start-address" : "38*1024",
84+
"sotp-section-1-address" : "(0x08000000+32*1024)",
85+
"sotp-section-1-size" : "(0x08000000+ 2*1024)",
86+
"sotp-section-2-address" : "(0x08000000+34*1024)",
87+
"sotp-section-2-size" : "(0x08000000+ 2*1024)",
88+
"update-client.application-details": "(0x08000000+36*1024)",
89+
"application-start-address" : "(0x08000000+38*1024)",
9090
"max-application-size" : "(1024*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
9191
},
9292
"DISCO_L476VG": {
93-
"sotp-section-1-address" : "32*1024",
94-
"sotp-section-1-size" : "2*1024",
95-
"sotp-section-2-address" : "34*1024",
96-
"sotp-section-2-size" : "2*1024",
97-
"update-client.application-details": "36*1024",
98-
"application-start-address" : "38*1024",
93+
"sotp-section-1-address" : "(0x08000000+32*1024)",
94+
"sotp-section-1-size" : "(0x08000000+ 2*1024)",
95+
"sotp-section-2-address" : "(0x08000000+34*1024)",
96+
"sotp-section-2-size" : "(0x08000000+ 2*1024)",
97+
"update-client.application-details": "(0x08000000+36*1024)",
98+
"application-start-address" : "(0x08000000+38*1024)",
9999
"max-application-size" : "(1024*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
100100
},
101101
"NUCLEO_F429ZI": {
102-
"sotp-section-1-address" : "32*1024",
103-
"sotp-section-1-size" : "16*1024",
104-
"sotp-section-2-address" : "48*1024",
105-
"sotp-section-2-size" : "16*1024",
106-
"update-client.application-details": "64*1024",
107-
"application-start-address" : "65*1024",
102+
"sotp-section-1-address" : "(0x08000000+32*1024)",
103+
"sotp-section-1-size" : "(0x08000000+16*1024)",
104+
"sotp-section-2-address" : "(0x08000000+48*1024)",
105+
"sotp-section-2-size" : "(0x08000000+16*1024)",
106+
"update-client.application-details": "(0x08000000+64*1024)",
107+
"application-start-address" : "(0x08000000+65*1024)",
108108
"max-application-size" : "(2048*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
109109
},
110110
"UBLOX_EVK_ODIN_W2": {
111111
"target.device_has_remove": ["EMAC"],
112-
"sotp-section-1-address" : "32*1024",
113-
"sotp-section-1-size" : "16*1024",
114-
"sotp-section-2-address" : "48*1024",
115-
"sotp-section-2-size" : "16*1024",
116-
"update-client.application-details": "64*1024",
117-
"application-start-address" : "65*1024",
112+
"sotp-section-1-address" : "(0x08000000+32*1024)",
113+
"sotp-section-1-size" : "(0x08000000+16*1024)",
114+
"sotp-section-2-address" : "(0x08000000+48*1024)",
115+
"sotp-section-2-size" : "(0x08000000+16*1024)",
116+
"update-client.application-details": "(0x08000000+64*1024)",
117+
"application-start-address" : "(0x08000000+65*1024)",
118118
"max-application-size" : "(2048*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
119119
},
120120
"UBLOX_C030_U201": {
121-
"sotp-section-1-address" : "32*1024",
122-
"sotp-section-1-size" : "16*1024",
123-
"sotp-section-2-address" : "48*1024",
124-
"sotp-section-2-size" : "16*1024",
125-
"update-client.application-details": "64*1024",
126-
"application-start-address" : "65*1024",
121+
"sotp-section-1-address" : "(0x08000000+32*1024)",
122+
"sotp-section-1-size" : "(0x08000000+16*1024)",
123+
"sotp-section-2-address" : "(0x08000000+48*1024)",
124+
"sotp-section-2-size" : "(0x08000000+16*1024)",
125+
"update-client.application-details": "(0x08000000+64*1024)",
126+
"application-start-address" : "(0x08000000+65*1024)",
127127
"max-application-size" : "(1024*1024-MBED_CONF_APP_APPLICATION_START_ADDRESS)"
128128
}
129129
}

0 commit comments

Comments
 (0)