ROBOOT core


Detailed Description

This module groups core ROBOOT functions - The hardware independent API.

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)


Enumeration Type Documentation

Stages of image processing returned by ROBOOT_ProcessPacket (only if value is greater than or equal to 0).

Definition at line 131 of file roboot.h.


Function Documentation

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.

Parameters:
flash_oper structure with pointers to functions performing operations on FLASH memory
Returns:
pointer to the buffer used internally by image processor

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.

Parameters:
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
Returns:
less than zero value means that image processor found problem (in image or during FLASH update), value equal to or greater than of zero means image processing stages (see ROBOOT_ProcesingStage_T). ROBOOT_PS_FILE_END value means that image processing was finished successfully.

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).

Returns:
pointer to the buffer containing File Magic data (4 bytes)

Definition at line 187 of file roboot.c.

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).

Returns:
pointer to the buffer containing Device Magic data (8 bytes)

Definition at line 195 of file roboot.c.

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).

Returns:
pointer to the buffer containing user (supplied) data (128 bytes)

Definition at line 203 of file roboot.c.

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).

Returns:
pointer to the buffer containing user (supplied) data (128 bytes)

Definition at line 210 of file roboot.c.

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).

Returns:
ID of cipher algorithm

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).

Returns:
true if key is encrypted with asymetric ciphering

Definition at line 225 of file roboot.c.

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).

Returns:
number of FLASH sections

Definition at line 233 of file roboot.c.


Generated on Tue Mar 9 07:57:33 2010 for 'ROBOOT' by  doxygen 1.5.8