Skip to main content

Initialized data compression for embedded systems

Project description

lean-init

Compression of initialized data for embedded systems.

Features

  • Use a fast decompressor (lz4)
  • Produce a fully debuggable elf file

Installation

Python package

pipenv shell
pip install leaninit

Native dependencies

The python package relies on lz4 to perform the compression and binutils to parse/edit elf files. Binutils package need to match the target CPU.

How to integrate

LD file

  • User add a new section .leaninit and specify in it which sections shall be compressed.
    • Use ASCIZ statement to specify each section name.
    • Add BYTE(0) to mark the end of the list.
  • Remove AT statement for sections to compress.

Start up file

  • Replace uncompressed initialization loop by a call to the compressed initialization function.

C code

  • Include leaninit.h in main.c.

Build system

  • Invoke leansys.cli at the end of the build to generate the final elf file.

How to test

Native dependencies

The test use Renode.

Launching a test

The testit_env scripts build the python package in an isolated environment and then test the basic example for a particular build preset.

cd examples/basic
./testit_env minSizeRel

Examples overview

basic example

It is a bare metal application which outputs the full text of Saint Exupery's novel "Le petit prince" on a UART.

In this example, we compress the .data section. It contains all initialized variables including the array petitprince.

whole_fw example

It is a bare metal application which outputs the full text of Saint Exupery's novel "Le petit prince" on a UART.

In this example, we compress the whole firmware. Everything is compressed except the startup file and the decompressor. At startup the firmware is decompressed into RAM and executed from there.

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

leaninit-0.0.3.tar.gz (214.6 kB view details)

Uploaded Source

Built Distribution

leaninit-0.0.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file leaninit-0.0.3.tar.gz.

File metadata

  • Download URL: leaninit-0.0.3.tar.gz
  • Upload date:
  • Size: 214.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for leaninit-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5f1e6bdb9515de8a7ae7e9e4a7b5eb1d74c645630b41aaf87b8adcc90a548ae6
MD5 5921a80ee423b324133e10e78ae82072
BLAKE2b-256 a0733324c58ec1be3f743f2e78e7915a09ed83820ad784ecc51a65f424cd884b

See more details on using hashes here.

Provenance

The following attestation bundles were made for leaninit-0.0.3.tar.gz:

Publisher: workflow.yml on sebastien-riou/lean-init

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leaninit-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: leaninit-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for leaninit-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 083d30062dcccb5e20954359556fdaf1d6178e948311715abaf25900714ce94d
MD5 015d68a2f57d5d4539ed180e4e4f2812
BLAKE2b-256 8afdeb5e1dd8c89b1780dc864f948dff49c5a370ad528253d7981f63dceecf30

See more details on using hashes here.

Provenance

The following attestation bundles were made for leaninit-0.0.3-py3-none-any.whl:

Publisher: workflow.yml on sebastien-riou/lean-init

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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