Kinetis Bootloader  2.0.0
Common bootloader for Kinetis devices
Context

Bootloader context and API structures. More...

+ Collaboration diagram for Context:

Data Structures

struct  flash_driver_interface_t
 Interface for the flash driver. More...
 
struct  aes_driver_interface_t
 Interface for AES 128 functions. More...
 
struct  bootloader_context_t
 Structure of bootloader global context. More...
 
struct  bootloader_tree_t
 Root of the bootloader API tree. More...
 

Typedefs

typedef uint32_t flash_driver_interface_t
 
typedef uint32_t flash_config_t
 
typedef uint32_t aes_driver_interface_t
 

Enumerations

enum  _bootloader_version_constants {
  kBootloader_Version_Name = 'K',
  kBootloader_Version_Major = 2,
  kBootloader_Version_Minor = 0,
  kBootloader_Version_Bugfix = 0
}
 Version constants for the bootloader.
 

Variables

bootloader_context_t g_bootloaderContext
 Bootloader global context data. More...
 
const flash_driver_interface_t g_flashDriverInterface
 Function table for flash driver.
 
const aes_driver_interface_t g_aesInterface
 
bootloader_context_t g_bootloaderContext
 Bootloader global context data. More...
 
const flash_driver_interface_t g_flashDriverInterface
 Function table for flash driver.
 
const aes_driver_interface_t g_aesInterface
 
const char bootloaderCopyright [] = "Copyright (c) 2013-2016 Freescale Semiconductor, Inc. All rights reserved."
 Copyright string for the bootloader.
 
const bootloader_tree_t g_bootloaderTree
 Static API tree. More...
 

Bootloader Entry Point

void bootloader_user_entry (void *arg)
 Entry point called by a user application to run the bootloader. More...
 

Usage Information

Bootloader context and API structures.


Data Structure Documentation

struct flash_driver_interface_t

Interface for the flash driver.

+ Collaboration diagram for flash_driver_interface_t:

Data Fields

standard_version_t version
 flash driver API version number.
 
status_t(* flash_init )(flash_config_t *config)
 
status_t(* flash_erase_all )(flash_config_t *config, uint32_t key)
 
status_t(* flash_erase_all_unsecure )(flash_config_t *config, uint32_t key)
 
status_t(* flash_erase )(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key)
 
status_t(* flash_program )(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)
 
status_t(* flash_get_security_state )(flash_config_t *config, flash_security_state_t *state)
 
status_t(* flash_security_bypass )(flash_config_t *config, const uint8_t *backdoorKey)
 
status_t(* flash_verify_erase_all )(flash_config_t *config, flash_margin_value_t margin)
 
status_t(* flash_verify_erase )(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_margin_value_t margin)
 
status_t(* flash_verify_program )(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint32_t *expectedData, flash_margin_value_t margin, uint32_t *failedAddress, uint32_t *failedData)
 
status_t(* flash_get_property )(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value)
 
status_t(* flash_register_callback )(flash_config_t *config, flash_callback_t callback)
 
status_t(* flash_program_once )(flash_config_t *config, uint32_t index, uint32_t *src, uint32_t lengthInBytes)
 
status_t(* flash_read_once )(flash_config_t *config, uint32_t index, uint32_t *dst, uint32_t lengthInBytes)
 
status_t(* flash_read_resource )(flash_config_t *config, uint32_t start, uint32_t *dst, uint32_t lengthInBytes, flash_read_resource_option_t option)
 
status_t(* flash_prepare_execute_in_ram_functions )(flash_config_t *config)
 
status_t(* flash_is_execute_only )(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, flash_execute_only_access_state_t *access_state)
 
status_t(* flash_erase_all_execute_only_segments )(flash_config_t *config, uint32_t key)
 
status_t(* flash_verify_erase_all_execute_only_segments )(flash_config_t *config, flash_margin_value_t margin)
 
status_t(* flash_set_flexram_function )(flash_config_t *config, flash_flexram_function_option_t option)
 
status_t(* flash_program_section )(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)
 
struct aes_driver_interface_t

Interface for AES 128 functions.

Data Fields

void(* aes_init )(uint32_t *key)
 
void(* aes_encrypt )(uint32_t *in, uint32_t *key, uint32_t *out)
 
void(* aes_decrypt )(uint32_t *in, uint32_t *key, uint32_t *out)
 
struct bootloader_context_t

Structure of bootloader global context.

