embutils.utils.binary module

Binary generation utilities.

date

2021

author

Christian Wiche

contact

cwichel@gmail.com

license

The MIT License (MIT)

embutils.utils.binary.bin_to_hex(src: Union[bytes, bytearray, str, pathlib.Path], out: Optional[Union[bytes, bytearray, str, pathlib.Path]] = None, off: int = 134217728) intelhex.IntelHex[source]

Convert a binary file into an HEX.

Parameters
  • src (TPPath) – Path to source BIN file.

  • out (TPPath) – Optional. If provided, saves the generated hex file in the given path.

  • off (int) – BIN file address offset.

Returns

HEX file

Return type

intelhex.IntelHex

embutils.utils.binary.merge_bin(src: List[Tuple[Union[bytes, bytearray, str, pathlib.Path], int]], out: Optional[Union[bytes, bytearray, str, pathlib.Path]] = None) intelhex.IntelHex[source]

Merge a group of binary files into an HEX.

Parameters
  • src (list) – List of tuples that contain: - BIN file path. - BIN file address offset

  • out (TPPath) – Optional. If provided, saves the generated hex file in the given path.

Returns

Merged HEX file.

Return type

intelhex.IntelHex

embutils.utils.binary.merge_hex(src: List[Union[bytes, bytearray, str, pathlib.Path]], out: Optional[Union[bytes, bytearray, str, pathlib.Path]] = None) intelhex.IntelHex[source]

Merge a group of HEX files.

Parameters
  • src (list) – List of paths to HEX files.

  • out (TPPath) – Optional. If provided, saves the generated hex file in the given path.

Returns

Merged HEX file.

Return type

intelhex.IntelHex