While exploring documentaion and trying to learn more about the DFU (and bootloader settings), I found info on how to generate the bootloader settings, which also explains why the bootloader example was booting to dfu mode the first time, and then to my app, after I used dfu to update it (because that is what happens when there is no bootloader settings present).
So, by running:
nrfutil settings generate --family NRF51 --application-version 1 --application my_app_nrf51822.hex --bootloader-version 2 --bl-settings-version 1 --no-backup settings.hex
It generates the settings.hex:
Generated Bootloader DFU settings .hex file and stored it in: settings.hex Bootloader DFU Settings: * File: settings.hex * Family: nRF51 * Start Address: 0x0003FC00 * CRC: 0x78F3C691 * Settings Version: 0x00000001 (1) * App Version: 0x00000001 (1) * Bootloader Version: 0x00000002 (2) * Bank Layout: 0x00000000 * Current Bank: 0x00000000 * Application Size: 0x0000B9F4 (47604 bytes) * Application CRC: 0x78A6D951 * Bank0 Bank Code: 0x00000001 * Softdevice Size: 0x00000000 (0 bytes) * Boot Validation CRC: 0x00000000 * SD Boot Validation Type: 0x00000000 (0) * App Boot Validation Type: 0x00000000 (0)
Thought this info to be relevant for defining the correct values for flash size (the app is currently 47604 bytes, but will probably still grow slightly).
More questions:
- how to flash this settings.hex together with the app, bootloader, softdevice, etc?
- how can I set the "Softdevice Size" to the correct value?
- Shouldn't we also set the "Boot Validation CRC" value?
Best regards,
Ricardo