Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #82 from NordicSemiconductor/feature/sd-id
Browse files Browse the repository at this point in the history
SD-ID updated
  • Loading branch information
bencefr authored Jul 7, 2017
2 parents 5266adc + 810eac3 commit 2de577f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions nordicsemi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion nordicsemi/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@

""" Version definition for nrfutil. """

NRFUTIL_VERSION = "3.1.0"
NRFUTIL_VERSION = "3.2.0"

0 comments on commit 2de577f

Please sign in to comment.