Kinetis Bootloader  2.0.0
Common bootloader for Kinetis devices
Property Store

Properties of the bootloader. More...

Data Structures

struct  bootloader_configuration_data_t
 Format of bootloader configuration data on Flash. More...
 
struct  reserved_region_t
 Structure of a reserved regions entry. More...
 
struct  unique_device_id_t
 Structure of a unique device id. More...
 
struct  external_memory_property_store_t
 Exernal Memory attribute store. More...
 
struct  property_store_t
 Structure of property store. More...
 
struct  external_memory_property_interface_t
 External Memory properties interface. More...
 
struct  property_interface_t
 Interface to property operations. More...
 

Enumerations

enum  _property_errors {
  kStatus_UnknownProperty = MAKE_STATUS(kStatusGroup_PropertyStore, 0),
  kStatus_ReadOnlyProperty = MAKE_STATUS(kStatusGroup_PropertyStore, 1),
  kStatus_InvalidPropertyValue = MAKE_STATUS(kStatusGroup_PropertyStore, 2)
}
 Property store status codes. More...
 
enum  _property_tag {
  kPropertyTag_ListProperties = 0x00,
  kPropertyTag_BootloaderVersion = 0x01,
  kPropertyTag_AvailablePeripherals = 0x02,
  kPropertyTag_FlashStartAddress = 0x03,
  kPropertyTag_FlashSizeInBytes = 0x04,
  kPropertyTag_FlashSectorSize = 0x05,
  kPropertyTag_FlashBlockCount = 0x06,
  kPropertyTag_AvailableCommands = 0x07,
  kPropertyTag_CrcCheckStatus = 0x08,
  kPropertyTag_Reserved9 = 0x09,
  kPropertyTag_VerifyWrites = 0x0a,
  kPropertyTag_MaxPacketSize = 0x0b,
  kPropertyTag_ReservedRegions = 0x0c,
  kPropertyTag_Reserved13 = 0x0d,
  kPropertyTag_RAMStartAddress = 0x0e,
  kPropertyTag_RAMSizeInBytes = 0x0f,
  kPropertyTag_SystemDeviceId = 0x10,
  kPropertyTag_FlashSecurityState = 0x11,
  kPropertyTag_UniqueDeviceId = 0x12,
  kPropertyTag_FacSupport = 0x13,
  kPropertyTag_FlashAccessSegmentSize = 0x14,
  kPropertyTag_FlashAccessSegmentCount = 0x15,
  kPropertyTag_FlashReadMargin = 0x16,
  kPropertyTag_QspiInitStatus = 0x17,
  kPropertyTag_TargetVersion = 0x18,
  kPropertyTag_ExternalMemoryAttributes = 0x19,
  kPropertyTag_ReliableUpdateStatus = 0x1a,
  kPropertyTag_InvalidProperty = 0xFF
}
 Property tags. More...
 
enum  _property_constants {
  kProperty_ReservedRegionsCount = 2,
  kProperty_FlashReservedRegionIndex = 0,
  kProperty_RamReservedRegionIndex = 1,
  kProperty_FlashVersionIdSizeInBytes = 8
}
 Property constants.
 
enum  _clock_flags { kClockFlag_HighSpeed = (1 << 0) }
 Bit positions for clock flags in configuration data.
 
enum  _boot_flags { kBootFlag_DirectBoot = (1 << 0) }
 Bit positions for boot flags in configuration data.
 
enum  _flash_constants { kBootloaderConfigAreaAddress = (uint32_t)(APP_VECTOR_TABLE) + 0x3c0 }
 Flash constants. More...
 
enum  _external_memory_property_tags {
  kExternalMemoryPropertyTag_InitStatus = 0,
  kExternalMemoryPropertyTag_StartAddress = 1,
  kExternalMemoryPropertyTag_MemorySizeInKbytes = 2,
  kExternalMemoryPropertyTag_PageSize = 3,
  kExternalMemoryPropertyTag_SectorSize = 4,
  kExternalMemoryPropertyTag_BlockSize = 5,
  kExternalMemoryPropertyTag_Start = kExternalMemoryPropertyTag_StartAddress,
  kExternalMemoryPropertyTag_End = kExternalMemoryPropertyTag_BlockSize
}
 External Memory Properties tag. More...
 
