nRF5 IoT SDK  v0.9.0
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Types and definitions.

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

Data Structures

struct  dfu_device_info_t
 Structure holding basic device information settings. More...
 
struct  bootloader_settings_t
 Structure holding bootloader settings for application and bank data. More...
 

Macros

#define NRF_UICR_BOOT_START_ADDRESS   (NRF_UICR_BASE + 0x14)
 
#define CODE_REGION_1_START   SD_SIZE_GET(MBR_SIZE)
 
#define SOFTDEVICE_REGION_START   MBR_SIZE
 
#define BOOTLOADER_REGION_START   0x0007D000
 
#define BOOTLOADER_SETTINGS_ADDRESS   0x0007F000
 
#define CODE_PAGE_SIZE   0x1000
 
#define DFU_REGION_TOTAL_SIZE   (BOOTLOADER_REGION_START - CODE_REGION_1_START)
 
#define DFU_APP_DATA_RESERVED   0x0000
 
#define DFU_BANK_PADDING   (DFU_APP_DATA_RESERVED % (2 * CODE_PAGE_SIZE))
 
#define DFU_IMAGE_MAX_SIZE_FULL   (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED)
 
#define DFU_IMAGE_MAX_SIZE_BANKED
 
#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 EMPTY_FLASH_MASK   0xFFFFFFFF
 
#define IS_WORD_SIZED(SIZE)   ((SIZE & (sizeof(uint32_t) - 1)) == 0)
 
#define BOOTLOADER_PART   1
 
#define SOFTDEVICE_PART   2
 
#define APPLICATION_PART   3
 
#define UICR_CUSTOMER_DEVICE_INFO_OFFSET   0x0
 
#define UICR_CUSTOMER_RESERVED_OFFSET   0x80
 
#define DFU_DEVICE_INFO_BASE
 
#define DFU_DEVICE_INFO   ((dfu_device_info_t *)DFU_DEVICE_INFO_BASE)
 
#define DFU_DEVICE_TYPE_EMPTY   ((uint16_t)0xFFFF)
 
#define DFU_DEVICE_REVISION_EMPTY   ((uint16_t)0xFFFF)
 
#define BANK_VALID_MASK   (BANK_VALID_APP | BANK_VALID_SD | BANK_VALID_BOOT)
 

Enumerations

enum  bootloader_bank_code_t {
  BANK_VALID_APP = 0x01,
  BANK_VALID_SD = 0x02,
  BANK_VALID_BOOT = 0x04,
  BANK_ERASED = 0xFE,
  BANK_INVALID_APP = 0xFF
}
 DFU Bank state code, which indicates wether the bank contains: A valid image, invalid image, or an erased flash.
 

Functions

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

Detailed Description

Device Firmware Update module type and definitions.

Macro Definition Documentation

#define APPLICATION_PART   3

Defines application part of software.

#define BANK_VALID_MASK   (BANK_VALID_APP | BANK_VALID_SD | BANK_VALID_BOOT)

Mask indicating that at least one part of device firmware will be updated after reset.

#define BOOTLOADER_PART   1

Defines bootloader part of software.

#define BOOTLOADER_REGION_START   0x0007D000

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   0x0007F000

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

#define CODE_PAGE_SIZE   0x1000

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   SD_SIZE_GET(MBR_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 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_BANK_PADDING   (DFU_APP_DATA_RESERVED % (2 * CODE_PAGE_SIZE))

Padding to ensure that image size banked is always page sized.

#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_DEVICE_INFO   ((dfu_device_info_t *)DFU_DEVICE_INFO_BASE)

The memory mapped structure for device information data.

#define DFU_DEVICE_INFO_BASE
Value:
(NRF_UICR_BASE + \
UICR_CUSTOMER_RESERVED_OFFSET + \
UICR_CUSTOMER_DEVICE_INFO_OFFSET)

The device information base address inside of UICR.

#define DFU_DEVICE_REVISION_EMPTY   ((uint16_t)0xFFFF)

Mask indicating no device revision is present in UICR. 0xFFFF is default flash pattern when not written with data.

#define DFU_DEVICE_TYPE_EMPTY   ((uint16_t)0xFFFF)

Mask indicating no device type is present in UICR. 0xFFFF is default flash pattern when not written with data.

#define DFU_IMAGE_MAX_SIZE_BANKED
Value:
DFU_APP_DATA_RESERVED - \
DFU_BANK_PADDING) / 2)

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

#define DFU_IMAGE_MAX_SIZE_FULL   (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED)

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

#define DFU_REGION_TOTAL_SIZE   (BOOTLOADER_REGION_START - CODE_REGION_1_START)

Total size of the region between SD and Bootloader.

#define EMPTY_FLASH_MASK   0xFFFFFFFF

Bit mask that defines an empty address in flash.

#define IS_WORD_SIZED (   SIZE)    ((SIZE & (sizeof(uint32_t) - 1)) == 0)

Macro for checking that the provided is word sized.

#define NRF_UICR_BOOT_START_ADDRESS   (NRF_UICR_BASE + 0x14)

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

#define SOFTDEVICE_PART   2

Defines SoftDevice part of software.

#define SOFTDEVICE_REGION_START   MBR_SIZE

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 UICR_CUSTOMER_DEVICE_INFO_OFFSET   0x0

The device info offset can be modified to place the device info settings at a different location. If the customer reserved UICR location is used for other application specific data, the offset must be updated to avoid collision with that data.[DFU UICR DEV offset] Device info offset inside the customer UICR reserved area. Customers may change this value to place the device information in a user-preferred location.

#define UICR_CUSTOMER_RESERVED_OFFSET   0x80

[DFU UICR DEV offset] Customer reserved area in the UICR. The area from UICR + 0x80 is reserved for customer usage.