![]() |
Kinetis Bootloader Host
2.0.0
Host Tools for Kinetis devices
|
Update class contains the functionality necessary to update the firmware on a device running Bootloader. More...
#include <Updater.h>
Inheritance diagram for blfwk::Updater:
Collaboration diagram for blfwk::Updater:Public Member Functions | |
| Updater (const Peripheral::PeripheralConfigData &config) | |
| Default constructor. | |
| virtual | ~Updater () |
| Destructor. | |
| uint32_vector_t | getProperty (property_t tag) |
| get Device's property by using get-property command. More... | |
| uint32_t | getSectorSize () |
| get Device's flash sector size. More... | |
| uint32_t | getFlshSize () |
| get Device's flash size. More... | |
| void | eraseFlashRegion (uint32_t start, uint32_t length) |
| Execute the FlashEraseRegion bootloader command. More... | |
| void | eraseFlashAll (uint32_t memoryId) |
| Execute the FlashEraseAll bootloader command. More... | |
| void | programOnce (uint32_t index, uint32_t byteCount, string data) |
| Execute the FlashProgramOnce bootloader command. More... | |
Public Member Functions inherited from blfwk::Bootloader | |
| Bootloader () | |
| Default Constructor for Simulator. | |
| Bootloader (const Peripheral::PeripheralConfigData &config) | |
| Constructor. | |
| virtual | ~Bootloader () |
| Destructor. | |
| void | inject (Command &cmd) |
| Inject a command into the bootloader. More... | |
| void | flush () |
| Flush state. | |
| void | execute (uint32_t entry_point, uint32_t param=0, uint32_t stack_pointer=0) |
| Execute the execute command. | |
| void | reset () |
| Execute the reset command. | |
| standard_version_t | getVersion () |
| Execute the get-property(current-version) command. | |
| uint32_t | getSecurityState () |
| Execute the get-property(flash-security-state) command. | |
| void | ping (int retries, unsigned int delay, int comSpeed) |
| Send a ping if applicable. | |
| Packetizer * | getPacketizer () const |
| Get the host packetizer. | |
Update API. | |
| typedef void(* | progress_callback_t) (updater_operation_t *op) |
| Type for the progress callback routine. | |
| updater_operation_t | m_operation |
| Struct used to monitor the Operation progress. | |
| void | setCallback (progress_callback_t callback) |
| Set the user-defined function to call on progress events. More... | |
| void | registerCallback (void(*callback)(int, int, int), bool *abort) |
| Set callback for progress and abort control. More... | |
| status_t | flashFirmware (const char *filename, uint32_t base_address) |
| Program flash on the device. More... | |
| void | eraseAllUnsecure () |
| Erase all flash blocks and release MCU security. More... | |
| void | unlock (string backdoor_key) |
| Release security using BackdoorKey. More... | |
| bool | isCommandSupported (const cmd_t &command) |
| Checks if Kinetis Bootloader device supports a given command. More... | |
Bootloader commands | |
| uint32_t | m_base_address |
| Base address of the image. | |
| uint32_t | m_sector_size |
| Sector size of the flash on the device. | |
| uint32_t | m_flashStart |
| Start address of the flash on the device. | |
| uint32_t | m_flashSize |
| The flash size (in bytes) of the device. | |
| SourceFile * | m_sourceFile |
| SourceFile object. | |
| progress_callback_t | m_progressCallback |
| Callback used to report update progress. | |
| Progress | m_progress |
| Progress control. | |
| void | writeMemory (DataSource::Segment *segment) |
| Execute the write-memory bootloader command. More... | |
| void | writeMemory (uint32_t address, const uchar_vector_t &data) |
| Execute the write-memory bootloader command. More... | |
| status_t | flashFromSourceFile () |
| Program flash procedure for SourceFile types. | |
| status_t | flashFromSBFile (const char *filename) |
| Program flash procedure for SB files. | |
Additional Inherited Members | |
Protected Attributes inherited from blfwk::Bootloader | |
| Packetizer * | m_hostPacketizer |
| Packet interface to send commands on. | |
| FileLogger * | m_logger |
| Singleton logger instance. | |
Update class contains the functionality necessary to update the firmware on a device running Bootloader.
The purpose of this class is to provide a common interface for updating any device running the Kinetis Bootloader from several different file formats.
| void Updater::eraseAllUnsecure | ( | ) |
Erase all flash blocks and release MCU security.
| std::runtime_error | Raised if the FlashEraseAllUnsecure command does not return success. Raised if the FlashEraseAllUnsecure command is not supported. |
| void Updater::eraseFlashAll | ( | uint32_t | memoryId | ) |
Execute the FlashEraseAll bootloader command.
| std::runtime_error | Thrown if an error occurred while sending the FlashEraseAll bootloader command. |
| void Updater::eraseFlashRegion | ( | uint32_t | start, |
| uint32_t | length | ||
| ) |
Execute the FlashEraseRegion bootloader command.
| std::runtime_error | Thrown if an error occurred while sending the FlashEraseRegion(start, length) bootloader command. |
| start | The beginning address of the memory region to be erased. |
| length | The length in bytes of the memory region to be erased. |
| status_t Updater::flashFirmware | ( | const char * | filename, |
| uint32_t | base_address | ||
| ) |
Program flash on the device.
| std::runtime_error | Raised if the file could not be opened successfully. |
| filename | The file to program into the device. |
| base_address | The address on the device where the file wiill be written. |
|
inline |
get Device's flash size.
| uint32_vector_t Updater::getProperty | ( | property_t | tag | ) |
get Device's property by using get-property command.
| std::runtime_error | Thrown if an error occurred while sending the GetProperty(property) bootloader command. |
| property | tag |
|
inline |
get Device's flash sector size.
| bool Updater::isCommandSupported | ( | const cmd_t & | command | ) |
Checks if Kinetis Bootloader device supports a given command.
| std::runtime_error | Thrown if an error occurred while sending the GetProperty(kProperty_AvailableCommands) bootloader command. |
| command | The command to check. |
| void Updater::programOnce | ( | uint32_t | index, |
| uint32_t | byteCount, | ||
| string | data | ||
| ) |
Execute the FlashProgramOnce bootloader command.
| std::runtime_error | Thrown if an error occurred while sending the FlashEraseAll bootloader command. |
| index | The index of a specific program once field. |
| byteCount | The length in bytes of a specific program once field. |
| data | The 8/16 hex digitals to write. |
|
inline |
Set callback for progress and abort control.
| callback | The function to callback with the progress data. |
| abort | The variable used for abort phase control. |
|
inline |
Set the user-defined function to call on progress events.
| callback | The function to callback with the progress data. |
| void Updater::unlock | ( | string | backdoor_key | ) |
Release security using BackdoorKey.
| std::runtime_error | Raised if the FlashSecurityDisable command does not return success. Raised if the FlashSecurityDisable command is not supported. Raised if the parameter is illegal |
| backdoor_key | The 16 hex digitals used to release the security |
|
protected |
Execute the write-memory bootloader command.
| std::runtime_error | Thrown if an error occurred while sending the WriteMemory(segment) bootloader command. |
| [in,out] | segment | The DatSource::Segment that represents the data to be written to the device. |
|
protected |
Execute the write-memory bootloader command.
| std::runtime_error | Thrown if an error occurred while sending the WriteMemory(vector<uint8_t) bootloader command. |
| [in] | data | A vector<uchar> refernce that contains the data to be written to the device. |
| [in] | address | The address on the device where the data will be written. |