Skip to content

Commit 14d6230

Browse files
authored
Feature/nrf52 release script (ARMmbed#113)
* Add release script features for nrf52_dk * Add binary naming info in release process doc
1 parent 289b368 commit 14d6230

File tree

4 files changed

+110
-21
lines changed

4 files changed

+110
-21
lines changed

configs/nrf52_mbed_app.json renamed to configs/nrf52_block_device_fake_rot.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@
3333
"update-client.firmware-header-version": "2"
3434
},
3535
"NRF52_DK": {
36-
"minimal-printf.console-output" : "SWO",
37-
"target.app_offset" : "0x74000",
38-
"update-client.application-details": "(508*1024)",
39-
"application-start-address" : "(152*1024)",
40-
"max-application-size" : "((456-152)*1024)",
41-
"target.extra_labels_remove" : ["SOFTDEVICE_S132_FULL", "SOFTDEVICE_COMMON"],
42-
"target.extra_labels_add" : ["SOFTDEVICE_S132_MBR"],
43-
"update-client.storage-address" : "(64*1024*1024)",
44-
"update-client.storage-size" : "(2*1024*1024)",
45-
"update-client.storage-locations" : 1,
46-
"update-client.storage-page" : 512
36+
"minimal-printf.console-output" : "SWO",
37+
"target.app_offset" : "0x74000",
38+
"update-client.application-details" : "(508*1024)",
39+
"application-start-address" : "(152*1024)",
40+
"max-application-size" : "((456-152)*1024)",
41+
"target.extra_labels_remove" : ["SOFTDEVICE_S132_FULL", "SOFTDEVICE_COMMON"],
42+
"target.extra_labels_add" : ["SOFTDEVICE_S132_MBR"],
43+
"update-client.storage-address" : "(64*1024*1024)",
44+
"update-client.storage-size" : "(2*1024*1024)",
45+
"update-client.storage-locations" : 1,
46+
"update-client.storage-page" : 512
4747
}
4848
}
4949
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"macros": [
3+
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\"",
4+
"PAL_USER_DEFINED_CONFIGURATION=\"sotp_fs_config_MbedOS.h\"",
5+
"MAX_COPY_RETRIES=1",
6+
"SHOW_PROGRESS_BAR=1",
7+
"MAX_BOOT_RETRIES=3",
8+
"ARM_UC_USE_PAL_CRYPTO=0",
9+
"Mutex=PlatformMutex",
10+
"PAL_USE_INTERNAL_FLASH=1",
11+
"PAL_THREAD_SAFETY=0",
12+
"ARM_UC_USE_SOTP=0",
13+
"MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP",
14+
"ARM_UC_USE_PAL_BLOCKDEVICE=1",
15+
"PAL_INT_FLASH_NUM_SECTIONS=2"
16+
],
17+
"config": {
18+
"application-start-address": {
19+
"help": "Address of the active application firmware in flash",
20+
"value": null
21+
},
22+
"max-application-size": {
23+
"help": "Maximum size of the active application",
24+
"value": null
25+
}
26+
},
27+
"target_overrides": {
28+
"*": {
29+
"target.features_remove": ["LWIP"],
30+
"target.features_add": ["COMMON_PAL"],
31+
"platform.stdio-baud-rate": 115200,
32+
"platform.stdio-flush-at-exit": false,
33+
"update-client.firmware-header-version": "2"
34+
},
35+
"NRF52_DK": {
36+
"minimal-printf.console-output" : "SWO",
37+
"target.app_offset" : "0x74000",
38+
"update-client.application-details" : "(508*1024)",
39+
"application-start-address" : "(152*1024)",
40+
"max-application-size" : "(156*1024)",
41+
"update-client.storage-address" : "(308*1024)",
42+
"update-client.storage-size" : "(156*1024)",
43+
"update-client.storage-locations" : 1,
44+
"update-client.storage-page" : 4,
45+
"target.extra_labels_remove" : ["SOFTDEVICE_S132_FULL", "SOFTDEVICE_COMMON"],
46+
"target.extra_labels_add" : ["SOFTDEVICE_S132_MBR"]
47+
}
48+
}
49+
}

scripts/make_release.py

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
# ----------------------------------------------------------------------------
1919

2020
from subprocess import check_output, call
21+
from intelhex import IntelHex
2122
import re, os
2223

