{"id":34079804,"url":"https://github.com/devcoons/memview","last_synced_at":"2025-12-30T16:28:21.748Z","repository":{"id":318846394,"uuid":"1076409591","full_name":"devcoons/memview","owner":"devcoons","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-15T08:26:45.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-15T22:51:26.549Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/devcoons.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-14T20:22:47.000Z","updated_at":"2025-10-15T08:26:49.000Z","dependencies_parsed_at":"2025-10-16T18:25:54.605Z","dependency_job_id":"f6e3f78f-d8b5-400d-b862-c247155744e8","html_url":"https://github.com/devcoons/memview","commit_stats":null,"previous_names":["devcoons/memview"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devcoons/memview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcoons%2Fmemview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcoons%2Fmemview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcoons%2Fmemview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcoons%2Fmemview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devcoons","download_url":"https://codeload.github.com/devcoons/memview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcoons%2Fmemview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27726944,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-12-14T11:02:27.701Z","updated_at":"2025-12-14T11:02:28.274Z","avatar_url":"https://github.com/devcoons.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memview\n\n![PyPI - Version](https://img.shields.io/pypi/v/memview?style=for-the-badge)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/memview?style=for-the-badge)\n![PyPI - License](https://img.shields.io/pypi/l/memview?style=for-the-badge)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/memview?style=for-the-badge\u0026color=%23F0F)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/memview?style=for-the-badge)\n\nInspect and visualize **binary memory layouts** from multiple input formats (Intel HEX, S-Record, hexdumps, and raw BIN).  \nDefine a layout once (TOML/YAML), then decode typed fields, verify expectations, and export reports (text/JSON/CSV).\n\n## Highlights\n\n- Unified **sparse memory** model over HEX/SREC/hexdumps/BIN\n- Declarative **layout**: segments, typed fields, expectations\n- Typed decoders: `u8/u16/u32/u64`, `bytes(size)`, `bitfield`, `addr`, `str(size, encoding)`\n- Bitfields with **configurable bit order**: `lsb` (default) or `msb`\n- Clean **CLI**: `inspect` → text/JSON/CSV\n- Minimal dependencies; install-anywhere\n\n---\n\n## Installation\n\n### Requirements\n- Python **3.11+**\n\n### Install\n```bash\npip install memview\n```\n\nIf you’re developing locally with a `src/` layout:\n```bash\npip install -e .\n```\n\n---\n\n## Input formats\n\n- **Intel HEX** (`.hex`) — parsed with addresses\n- **S-Record** (`.srec`, `.s19`, `.mot`) — parsed with addresses\n- **Hex dump** (xxd / hexdump -C style) — parsed with addresses\n- **Raw BIN** — no addresses; you **must** pass `--base`\n\n---\n\n## CLI\n\n### Inspect a file (layout-aware)\n```bash\nmemview inspect fw.hex --layout fw.toml\n```\n\n### Choose output format\n```bash\nmemview inspect fw.hex --layout fw.toml --format text\nmemview inspect fw.hex --layout fw.toml --format json\nmemview inspect fw.hex --layout fw.toml --format csv\n```\n\n### BIN requires a base address\n```bash\nmemview inspect fw.bin --layout fw.toml --base 0x08000000\n```\n\n### Bitfield bit order override (lsb by default)\n```bash\nmemview inspect fw.hex --layout fw.toml --bit-order msb\n```\n\n### Exit codes\n- `0` — success\n- `2` — success with issues (e.g., missing bytes, expectation failures)\n- `1` — error\n\n---\n\n## Layout files\n\nLayouts can be **TOML** (recommended) or **YAML** (if `PyYAML` is installed).\n\n### Minimal TOML example\n\n```toml\n[memory]\nfill = 0xFF\n# Optional default bit order for bitfields; defaults to \"lsb\" if omitted\n# bit_order = \"lsb\"  # or \"msb\"\n\n[[segments]]\nname = \"header\"\nbase = 0x08000000\nsize = 64\n\n[[segments]]\nname = \"app\"\nbase = 0x08000040\nsize = 0x70000\n\n[[layout]]\nname   = \"magic\"\nat     = \"header+0x00\"\ntype   = \"u32\"\nendian = \"be\"\n\n[[layout]]\nname = \"flags\"\nat   = \"header+0x04\"\ntype = \"bitfield\"\n# field-level override (optional): bit_order = \"msb\"\nbits = [\n  { name = \"secure\", bit = 0 },\n  { name = \"debug\",  bit = 1 },\n  { name = \"valid\",  bit = 7 }\n]\n\n[[layout]]\nname   = \"length\"\nat     = \"header+0x06\"\ntype   = \"u16\"\nendian = \"le\"\n\n[[layout]]\nname   = \"entry_point\"\nat     = \"header+0x08\"\ntype   = \"addr\"\nendian = \"le\"\n\n[[layout]]\nname   = \"name\"\nat     = \"header+0x0C\"\ntype   = \"str\"\nsize   = 8\nencoding = \"ascii\"\n\n[[layout]]\nname   = \"payload\"\nat     = \"app+0x00\"\ntype   = \"bytes\"\nsize   = 256\n```\n\n### Address syntax\n\n- Absolute: `0x08000000`\n- Segment + offset: `segmentName+0x04`\n\n### Types (current)\n\n- Scalars: `u8`, `u16`, `u32`, `u64` (with `endian = \"le\" | \"be\"`)\n- `bytes(size = N)`\n- `bitfield` with `bits = [{name, bit}]`  \n  - **Bit numbering is LSB-first by default.**  \n  - Control via `memory.bit_order = \"lsb\"|\"msb\"` or per-field `bit_order`.\n- `addr` (4 bytes, endianness controllable)\n- `str(size = N, encoding = \"ascii\" | \"utf8\")` (trailing NULs trimmed)\n\n### Expectations\n\nFor integer-like fields you can set `expect`:\n\n```toml\n[[layout]]\nname   = \"magic\"\nat     = \"header+0x00\"\ntype   = \"u32\"\nendian = \"be\"\nexpect = 0xABCD1234\n```\n\nIf an expectation fails (or bytes are missing), the CLI returns `2` and lists issues.\n\n---\n\n## Examples\n\n### Intel HEX\n```bash\nmemview inspect firmware.hex --layout fw.toml\n```\n\n### S-Record\n```bash\nmemview inspect firmware.srec --layout fw.toml --format json\n```\n\n### Hex dump (xxd / hexdump -C)\n```bash\nmemview inspect dump.txt --layout fw.toml --format csv\n```\n\n### BIN with explicit base\n```bash\nmemview inspect firmware.bin --layout fw.toml --base 0x08000000\n```\n\n---\n\n## Output samples\n\n### Text\n```\nField              Addr       Type       Value\nmagic              0x08000000 u32(be)    0xABCD1234\nflags              0x08000004 bitfield   {debug=0, secure=1, valid=1}\nlength             0x08000006 u16(le)    0x0020\nentry_point        0x08000008 addr(le)   0x08000040\nname               0x0800000C str        TEST\npayload            0x08000040 bytes      [256 bytes] sha256=2f5b7b8e2a7f2a8c…\n```\n\n### JSON (excerpt)\n```json\n{\n  \"fields\": [\n    {\"name\":\"magic\",\"address\":134217728,\"type\":\"u32\",\"value\":2882343476,\"meta\":{\"endian\":\"be\"}},\n    {\"name\":\"payload\",\"address\":134217792,\"type\":\"bytes\",\"value\":{\"kind\":\"bytes\",\"len\":256,\"sha256\":\"...\"},\"meta\":{\"size\":256}}\n  ],\n  \"issues\": []\n}\n```\n\n### CSV (first rows)\n```\nname,address,type,value,meta\nmagic,0x08000000,u32,0xABCD1234,{\"endian\":\"be\"}\nflags,0x08000004,bitfield,{debug=0, secure=1, valid=1},{}\n...\n```\n\n---\n\n## Programmatic API (preview)\n\n```python\nfrom memview.loaders import load_from_path\nfrom memview.layout import load_layout, inspect\n\nlayout = load_layout(\"fw.toml\")\nmem, kind = load_from_path(\"firmware.hex\", fill=0xFF)\nreport = inspect(layout, mem, default_bit_order=\"lsb\")\nfor f in report.fields:\n    print(f.name, hex(f.address), f.type, f.value)\n```\n\n---\n\n## Behavior and guarantees\n\n- **No base address in layout for BIN.** For raw binaries, the start address must be provided on the command line via `--base`.\n- Gaps are filled with `--fill` during normalization; attempts to read missing bytes for a field are reported as issues.\n- Overlapping segments on ingest are rejected.\n- Bitfield **default** is `lsb`. Precedence:\n  1. field-level `bit_order`\n  2. CLI `--bit-order`\n  3. layout `memory.bit_order`\n  4. implicit default `lsb`\n\n\n## License\n\nMIT © Ioannis D. (devcoons)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcoons%2Fmemview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevcoons%2Fmemview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcoons%2Fmemview/lists"}