enum  _ram_constants {
  kRAMCount = 3,
  kRAMCount = 3
}
 
enum  _property_store_tags { kPropertyStoreTag = FOUR_CHAR_CODE('k', 'c', 'f', 'g') }
 

Variables

const property_interface_t g_propertyInterface
 Property interface.
 

Command Availability

enum  _available_commands { kAvailableCommands }
 

Property Store

status_t bootloader_property_load_user_config (void)
 Early initialization function to get user configuration data.
 
status_t bootloader_property_init (void)
 Initialize the property store. More...
 
status_t bootloader_property_get (uint8_t tag, uint8_t memoryId, const void **value, uint32_t *valueSize)
 Get a property. More...
 
status_t bootloader_property_set_uint32 (uint8_t tag, uint32_t value)
 Set a property. More...
 

Usage Information

Properties of the bootloader.


Data Structure Documentation

struct bootloader_configuration_data_t

Format of bootloader configuration data on Flash.

Data Fields
uint8_t bootFlags [1e:1e] One's complemnt of direct boot flag, 0xFE represents direct boot
uint8_t canConfig1 [29:29] ClkSel[1], PropSeg[3], SpeedIndex[4]
uint16_t canConfig2 [2a:2b] Pdiv[8], Pseg1[3], Pseg2[3], rjw[2]
uint16_t canRxId [2e:2f] rxId
uint16_t canTxId [2c:2d] txId
uint8_t clockDivider [1d:1d] One's complement of clock divider, zero divider is divide by 1
uint8_t clockFlags [1c:1c] High Speed and other clock options
uint32_t crcByteCount [08:0b]
uint32_t crcExpectedValue [0c:0f]
uint32_t crcStartAddress [04:07]
uint8_t enabledPeripherals [10:10]
uint8_t i2cSlaveAddress [11:11]
uint32_t keyBlobPointer [24:27] Holds a pointer value to the key blob array used to configure OTFAD
uint32_t mmcauConfigPointer [20:23] Holds a pointer value to the MMCAU configuration
uint8_t pad0 [1f:1f] Reserved, set to 0xFF
uint8_t pad1 [28:28] reserved
uint16_t peripheralDetectionTimeoutMs

[12:13] Timeout in milliseconds for peripheral detection before jumping

uint32_t qspi_config_block_pointer [30:33] QSPI config block pointer.
uint32_t tag [00:03] Tag value used to validate the bootloader configuration data. Must be set to 'kcfg'.
uint16_t usbPid [16:17]
uint32_t usbStringsPointer [18:1b]
uint16_t usbVid to application code

[14:15]

struct reserved_region_t

Structure of a reserved regions entry.

Data Fields
uint32_t endAddress
uint32_t startAddress
struct unique_device_id_t

Structure of a unique device id.

Data Fields
uint32_t uidh
uint32_t uidl
uint32_t uidmh
uint32_t uidml
struct external_memory_property_store_t

Exernal Memory attribute store.

Data Fields
uint32_t availableAttributesFlag Available Atrributes, bit map.
uint32_t blockSize block size of external memory
uint32_t flashSizeInKB flash size of external memory
uint32_t pageSize page size of external memory
uint32_t sectorSize sector size of external memory
uint32_t startAddress start Address of external memory
struct property_store_t

Structure of property store.

+ Collaboration diagram for property_store_t:
Data Fields
uint32_t availableCommands verificaton. Writable by host.

Bit mask of the available commands.

uint32_t availablePeripherals

The set of peripherals supported available on this chip. See enum _peripheral_types in bl_peripheral.h.

