Skip to main content

Python library for parsing and creating GBL (Gecko Bootloader) files

Project description

GBL Python Library

This is a Python library for parsing and creating GBL files.

Features

  • Parse GBL files: Read and parse GBL files into a list of tag objects.
  • Create GBL files: Programmatically create GBL files using a builder pattern.
  • Encode GBL files: Encode a list of tag objects into a byte array.

Usage

Parsing a GBL File

from gbl import Gbl, ParseResultSuccess, ParseResultFatal

gbl = Gbl()

with open('firmware.gbl', 'rb') as f:
    data = f.read()

result = gbl.parse_byte_array(data)

if isinstance(result, ParseResultSuccess):
    tags = result.result_list
    for tag in tags:
        print(f'Found tag: {tag.tag_type.name}')
elif isinstance(result, ParseResultFatal):
    print(f'Error parsing GBL file: {result.error}')

Creating a GBL File

from gbl import Gbl

builder = Gbl.GblBuilder.create()
builder.application()
builder.prog(0x1000, b'\x01\x02\x03')

gbl_bytes = builder.build_to_byte_array()

with open('new_firmware.gbl', 'wb') as f:
    f.write(gbl_bytes)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gbl_ninja-1.0.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gbl_ninja-1.0.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file gbl_ninja-1.0.0.tar.gz.

File metadata

  • Download URL: gbl_ninja-1.0.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for gbl_ninja-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d810e93ae5b5d218ba2bbd47ac79c259c69580cd49c1ac13c4cd210eb23b4abf
MD5 ca2fd33ea325d289f8ae1f2400737f9b
BLAKE2b-256 6aeb22fd4228641ad72f9f617221c83144863e05075f0d1de6db9eccfd9b6aca

See more details on using hashes here.

File details

Details for the file gbl_ninja-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gbl_ninja-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for gbl_ninja-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c557c876a73fdc62f0aabe29fc305064b2eb60a976feabc6e078f567d27d9dd
MD5 027ca883e17191341d8a5de16e370490
BLAKE2b-256 0e782d4f25e168396389ca74ba7eec852edc1c2f717ab6576d3dcd81d0702c6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page