merge_files ( input_files, 'merged.srec' ) import hexrec.records as hr input_files = hr. This example shows how to merge a bootloader, an executable, and someĬonfiguration data into a single file, in the order they are listed. Them, and might be faster for their workers or machine, where every second Program the microcontroller, because a single file is simpler to manage for It is very common that the board factory prefers to receive a single file to This can also be done by running the hexrec package as a command line tool: $ python -m hexrec convert data.hex data.srec Merge files convert_file ( 'data.hex', 'data.srec' ) In this example, a HEX file is converted to SREC. It happens that some software tool only supports some hexadecimal record fileįormats, or the format given to you is not handled properly, or simply you To have a glimpse of the features provided by this library, some simple butĬommon examples are shown in the following. Maintainable, following some naive pythonic K.I.S.S. The codebase is written in a simple fashion, to be easily readable and You can also create your own standalone executable, or download a precompiled Package itself ( python -m hexrec), providing some record file utilities. The package can also be run as a command line tool, by running the hexrec Hexrec.xxd is an emulation of the xxd command line utility delivered The hexrec.utils module provides some miscellaneous utility stuff. The hexrec.records allows to load bytesparse virtual memories, whichĪre as easy to use as the native bytearray, but with sparse data blocks. It provides high-level functions to deal with record files, as well as classes Merge/patch multiple hexadecimal record files of different formats Īccess every single record of a hexadecimal record file Įdit sparse data in a virtual memory behaving like a bytearray Įxtract or update only some parts of the binary data.įor the full documentation, please refer to:Īs the core of this library are record files, the hexrec.records is the In-place editing by humans rather tedious as data should be split, and theĬhecksum and other metadata have to be updated.Īll of the above led to the development of this library, which allows to,Ĭonvert between hexadecimal record formats Line-by-line writing to the target memory (in the old days), but this makes Name) protected by some kind of checksum. Or SREC, although ELF is arguably the most common for debuggable executables.Ī bad thing is that their support in embedded software toolsets is sometimesįlawed or only one of the formats is supported, while the supplier provides itsĪnother feature is that binary data is split into text record lines (thus their So every time a supplier has to give away its binary data it is either in HEX Other common formats for binary data exchange for embedded systems include theĮxecutable and Linkable Format (.elf), hex dumps (by hexdump or xxd),Ī good thing about hexadecimal record files is that they are almost de-facto, The most common file formats for hexadecimal record files are Intel HEX Such binary data can contain compiled executable code, configuration data, Way to share binary data to be written to the target non-volatile memory, suchĪs a EEPROM or microcontroller code flash. In the field of embedded systems, hexadecimal record files are the most common The purpose of this library is to provide simple but useful methods to load, Library to handle hexadecimal record files
0 Comments
Leave a Reply. |