35 #include "bootloader_common.h" 36 #include "crc/crc32.h" 41 #ifndef SB_FILE_MAJOR_VERSION 42 #define SB_FILE_MAJOR_VERSION 1 69 #define BYTES_PER_CHUNK 16 72 #define BOOT_SIGNATURE 0x504d5453 75 #define BOOT_SIGNATURE2 0x6c746773 78 #define FFLG_DISPLAY_PROGRESS 0x0001 81 #define SFLG_SECTION_BOOTABLE 0x0001 84 #define CFLG_LAST_TAG 0x01 87 #define ROM_ERASE_ALL_MASK 0x01 88 #define ROM_ERASE_ALL_UNSECURE_MASK 0x02 91 #define ROM_JUMP_SP_MASK 0x02 94 #define ROM_MEM_SPACE_SHIFT 0x8 97 #define ROM_MEM_SPACE_MASK 0xf 102 kLdrMemorySpace_Internal,
103 kLdrMemorySpace_eMMC0,
105 kLdrMemorySpace_SDRAM0,
106 kLdrMemorySpace_IFR0,
107 kLdrMemorySpace_eFuse0,
112 #define ROM_MEM_CTRL_SHIFT 0x8 115 #define ROM_MEM_CTRL_MASK 0xf 120 kLdrMemoryCtrl_InternalFlash,
121 kLdrMemoryCtrl_QSPI0,
126 #define ROM_PROG_8BYTE_MASK 0x01 129 #define ROM_NOP_CMD 0x00 130 #define ROM_TAG_CMD 0x01 131 #define ROM_LOAD_CMD 0x02 132 #define ROM_FILL_CMD 0x03 133 #define ROM_JUMP_CMD 0x04 134 #define ROM_CALL_CMD 0x05 135 #define ROM_MODE_CMD 0x06 136 #define ROM_ERASE_CMD 0x07 137 #define ROM_RESET_CMD 0x08 138 #define ROM_MEM_ENABLE_CMD 0x09 139 #define ROM_PROG_CMD 0x0a 142 #define ROM_BOOT_SECTION_ID 1 143 #define ROM_BOOT_IMAGE_ID 2 145 typedef uint8_t chunk_t[BYTES_PER_CHUNK];
148 typedef struct _boot_cmd
159 typedef struct _boot_hdr1
170 typedef struct _boot_hdr2
198 uint32_t bootSectChunks;
199 uint32_t receivedChunks;
213 #if defined(__cplusplus) 215 #endif // __cplusplus 221 #if defined(__cplusplus) 223 #endif // __cplusplus uint8_t minor
minor file format version
Definition: sbloader.h:164
uint32_t hash
last 32-bits of SHA-1 hash
Definition: sbloader.h:161
_ldr_memory_space
Memory Space constants.
Definition: sbloader.h:100
Boot command definition.
Definition: sbloader.h:148
uint8_t checksum
8-bit checksum over command chunk
Definition: sbloader.h:150
uint16_t flags
command flags (modifier)
Definition: sbloader.h:152
uint32_t bootSectID
section ID of the first boot section
Definition: sbloader.h:173
uint32_t data
data argument
Definition: sbloader.h:155
uint16_t hdrChunks
number of chunks in the header
Definition: sbloader.h:176
uint16_t keyOffset
chunk offset to the key dictionary
Definition: sbloader.h:175
status_t(* pLdrFnc_t)(ldr_Context_t *)
Function pointer definition for all loader action functions.
Definition: sbloader.h:184
_ldr_memory_ctrl
Memory Controller constants.
Definition: sbloader.h:118
uint32_t count
count argument
Definition: sbloader.h:154
status_t sbloader_finalize(void)
Implement jump or reset command.
Definition: sbloader.c:1131
uint16_t keyCount
number of keys in the key dictionary
Definition: sbloader.h:174
Definition for boot image file header chunk 1.
Definition: sbloader.h:159
uint8_t major
major file format version
Definition: sbloader.h:163
status_t sbloader_pump(uint8_t *data, uint32_t length)
Pump the loader state machine.
Definition: sbloader.c:1050
status_t sbloader_init(void)
Initialize the loader state machine.
Definition: sbloader.c:998
uint32_t bootOffset
chunk offset to the first boot section
Definition: sbloader.h:172
uint32_t signature
must equal "STMP"
Definition: sbloader.h:162
SB loader status group number (101).
Definition: bootloader_common.h:144
State information for the CRC32 algorithm.
Definition: crc32.h:44
Loader context definition.
Definition: sbloader.h:193
uint32_t fileChunks
total chunks in the file
Definition: sbloader.h:166
uint16_t fileFlags
global file flags
Definition: sbloader.h:165
uint16_t sectCount
number of sections in the image
Definition: sbloader.h:177
status_t(* pJumpFnc_t)(uint32_t)
Jump command function pointer definition.
Definition: sbloader.h:187
uint8_t tag
command tag (identifier)
Definition: sbloader.h:151
uint32_t address
address argument
Definition: sbloader.h:153
_sbloader_status
SB loader status codes.
Definition: sbloader.h:48
Definition for boot image file header chunk 2.
Definition: sbloader.h:170
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
status_t(* pCallFnc_t)(uint32_t, uint32_t *)
Call command function pointer definition.
Definition: sbloader.h:190