2324
# the memory start address of platforms
2425
mem_starts = {
2526
"K64F": 0,
27+
"NRF52_DK": 0,
2628
"NUCLEO_F429ZI": 0x08000000,
2729
"UBLOX_EVK_ODIN_W2": 0x08000000,
2830
"UBLOX_C030_U201": 0x08000000
@@ -34,15 +36,27 @@
3436
),
3537
"internal_flash_sotp": (
3638
"configs/internal_flash_sotp.json", "internal-flash", "sotp"
39+
),
40+
"internal_flash_fake_rot": (
41+
"configs/internal_flash_fake_rot.json", "internal-flash", "fake-rot"
42+
),
43+
"nrf52_block_device_fake_rot": (
44+
"configs/nrf52_block_device_fake_rot.json", "block-device", "fake-rot"
45+
),
46+
"nrf52_internal_flash_fake_rot": (
47+
"configs/nrf52_internal_flash_fake_rot.json", "internal-flash", "fake-rot"
3748
)
3849
}
3950
# format: ("target", "config_name")
4051
targets = [
4152
("K64F", "default"),
4253
("K64F", "internal_flash_sotp"),
54+
("K64F", "internal_flash_fake_rot"),
4355
("NUCLEO_F429ZI", "default"),
4456
("UBLOX_EVK_ODIN_W2", "default"),
45-
("UBLOX_C030_U201", "default")
57+
("UBLOX_C030_U201", "default"),
58+
("NRF52_DK", "nrf52_block_device_fake_rot"),
59+
("NRF52_DK", "nrf52_internal_flash_fake_rot")
4660
]
4761
toolchain = "GCC_ARM"
4862
profile = "tiny.json" # default value, changed via command line arg --profile
@@ -187,6 +201,16 @@ def find_offset(map_file, symbol):
187201

188202
return int(match.groups()[0], 16)
189203

204+
def mergehex(fn_1, fn_2):
205+
"""
206+
merge two hex files write back to file 1.
207+
"""
208+
ih_1 = IntelHex(fn_1)
209+
ih_2 = IntelHex(fn_2)
210+
ih_1.merge(ih_2)
211+
212+
ih_1.tofile(fn_1, format='hex')
213+
190214
if __name__ == '__main__':
191215
import shutil, os, glob,json, pprint, argparse, sys
192216
from collections import OrderedDict
@@ -253,7 +277,11 @@ def find_offset(map_file, symbol):
253277

254278
build_dir = "./BUILD/{}/{}/".format(target, toolchain)
255279
map_file = path.join(build_dir, bootloader_repo_name+'.map')
256-
bin_file = path.join(build_dir, bootloader_repo_name+'.bin')
280+
bin_file_type = "bin"
281+
if target == "NRF52_DK":
282+
map_file = path.join(build_dir, bootloader_repo_name+'_application.map')
283+
bin_file_type = "hex"
284+
bin_file = path.join(build_dir, bootloader_repo_name+'.'+bin_file_type)
257285

258286
# find bootloader details offset
259287
bootloader_offset = find_offset(map_file, "bootloader")
@@ -296,12 +324,17 @@ def find_offset(map_file, symbol):
296324
addr = app_config_js['target_overrides'][target][field]
297325
s = s.replace(addr, "0x{:08X}".format(bootloader_offset))
298326

299-
# validation
300-
if validate_config(bootloader_config_js,
301-
app_config_js, target, bin_file):
302-
target_config_exist = True
327+
bootloader_storage = bootloader_configs[bootloader_config_name][1]
328+
if target != "NRF52_DK" and update_storage != "fake-rot":
329+
# validation
330+
if validate_config(bootloader_config_js,
331+
app_config_js, target, bin_file):
332+
target_config_exist = True
333+
else:
334+
print("Config validation failed")
335+
sys.exit(1)
303336
else:
304-
sys.exit(1)
337+
target_config_exist = True
305338
except KeyError:
306339
print "no config in this file for target", target
307340

@@ -318,9 +351,16 @@ def find_offset(map_file, symbol):
318351
git_desc = get_git_desc()
319352
release_desc = git_desc.replace('.', '_')
320353

321-
fn = 'mbed-bootloader-{}-{}-{}-{}.bin'.format(
322-
target_name, bootloader_storage, bootloader_rot, release_desc)
354+
fn = 'mbed-bootloader-{}-{}-{}-{}.{}'.format(
355+
target_name, bootloader_storage, bootloader_rot,
356+
release_desc, bin_file_type)
323357
dst = path.join(example_dir, 'tools', fn)
324358

359+
if target == "NRF52_DK":
360+
print "merging uicr with bootloader"
361+
# merge bootloader with uicr
362+
uicr_fn = "scripts/uicr-0x74000.hex"
363+
mergehex(bin_file, uicr_fn)
364+
325365
print dst, path.isfile(dst)
326366
shutil.copyfile(bin_file, dst)

scripts/release_process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
1. Combine the bootloaer and the example application
2727
1. Perform an full e2e update to make sure bootloader works correctly. Some of this is automated in the CI but need to make sure each binary is tested in at least one of the configurations.
2828
1. Make sure the bootloader details is correctly read. Look for the trace `ARM_UC_HUB_STATE_REPORT_INSTALLER_DETAILS`
29-
1. Submit pull request to [example app](https://github.com/ARMmbed/mbed-cloud-client-example-internal/) best to mention the SHA-1 of the binary's origin. The file name of the generated binary now contain `git describe` information, make sure you add new bin and remove the old ones.
29+
1. Submit pull request to [example app](https://github.com/ARMmbed/mbed-cloud-client-example-internal/) best to mention the SHA-1 of the binary's origin. The file name of the generated binary now contain `git describe` information, make sure you add new bin and remove the old ones. The naming scheme is `mbed-bootloader-{target}-{storage_option}-{rot_option}-{git describe --tags --abbrev=4}.bin`
3030
1. Repeat the same for [testapp](https://github.com/ARMmbed/mbed-client-testapp)
3131

3232
# External release to restricted repo

0 commit comments

Comments
 (0)