![]() |
Kinetis Bootloader Host
2.0.0
Host Tools for Kinetis devices
|
Class that encapsulates the elftosb tool. More...
Collaboration diagram for elftosbTool:Classes | |
| struct | FamilyNameTableEntry |
| A structure describing an entry in the table of chip family names. More... | |
Public Member Functions | |||
| elftosbTool (int argc, char *argv[]) | |||
| ~elftosbTool () | |||
| bool | lookupFamilyName (const char *name, chip_family_t *family) | ||
| Searches the family name table. More... | |||
| int | processOptions () | ||
| void | printUsage (Options &options) | ||
| int | run () | ||
| Core of the tool. More... | |||
| void | checkArguments () | ||
Validate arguments that can be checked.
| |||
| void | setVerboseLogging () | ||
| Turns on verbose logging. | |||
| uint32_t | parseIntValue (const char *value) | ||
| Returns the integer value for a string. More... | |||
| void | overrideVariable (const char *optarg) | ||
| Parses the -D option to override a constant value. | |||
| void | overrideOption (const char *optarg) | ||
| void | convert () | ||
Do the conversion.
| |||
| void | addCryptoKeys (elftosb::EncoreBootImage *encoreImage) | ||
| void | generateKeyFile (const std::string &path) | ||
| Opens the file at path and writes a random key file. More... | |||
| void | dumpKey (const AESKey< 128 > &key) | ||
| Write the value of each byte of the key to the log. | |||
| void | readBootImage () | ||
| Opens and reads the boot image identified on the command line. More... | |||
| void | extractSection (EncoreBootImage::Section *section) | ||
| Dumps the contents of a section to stdout. More... | |||
| bool | compareDigests (const sha1_digest_t &a, const sha1_digest_t &b) | ||
| Compares two SHA-1 digests and returns whether they are equal. More... | |||
| void | dumpImageHeader (const EncoreBootImage::boot_image_header_t &header) | ||
| void | dumpSectionHeader (const EncoreBootImage::section_header_t &header) | ||
| void | logHexArray (Logger::log_level_t level, const uint8_t *bytes, unsigned count) | ||
| Log an array of bytes as hex. | |||
Protected Types | |
| enum | chip_family_t { k37xxFamily, kMX28Family, kKinetisFamily } |
| Supported chip families. More... | |
Protected Attributes | |
| int | m_argc |
| Number of command line arguments. | |
| char ** | m_argv |
| String value for each command line argument. | |
| StdoutLogger * | m_logger |
| Singleton logger instance. | |
| string_vector_t | m_keyFilePaths |
| Paths to OTP key files. | |
| string_vector_t | m_positionalArgs |
| Arguments coming after explicit options. | |
| bool | m_isVerbose |
| Whether the verbose flag was turned on. | |
| bool | m_useDefaultKey |
| Include a default (zero) crypto key. | |
| const char * | m_commandFilePath |
| Path to the elftosb command file. | |
| const char * | m_outputFilePath |
| Path to the output .sb file. | |
| const char * | m_searchPath |
| Optional search path for input files. | |
| elftosb::version_t | m_productVersion |
| Product version specified on command line. | |
| elftosb::version_t | m_componentVersion |
| Component version specified on command line. | |
| bool | m_productVersionSpecified |
| True if the product version was specified on the command line. | |
| bool | m_componentVersionSpecified |
| True if the component version was specified on the command line. | |
| chip_family_t | m_family |
| Chip family that the output file is formatted for. | |
| elftosb::ConversionController | m_controller |
| Our conversion controller instance. | |
| bool | m_doElftoSB |
| True if generating SB file. | |
| bool | m_doKeygen |
| Whether to generate the key file. | |
| int | m_keyCount |
| Number of keys to generate. | |
| bool | m_doExtract |
| True if extract mode is on. | |
| int32_t | m_sectionIndex |
| Index of section to extract. | |
| bool | m_extractBinary |
| True if extraction output is binary, false for hex. | |
| smart_ptr< EncoreBootImageReader > | m_reader |
| Boot image reader object. | |
Static Protected Attributes | |
| static const FamilyNameTableEntry | kFamilyNameTable [] |
| Table that maps from family name strings to chip family constants. More... | |
Class that encapsulates the elftosb tool.
A single global logger instance is created during object construction. It is never freed because we need it up to the last possible minute, when an exception could be thrown.
| struct elftosbTool::FamilyNameTableEntry |
A structure describing an entry in the table of chip family names.
| Class Members | ||
|---|---|---|
| chip_family_t | family | |
| const char *const | name | |
|
protected |
|
inline |
Constructor.
Creates the singleton logger instance.
|
inline |
Destructor.
|
inline |
Compares two SHA-1 digests and returns whether they are equal.
| true | The two digests are equal. |
| false | The a and b digests are different from each other. |
|
inline |
Dumps the contents of a section to stdout.
If m_extractBinary is true then the contents are written as raw binary to stdout. Otherwise the data is formatted using logHexArray().
|
inline |
Opens the file at path and writes a random key file.
Each key file will have m_keyCount number of keys written into it, each on a line by itself.
|
inline |
Searches the family name table.
| true | The name was found in the table, and family is valid. |
| false | No matching family name was found. The family argument is not modified. |
|
inline |
Returns the integer value for a string.
Metric multiplier prefixes are supported.
|
inline |
Prints help for the tool.
|
inline |
Reads the command line options passed into the constructor.
This method can return a return code to its caller, which will cause the tool to exit immediately with that return code value. Normally, though, it will return -1 to signal that the tool should continue to execute and all options were processed successfully.
The Options class is used to parse command line options. See #k_optionsDefinition for the list of options and #k_usageText for the descriptive help for each option.
| -1 | The options were processed successfully. Let the tool run normally. |
|
inline |
Opens and reads the boot image identified on the command line.
|
inline |
Core of the tool.
Calls processOptions() to handle command line options before performing the real work the tool does.
|
staticprotected |
Table that maps from family name strings to chip family constants.