emCompress-Flex is a cost-effective compression library for speeding up firmware updates. It implements the lossless compression algorithm LZMA, which is used by popular compression tools, such as 7zip. emCompress-Flex enables you to use LZMA decompression even on small embedded targets.
- Compression and decompression of firmware images
- Compatible with standard LZMA compression tools
- Easy-to-use zlib-like API
- Libraries for host and embedded applications
emCompress-Flex implements the LZMA (Lempel–Ziv–Markov chain) lossless compression algorithm which was first used in the 7z file format. This algorithm uses a dictionary compression scheme similar to the LZ77 algorithm and features a high compression ratio and a variable compression-dictionary size, while still maintaining decompression speed similar to other commonly used compression algorithms.
|Codec||Compressed size ||Compression speed ||Decompression speed ||Compression RAM||Decompression RAM|
|LZMA(1k,0,0,0)||108.676 KB||282||87||6.010 MB||5,060 B|
|LZMA(1k,3,1,1)||103.675 KB||289||91||6.010 MB||27.613 KB|
|LZMA(2k,0,0,0)||106.270 KB||363||91||6.015 MB||6,084 B|
|LZMA(2k,3,1,1)||101.701 KB||378||93||6.015 MB||28.613 KB|
|LZMA(4k,0,0,0)||104.640 KB||582||85||6.025 MB||8,132 B|
|LZMA(4k,3,1,1)||100.450 KB||593||90||6.025 MB||30.613 KB|
|LZMA(8k,0,0,0)||103.592 KB||980||87||6.044 MB||11.941 KB|
|LZMA(8k,3,1,1)||99.742 KB||992||87||6.044 MB||34.613 KB|
|LZMA(16k,0,0,0)||102.706 KB||1,821||82||6.083 MB||19.941 KB|
|LZMA(16k,3,1,1)||99.198 KB||1,785||85||6.083 MB||42.613 KB|
|LZMA(32k,0,0,0)||102.059 KB||2,389||97||6.162 MB||35.941 KB|
|LZMA(32k,3,1,1)||98.808 KB||2,550||86||6.162 MB||58.613 KB|
|LZMA(64k,0,0,0)||100.030 KB||4,182||89||6.318 MB||67.941 KB|
|LZMA(64k,3,1,1)||97.180 KB||4,274||83||6.318 MB||90.613 KB|
|LZMA(128k,0,0,0)||99.840 KB||5,081||85||6.630 MB||131.941 KB|
|LZMA(128k,3,1,1)||97.067 KB||5,026||86||6.630 MB||154.613 KB|
|LZMA(256k,0,0,0)||99.851 KB||3,001||83||7.255 MB||259.941 KB|
|LZMA(256k,3,1,1)||97.080 KB||3,212||87||7.255 MB||282.613 KB|
 Uncompressed input size: 182.695 KB
 ns/Byte on Intel i7 @ 4.6GHz, only for comparison between codecs
emCompress-Flex provides a simple zlib-like API for the incremental processing of input. This interface enables compression and decompression of data on the fly. It can be used to process data in chunks as they are received from a remote system instead of requiring that all data be available at once. It can also be used to process data and output chunks into a small buffer for further processing instead of requiring a large output buffer that can hold all of the compressed or decompressed data at once. This can reduce memory buffer requirements.
emCompress-Flex is the cost-effective solution for accelerating firmware updates by compressing and decompressing the firmware image.
Modern products, in particular IoT devices, require the ability to update their firmware in the field. Most of these devices implement over-the-air (OTA) updates through their main communication channel. When a device is connected via WiFi, available bandwidth is not an issue, but other channels such as Bluetooth or Zigbee might have limited bandwidth. Also, updates via wired connections often have bandwidth restrictions, e.g. the popular CAN bus.
To speed up the update process, lossless compression of firmware images reduces the amount of data to be transferred to the device. emCompress-Flex enables firmware updates with compressed images. They can be easily compressed with the tool included in emCompress-Flex. Once compressed, one can simply deploy the compressed file and send it to the target.
The emCompress-Flex interface is suited to receive a compressed data stream and to decompress it on the fly for the update module, which processes the decompressed data afterward. For compressed firmware updates, the target decompresses the received data and immediately writes it to flash in small chunks. This removes the need to decompress the whole firmware image first before doing the update.
emCompress-Flex includes the compressor in a simple-to-use tool as well as in a dynamic library to easily include compression with your tools. It is also compatible with standard LZMA compression tools.
The decompressor is included in a library and can be included into any application, running on a computer or on a microcontroller. It is not limited to 32-bit architectures, but can be used even on 8-bit and 16-bit devices.