Macros | |
#define | ALIGN_TO_PAGE(val) ALIGN_NUM((CODE_PAGE_SIZE), (val)) |
Functions | |
uint32_t | nrf_dfu_bank0_start_addr (void) |
Function for getting the start address of bank 0. More... | |
uint32_t | nrf_dfu_bank1_start_addr (void) |
Function for getting the start address of bank 1. More... | |
uint32_t | nrf_dfu_app_start_address (void) |
Function for getting the start address of the app. More... | |
uint32_t | nrf_dfu_softdevice_start_address (void) |
Function for getting the start address of the SoftDevice. More... | |
uint32_t | nrf_dfu_cache_prepare (uint32_t required_size, bool single_bank, bool keep_app, bool keep_softdevice) |
Function for finding and preparing a place in flash in which to store a DFU update. More... | |
void | nrf_dfu_softdevice_invalidate (void) |
Function for making sure a SoftDevice is not recognized as such anymore. More... | |
void | nrf_dfu_bank_invalidate (nrf_dfu_bank_t *const p_bank) |
Function for making sure a bank is not copied or booted. More... | |
#define ALIGN_TO_PAGE | ( | val | ) | ALIGN_NUM((CODE_PAGE_SIZE), (val)) |
Round up val to the next page boundary
uint32_t nrf_dfu_app_start_address | ( | void | ) |
Function for getting the start address of the app.
uint32_t nrf_dfu_bank0_start_addr | ( | void | ) |
Function for getting the start address of bank 0.
uint32_t nrf_dfu_bank1_start_addr | ( | void | ) |
Function for getting the start address of bank 1.
void nrf_dfu_bank_invalidate | ( | nrf_dfu_bank_t *const | p_bank | ) |
Function for making sure a bank is not copied or booted.
This also sets the size of the bank to 0.
[in] | p_bank | Pointer to the bank to be invalidated. |
uint32_t nrf_dfu_cache_prepare | ( | uint32_t | required_size, |
bool | single_bank, | ||
bool | keep_app, | ||
bool | keep_softdevice | ||
) |
Function for finding and preparing a place in flash in which to store a DFU update.
This function checks the size requirements and selects a location for placing the cache of the DFU images. The function tries to find enough space after the existing firmwares. If there is not enough space, the present application is deleted. If there is still not enough space, the SoftDevice is deleted. If single_bank
is true, the default behavior is to immediately delete the app and SoftDevice as necessary to place the new firmware at its intended location. If the intended location cannot be made available, or if the update is a bootloader update, the update will be a dual bank update, and nothing will be deleted by this function except when needed for size. If keep_app
is true, the app is never deleted by this function. Likewise if keep_softdevice
is true, the SoftDevice is never deleted by this function. If the new firmware cannot fit within the constraints, nothing is deleted and the function fails.
[in] | required_size | Requirements for the size of the new image. |
[in] | single_bank | Whether to put the firmware directly where it's meant to go. keep_app and keep_softdevice take precedence over this. |
[in] | keep_app | True to ensure the app is not deleted by this function. This effectively enforces dual bank update. |
[out] | keep_softdevice | True to ensure the SoftDevice is not deleted by this function. |
NRF_SUCCESS | If a cache location was found for the DFU process. |
NRF_ERROR_NO_MEM | If there is not enough space available to receive the update. Nothing has been deleted. |
void nrf_dfu_softdevice_invalidate | ( | void | ) |
Function for making sure a SoftDevice is not recognized as such anymore.
It works by overwriting the magic number of the SoftDevice with 0s. The magic number is used throughout the bootloader to detect whether a SoftDevice is present.
uint32_t nrf_dfu_softdevice_start_address | ( | void | ) |
Function for getting the start address of the SoftDevice.