+ Collaboration diagram for bootloader_context_t:
Data Fields
const peripheral_descriptor_t * activePeripheral The currently active peripheral.
const aes_driver_interface_t * aesInterface Interface to the AES driver.
const peripheral_descriptor_t * allPeripherals Array of all peripherals.
const command_interface_t * commandInterface Interface to command processor operations.
const flash_driver_interface_t * flashDriverInterface Flash driver interface.
flash_config_t flashState Flash driver instance.
const memory_interface_t * memoryInterface Abstract interface to memory operations.
const memory_map_entry_t * memoryMap Memory map used by abstract memory interface.
const property_interface_t * propertyInterface Interface to property store.
struct bootloader_tree_t

Root of the bootloader API tree.

An instance of this struct resides in read-only memory in the bootloader. It provides a user application access to APIs exported by the bootloader.

Note
The order of existing fields must not be changed.
+ Collaboration diagram for bootloader_tree_t:

Data Fields

void(* runBootloader )(void *arg)
 Function to start the bootloader executing.
 
standard_version_t version
 Bootloader version number.
 
const char * copyright
 Copyright string.
 
const bootloader_context_truntimeContext
 Pointer to the bootloader's runtime context.
 
const flash_driver_interface_tflashDriver
 Flash driver API.
 
const aes_driver_interface_taesDriver
 AES driver API.
 
standard_version_t bootloader_version
 Bootloader version number.
 
const uint32_t * reserved
 Do NOT use.
 

Function Documentation

void bootloader_user_entry ( void *  arg)

Entry point called by a user application to run the bootloader.

For ROM targets, this function configures the RCM_FM register so that the ROM will execute automatically out of reset. Then the system is reset.

Flash-resident configurations just call the reset handler as the entry point, since there is no way to automatically get back into the bootloader out of reset (or at least no guaranteed way).

Parameters
argFor future expansion. Currently unused.

Variable Documentation

const aes_driver_interface_t g_aesInterface
Initial value:
= {
#if AES_SECURITY_SUPPORTED
.aes_init = aes_init, .aes_encrypt = aes_encrypt, .aes_decrypt = aes_decrypt
}
void aes_init(uint32_t *key)
An initialization function for the decryption peripheral Warning: The key must be word aligned...
Definition: aes_security.c:79
void aes_decrypt(uint32_t *in, uint32_t *key, uint32_t *out)
Decrypts a 16 byte block of data in and out may use the same address so decrypting in place is suppor...
Definition: aes_security.c:138
void aes_encrypt(uint32_t *in, uint32_t *key, uint32_t *out)
Encrypts a 16 byte block of data in and out may use the same address so encrypting in place is suppor...
Definition: aes_security.c:113
bootloader_context_t g_bootloaderContext
Initial value:
= {.memoryInterface = &g_memoryInterface,
.memoryMap = g_memoryMap,
.allPeripherals = g_peripherals,
.activePeripheral = NULL,
.propertyInterface = &g_propertyInterface,
.commandInterface = &g_commandInterface,
.flashDriverInterface = &g_flashDriverInterface,
#if AES_SECURITY_SUPPORTED
.aesInterface = &g_aesInterface
#endif
}
command_interface_t g_commandInterface
Default command interface.
Definition: bl_command.c:207
const property_interface_t g_propertyInterface
Property interface.
Definition: property.c:100
const memory_interface_t g_memoryInterface
Abstract memory interface.
Definition: memory.c:59
const peripheral_descriptor_t g_peripherals[]
Array of all peripherals available in this device.
Definition: MK65F18/src/bus_pal_hardware.c:206
memory_map_entry_t g_memoryMap[]
Memory map for the system.
const flash_driver_interface_t g_flashDriverInterface
Function table for flash driver.
Definition: bl_tree_root.c:46

Bootloader global context data.

bootloader_context_t g_bootloaderContext

Bootloader global context data.

const bootloader_tree_t g_bootloaderTree
Initial value:
= {.runBootloader = bootloader_user_entry,
.version = {.name = kBootloader_Version_Name,
.major = kBootloader_Version_Major,
.minor = kBootloader_Version_Minor,
.bugfix = kBootloader_Version_Bugfix },
.copyright = bootloaderCopyright,
.runtimeContext = &g_bootloaderContext,
.flashDriver = &g_flashDriverInterface,
.aesDriver = &g_aesInterface }
void bootloader_user_entry(void *arg)
Entry point called by a user application to run the bootloader.
Definition: bl_user_entry.c:43
bootloader_context_t g_bootloaderContext
Bootloader global context data.
Definition: bl_context.c:40
const char bootloaderCopyright[]
Copyright string for the bootloader.
Definition: bl_tree_root.c:116
const flash_driver_interface_t g_flashDriverInterface
Function table for flash driver.
Definition: bl_tree_root.c:46

Static API tree.