FwTools class provides basic manipulation (Parse, Create, Convert, Combine, Validate, Compare) with Intel-HEX, TI-TXT, SREC and ELF firmware formatted files.
More...
|
| class | BslPasswords |
| | [MSP430 specific] BSL Password is required for almost any BSL operation except Mass Erase. Password is last 16-byte (F543x-non-A only) or 32-byte (others) of IVT (FFE0-FFFF), if newer 5xx/6xx MCU is used. If MCU from older series is used (1xx/2xx/4xx), password is exactly 20-byte long. Mostly it is 32-byte. More...
|
| |
| class | Firmware |
| | Firmware object representation. Nodes is collection of FwNode (Addr + Data) and Info is FwInfo class. ToString, Equal and Euqality Operators (==, !=) overides are available. More...
|
| |
| class | FwInfo |
| | FwInfo provides info about firmware, like format, first and last addresses, CRC, code size and reset vector. More...
|
| |
| class | FwNode |
| | Atomic unit which every firmware consits of representated by single byte with max 32-bit long address. More...
|
| |
|
| static Firmware | Parse (string FirmwarePath, FwFormat Format=FwFormat.AUTO, bool FillFF=false, StringWriter Log=null) |
| | Parse firmware file from FirmwarePath in TI-TXT, Intel-HEX or ELF format and returns List of FwNode (Data+Addr) and Info. Auto Mode reads data and based on some particular characters determine what firmare format it should be. FillFF is optional parameter forcing to fill missing addr nodes with 0xFF and return monolithic piece of code, which is usefull for crc calc or overwriting whole memory in mcu. Log writes text (new line formatted) output only when parsing ELF firmware file. More...
|
| |
| static string | Create (Firmware Firmware, FwFormat Format=FwFormat.AUTO, int LineLength=0) |
| | Create firmware multi-line string in TI-TXT or Intel-HEX format. ELF is not supported yet. AUTO format will force TI-TXT format. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32). More...
|
| |
| static string | Create (IEnumerable< byte > Data, int AddrStart, FwFormat Format=FwFormat.AUTO, int LineLength=0) |
| | Create firmware multi-line string in TI-TXT or Intel-HEX format. ELF is not supported yet. AUTO format will force TI-TXT format. AddrStart is address of first byte in data collection. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32). More...
|
| |
| static string | Create (ICollection< FwNode > Data, FwFormat Format=FwFormat.AUTO, int LineLength=0) |
| | Create firmware multi-line string in TI-TXT or Intel-HEX format. ELF is not supported yet. AUTO format will force TI-TXT format. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32). More...
|
| |
| static BslPasswords | GetPassword (string FirmwarePath) |
| | [MSP430 specific] Read and parse firmware file (format auto-detected) and return BSL password. Password is last 16-byte (F543x-non-A only) or 32-byte (others) of IVT (FFE0-FFFF), if newer 5xx/6xx MCU is used. If MCU from older series is used (1xx/2xx/4xx), password is exactly 20-byte long. Mostly it is 32-byte. More...
|
| |
| static FwInfo | Validate (string FirmwarePath, StringWriter Log=null) |
| | Validate firmware file and return FwInfo class, with specific firmware information. ResetVector and SizeBuffer are MSP430 specifics, other properties are universal. Log writes text (new line formatted) output only when parsing ELF firmware file. More...
|
| |
|
| static string | Fw |
| | Convert firmware TI-TXT, Intel-HEX or ELF format (auto detected) to firmware in TI-TX or Intel-HEX format. Returned Fw is firmware and Format is useful for auto-detect feedback, indicates input format. FillFF is optional parameter forcing to fill missing addr nodes with 0xFF and return monolithic piece of code, which is usefull for crc calc or overwriting whole memory in mcu. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32). More...
|
| |
| static bool | Equal |
| | Compare two Firmware files. First, auto-detects format, then parse Nodes (Address + Data) and finally run compare. Equal = True if both files contains exactly same set of Firmware Nodes, in other case result is false. Equal = False if any Firmware is null or if any Firmware Node count is zero. Match [0.0 ; 1.0] is match when 1.0 is full match and Equal = True, and 0.0 is different fw. BytesDiff is count of bytes (Data nodes) which both firmwares differ at. 0 means full match. More...
|
| |
|
|
static string FwFormat Format | Convert (string FirmwarePath, FwFormat Format, bool FillFF=false, int LineLength=0) |
| |
|
static string FwFormat FwFormat Format2 | Combine (string FirmwarePath1, string FirmwarePath2, FwFormat Format, bool FillFF=false, int LineLength=0) |
| |
|
static bool double int BytesDiff | Compare (string FirmwarePath1, string FirmwarePath2) |
| |
|
static bool double int BytesDiff | Compare (Firmware Firmware1, Firmware Firmware2) |
| |
|
static Firmware | ParseAutoDetect (string firmware_path, bool fill_FF=false, StringWriter log=null) |
| |
|
static Firmware | ParseIntelHex (string firmware_path, bool fill_FF=false, string _data="") |
| |
|
static Firmware | ParseTiTxt (string firmware_path, bool fill_FF=false, string _data="") |
| |
|
static Firmware | ParseSrec (string firmware_path, bool fill_FF=false, string _data="") |
| |
|
static Firmware | ParseElf32 (string firmware_path, bool fill_FF=false, byte[] _data=null, StringWriter log=null) |
| |
|
static List< FwNode > List< long > FilledFFAddr | FillGapsWithFF (List< FwNode > code) |
| |
|
static string | CreateIntelHex (ICollection< FwNode > data, int _lineLength=0) |
| |
|
static string | CreateSrec (ICollection< FwNode > data, int _lineLength=0) |
| |
|
static string | CreateTiTxt (ICollection< FwNode > data, int _lineLength=0) |
| |
|
static ICollection< FwNode > | CombineFw (Firmware fw1, Firmware fw2, bool fillFF=false) |
| |
|
static BslPasswords | GetBslPassword (string FirmwarePath) |
| |
|
| const string | ERR_444 |
| |
|
const string | ERR_445 = "Invalid or corrupted firmware file. Intel-HEX, TI-TXT, SREC and ELF formats are supported." |
| |
|
const string | ERR_470 = "Failed to create firmware." |
| |
|
const string | ERR_471 = "Failed to create firmware. Input data is empty." |
| |
|
const string | ERR_472 = "ELF firmware format is not supported yet as output." |
| |
|
const string | ERR_473 = "File does not exists." |
| |
|
const string | ERR_474 = "Exception aborted execution while trying to read file." |
| |
| const string | ERR_475 |
| |
|
const string | ERR_476 = "Only 32-bit ELF format is supported." |
| |
|
const string | ERR_477 = "Only little endian ELF format is supported." |
| |
|
const string | ERR_478 = "Only executable file type ELF format is supported." |
| |
|
const string | ERR_480 = "Wrong or corrupted file. ELF magic number (7F-45-4C-46) mismatch." |
| |
| const string | ERR_481 |
| |
|
static string FwFormat | Format1 |
| |
|
static bool double | Match |
| |
|
static List< FwNode > | Data |
| |
FwTools class provides basic manipulation (Parse, Create, Convert, Combine, Validate, Compare) with Intel-HEX, TI-TXT, SREC and ELF firmware formatted files.
◆ FwFormat
Supported firmware formats. AUTO is default value. When chosen AUTO, Parse will auto detect fw format, and Create will use TI-TXT. ELF format is currently supported only by Parse.
| Enumerator |
|---|
| AUTO | When chosen AUTO, Parse will auto detect fw format, and Create will use TI-TXT.
|
| TI_TXT | TI-TXT format described at: HERE
|
| INTEL_HEX | Intel-HEX format described at: HERE
|
| SREC | Motorola-SREC S-Record format described at: HERE
|
| ELF | ELF format described at: HERE
|
◆ Create() [1/3]
Create firmware multi-line string in TI-TXT or Intel-HEX format. ELF is not supported yet. AUTO format will force TI-TXT format. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32).
- Exceptions
-
◆ Create() [2/3]
| static string BSL430_NET.FirmwareTools.FwTools.Create |
( |
ICollection< FwNode > |
Data, |
|
|
FwFormat |
Format = FwFormat.AUTO, |
|
|
int |
LineLength = 0 |
|
) |
| |
|
static |
Create firmware multi-line string in TI-TXT or Intel-HEX format. ELF is not supported yet. AUTO format will force TI-TXT format. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32).
- Exceptions
-
◆ Create() [3/3]
| static string BSL430_NET.FirmwareTools.FwTools.Create |
( |
IEnumerable< byte > |
Data, |
|
|
int |
AddrStart, |
|
|
FwFormat |
Format = FwFormat.AUTO, |
|
|
int |
LineLength = 0 |
|
) |
| |
|
static |
Create firmware multi-line string in TI-TXT or Intel-HEX format. ELF is not supported yet. AUTO format will force TI-TXT format. AddrStart is address of first byte in data collection. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32).
- Exceptions
-
◆ GetPassword()
| static BslPasswords BSL430_NET.FirmwareTools.FwTools.GetPassword |
( |
string |
FirmwarePath | ) |
|
|
static |
[MSP430 specific] Read and parse firmware file (format auto-detected) and return BSL password. Password is last 16-byte (F543x-non-A only) or 32-byte (others) of IVT (FFE0-FFFF), if newer 5xx/6xx MCU is used. If MCU from older series is used (1xx/2xx/4xx), password is exactly 20-byte long. Mostly it is 32-byte.
◆ Parse()
| static Firmware BSL430_NET.FirmwareTools.FwTools.Parse |
( |
string |
FirmwarePath, |
|
|
FwFormat |
Format = FwFormat.AUTO, |
|
|
bool |
FillFF = false, |
|
|
StringWriter |
Log = null |
|
) |
| |
|
static |
Parse firmware file from FirmwarePath in TI-TXT, Intel-HEX or ELF format and returns List of FwNode (Data+Addr) and Info. Auto Mode reads data and based on some particular characters determine what firmare format it should be. FillFF is optional parameter forcing to fill missing addr nodes with 0xFF and return monolithic piece of code, which is usefull for crc calc or overwriting whole memory in mcu. Log writes text (new line formatted) output only when parsing ELF firmware file.
- Exceptions
-
◆ Validate()
| static FwInfo BSL430_NET.FirmwareTools.FwTools.Validate |
( |
string |
FirmwarePath, |
|
|
StringWriter |
Log = null |
|
) |
| |
|
static |
Validate firmware file and return FwInfo class, with specific firmware information. ResetVector and SizeBuffer are MSP430 specifics, other properties are universal. Log writes text (new line formatted) output only when parsing ELF firmware file.
- Exceptions
-
◆ Equal
| static bool BSL430_NET.FirmwareTools.FwTools.Equal |
|
static |
Compare two Firmware files. First, auto-detects format, then parse Nodes (Address + Data) and finally run compare. Equal = True if both files contains exactly same set of Firmware Nodes, in other case result is false. Equal = False if any Firmware is null or if any Firmware Node count is zero. Match [0.0 ; 1.0] is match when 1.0 is full match and Equal = True, and 0.0 is different fw. BytesDiff is count of bytes (Data nodes) which both firmwares differ at. 0 means full match.
Compare two already parsed Firmware objects (Address + Data).
Equal = True if both files contains exactly same set of Firmware Nodes, in other case result is false.
Equal = False if any Firmware is null or if any Firmware Node count is zero.
Match [0.0 ; 1.0] is match when 1.0 is full match and Equal = True, and 0.0 is different fw.
BytesDiff is count of bytes (Data nodes) which both firmwares differ at. 0 means full match.
- Exceptions
-
◆ ERR_444
| const string BSL430_NET.FirmwareTools.FwTools.ERR_444 |
|
staticprivate |
Initial value:= "Parsing firmware failed! Invalid or corrupted firmware file. Intel-HEX, TI-TXT, SREC " +
"and ELF formats are supported."
◆ ERR_475
| const string BSL430_NET.FirmwareTools.FwTools.ERR_475 |
|
staticprivate |
Initial value:= "Auto-detect firmware format failed. Most likely wrong or corrupted file. Intel-HEX, " +
"TI-TXT, SREC and ELF formats are supported."
◆ ERR_481
| const string BSL430_NET.FirmwareTools.FwTools.ERR_481 |
|
staticprivate |
Initial value:= "Firmware address conflict. There is an overlap between both firmware files, combining " +
"them would result in corrupted firmware."
◆ Fw
| static string BSL430_NET.FirmwareTools.FwTools.Fw |
|
static |
Convert firmware TI-TXT, Intel-HEX or ELF format (auto detected) to firmware in TI-TX or Intel-HEX format. Returned Fw is firmware and Format is useful for auto-detect feedback, indicates input format. FillFF is optional parameter forcing to fill missing addr nodes with 0xFF and return monolithic piece of code, which is usefull for crc calc or overwriting whole memory in mcu. LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32).
Combines two firmware files into single one with format specified. Usually, main firmware and EEPROM file is done this way, or main firmware and Info A flash content is merged. Returned Fw is firmware and Format1 with Format2 are useful for auto-detect feedback, indicates input formats.
FillFF is optional parameter forcing to fill missing addr nodes with 0xFF and return monolithic piece of code, which is usefull for crc calc or overwriting whole memory in mcu.
LineLength defines amount of data bytes per one text row. When = 0, default values are set (TI-TXT = 16, Intel-HEX = 32, SREC = 32).
- Exceptions
-
The documentation for this class was generated from the following files:
- D:/PROJECTS/C#/BSL430.NET/src/BSL430.NET.FirmwareTools/FwTools.cs
- D:/PROJECTS/C#/BSL430.NET/src/BSL430.NET.FirmwareTools/FwTools_priv.cs