nRF51 SDK - S110 SoftDevice
|
When updating the application on the chip, you can use an init packet in DFU to perform a safety check of the application image before it is transferred. This init packet provides a mechanism to include safety checks as part of the update procedure, so that a device accepts only compatible applications.
The init packet contains the following information that can be used for safety checks (see dfu_init_packet_t):
The nRF51 SDK provides a template, dfu_init_template.c
, to perform safety checks of the init packet. This template can be used as starting point to develop procedures that increase the safety of DFU.
The device and revision types can be stored in the user-reserved area of UICR
(0x10001080
) on the nRF51 chip. If this location is used for other purposes, update the offset UICR_CUSTOMER_DEVICE_INFO_OFFSET in dfu_init.h
to match a free location in UICR.
The default value in UICR
is 0xFFFF
. If this value is present, any device and revision type provided in the init packet is accepted.
The DFU init packet supports checking the application version. The current Bootloader/DFU example does not use this feature. However, you should implement an application version check if required. Add this check to dfu_init_template.c
.
If you add an application version check, every application must be compiled with a version ID. This version ID should be placed at a predefined location in the application image, for example at the application start address + 0x0100
, similar to the principle used by Nordic SoftDevices.
See the following code snippet from dfu_init_template.c
, which illustrates where to extend the DFU Init packet handling with an application version safety check:
Applications that are compiled for the nRF51 chip target a specific SoftDevice, for example S110 v7.1.0. Some applications might work with multiple SoftDevice versions if the API is backward compatible. For example, an application that is compiled for SoftDevice S110 v7.0.0 can also run on SoftDevice S110 v7.1.0.
You can provide a list of supported SoftDevices for the application that is to be installed in the DFU init packet. The DFU checks the list that is provided in the init packet against the currently installed SoftDevice on the chip and continues the update procedure only if a matching SoftDevice is installed.
A value of 0xFFFE
indicates that the application should be installed regardless of the SoftDevice that is present. This feature can be helpful during development, but you should not use it in a product.
See the following table for the FWID
values of current SoftDevices:
SoftDevice S110 | FWID |
---|---|
S110 v7.0.0 | 0x004F |
S110 v7.1.0 | 0x005A |
Development/any | 0xFFFE |