nRF5 SDK v17.1.0
Macros | Functions
Bootloader Information

Macros

#define SD_INFO_ABS_OFFSET_GET(baseaddr, offset)   ((baseaddr) + (SOFTDEVICE_INFO_STRUCT_OFFSET) + (offset))
 Macro for getting the start address of the bootloader image. More...
 
#define SD_OFFSET_GET_UINT32(baseaddr, offset)   (*((uint32_t *) SD_INFO_ABS_OFFSET_GET(baseaddr, offset)))
 Macros for reading a byte or a word at a particular offset inside a SoftDevice information struct. Use MBR_SIZE as baseaddr when the SoftDevice is installed just above the MBR (the usual case).
 
#define SD_OFFSET_GET_UINT16(baseaddr, offset)   (*((uint16_t *) SD_INFO_ABS_OFFSET_GET(baseaddr, offset)))
 
#define SD_OFFSET_GET_UINT8(baseaddr, offset)   (*((uint8_t *) SD_INFO_ABS_OFFSET_GET(baseaddr, offset)))
 
#define SD_MAGIC_NUMBER_GET(baseaddr)   SD_OFFSET_GET_UINT32(baseaddr, 0x04)
 Macro for reading the magic number of a SoftDevice at a given base address.
 
#define SD_MAGIC_NUMBER_ABS_OFFSET_GET(baseaddr)   SD_INFO_ABS_OFFSET_GET(baseaddr, 0x04)
 Macro for getting the absolute address of the magic number.
 
#define SD_MAGIC_NUMBER   ((uint32_t)0x51B1E5DB)
 The number present at a specific location in all SoftDevices.
 
#define SD_PRESENT   ((SD_MAGIC_NUMBER_GET(MBR_SIZE)) == (SD_MAGIC_NUMBER))
 Whether a SoftDevice is at its regular location.
 
#define SD_MAJOR_VERSION_MULTIPLIER   (1000000)
 The multiplier for the major version of the SoftDevice. See SD_VERSION_GET.
 
#define SD_MAJOR_VERSION_EXTRACT(raw_version)   ((raw_version)/SD_MAJOR_VERSION_MULTIPLIER)
 Read the major version of the SoftDevice from the raw version number. See SD_VERSION_GET.
 
#define BOOTLOADER_DFU_GPREGRET_MASK   (0xF8)
 
#define BOOTLOADER_DFU_GPREGRET   (0xB0)
 
#define BOOTLOADER_DFU_START_BIT_MASK   (0x01)
 
#define BOOTLOADER_DFU_GPREGRET2_MASK   (0xF8)
 
#define BOOTLOADER_DFU_GPREGRET2   (0xA8)
 
#define BOOTLOADER_DFU_SKIP_CRC_BIT_MASK   (0x01)
 
#define BOOTLOADER_DFU_START_MASK   (BOOTLOADER_DFU_GPREGRET_MASK | BOOTLOADER_DFU_START_BIT_MASK)
 
#define BOOTLOADER_DFU_START   (BOOTLOADER_DFU_GPREGRET | BOOTLOADER_DFU_START_BIT_MASK)
 
#define BOOTLOADER_DFU_SKIP_CRC_MASK   (BOOTLOADER_DFU_GPREGRET2_MASK | BOOTLOADER_DFU_SKIP_CRC_BIT_MASK)
 
#define BOOTLOADER_DFU_SKIP_CRC   (BOOTLOADER_DFU_GPREGRET2 | BOOTLOADER_DFU_SKIP_CRC_BIT_MASK)
 
#define NRF_DFU_DEBUG   0
 Macro based on NRF_DFU_DEBUG_VERSION that can be checked for true/false instead of defined/not defined.
 

Functions

void nrf_bootloader_mbr_addrs_populate (void)
 Function for populating addresses in the MBR code page. More...
 
void nrf_bootloader_debug_port_disable (void)
 Function for checking if the debug port access is disabled. More...
 

Detailed Description

Macro Definition Documentation

#define BOOTLOADER_DFU_GPREGRET   (0xB0)

Magic pattern written to GPREGRET register to signal between main app and DFU. The 3 lower bits are assumed to be used for signalling purposes.

#define BOOTLOADER_DFU_GPREGRET2   (0xA8)

Magic pattern written to GPREGRET2 register to signal between main app and DFU. The 3 lower bits are assumed to be used for signalling purposes.

#define BOOTLOADER_DFU_GPREGRET2_MASK   (0xF8)

Mask for GPGPREGRET2 bits used for the magic pattern written to GPREGRET2 register to signal between main app and DFU.

#define BOOTLOADER_DFU_GPREGRET_MASK   (0xF8)

Mask for GPGPREGRET bits used for the magic pattern written to GPREGRET register to signal between main app and DFU.

#define BOOTLOADER_DFU_SKIP_CRC   (BOOTLOADER_DFU_GPREGRET2 | BOOTLOADER_DFU_SKIP_CRC_BIT_MASK)

Magic number to signal that CRC can be skipped due to low power modes.

#define BOOTLOADER_DFU_SKIP_CRC_BIT_MASK   (0x01)

Bit mask to signal from main application that CRC-check is not needed for image verification.

#define BOOTLOADER_DFU_START   (BOOTLOADER_DFU_GPREGRET | BOOTLOADER_DFU_START_BIT_MASK)

Magic number to signal that bootloader should enter DFU mode because of signal from Buttonless DFU in main app.

#define BOOTLOADER_DFU_START_BIT_MASK   (0x01)

Bit mask to signal from main application to enter DFU mode using a buttonless service.

#define SD_INFO_ABS_OFFSET_GET (   baseaddr,
  offset 
)    ((baseaddr) + (SOFTDEVICE_INFO_STRUCT_OFFSET) + (offset))

Macro for getting the start address of the bootloader image.

The macro is not a compile time symbol. It cannot be used as a constant expression, for example, inside a static assert or linker script at-placement.Macro for getting the size of the bootloader image.Macro for converting an offset inside the SoftDevice information struct to an absolute address.

Function Documentation

void nrf_bootloader_debug_port_disable ( void  )

Function for checking if the debug port access is disabled.

If the debug port access is enabled, disable it. This function checks and writes to the UICR registers APPROTECT and DEBUGCTRL.

void nrf_bootloader_mbr_addrs_populate ( void  )

Function for populating addresses in the MBR code page.

This function writes two words to flash if the flash is 0xFFFFFFFF. This is done in code because doing this through the hex file interferes with flashing algorithms. See nrf_mbr.h.


Documentation feedback | Developer Zone | Subscribe | Updated