McuMgrImageConfig

Global configuration for the magic numbers used when parsing McuBoot firmware image headers and TLV trailers.

The default values match the standard McuBoot specification. If a device uses custom magic numbers, call the appropriate setters before starting the SMP OTA upgrade.

Example usage:

    // Set custom magic numbers before starting OTA
    McuMgrImageConfig.setHeaderMagic(0xCustomMagic);
    McuMgrImageConfig.setTlvInfoMagic(0xCustomTlvMagic);
    McuMgrImageConfig.setTlvProtectedInfoMagic(0xCustomProtectedTlvMagic);

    // Start the OTA upgrade ...

    // Optionally restore defaults afterwards
    McuMgrImageConfig.resetToDefaults();

Functions

Link copied to clipboard
open fun getHeaderMagic(): Int
Returns the expected magic number for the current McuBoot image header.
Link copied to clipboard
open fun getHeaderMagicV1(): Int
Returns the expected magic number for the legacy (V1) McuBoot image header.
Link copied to clipboard
open fun getTlvInfoMagic(): Int
Returns the expected magic number for the unprotected TLV info block.
Link copied to clipboard
Returns the expected magic number for the protected TLV info block.
Link copied to clipboard
open fun resetToDefaults()
Resets all magic numbers to the standard McuBoot default values.
Link copied to clipboard
open fun setHeaderMagic(magic: Int)
Sets a custom magic number for the current McuBoot image header.
Link copied to clipboard
open fun setHeaderMagicV1(magic: Int)
Sets a custom magic number for the legacy (V1) McuBoot image header.
Link copied to clipboard
open fun setTlvInfoMagic(magic: Int)
Sets a custom magic number for the unprotected TLV info block.
Link copied to clipboard
open fun setTlvProtectedInfoMagic(magic: Int)
Sets a custom magic number for the protected TLV info block.