Usage.
ROBOOT must be initialized by a call to ROBOOT_InitProcessing. After that the bootloading engine is fed by sequential calls to ROBOOT_ProcessPacket. All other functions retrieve additional information about the image being processed.
See bootloader examples for typical usage scenarios.
Defines | |
#define | ROBOOT_VER_HI 2 |
ROBOOT version (high number). | |
#define | ROBOOT_VER_LO 0 |
ROBOOT version (low number). | |
#define | ROBOOT_INTERNAL_ERROR -1 |
Error code: Internal error. | |
#define | ROBOOT_FLS_UNLOCK_ERROR -2 |
Error code: Unable to unlock FLASH memory. | |
#define | ROBOOT_FLS_ERASE_ERROR -3 |
Error code: Unable to erase FLASH memory sector. | |
#define | ROBOOT_FLS_WRITE_ERROR -4 |
Error code: Unable to write into FLASH memory. | |
#define | ROBOOT_IMG_VERSION_ERROR -5 |
Error code: Bad image version. | |
#define | ROBOOT_IMG_HASH_MATCH_ERROR -6 |
Error code: Hash mismatch. | |
#define | ROBOOT_IMG_CIPHER_MATCH_ERROR -7 |
Error code: Cipher key mismatch. | |
#define | ROBOOT_IMG_ACIPHER_MATCH_ERROR -8 |
Error code: Asymetric Cipher key mismatch. | |
#define | ROBOOT_IMG_DEVKEY_LEN_ERROR -9 |
Error code: Device Key length mismatch. | |
#define | ROBOOT_IMG_CHECK_TYPE_ERROR -10 |
Error code: Check type mismatch. | |
#define | ROBOOT_IMG_DEV_VERSION_ERROR -11 |
Error code: Device version mismatch. | |
#define | ROBOOT_IMG_APP_VERSION_ERROR -12 |
Error code: Application version mismatch. | |
#define | ROBOOT_IMG_DEV_ID_ERROR -13 |
Error code: Device ID mismatch. | |
#define | ROBOOT_IMG_CHECK_FM_ERROR -14 |
Error code: File magic mismatch. | |
#define | ROBOOT_IMG_CHECK_DM_ERROR -15 |
Error code: Device magic mismatch. | |
#define | ROBOOT_IMG_SM_ERROR -16 |
Error code: Section magic mismatch. | |
#define | ROBOOT_IMG_SECTION_CRC_ERROR -17 |
Error code: Section CRC mismatch. | |
Enumerations | |
enum | ROBOOT_ProcesingStage_T { ROBOOT_PS_FILE_END, ROBOOT_PS_FILE_MAGIC, ROBOOT_PS_DEV_MAGIC, ROBOOT_PS_CRYPTO_KEY, ROBOOT_PS_CHECK_AREA, ROBOOT_PS_SECTION_HEADER, ROBOOT_PS_SECTION_DATA } |
Functions | |
uint8_t * | ROBOOT_InitProcessing (const ROBOOT_FLASH_Operations_T *flash_oper) |
int8_t | ROBOOT_ProcessPacket (uint32_t size, uint8_t **new_buf) |
const uint8_t * | ROBOOT_GetFileMagic (void) |
const uint8_t * | ROBOOT_GetDeviceMagic (void) |
const uint8_t * | ROBOOT_GetUserData (void) |
uint8_t | ROBOOT_GetHashType (void) |
uint8_t | ROBOOT_GetCipherType (void) |
bool | ROBOOT_IsAsymetricKeyCipherUsed (void) |
uint32_t | ROBOOT_GetNumberOfSections (void) |
uint8_t* ROBOOT_InitProcessing | ( | const ROBOOT_FLASH_Operations_T * | flash_oper | ) |
Initializes image processor FSM. Maximum available space of the returned buffer is determined by the configuration parameter IMG_BUFFER_SIZE. If flash_oper is NULL or at least one operation is not defined (NULL) then image processor performs only a dry run without real FLASH update.
flash_oper | structure with pointers to functions performing operations on FLASH memory |
Definition at line 241 of file roboot.c.
References ROBOOT_FLASH_Operations_T::FlashErasePage, ROBOOT_FLASH_Operations_T::FlashLock, ROBOOT_FLASH_Operations_T::FlashUnlock, and ROBOOT_FLASH_Operations_T::FlashWriteData.
Referenced by FeedImageProcessor().
int8_t ROBOOT_ProcessPacket | ( | uint32_t | size, | |
uint8_t ** | new_buf | |||
) |
Supplies chunk of bootloader image to the image processor. Before this function call the caller should copy image data into buffer previously (ROBOOT_InitProcessing or ROBOOT_ProcessPacket) supplied by image processor. Maximum available space of the returned buffer is determined by the configuration parameter IMG_BUFFER_SIZE. If function will return less than zero value then image processing should be restarted (call to ROBOOT_InitProcessing) and procedure should be repeated.
size | length of image data available to image processor (copied to image buffer before call) | |
new_buf | this is output parameter, on exit pointer pointed by new_buf will be modified to actual buffer area |
Definition at line 266 of file roboot.c.
References ROBOOT_INTERNAL_ERROR.
Referenced by FeedImageProcessor().
const uint8_t* ROBOOT_GetFileMagic | ( | void | ) |
Returns pointer to the file magic image field. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).
const uint8_t* ROBOOT_GetDeviceMagic | ( | void | ) |
Returns pointer to the device magic image field. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).
const uint8_t* ROBOOT_GetUserData | ( | void | ) |
Returns pointer to the user data field. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).
uint8_t ROBOOT_GetHashType | ( | void | ) |
Returns hash type used by image. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).
uint8_t ROBOOT_GetCipherType | ( | void | ) |
Returns ID of cipher algorithm used in image. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).
Definition at line 217 of file roboot.c.
References ROBOOT_CIPHER_TYPE.
bool ROBOOT_IsAsymetricKeyCipherUsed | ( | void | ) |
Returns flag indicating if asymetric key is used for key ciphering. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).
uint32_t ROBOOT_GetNumberOfSections | ( | void | ) |
Returns number of sections embedded in image. Returned content is valid only after at least image header was successfully processed (ROBOOT_ProcessPacket returned 0 or value greater than ROBOOT_PS_CHECK_AREA).