nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Types and definitions.

Device Firmware Update module type and definitions. More...

Data Structures

struct  SOFTDEVICE_INFORMATION_Type
 Structure holding SoftDevice information to be used by the Bootloader/DFU. Only size field is used. More...
 
struct  dfu_start_packet_t
 Structure holding a start packet containing update mode and image sizes. More...
 
struct  dfu_data_packet_t
 Structure holding a bootloader init/data packet received. More...
 
struct  dfu_update_packet_t
 Structure for holding dfu update packet. Packet type indicate the type of packet. More...
 
struct  dfu_update_status_t
 Structure holding DFU complete event. More...
 

Macros

#define SOFTDEVICE_INFORMATION_BASE   0x0003000
 
#define SOFTDEVICE_INFORMATION   ((SOFTDEVICE_INFORMATION_Type *) SOFTDEVICE_INFORMATION_BASE)
 
#define NRF_UICR_BOOT_START_ADDRESS   (NRF_UICR_BASE + 0x14)
 
#define CODE_REGION_1_START   SOFTDEVICE_INFORMATION->softdevice_size
 
#define SOFTDEVICE_REGION_START   0x00001000
 
#define BOOTLOADER_REGION_START   0x0003C000
 
#define BOOTLOADER_SETTINGS_ADDRESS   0x0003FC00
 
#define DFU_REGION_TOTAL_SIZE   (BOOTLOADER_REGION_START - CODE_REGION_1_START)
 
#define DFU_APP_DATA_RESERVED   0x0000
 
#define DFU_IMAGE_MAX_SIZE_FULL   (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED)
 
#define DFU_IMAGE_MAX_SIZE_BANKED   (((DFU_REGION_TOTAL_SIZE)/2) - DFU_APP_DATA_RESERVED)
 
#define DFU_BL_IMAGE_MAX_SIZE   (BOOTLOADER_SETTINGS_ADDRESS - BOOTLOADER_REGION_START)
 
#define DFU_BANK_0_REGION_START   CODE_REGION_1_START
 
#define DFU_BANK_1_REGION_START   (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED)
 
#define CODE_PAGE_SIZE   0x0400
 
#define EMPTY_FLASH_MASK   0xFFFFFFFF
 
#define INVALID_PACKET   0x00
 
#define INIT_PACKET   0x01
 
#define STOP_INIT_PACKET   0x02
 
#define START_PACKET   0x03
 
#define DATA_PACKET   0x04
 
#define STOP_DATA_PACKET   0x05
 
#define DFU_UPDATE_SD   0x01
 
#define DFU_UPDATE_BL   0x02
 
#define DFU_UPDATE_APP   0x04
 
#define DFU_INIT_RX   0x00
 
#define DFU_INIT_COMPLETE   0x01
 

Typedefs

typedef void(* dfu_complete_handler_t )(dfu_update_status_t dfu_update_status)
 Update complete handler type.
 

Enumerations

enum  dfu_update_status_code_t {
  DFU_UPDATE_APP_COMPLETE,
  DFU_UPDATE_SD_COMPLETE,
  DFU_UPDATE_SD_SWAPPED,
  DFU_UPDATE_BOOT_COMPLETE,
  DFU_BANK_0_ERASED,
  DFU_TIMEOUT,
  DFU_RESET
}
 DFU status error codes. More...
 

Functions

 STATIC_ASSERT ((((0x0000)&(0x0400-1))==0x00))
 

Detailed Description

Device Firmware Update module type and definitions.

Macro Definition Documentation

#define BOOTLOADER_REGION_START   0x0003C000

This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating.

#define BOOTLOADER_SETTINGS_ADDRESS   0x0003FC00

The field specifies the page location of the bootloader settings address.

#define CODE_PAGE_SIZE   0x0400

Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct.

#define CODE_REGION_1_START   SOFTDEVICE_INFORMATION->softdevice_size

This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0.

#define DATA_PACKET   0x04

Packet identifies for a Data Packet.

#define DFU_APP_DATA_RESERVED   0x0000

Size of Application Data that must be preserved between application updates. This value must be a multiple of page size. Page size is 0x400 (1024d) bytes, thus this value must be 0x0000, 0x0400, 0x0800, 0x0C00, 0x1000, etc.

#define DFU_BANK_0_REGION_START   CODE_REGION_1_START

Bank 0 region start.

#define DFU_BANK_1_REGION_START   (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED)

Bank 1 region start.

#define DFU_BL_IMAGE_MAX_SIZE   (BOOTLOADER_SETTINGS_ADDRESS - BOOTLOADER_REGION_START)

Maximum size of a bootloader, excluding save data from the current bootloader.

#define DFU_IMAGE_MAX_SIZE_BANKED   (((DFU_REGION_TOTAL_SIZE)/2) - DFU_APP_DATA_RESERVED)

Maximum size of a application, excluding save data from the application.

#define DFU_IMAGE_MAX_SIZE_FULL   (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED)

Maximum size of a application, excluding save data from the application.

#define DFU_INIT_COMPLETE   0x01

Op Code identifies for transmission complete of init packet.

#define DFU_INIT_RX   0x00

Op Code identifies for receiving init packet.

#define DFU_REGION_TOTAL_SIZE   (BOOTLOADER_REGION_START - CODE_REGION_1_START)

Total size of the region between SD and Bootloader.

#define DFU_UPDATE_APP   0x04

Bit field indicating update of application is ongoing.

#define DFU_UPDATE_BL   0x02

Bit field indicating update of bootloader is ongoing.

#define DFU_UPDATE_SD   0x01

Bit field indicating update of SoftDevice is ongoing.

#define EMPTY_FLASH_MASK   0xFFFFFFFF

Bit mask that defines an empty address in flash.

#define INIT_PACKET   0x01

Packet identifies for initialization packet.

#define INVALID_PACKET   0x00

Invalid packet identifies.

#define NRF_UICR_BOOT_START_ADDRESS   (NRF_UICR_BASE + 0x14)

Register where the bootloader start address is stored in the UICR register.

#define SOFTDEVICE_INFORMATION   ((SOFTDEVICE_INFORMATION_Type *) SOFTDEVICE_INFORMATION_BASE)

Make SoftDevice information accessible through the structure.

#define SOFTDEVICE_INFORMATION_BASE   0x0003000

Location in the SoftDevice image which holds the SoftDevice informations.

#define SOFTDEVICE_REGION_START   0x00001000

This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating.

#define START_PACKET   0x03

Packet identifies for the Data Start Packet.

#define STOP_DATA_PACKET   0x05

Packet identifies for the Data Stop Packet.

#define STOP_INIT_PACKET   0x02

Packet identifies for stop initialization packet. Used when complete init packet has been received so that the init packet can be used for pre validaiton.

Enumeration Type Documentation

DFU status error codes.

Enumerator
DFU_UPDATE_APP_COMPLETE 

Status update of application complete.

DFU_UPDATE_SD_COMPLETE 

Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1.

DFU_UPDATE_SD_SWAPPED 

Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1.

DFU_UPDATE_BOOT_COMPLETE 

Status update complete.

DFU_BANK_0_ERASED 

Status bank 0 erased.

DFU_TIMEOUT 

Status timeout.

DFU_RESET 

Status Reset to indicate current update procedure has been aborted and system should reset.