{"id":15416965,"url":"https://github.com/blueandi/pyhexdump","last_synced_at":"2025-04-19T14:34:48.138Z","repository":{"id":59626189,"uuid":"538209437","full_name":"BlueAndi/pyHexDump","owner":"BlueAndi","description":"Hex dump for command line interface with template functionality","archived":false,"fork":false,"pushed_at":"2025-03-13T22:40:18.000Z","size":240,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T08:43:35.725Z","etag":null,"topics":["dump","hexdump","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlueAndi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-18T18:52:58.000Z","updated_at":"2025-03-13T22:39:39.000Z","dependencies_parsed_at":"2024-01-04T01:08:40.730Z","dependency_job_id":"7c225133-58a7-4363-a909-62933313e579","html_url":"https://github.com/BlueAndi/pyHexDump","commit_stats":{"total_commits":129,"total_committers":4,"mean_commits":32.25,"dds":0.06976744186046513,"last_synced_commit":"dd6063c484bf5d58aca145d0191dc0bba8af2efd"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2FpyHexDump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2FpyHexDump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2FpyHexDump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2FpyHexDump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlueAndi","download_url":"https://codeload.github.com/BlueAndi/pyHexDump/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249715499,"owners_count":21315055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dump","hexdump","python","python3"],"created_at":"2024-10-01T17:14:18.740Z","updated_at":"2025-04-19T14:34:48.126Z","avatar_url":"https://github.com/BlueAndi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyHexDump \u003c!-- omit in toc --\u003e\n\nA CLI tool written in Python to dump binary files and files in intel hex format. It can generate a report for any file based on report template. This is useful for images which contain specific data always on the same address, e.g. a CRC, signature, etc.\n\nThere are a lot of hex viewers already, but I was not able to find one which I could configure in a way to generate something like a report.\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)\n[![Repo Status](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)\n![CI Status](https://github.com/BlueAndi/pyHexDump/actions/workflows/push.yml/badge.svg)\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Overview](#overview)\n- [Examples](#examples)\n  - [Dump data](#dump-data)\n    - [Dump data as 8-bit](#dump-data-as-8-bit)\n    - [Dump data as 32-bit little endian](#dump-data-as-32-bit-little-endian)\n  - [Calculate checksum](#calculate-checksum)\n  - [Print configuration](#print-configuration)\n  - [Print report with template](#print-report-with-template)\n    - [Example](#example)\n  - [Configuration using structures](#configuration-using-structures)\n    - [Example](#example-1)\n  - [Define structure as datatype](#define-structure-as-datatype)\n    - [Example](#example-2)\n- [Macros](#macros)\n  - [macros\\_compare\\_values()](#macros_compare_values)\n  - [m\\_read\\_uint8()](#m_read_uint8)\n  - [m\\_read\\_uint16le()](#m_read_uint16le)\n  - [m\\_read\\_uint16be()](#m_read_uint16be)\n  - [m\\_read\\_uint32le()](#m_read_uint32le)\n  - [m\\_read\\_uint32be()](#m_read_uint32be)\n  - [m\\_read\\_uint64le()](#m_read_uint64le)\n  - [m\\_read\\_uint64be()](#m_read_uint64be)\n  - [m\\_read\\_int8()](#m_read_int8)\n  - [m\\_read\\_int16le()](#m_read_int16le)\n  - [m\\_read\\_int16be()](#m_read_int16be)\n  - [m\\_read\\_int32le()](#m_read_int32le)\n  - [m\\_read\\_int32be()](#m_read_int32be)\n  - [m\\_read\\_int64le()](#m_read_int64le)\n  - [m\\_read\\_int64be()](#m_read_int64be)\n  - [m\\_read\\_float32le()](#m_read_float32le)\n  - [m\\_read\\_float32be()](#m_read_float32be)\n  - [m\\_read\\_float64le()](#m_read_float64le)\n  - [m\\_read\\_float64be()](#m_read_float64be)\n  - [m\\_read\\_string()](#m_read_string)\n  - [m\\_calc\\_checksum()](#m_calc_checksum)\n  - [m\\_swap\\_bytes\\_u16()](#m_swap_bytes_u16)\n  - [m\\_swap\\_bytes\\_u32()](#m_swap_bytes_u32)\n  - [m\\_swap\\_words\\_u32()](#m_swap_words_u32)\n- [Used Libraries](#used-libraries)\n- [Issues, Ideas And Bugs](#issues-ideas-and-bugs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Installation\n\n```cmd\n$ git clone https://github.com/BlueAndi/pyHexDump.git\n$ cd pyHexDump\n$ pip install .\n```\n\n## Usage\n\nShow help information:\n```cmd\n$ pyHexDump --help\n```\n\n## Overview\n\n![goverview](https://www.plantuml.com/plantuml/proxy?cache=no\u0026src=https://raw.githubusercontent.com/BlueAndi/pyHexDump/main/doc/uml/static_view.wsd)\n\n## Examples\n\nDon't miss the examples in the [example](./examples/) folder. In the following chapters you can see how to use pyHexDump and its output.\n\n### Dump data\n\nDump bytes in the classic way by address.\n\n#### Dump data as 8-bit\n\n\n```$ pyHexDump dump ./examples/data/aurix_tc397.hex -a 0x80000020```\n\nResult:\n\n```text\n80000020: 02 58 DA 01 9B 1F 00 F0 0F 4F 10 F0 6C 41 C5 FF\n80000030: 00 01 BC F1 82 04 6D 00 2F 04 91 30 00 FF 39 FF\n80000040: 30 06 16 0F 4B 0F 41 F1 4B F2 51 F0 3C 01 3C 01\n80000050: 4B 0F 31 F1 3B 80 3E 00 4B 0F 01 02 E2 08 3C 01\n```\n\n#### Dump data as 32-bit little endian\n\n```$ pyHexDump dump ./examples/data/aurix_tc397.hex -a 0x80000020 -dt uint32le```\n\nResult:\n\n```text\n80000020: 01DA5802 F0001F9B F0104F0F FFC5416C\n80000030: F1BC0100 006D0482 3091042F FF39FF00\n80000040: 0F160630 F1410F4B F051F24B 013C013C\n80000050: F1310F4B 003E803B 02010F4B 013C08E2\n80000060: 4800800B 00CE006D 4F409000 80DA4802\n80000070: 5008003B F440F5A6 006D8402 01DA028B\n80000080: F0108F0F 9000F16C FFFFFFFF 7FFFFFFF\n80000090: F0248160 00873802 FFFFFFFF F0248164\n800000A0: 0000D066 FFFFFFFF F0248168 00073802\n800000B0: FFFFFFFF F024816C 00009826 FFFFFFFF\n800000C0: F0248124 000000C9 FFFFFFFF F0248108\n800000D0: 30360001 FFFFFFFF F024810C 0B690708\n800000E0: FFFFFFFF F0248128 0121048E FFFFFFFF\n800000F0: 00000000 FFFFFFFF FFFFFFFF FFFFFFFF\n80000100: F8000091 3048FFD9 0200000D 0FDCF402\n80000110: 00000000 00000000 00000000 00000000\n```\n\n### Calculate checksum\n\nCalculate a CRC checksum over a specific range.\n\n```$ pyHexDump checksum ./examples/data/aurix_tc397.hex -sa 0x80000020 -ea 0x80000040```\n\nResult:\n\n```text\n219725A2\n```\n\nThe following optional arguments are supported:\n\n* ```-bde``` The binary data endianess and bit width:\n    * \"uint8\": unsigned 8-bit\n    * \"uint16le\": unsigned 16-bit little endian\n    * \"uint16be\": unsigned 16-bit big endian\n    * \"uint32le\": unsigned 32-bit little endian\n    * \"uint32be\": unsigned 32-bit big endian\n* ```-sa```: Start address of the CRC calculation.\n* ```-ea```: End address of the CRC calculation (not included).\n* ```-p```: The polynomial for the CRC calculation. Default: 0x04C11DB7\n* ```-bw```: The bit width, e.g. 8 in case of a CRC-8. Default: 32\n* ```-s```-: The seed value which to use. Default: 0\n* ```-ri```: If the input data shall be reflected, set to True. Default: False\n* ```-ro```: If the output data shall be reflected, set to True. Default: False\n* ```-fx```: If the output shall be have a final XOR with all bits set, set to True. Default: False\n\n### Print configuration\n\nElements with their name, address, datatype and count can be configured separately.\nBy using the ```print``` command all of the values in the configuration are printed to the CLI.\n\nThe following datatypes are supported:\n\n* \"int8\": signed 8-bit\n* \"uint8\": unsigned 8-bit\n* \"int16le\": signed 16-bit little endian\n* \"int16be\": signed 16-bit big endian\n* \"uint16le\": unsigned 16-bit little endian\n* \"uint16be\": unsigned 16-bit big endian\n* \"int32le\": signed 32-bit little endian\n* \"int32be\": signed 32-bit big endian\n* \"uint32le\": unsigned 32-bit little endian\n* \"uint32be\": unsigned 32-bit big endian\n* \"int64le\": signed 64-bit little endian\n* \"int64be\": signed 64-bit big endian\n* \"uint64le\": unsigned 64-bit little endian\n* \"uint64be\": unsigned 64-bit big endian\n* \"float32le\": floating point 32-bit little endian\n* \"float32be\": floating point 32-bit big endian\n* \"float64le\": floating point 64-bit little endian\n* \"float64be\": floating point 64-bit big endian\n* \"utf8\": String encoded in UTF-8\n\n```$ pyHexDump print ./examples/data/aurix_tc397.hex ./examples/print_config/config.json --onlyInHex```\n\nwith ```config.json``` like\n\n```json\n{\n    \"elements\": [{\n        \"name\": \"UCB00_BMI_BMHDID\",\n        \"addr\": \"0xAF400000\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_STAD\",\n        \"addr\": \"0xAF400004\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_CRCBMHD\",\n        \"addr\": \"0xAF400008\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_CRCBMHD_N\",\n        \"addr\": \"0xAF40000C\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_PWx\",\n        \"addr\": \"0xAF400104\",\n        \"dataType\": \"uint32le\",\n        \"count\": 8\n    }, {\n        \"name\": \"UCB00_CONFIRMATION\",\n        \"addr\": \"0xAF4001F0\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }]\n}\n```\n\nResult:\n\n```\nUCB00_BMI_BMHDID @ AF400000: 0xB35900FE\nUCB00_STAD @ AF400004: 0xA0000000\nUCB00_CRCBMHD @ AF400008: 0x31795570\nUCB00_CRCBMHD_N @ AF40000C: 0xCE86AA8F\nUCB00_PWx @ AF400104: [0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000]\nUCB00_CONFIRMATION @ AF4001F0: 0x43211234\n```\n\n### Print report with template\n\nThe [Mako template library](https://www.makotemplates.org/) is used, to provide a lot of functionality. Please have a look to the [Mako documentation](https://docs.makotemplates.org/en/latest/) for details.\n\nA configuration element can be accessed in the template via:\n\n* ```${\u003cconfig-element-name\u003e}```: Prints the decimal value.\n* ```${\u003cconfig-element-name\u003e.hex()}```: Prints the value in hex with \"0x\" as prefix by default.\n* ```${\u003cconfig-element-name\u003e.hex(\"\")}```: Prints the value in hex without a prefix.\n* ```${\u003cconfig-element-name\u003e.addr()}```: Prints the address in decimal.\n\n#### Example\n\n```$ pyHexDump print ./examples/data/aurix_tc397.hex ./examples/print_config_and_template/config.json --templateFile ./examples/print_config_and_template/markdown.mako```\n\nwith ```config.json``` like\n\n```json\n{\n    \"elements\": [{\n        \"name\": \"UCB00_BMI_BMHDID\",\n        \"addr\": \"0xAF400000\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_STAD\",\n        \"addr\": \"0xAF400004\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_CRCBMHD\",\n        \"addr\": \"0xAF400008\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_CRCBMHD_N\",\n        \"addr\": \"0xAF40000C\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }, {\n        \"name\": \"UCB00_PWx\",\n        \"addr\": \"0xAF400104\",\n        \"dataType\": \"uint32le\",\n        \"count\": 8\n    }, {\n        \"name\": \"UCB00_CONFIRMATION\",\n        \"addr\": \"0xAF4001F0\",\n        \"dataType\": \"uint32le\",\n        \"count\": 1\n    }]\n}\n```\n\nwith ```markdown.mako``` like\n\n```mako\n\u003c%text\u003e# Aurix TC397 - Blinky Example\u003c/%text\u003e\n\n\u003c%text\u003e## User Control Block 00\u003c/%text\u003e\n\n|Short Name|Value|\n|----------|-----|\n| BMI_BMHDID | ${UCB00_BMI_BMHDID.hex()} |\n| STAD | ${UCB00_STAD.hex()} |\n| CRCBMHD | ${UCB00_CRCBMHD.hex()} |\n| CRCBMHD_N | ${UCB00_CRCBMHD_N.hex()} |\n| PWx | ${UCB00_PWx.hex()} |\n| CONFIRMATION | ${UCB00_CONFIRMATION.hex()} |\n\u003c%\n    bmi_bmhdid = UCB00_BMI_BMHDID\n    bmi    = (bmi_bmhdid \u003e\u003e  0) \u0026 0xFFFF\n    bmhdid = (bmi_bmhdid \u003e\u003e  16) \u0026 0xFFFF\n    pindis = (bmi \u003e\u003e 0) \u0026 0x01\n    hwcfg  = (bmi \u003e\u003e 1) \u0026 0x07\n\n    mode_by_hwcfg = \"disabled\"\n    if pindis == 0:\n        mode_by_hwcfg = \"enabled\"\n\n    start_up_mode = \"invalid\"\n    if hwcfg == 0x07:\n        start_up_mode = \"internal start from flash\"\n    elif hwcfg == 0x06:\n        start_up_mode = \"alternate boot mode\"\n    elif hwcfg == 0x04:\n        start_up_mode = \"generic bootstrap loader mode\"\n    elif hwcfg == 0x03:\n        start_up_mode = \"asc bootstrap loader mode\"\n    \n    is_bmh_valid = \"invalid\"\n    if bmhdid == 0xB359:\n        is_bmh_valid = \"OK\"\n    \n    calculated_crc_bmhd = m_calc_checksum(\"uint32le\", UCB00_BMI_BMHDID.addr(), UCB00_CRCBMHD.addr(), 0x04c11db7, 32, 0xffffffff, True, True, True)\n    calculated_crc_bmhd_n = m_calc_checksum(\"uint32le\", UCB00_BMI_BMHDID.addr(), UCB00_CRCBMHD.addr(), 0x04c11db7, 32, 0xffffffff, True, True, False)\n\n    is_bmh_integrity_given = \"Not OK\"\n    if calculated_crc_bmhd == UCB00_CRCBMHD:\n        if calculated_crc_bmhd_n == UCB00_CRCBMHD_N:\n            is_bmh_integrity_given = \"OK\"\n%\u003e\n\u003c%text\u003e### Boot Mode Index (BMI)\u003c/%text\u003e\n* Mode selection by configuration pins: ${mode_by_hwcfg}\n* Start-up mode: ${start_up_mode}\n\n\u003c%text\u003e### Boot Mode Header Identifier (BMHDID)\u003c/%text\u003e\nIs boot mode header valid: ${is_bmh_valid}\n\n\u003c%text\u003e### Boot Mode Header CRC (CRCBMHD/CRCBMHD_N)\u003c/%text\u003e\nIs boot mode header integrity given: ${is_bmh_integrity_given}\n```\n\nResult:\n\n```markdown\n## Aurix TC397 - Blinky Example\n\n### User Control Block 00\n\n|Short Name|Value|\n|----------|-----|\n| BMI_BMHDID | 0xB35900FE |\n| STAD | 0xA0000000 |\n| CRCBMHD | 0x31795570 |\n| CRCBMHD_N | 0xCE86AA8F |\n| PWx | [0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000] |\n| CONFIRMATION | 0x43211234 |\n\n#### Boot Mode Index (BMI)\n\n* Mode selection by configuration pins: enabled\n* Start-up mode: internal start from flash\n\n#### Boot Mode Header Identifier (BMHDID)\n\nIs boot mode header valid: OK\n\n#### Boot Mode Header CRC (CRCBMHD/CRCBMHD_N)\n\nIs boot mode header integrity given: OK\n```\n\n### Configuration using structures\n\nIf several elements are right behind each other like in a structure, it can be configured in a similar way by using a list of elements for a datatype. The address of each element in the structure is calculated by the given base address in the datatype of each element.\n\n#### Example\n\n```json\n{\n    \"elements\": [{\n        \"name\": \"UCB00\",\n        \"addr\": \"0xAF400000\",\n        \"dataType\": [{\n            \"name\": \"BMI_BMHDID\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"STAD\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"CRCBMHD\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"CRCBMHD_N\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"PWx\",\n            \"dataType\": \"uint32le\",\n            \"offset\": \"0x0104\",\n            \"count\": 8\n        }, {\n            \"name\": \"CONFIRMATION\",\n            \"dataType\": \"uint32le\",\n            \"offset\": \"0x01F0\",\n            \"count\": 1\n        }],\n        \"count\": 1\n    }]\n}\n```\n\nTo access it in the template, you can use the \".\" notation or Python dictionary syntax.\n\nwith ```markdown.mako``` like\n\n```mako\n\u003c%text\u003e# Aurix TC397 - Blinky Example\u003c/%text\u003e\n\n\u003c%text\u003e## User Control Block 00\u003c/%text\u003e\n\n|Short Name|Value|\n|----------|-----|\n| BMI_BMHDID | ${UCB00.BMI_BMHDID.hex()} |\n| STAD | ${UCB00.STAD.hex()} |\n| CRCBMHD | ${UCB00.CRCBMHD.hex()} |\n| CRCBMHD_N | ${UCB00.CRCBMHD_N.hex()} |\n| PWx | ${UCB00.PWx.hex()} |\n| CONFIRMATION | ${UCB00.CONFIRMATION.hex()} |\n\u003c%\n    bmi_bmhdid = UCB00.BMI_BMHDID\n    bmi    = (bmi_bmhdid \u003e\u003e  0) \u0026 0xFFFF\n    bmhdid = (bmi_bmhdid \u003e\u003e  16) \u0026 0xFFFF\n    pindis = (bmi \u003e\u003e 0) \u0026 0x01\n    hwcfg  = (bmi \u003e\u003e 1) \u0026 0x07\n\n    mode_by_hwcfg = \"disabled\"\n    if pindis == 0:\n        mode_by_hwcfg = \"enabled\"\n\n    start_up_mode = \"invalid\"\n    if hwcfg == 0x07:\n        start_up_mode = \"internal start from flash\"\n    elif hwcfg == 0x06:\n        start_up_mode = \"alternate boot mode\"\n    elif hwcfg == 0x04:\n        start_up_mode = \"generic bootstrap loader mode\"\n    elif hwcfg == 0x03:\n        start_up_mode = \"asc bootstrap loader mode\"\n    \n    is_bmh_valid = \"invalid\"\n    if bmhdid == 0xB359:\n        is_bmh_valid = \"OK\"\n\n    calculated_crc_bmhd = m_calc_checksum(\"uint32le\", UCB00.BMI_BMHDID.addr(), UCB00.CRCBMHD.addr(), 0x04c11db7, 32, 0xffffffff, True, True, True)\n    calculated_crc_bmhd_n = m_calc_checksum(\"uint32le\", UCB00.BMI_BMHDID.addr(), UCB00.CRCBMHD.addr(), 0x04c11db7, 32, 0xffffffff, True, True, False)\n\n    is_bmh_integrity_given = \"Not OK\"\n    if calculated_crc_bmhd == UCB00.CRCBMHD:\n        if calculated_crc_bmhd_n == UCB00.CRCBMHD_N:\n            is_bmh_integrity_given = \"OK\"\n%\u003e\n\u003c%text\u003e### Boot Mode Index (BMI)\u003c/%text\u003e\n\n* Mode selection by configuration pins: ${mode_by_hwcfg}\n* Start-up mode: ${start_up_mode}\n\n\u003c%text\u003e### Boot Mode Header Identifier (BMHDID)\u003c/%text\u003e\n\nIs boot mode header valid: ${is_bmh_valid}\n\n\u003c%text\u003e### Boot Mode Header CRC (CRCBMHD/CRCBMHD_N)\u003c/%text\u003e\n\nIs boot mode header integrity given: ${is_bmh_integrity_given}\n```\n\n### Define structure as datatype\n\nIf a structure shall be used several times, define it as a datatype and use its name.\n\n#### Example\n\n```json\n{\n    \"elements\": [{\n        \"name\": \"UCB00\",\n        \"addr\": \"0xAF400000\",\n        \"dataType\": \"UCB_t\",\n        \"count\": 1\n    }],\n    \"structures\": [{\n        \"name\": \"UCB_t\",\n        \"elements\": [{\n            \"name\": \"BMI_BMHDID\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"STAD\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"CRCBMHD\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"CRCBMHD_N\",\n            \"dataType\": \"uint32le\",\n            \"count\": 1\n        }, {\n            \"name\": \"PWx\",\n            \"dataType\": \"uint32le\",\n            \"offset\": \"0x0104\",\n            \"count\": 8\n        }, {\n            \"name\": \"CONFIRMATION\",\n            \"dataType\": \"uint32le\",\n            \"offset\": \"0x01F0\",\n            \"count\": 1\n        }]\n    }]\n}\n```\n\n## Macros\n\nThe following macros are available in the templates.\n\n### macros_compare_values()\n\nCompares the set value with the actual value.\n\nParameters:\n\n* set_value: Set value\n* actual_value: Actual value\n* value_format=\"{:02X}\": Value format used to print them in case they are different.\n\nReturns:\n\n* \"Ok\": If both values are equal.\n* \"Not Ok (Set: \u0026lt;set_value\u0026gt;, Actual: \u0026lt;actual_value\u0026gt;)\": If the values are different.\n\n### m_read_uint8()\n\nRead unsigned 8-bit value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_uint16le()\n\nRead unsigned 16-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_uint16be()\n\nRead unsigned 16-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_uint32le()\n\nRead unsigned 32-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_uint32be()\n\nRead unsigned 32-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_uint64le()\n\nRead unsigned 64-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_uint64be()\n\nRead unsigned 64-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int8()\n\nRead signed 8-bit value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int16le()\n\nRead signed 16-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int16be()\n\nRead signed 16-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int32le()\n\nRead signed 32-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int32be()\n\nRead signed 32-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int64le()\n\nRead signed 64-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_int64be()\n\nRead signed 64-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_float32le()\n\nRead floating point 32-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_float32be()\n\nRead floating point 32-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_float64le()\n\nRead floating point 64-bit little endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_float64be()\n\nRead floating point 64-bit big endian value from binary data at given address and returns it.\n\nParameters:\n\n* addr: Address\n\n### m_read_string()\n\nRead string from binary data at given address and returns it. It will consider the string termination.\n\nParameters:\n\n* encoding: The character encoding.\n    * Default: utf-8\n\n### m_calc_checksum()\n\nCalculate the CRC checksum.\n\nParameters:\n\n* binary_data_endianess: The binary data endianess and bit width:\n    * \"uint8\": unsigned 8-bit\n    * \"uint16le\": unsigned 16-bit little endian\n    * \"uint16be\": unsigned 16-bit big endian\n    * \"uint32le\": unsigned 32-bit little endian\n    * \"uint32be\": unsigned 32-bit big endian\n* start_address: Start address of the CRC calculation.\n* end_address: End address of the CRC calculation (not included).\n* polynomial: The polynomial for the CRC calculation.\n* bit_width: The bit width, e.g. 8 in case of a CRC-8.\n* seed: The seed value which to use.\n* reverse_input: If the input data shall be reflected, set to True otherwise to False.\n* reverse_output: If the output data shall be reflected, set to True otherwise to False.\n* final_xor: If the output shall be have a final XOR with all bits set, set to True otherwise to False.\n\n### m_swap_bytes_u16()\n\nSwaps the bytes of a unsigned 16-bit value.\n\nParameters:\n\n* value: Source value\n\nReturns:\n\n* Swapped value\n\n### m_swap_bytes_u32()\n\nSwaps the bytes of a unsigned 32-bit value.\n\nParameters:\n\n* value: Source value\n\nReturns:\n\n* Swapped value\n\n### m_swap_words_u32()\n\nSwaps the 16-bit words of a unsigned 32-bit value.\n\nParameters:\n\n* value: Source value\n\nReturns:\n\n* Swapped value\n\n## Used Libraries\n\nUsed 3rd party libraries which are not part of the standard Python package:\n\n| Library | Description | License |\n| ------- | ----------- | ------- |\n| [intelhex](https://github.com/python-intelhex/intelhex) | Reading files in IntelHex format | BSD-3 License |\n| [Mako](https://www.makotemplates.org/) | Template engine | MIT License |\n| [toml](https://github.com/uiri/toml) | Parsing [TOML](https://en.wikipedia.org/wiki/TOML) | MIT License |\n\n## Issues, Ideas And Bugs\n\nIf you have further ideas or you found some bugs, great! Create a [issue](https://github.com/BlueAndi/pyHexDump/issues) or if you are able and willing to fix it by yourself, clone the repository and create a pull request.\n\n## License\n\nThe whole source code is published under the [MIT license](http://choosealicense.com/licenses/mit/).\nConsider the different licenses of the used third party libraries too!\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueandi%2Fpyhexdump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueandi%2Fpyhexdump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueandi%2Fpyhexdump/lists"}