35 #include "bootloader_common.h" 36 #include "packet/command_packet.h" 37 #if !defined(BOOTLOADER_HOST) 38 #include "fsl_device_registers.h" 39 #include "utilities/vector_table_info.h" 54 #define HAS_CMD(tag) (1 << ((tag)-kFirstCommandTag)) 58 #define IS_CMD_AVAILABLE(mask, tag) (((mask)&HAS_CMD(tag)) != 0) 60 enum _available_commands
62 kAvailableCommands = (
63 #if !BL_FEATURE_MIN_PROFILE 64 HAS_CMD(kCommandTag_FlashEraseAll) | HAS_CMD(kCommandTag_FlashEraseRegion) | HAS_CMD(kCommandTag_WriteMemory)
65 #if BL_FEATURE_FLASH_SECURITY 67 HAS_CMD(kCommandTag_FlashSecurityDisable)
68 #endif // BL_FEATURE_ERASEALL_UNSECURE 70 HAS_CMD(kCommandTag_GetProperty) | HAS_CMD(kCommandTag_Execute) | HAS_CMD(kCommandTag_Reset) |
71 HAS_CMD(kCommandTag_SetProperty) | HAS_CMD(kCommandTag_ReadMemory) | HAS_CMD(kCommandTag_FillMemory) |
72 HAS_CMD(kCommandTag_ReceiveSbFile) | HAS_CMD(kCommandTag_Call)
73 #if BL_FEATURE_ERASEALL_UNSECURE 75 HAS_CMD(kCommandTag_FlashEraseAllUnsecure)
76 #endif // BL_FEATURE_ERASEALL_UNSECURE 78 HAS_CMD(kCommandTag_FlashReadOnce) | HAS_CMD(kCommandTag_FlashProgramOnce) |
79 HAS_CMD(kCommandTag_FlashReadResource)
80 #if BL_FEATURE_QSPI_MODULE 82 HAS_CMD(kCommandTag_ConfigureQuadSpi)
83 #endif // BL_FEATURE_QSPI_MODULE 85 #else // BL_FEATURE_MIN_PROFILE 86 HAS_CMD(kCommandTag_FlashEraseAll) | HAS_CMD(kCommandTag_FlashEraseRegion) | HAS_CMD(kCommandTag_WriteMemory)
87 #if BL_FEATURE_FLASH_SECURITY 89 HAS_CMD(kCommandTag_FlashSecurityDisable)
90 #endif // BL_FEATURE_FLASH_SECURITY 92 HAS_CMD(kCommandTag_GetProperty) | HAS_CMD(kCommandTag_Execute) | HAS_CMD(kCommandTag_Reset) |
93 HAS_CMD(kCommandTag_SetProperty)
94 #if BL_FEATURE_READ_MEMORY 96 HAS_CMD(kCommandTag_ReadMemory)
97 #endif // BL_FEATURE_READ_MEMORY 98 #if BL_FEATURE_FILL_MEMORY 100 HAS_CMD(kCommandTag_FillMemory)
101 #endif // BL_FEATURE_FILL_MEMORY 102 #if BL_FEATURE_ERASEALL_UNSECURE 104 HAS_CMD(kCommandTag_FlashEraseAllUnsecure)
105 #endif // BL_FEATURE_ERASEALL_UNSECURE 106 #if BL_FEATURE_QSPI_MODULE 108 HAS_CMD(kCommandTag_ConfigureQuadSpi)
109 #endif // BL_FEATURE_QSPI_MODULE 111 #endif // BL_FEATURE_MIN_PROFILE 129 kPropertyTag_ListProperties = 0x00,
130 kPropertyTag_BootloaderVersion = 0x01,
131 kPropertyTag_AvailablePeripherals = 0x02,
132 kPropertyTag_FlashStartAddress = 0x03,
133 kPropertyTag_FlashSizeInBytes = 0x04,
134 kPropertyTag_FlashSectorSize = 0x05,
135 kPropertyTag_FlashBlockCount = 0x06,
136 kPropertyTag_AvailableCommands = 0x07,
137 kPropertyTag_CrcCheckStatus = 0x08,
138 kPropertyTag_Reserved9 = 0x09,
139 kPropertyTag_VerifyWrites = 0x0a,
140 kPropertyTag_MaxPacketSize = 0x0b,
141 kPropertyTag_ReservedRegions = 0x0c,
142 kPropertyTag_Reserved13 = 0x0d,
143 kPropertyTag_RAMStartAddress = 0x0e,
144 kPropertyTag_RAMSizeInBytes = 0x0f,
145 kPropertyTag_SystemDeviceId = 0x10,
146 kPropertyTag_FlashSecurityState = 0x11,
147 kPropertyTag_UniqueDeviceId = 0x12,
148 kPropertyTag_FacSupport = 0x13,
149 kPropertyTag_FlashAccessSegmentSize = 0x14,
150 kPropertyTag_FlashAccessSegmentCount = 0x15,
151 kPropertyTag_FlashReadMargin = 0x16,
152 kPropertyTag_QspiInitStatus = 0x17,
153 kPropertyTag_TargetVersion = 0x18,
154 kPropertyTag_ExternalMemoryAttributes = 0x19,
155 kPropertyTag_ReliableUpdateStatus = 0x1a,
156 kPropertyTag_InvalidProperty = 0xFF,
162 kProperty_ReservedRegionsCount = 2,
163 kProperty_FlashReservedRegionIndex = 0,
164 kProperty_RamReservedRegionIndex = 1,
166 kProperty_FlashVersionIdSizeInBytes = 8,
172 kClockFlag_HighSpeed = (1 << 0)
178 kBootFlag_DirectBoot = (1 << 0)
181 #if !defined(BOOTLOADER_HOST) 193 #endif // BOOTLOADER_HOST 196 typedef struct BootloaderConfigurationData
224 typedef struct ReservedRegion
226 uint32_t startAddress;
231 typedef struct UniqueDeviceId
236 #if defined(BOOTLOADER_HOST) | defined(SIM_UIDH) 268 #if CPU_IS_ARM_CORTEX_M7 276 typedef struct PropertyStore
282 uint32_t flashStartAddress;
288 uint32_t ramStartAddress[kRAMCount];
289 uint32_t ramSizeInBytes[kRAMCount];
292 uint32_t availableCommands;
314 typedef struct ExternalMemoryPropertyInterface
317 status_t (*
get)(uint32_t tag, uint32_t *value);
321 typedef struct PropertyInterface
325 status_t (*
get)(uint8_t tag, uint8_t id,
const void **value, uint32_t *valueSize);
326 status_t (*set_uint32)(uint8_t tag, uint32_t value);
393 #endif // _property_h Sector size tag.
Definition: property.h:248
status_t bootloader_property_set_uint32(uint8_t tag, uint32_t value)
Set a property.
Definition: property.c:480
uint16_t peripheralDetectionTimeoutMs
Definition: property.h:204
uint8_t pad0
[1f:1f] Reserved, set to 0xFF
Definition: property.h:212
_external_memory_property_tags
External Memory Properties tag.
Definition: property.h:242
uint32_t flashSizeInBytes
Size in bytes of program flash.
Definition: property.h:284
uint16_t canTxId
[2c:2d] txId
Definition: property.h:218
uint32_t tag
[00:03] Tag value used to validate the bootloader configuration data. Must be set to 'kcfg'...
Definition: property.h:198
_clock_flags
Bit positions for clock flags in configuration data.
Definition: property.h:170
uint32_t qspi_config_block_pointer
[30:33] QSPI config block pointer.
Definition: property.h:220
_property_constants
Property constants.
Definition: property.h:160
Exernal Memory attribute store.
Definition: property.h:256
_property_errors
Property store status codes.
Definition: property.h:118
uint32_t keyBlobPointer
[24:27] Holds a pointer value to the key blob array used to configure OTFAD
Definition: property.h:214
status_t bootloader_property_init(void)
Initialize the property store.
Definition: property.c:151
standard_version_t serialProtocolVersion
Serial protocol version number.
Definition: property.h:279
uint8_t bootFlags
[1e:1e] One's complemnt of direct boot flag, 0xFE represents direct boot
Definition: property.h:211
bootloader_configuration_data_t configurationData
Configuration data from flash address 0x3c0-0x3ff in sector 0 (64 bytes max)
Definition: property.h:302
uint32_t flashSizeInKB
flash size of external memory
Definition: property.h:260
uint8_t i2cSlaveAddress
[11:11]
Definition: property.h:203
uint8_t pad1
[28:28] reserved
Definition: property.h:215
const property_interface_t g_propertyInterface
Property interface.
Definition: property.c:100
Pag size tag.
Definition: property.h:247
property_store_t * store
The property store.
Definition: property.h:327
uint32_t verifyWrites
Definition: property.h:291
uint32_t sectorSize
sector size of external memory
Definition: property.h:262
standard_version_t targetVersion
Target version number.
Definition: property.h:280
External Memory properties interface.
Definition: property.h:314
uint16_t canRxId
[2e:2f] rxId
Definition: property.h:219
uint16_t canConfig2
[2a:2b] Pdiv[8], Pseg1[3], Pseg2[3], rjw[2]
Definition: property.h:217
uint32_t flashAccessSegmentSize
The size in bytes of one segment of flash.
Definition: property.h:296
uint32_t flashSectorSize
The size in bytes of one sector of program flash. This is the minimum erase size. ...
Definition: property.h:285
status_t bootloader_property_load_user_config(void)
Early initialization function to get user configuration data.
Definition: property.c:118
uint32_t flashReadMargin
The margin level setting for flash erase and program Verify CMDs.
Definition: property.h:298
uint32_t availablePeripherals
Definition: property.h:281
The bootloader configuration data location .
Definition: property.h:191
uint32_t flashBlockSize
The size in bytes of one block of program flash.
Definition: property.h:286
_property_tag
Property tags.
Definition: property.h:127
Structure of a unique device id.
Definition: property.h:231
Property store status group number (103).
Definition: bootloader_common.h:146
uint8_t enabledPeripherals
[10:10]
Definition: property.h:202
uint8_t clockDivider
[1d:1d] One's complement of clock divider, zero divider is divide by 1
Definition: property.h:210
uint32_t crcByteCount
[08:0b]
Definition: property.h:200
uint32_t crcExpectedValue
[0c:0f]
Definition: property.h:201
uint32_t startAddress
start Address of external memory
Definition: property.h:259
uint16_t usbPid
[16:17]
Definition: property.h:207
uint32_t pageSize
page size of external memory
Definition: property.h:261
_boot_flags
Bit positions for boot flags in configuration data.
Definition: property.h:176
Block size tag.
Definition: property.h:249
uint32_t mmcauConfigPointer
[20:23] Holds a pointer value to the MMCAU configuration
Definition: property.h:213
Interface to property operations.
Definition: property.h:321
uint8_t clockFlags
[1c:1c] High Speed and other clock options
Definition: property.h:209
status_t bootloader_property_get(uint8_t tag, uint8_t memoryId, const void **value, uint32_t *valueSize)
Get a property.
Definition: property.c:304
Structure of version property.
Definition: bootloader_common.h:168
Memory size tag.
Definition: property.h:246
Init status tag.
Definition: property.h:244
uint32_t crcCheckStatus
Status code from the last CRC check operation.
Definition: property.h:290
Start address tag.
Definition: property.h:245
Property is read-only.
Definition: property.h:121
uint32_t flashFacSupport
Boolean indicating whether the FAC feature is supported.
Definition: property.h:295
external_memory_property_store_t externalMemoryPropertyStore
Property store for external memory.
Definition: property.h:303
uint32_t qspiInitStatus
Result of QSPI+OTFAD init during bootloader startup.
Definition: property.h:299
_property_store_tags
Definition: property.h:307
Property value is out of range.
Definition: property.h:122
uint32_t blockSize
block size of external memory
Definition: property.h:263
Structure of property store.
Definition: property.h:276
uint32_t crcStartAddress
[04:07]
Definition: property.h:199
uint8_t canConfig1
[29:29] ClkSel[1], PropSeg[3], SpeedIndex[4]
Definition: property.h:216
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
uint32_t usbStringsPointer
[18:1b]
Definition: property.h:208
uint32_t flashAccessSegmentCount
The count of flash access segment within flash module.
Definition: property.h:297
uint32_t reliableUpdateStatus
Status of reliable update.
Definition: property.h:304
Tag value used to validate the bootloader configuration data.
Definition: property.h:310
_flash_constants
Flash constants.
Definition: property.h:183
Format of bootloader configuration data on Flash.
Definition: property.h:196
Structure of a reserved regions entry.
Definition: property.h:224
unique_device_id_t UniqueDeviceId
Unique identification for the device.
Definition: property.h:294
uint32_t flashBlockCount
Number of blocks in the flash array.
Definition: property.h:287
uint32_t availableAttributesFlag
Available Atrributes, bit map.
Definition: property.h:258
standard_version_t bootloaderVersion
Current bootloader version.
Definition: property.h:278