setMbrSize

open fun setMbrSize(@IntRange(from = 0) mbrSize: Int): DfuServiceInitiator

This method sets the size of an MBR (Master Boot Record). It should be used only when updating a file from a HEX file. If you use BIN or ZIP, value set here will be ignored.

The MBR size is important for the HEX parser, which has to cut it from the Soft Device's HEX before sending it to the DFU target. The MBR can't be updated using DFU, and the bootloader expects only the Soft Device bytes. Usually, the Soft Device HEX provided by Nordic contains an MBR at addresses 0x0000 to 0x1000. 0x1000 is the default size of MBR which will be used.

If you have a HEX file which address start from 0 and want to send the whole BIN content from it, you have to set the MBR size to 0, otherwise first 4096 bytes will be cut off.

The value set here will not be used if the SETTINGS_MBR_SIZE is set in Shared Preferences.

Return

the builder

Parameters

mbrSize

the MBR size in bytes. Defaults to 4096 (0x1000) bytes.

See also