diff --git a/README.md b/README.md index 4618100..5906cbb 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ SoftDevice | FWID (sd-req) `s132_nrf52_4.0.0` | 0x95 `s132_nrf52_4.0.2` | 0x98 `s132_nrf52_4.0.3` | 0x99 +`s132_nrf52_4.0.4` | 0x9E `s132_nrf52_5.0.0` | 0x9D **Note**: The Thread stack doesn't use a SoftDevice but --sd-req option is required for compatibility reasons. You can provide any value for the option as it is ignored during DFU. @@ -159,16 +160,18 @@ The following conventions are used on the table: Combination | Supported | Notes --------------| ----------|------- BL | Yes | -SD | Yes | **See notes 1 and 2 below** +SD | Yes | **See note 1 below** APP | Yes | BL + SD | Yes | BL + APP | No | Create two .zip packages instead -BL + SD + APP | Yes | **See note 1 below** +BL + SD + APP | Yes | **See note 2 below** SD + APP | Yes | **See notes 1 and 2 below** **Note 1:** SD must be of the same Major Version as the old BL may not be compatible with the new SD. -**Note 2:** When updating BL + SD + APP the update is done in 2 following connections, unless a custom bootloader is used. First the BL + SD is updated, then the bootloader will disconnect and the new BL will start advertising. Second connection to the new bootloader will update the APP. However, the two SDs may have different IDs. The first update requires --sd-req to be set to the ID of the old SD while update of the APP requires the ID of the new SD. In that case the new ID can be set using ```--sd-id``` parameter. +**Note 2:** When updating SD (+ BL) + APP the update is done in 2 following connections, unless a custom bootloader is used. First the SD (+ BL) is updated, then the bootloader will disconnect and the (new) BL will start advertising. Second connection to the bootloader will update the APP. However, the two SDs may have different IDs. The first update requires `--sd-req` to be set to the ID of the old SD. Update of the APP requires the ID of the new SD. In that case the new ID must be set using `--sd-id` parameter. This parameter is +was added in nrfutil 3.1.0 and is required since 3.2.0 in case the package should contain SD (+ BL) + APP. Also, since version 3.2.0 the new ID is copied to `--sd-req` list so that +in case of a link loss during APP update the DFU process can be restarted. In that case the new SD would overwrite itself, so `--sd-req` must contain also the ID of the new SD. ##### display Use this option to display the contents of a DFU package in a .zip file. diff --git a/nordicsemi/__main__.py b/nordicsemi/__main__.py index 31b3fe9..c664284 100644 --- a/nordicsemi/__main__.py +++ b/nordicsemi/__main__.py @@ -390,6 +390,7 @@ def pkg(): '\n|s132_nrf52_4.0.0|0x95|' '\n|s132_nrf52_4.0.2|0x98|' '\n|s132_nrf52_4.0.3|0x99|' + '\n|s132_nrf52_4.0.4|0x9E|' '\n|s132_nrf52_5.0.0|0x9D|', type=click.STRING, multiple=True) @@ -527,6 +528,10 @@ def generate(zipfile, click.echo("Error: --bootloader-version required with bootloader image.") return + if application is not None and softdevice is not None and sd_id is None: + click.echo("Error: --sd-id required with softdevice and application images.") + return + sd_req_list = [] if sd_req is not None: try: @@ -543,6 +548,14 @@ def generate(zipfile, # This will parse any string starting with 0x as base 16. sd_id_list = sd_id.split(',') sd_id_list = map(int_as_text_to_int, sd_id_list) + + # Copy all IDs from sd_id_list to sd_req_list, without duplicates. + # This ensures that the softdevice update can be repeated in case + # SD+(BL)+App update terminates during application update after the + # softdevice was already updated (with new ID). Such update would + # have to be repeated and the softdevice would have to be sent again, + # this time updating itself. + sd_req_list += set(sd_id_list) - set(sd_req_list) except ValueError: raise NordicSemiException("Could not parse value for --sd-id. " "Hex values should be prefixed with 0x.") diff --git a/nordicsemi/version.py b/nordicsemi/version.py index 9e33ffe..4f0dc72 100644 --- a/nordicsemi/version.py +++ b/nordicsemi/version.py @@ -37,4 +37,4 @@ """ Version definition for nrfutil. """ -NRFUTIL_VERSION = "3.1.0" +NRFUTIL_VERSION = "3.2.0"