Bootload InfoPlugin > Storage

Description

Indicates which firmware update image should be bootloaded next.

This plugin provides the bootloader with support for storing multiple images and attempting to bootload a prioritized list. The Bootload Information struct is placed at a known location in storage, and points to a list of images to attempt to bootload.

While the Bootload Information list of images to attempt to bootload has a compile-time configurable size, the bootloader is capable of handling lists of images with different sizes, e.g., if a bootloader upgrade changes the slot layout or if a storage device that was initialized on a different device is used.

If only one storage slot is available, the functions available in this API will do nothing and return applicable error codes ( BOOTLOADER_OK for storage_getBootloadList and storage_setBootloadList , and BOOTLOADER_ERROR_BOOTLOAD_LIST_FULL for storage_appendBootloadList ).

Data Structures

struct BootloadInfo_t

Macros

#define BTL_STORAGE_BOOTLOADINFO_MAGIC 0xE18F5239UL
Magic word indicating BootloadInfo_t struct.
#define BTL_STORAGE_BOOTLOADINFO_VERSION 0x00000001UL
Version number for the BootloadInfo_t struct.
#define BTL_STORAGE_BOOTLOAD_LIST_MAX_LENGTH 16UL
Maximum number of items in the BootloadInfo_t::bootloadList .

Functions

int32_t storage_getBootloadList (int32_t slotIds[], size_t length)
int32_t storage_setBootloadList (int32_t slotIds[], size_t length)
int32_t storage_appendBootloadList (int32_t slotId)

Function Documentation

int32_t storage_getBootloadList ( int32_t slotIds[],
size_t length
)

Get list of firmware update images to attempt to bootload.

Parameters
[out] slotIds Pointer to array of integers to fill with slot IDs, or -1 if list position does not contain a valid slot ID
[in] length Number of slot IDs to get
Returns
Error code: BOOTLOADER_OK if list of slots was successfully filled else error code in BOOTLOADER_ERROR_STORAGE_BASE range
int32_t storage_setBootloadList ( int32_t slotIds[],
size_t length
)

Set list of firmware update images to attempt to bootload.

Parameters
[in] slotIds Pointer to array of slot IDs to set
[in] length Number of slot IDs to set
Returns
Error code: BOOTLOADER_OK if list of slots was successfully filled
int32_t storage_appendBootloadList ( int32_t slotId )

Append a storage slot to the list of storage slots to try bootloading from.

Parameters
[in] slotId ID of the slot
Returns
Error code: BOOTLOADER_OK if slot was successfully appended