Skip to content

Commit 4d7af22

Browse files
author
Veijo Pesonen
committed
README: Adds instructions how to obtain bootloader-details
1 parent d4c30ae commit 4d7af22

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,21 @@ For this information to propagate to the cloud, the 3 macros (`BOOTLOADER_ARM_SO
7979
1. `BOOTLOADER_OEM_SOURCE_HASH` is used to indicate any modification that OEMs have made on top of the vanilla mbed-bootloader. Hence it should be populated with the OEM modified bootloader SHA-1 git commit hash.
8080
1. `BOOTLOADER_STORAGE_LAYOUT` is a proprietary enum to indicate the storage layout supported by this bootloader. The OEM is free to define the meaning of this number.
8181

82-
In order for the cloud client to recognise this struct and obtain the information. The offset of the symbol in the bootloader binary needs to be populated in the cloud client's configuration file:
83-
1. Compile the bootloader. Flash and run the bootloader. On the serial UART you will see the following printout:
82+
In order for the cloud client to recognise this struct and obtain the information. The offset of the symbol in the bootloader binary needs to be populated in the cloud client's configuration file. This information can be obtained from the map file of the compiled bootloader.
8483

85-
> Layout: <layout_no> <boot_loader_info_address>
86-
1. Keep a note of the `boot_loader_info_address` which we will use in the next step.
87-
1. In the `mbed_app.json` of the Pelion Cloud Client Application, change the following: `"update-client.bootloader-details" : "<boot_loader_info_address>"`
84+
1. Example python code for obtaining the location:
85+
```python
86+
with open("BUILD/UBLOX_EVK_ODIN_W2/GCC_ARM/mbed-bootloader.map", 'r') as fd:
87+
s = fd.read()
88+
89+
regex = r"\.rodata\..*{}\s+(0x[0-9a-fA-F]+)".format("bootloader")
90+
match = re.search(regex, s, re.MULTILINE)
91+
offset = int(match.groups()[0], 16)
92+
print hex(offset)
93+
```
94+
1. In the `mbed_app.json` of the Pelion Cloud Client Application, change the following:
95+
96+
> `"update-client.bootloader-details" : "<boot_loader_info_address>"`
8897

8998
### MISC
9099

0 commit comments

Comments
 (0)