MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
SBLOADER Driver

Overview

Data Structures

struct  boot_cmd_t
 Boot command definition. More...
 
struct  boot_hdr1_t
 Definition for boot image file header chunk 1. More...
 
struct  boot_hdr2_t
 Definition for boot image file header chunk 2. More...
 
struct  crc32_data_t
 State information for the CRC32 algorithm. More...
 
struct  ldr_Context_t
 Loader context definition. More...
 
struct  mem_region_t
 Memory region information table. More...
 
struct  mem_attribute_t
 Memory Attribute Structure. More...
 
struct  mem_context_t
 Memory context structure. More...
 
struct  api_memory_region_interface_t
 Memory region interface structure. More...
 
struct  api_memory_map_entry_t
 Memory entry data structure. More...
 
struct  api_core_context_t
 The API context structure. More...
 
struct  sb3_data_range_header_t
 section data range structure More...
 
struct  sb3_section_header_t
 sb3 DATA section header format More...
 
struct  kb_region_t
 Memory region definition. More...
 
struct  ldr_Context_v3_t
 Loader context definition. More...
 

Macros

#define SB_FILE_MAJOR_VERSION   (3)
 Determines the version of SB loader implementation (1: sb1.0; 2: sb2.0; 3.1: sb3.1)
 
#define kStatusGroup_SBLoader   (101U)
 Bootloader status group numbers.
 
#define RAM_REGION_COUNT   (2U)
 Contiguous RAM region count.
 
#define FLASH_REGION_COUNT   (1U)
 Contiguous FLASH region count.
 
#define FFR_REGION_COUNT   (1U)
 Contiguous FFR region count.
 
#define MEM_INTERFACE_COUNT   (4U)
 Memory Interface count.
 
#define FLEXSPINOR_REGION_COUNT   (1U)
 Contiguous FLEXSPINOR meomry count.
 
#define BYTES_PER_CHUNK   16
 Defines the number of bytes in a cipher block (chunk). More...
 
#define BOOT_SIGNATURE   0x504d5453
 Boot image signature in 32-bit little-endian format "PMTS".
 
#define BOOT_SIGNATURE2   0x6c746773
 Boot image signature in 32-bit little-endian format "ltgs".
 
#define FFLG_DISPLAY_PROGRESS   0x0001
 These define file header flags.
 
#define SFLG_SECTION_BOOTABLE   0x0001
 These define section header flags.
 
#define CFLG_LAST_TAG   0x01
 These define boot command flags.
 
#define ROM_ERASE_ALL_MASK   0x01
 ROM_ERASE_CMD flags.
 
#define ROM_JUMP_SP_MASK   0x02
 ROM_JUMP_CMD flags.
 
#define ROM_MEM_DEVICE_ID_SHIFT   0x8
 Memory device id shift at sb command flags.
 
#define ROM_MEM_DEVICE_ID_MASK   0xff00
 Memory device id mask.
 
#define ROM_MEM_GROUP_ID_SHIFT   0x4
 Memory group id shift at sb command flags.
 
#define ROM_MEM_GROUP_ID_MASK   0xf0
 Memory group id flags mask.
 
#define ROM_PROG_8BYTE_MASK   0x01
 ROM_PROG_CMD flags.
 
#define ROM_NOP_CMD   0x00
 These define the boot command tags.
 
#define ROM_BOOT_SECTION_ID   1
 Plugin return codes.
 
#define SB3_BYTES_PER_CHUNK   16
 Defines the number of bytes in a cipher block (chunk). More...
 
#define SB3_DATA_RANGE_HEADER_FLAGS_ERASE_MASK   (0x1u)
 bit 0
 
#define SB3_DATA_RANGE_HEADER_FLAGS_LOAD_MASK   (0x2u)
 bit 1
 
#define SBLOADER_V3_CMD_SET_ALL
 The all of the allowed command.
 
#define SBLOADER_V3_CMD_SET_IN_ISP_MODE
 The allowed command set in ISP mode.
 
#define SBLOADER_V3_CMD_SET_IN_REC_MODE
 The allowed command set in recovery mode.
 

Typedefs

typedef status_t(* pLdrFnc_t )(ldr_Context_t *)
 Function pointer definition for all loader action functions. More...
 
typedef status_t(* pJumpFnc_t )(uint32_t)
 Jump command function pointer definition. More...
 
typedef status_t(* pCallFnc_t )(uint32_t, uint32_t *)
 Call command function pointer definition. More...
 
typedef status_t(* pLdrFnc_v3_t )(ldr_Context_v3_t *)
 Function pointer definition for all loader action functions. More...
 

Enumerations

enum  
 SB loader status codes. More...
 
enum  section_type_t { kSectionNone = 0 }
 sb3 section definitions More...
 
enum  sb3_cmd_t
 loader command enum
 
enum  kb_operation_t {
  kRomAuthenticateImage = 1,
  kRomLoadImage = 2
}
 Details of the operation to be performed by the ROM. More...
 

Functions

status_t Sbloader_Init (api_core_context_t *ctx)
 Perform the Sbloader runtime environment initialization This API is used for initializing the sbloader state machine before calling the api_sbloader_pump. More...
 
status_t Sbloader_Pump (api_core_context_t *ctx, uint8_t *data, uint32_t length)
 Handle the SB data stream This API is used for handling the secure binary(SB3.1 format) data stream, which is used for image update, lifecycle advancing, etc. More...
 
status_t Sbloader_Finalize (api_core_context_t *ctx)
 Finish the sbloader handling The API is used for finalizing the sbloader operations. More...
 