standard_version_t bootloaderVersion Current bootloader version.
bootloader_configuration_data_t configurationData Configuration data from flash address 0x3c0-0x3ff in sector 0 (64 bytes max)
uint32_t crcCheckStatus Status code from the last CRC check operation.
external_memory_property_store_t externalMemoryPropertyStore Property store for external memory.
uint32_t flashAccessSegmentCount The count of flash access segment within flash module.
uint32_t flashAccessSegmentSize The size in bytes of one segment of flash.
uint32_t flashBlockCount Number of blocks in the flash array.
uint32_t flashBlockSize The size in bytes of one block of program flash.
uint32_t flashFacSupport Boolean indicating whether the FAC feature is supported.
uint32_t flashReadMargin The margin level setting for flash erase and program Verify CMDs.
uint32_t flashSectorSize The size in bytes of one sector of program flash. This is the minimum erase size.
uint32_t flashSizeInBytes Size in bytes of program flash.
uint32_t flashStartAddress Start address of program flash.
uint32_t qspiInitStatus Result of QSPI+OTFAD init during bootloader startup.
uint32_t ramSizeInBytes[kRAMCount] Size in bytes of RAM.
uint32_t ramStartAddress[kRAMCount] Start address of RAM.
uint32_t reliableUpdateStatus Status of reliable update.
reserved_region_t reservedRegions[kProperty_ReservedRegionsCount] Flash and Ram reserved regions.
standard_version_t serialProtocolVersion Serial protocol version number.
standard_version_t targetVersion Target version number.
unique_device_id_t UniqueDeviceId Unique identification for the device.
uint32_t verifyWrites

Boolean controlling whether the bootloader will verify writes to flash. Non-zero enables

struct external_memory_property_interface_t

External Memory properties interface.

Data Fields

uint32_t memoryId
 
status_t(* get )(uint32_t tag, uint32_t *value)
 
struct property_interface_t

Interface to property operations.

+ Collaboration diagram for property_interface_t:

Data Fields

status_t(* load_user_config )(void)
 Load the user configuration data.
 
status_t(* init )(void)
 Initialize.
 
status_t(* get )(uint8_t tag, uint8_t id, const void **value, uint32_t *valueSize)
 Get property.
 
status_t(* set_uint32 )(uint8_t tag, uint32_t value)
 Set uint32_t property.
 
property_store_tstore
 The property store.
 

Enumeration Type Documentation

External Memory Properties tag.

Enumerator
kExternalMemoryPropertyTag_InitStatus 

Init status tag.

kExternalMemoryPropertyTag_StartAddress 

Start address tag.

kExternalMemoryPropertyTag_MemorySizeInKbytes 

Memory size tag.

kExternalMemoryPropertyTag_PageSize 

Pag size tag.

kExternalMemoryPropertyTag_SectorSize 

Sector size tag.

kExternalMemoryPropertyTag_BlockSize 

Block size tag.

Flash constants.

Enumerator
kBootloaderConfigAreaAddress 

The bootloader configuration data location .

A User Application should populate a BootloaderConfigurationData struct at 0x3c0 from the beginning of the application image which must be the User Application vector table for the flash-resident bootloader collaboration.

Property store status codes.

Enumerator
kStatus_ReadOnlyProperty 

Property is read-only.

kStatus_InvalidPropertyValue 

Property value is out of range.

Enumerator
kPropertyStoreTag 

Tag value used to validate the bootloader configuration data.

Property tags.

Note
Do not change any tag values. Add tags at the end.

Function Documentation

status_t bootloader_property_get ( uint8_t  tag,
uint8_t  memoryId,
const void **  value,
uint32_t *  valueSize 
)

Get a property.

Example calling sequence for uint32_t property:

1 void * value;
2 uint32_t valueSize;
3 status_t status = bootloader_property_get(sometag, &value, &valueSize);
4 uint32_t result = *(uint32_t *)value;
Parameters
tagTag of the requested property
memoryIdId for specified external memory, for example: 1 represent QuadSPI 0
valuePointer to where to write a pointer to the result, may be NULL
valueSizeSize in bytes of the property value, may be NULL
Return values
kStatus_Success
kStatus_UnknownProperty
status_t bootloader_property_init ( void  )

Initialize the property store.

Initialize flash properties.

status_t bootloader_property_set_uint32 ( uint8_t  tag,
uint32_t  value 
)

Set a property.

Only uint32_t properties can be set with this function.

Parameters
tagTag of the property to set
valueNew property value
Return values
kStatus_Success
kStatus_UnknownProperty
kStatus_ReadOnlyProperty