We are using an nRF51x22 in one of our designs.
I am in the process of writing a bootloader that conforms to a packet format we use for loading code across our product line (this allows our suite of software tools to work across our product line, to load code into many different processors).
Anyway, we need a buttonless DFU to accomplish this.
I noticed that there is an example buttonless DFU that only supports the nRF52 products (contained in SDK version 15.0.0), but that buttonless DFU requires the loading of a special dedicated soft device to handle the buttonless toggling between the bootloader and the application. A specialized soft device seems like an extremely complicated way to accomplish what should be a rather simple thing – the decision whether to stay in the bootloader, or jump to the application. Besides, we need a BLE stack loaded as our soft device.
I am drawn to this structure, and its use:
typedef struct
{
uint32_t crc; /**< CRC for the stored DFU settings, not including the CRC itself. If 0xFFFFFFF, the CRC has never been calculated. */
uint32_t settings_version; /**< Version of the currect dfu settings struct layout.*/
uint32_t app_version; /**< Version of the last stored application. */
uint32_t bootloader_version; /**< Version of the last stored bootloader. */
uint32_t bank_layout; /**< Bank layout: single bank or dual bank. This value can change. */
uint32_t bank_current; /**< The bank that is currently used. */
nrf_dfu_bank_t bank_0; /**< Bank 0. */
nrf_dfu_bank_t bank_1; /**< Bank 1. */
uint32_t write_offset; /**< Write offset for the current operation. */
uint32_t sd_size; /**< SoftDevice size (if combined BL and SD). */
dfu_progress_t progress; /**< Current DFU progress. */
uint32_t enter_buttonless_dfu;
uint8_t init_command[INIT_COMMAND_MAX_SIZE]; /**< Buffer for storing the init command. */
} nrf_dfu_settings_t;
Shouldn’t the decision to stay in the bootloader or run the application be a simple matter of triggering off the “enter_buttonless_dfu” element of the above structure?
In order to set this value in the application, and then have the DFU evaluate it upon reset, this structure has to be stored non-volatially. Is it place in non-volatile memory at some point? If so, I’m not finding where (although I could be overlooking it).
TIA