Data Structure Documentation

struct boot_cmd_t

Data Fields

uint8_t checksum
 8-bit checksum over command chunk
 
uint8_t tag
 command tag (identifier)
 
uint16_t flags
 command flags (modifier)
 
uint32_t address
 address argument
 
uint32_t count
 count argument
 
uint32_t data
 data argument
 
struct boot_hdr1_t

Data Fields

uint32_t hash
 last 32-bits of SHA-1 hash
 
uint32_t signature
 must equal "STMP"
 
uint8_t major
 major file format version
 
uint8_t minor
 minor file format version
 
uint16_t fileFlags
 global file flags
 
uint32_t fileChunks
 total chunks in the file
 
struct boot_hdr2_t

Data Fields

uint32_t bootOffset
 chunk offset to the first boot section
 
uint32_t bootSectID
 section ID of the first boot section
 
uint16_t keyCount
 number of keys in the key dictionary
 
uint16_t keyOffset
 chunk offset to the key dictionary
 
uint16_t hdrChunks
 number of chunks in the header
 
uint16_t sectCount
 number of sections in the image
 
struct crc32_data_t

Data Fields

uint32_t currentCrc
 Current CRC value. More...
 
uint32_t byteCountCrc
 Number of bytes processed. More...
 

Field Documentation

uint32_t crc32_data_t::currentCrc
uint32_t crc32_data_t::byteCountCrc
struct _ldr_Context

Provides forward reference to the loader context definition.

Data Fields

pLdrFnc_t Action
 pointer to loader action function
 
uint32_t fileChunks
 chunks remaining in file
 
uint32_t sectChunks
 chunks remaining in section
 
uint32_t bootSectChunks
 number of chunks we need to complete the boot section
 
uint32_t receivedChunks
 number of chunks we need to complete the boot section
 
uint16_t fileFlags
 file header flags
 
uint16_t keyCount
 number of keys in the key dictionary
 
uint32_t objectID
 ID of the current boot section or image.
 
crc32_data_t crc32
 crc calculated over load command payload
 
uint8_t * src
 source buffer address
 
chunk_t initVector
 decryption initialization vector
 
chunk_t dek
 chunk size DEK if the image is encrypted
 
chunk_t scratchPad
 chunk size scratch pad area
 
boot_cmd_t bootCmd
 current boot command
 
uint32_t skipCount
 Number of chunks to skip.
 
bool skipToEnd
 true if skipping to end of file
 
uint32_t offsetSignatureBytes
 offset to signagure block header in bytesn
 
struct mem_region_t
struct mem_attribute_t
struct mem_context_t
struct api_memory_region_interface_t
struct api_memory_map_entry_t
struct api_core_context_t
struct sb3_data_range_header_t
struct sb3_section_header_t
struct kb_region_t
struct _ldr_Context_v3

Provides forward reference to the loader context definition.

Data Fields

pLdrFnc_v3_t Action
 pointer to loader action function
 
uint32_t block_size
 size of each block in bytes
 
uint32_t block_data_size
 data size in bytes (NBOOT_SB3_CHUNK_SIZE_IN_BYTES)
 
uint32_t block_data_total
 data max size in bytes (block_size * data_size
 
uint32_t block_buffer_size
 block0 and block size
 
uint32_t processedBlocks
 will be used for both block0 and blockx
 
bool in_data_block
 data block offset in a block. More...
 
bool in_data_section
 in progress of handling a data section within a data block
 
bool in_data_range
 in progress of handling a data range within a data section
 
uint32_t commandSet
 support command set during sb file handling
 
uint8_t data_buffer [SB3_DATA_BUFFER_SIZE_IN_BYTE]
 temporary data buffer
 
kb_options_t fromAPI
 options from ROM API
 

Field Documentation

bool ldr_Context_v3_t::in_data_block

in progress of handling a data block within a block

Macro Definition Documentation

#define BYTES_PER_CHUNK   16

This is dictated by the encryption algorithm.

#define SB3_BYTES_PER_CHUNK   16

This is dictated by the encryption algorithm.

Typedef Documentation

typedef status_t(* pLdrFnc_t)(ldr_Context_t *)
typedef status_t(* pJumpFnc_t)(uint32_t)
typedef status_t(* pCallFnc_t)(uint32_t, uint32_t *)
typedef status_t(* pLdrFnc_v3_t)(ldr_Context_v3_t *)

Enumeration Type Documentation

anonymous enum

section type

Enumerator
kSectionNone 

end or invalid

The kRomAuthenticateImage operation requires the entire signed image to be available to the application.

Enumerator
kRomAuthenticateImage 

Authenticate a signed image.

kRomLoadImage 

Load SB file.

Function Documentation

status_t Sbloader_Init ( api_core_context_t ctx)

This API should be called after the iap_api_init API.

Parameters
ctxPointer to IAP API core context structure.
Return values
kStatus_SuccessApi was executed succesfuly.
status_t Sbloader_Pump ( api_core_context_t ctx,
uint8_t *  data,
uint32_t  length 
)

This API should be called after the iap_api_init and api_sbloader_init APIs.

Parameters
ctxPointer to IAP API core context structure.
dataPointer to source data that is the sb file buffer data.
lengthThe size of the process buffer data.
Return values
kStatus_SuccessApi was executed succesfuly.
kStatus_InvalidArgumentAn invalid argument is provided.
kStatus_FailAPI execution failed.
status_t Sbloader_Finalize ( api_core_context_t ctx)
Parameters
ctxPointer to IAP API core context structure.
Return values
kStatus_SuccessApi was executed succesfuly.