emCompress-Embed is a compression library that uses common compression codecs to reduce the storage requirements for static data. Having less data to store means the firmware image may fit into a smaller flash memory device. This can potentially decrease the required size of an embedded system, reducing cost.
emCompress-Embed compresses the data on the host in advance. The compressed data is then included in the firmware, along with a small and fast decompressor, so data can be decompressed on the fly, whenever needed.
Decompression of static data on a embedded system
Automatic selection of the best codec for each data file
Fixed size of decompressor RAM usage, selected at data compression
The amount of ROM that emCompress uses for decompression, varies with the codec selected. The table below measures the total ROM required for a single decoder, including all supporting functions and excluding integrity checks on the target device.
Some of the codecs share common code. Hence, if your compressed bitstreams only use DEFLATE, the amount of ROM required is easily read off from the table. If you are using more than one codec in your application, the amount of ROM is less than the sum of all used codecs.
Adding a table-driven CRC32 integrity check adds about 1.1 KB of code to the total emCompress ROM requirement. The following table lists the ROM requirements per codec.
The amount of RAM that emCompress uses is under complete control as it is specified at compression time. Typically, 2KB of temporary RAM for decompression is already enough for good compression ratios, but even without temporary RAM, good compression ratios can be achieved in many cases. No static RAM is required and stack usage remains well below 512 bytes.
|Uncompressed Data (112 KiB ≙ 100%)|
|Data size||30.5 KiB|
|Decompression RAM||2 KiB||48 KiB|
|Decompression speed*||3 MiB/s||2 MiB/s|
* Running on Cortex-M4 @ 200 MHz
With emCompress-Embed data is compressed on the host. As a result the compressed data can be included as a byte array in a firmware image, along with the algorithm to decompress the data on demand.
Software never shrinks in size. . During the lifecycle of embedded systems, customers expect firmware updates. Typically, firmware images grow with each update, new features are added, existing features cannot be taken away., and at some point,new firmware risks exceeding available flash size.
Compressing static data, anything which is stored in flash and copied into RAM, e.g. used to configure peripherals or sent to external systems, can free up some memory to make another firmware update possible.
The decompression algorithms of emCompress-Embed are developed for a small ROM footprint. Thus emCompress-Embed can almost always reduce the overall firmware image size.
The emCompress-Embed Tools test all available compression codecs and select the best fit. With knowledge of the available RAM for decompression, the codecs can be tuned to match the resources of the embedded system.
When an embedded system includes an FPGA(SoC) or CPLD, the firmware needs to load a configuration bitstream into the device. In small systems without external memory the bitstream data is usually included in the firmware.
emCompress-Embed can compress bitstreams to reduce storage requirements. On startup of the system, the firmware can decompress the bitstream. With decompression on the fly, the device can be immediately configured with decompressed chunks without having to decompress the overall bitstream into RAM first.
Embedded Systems with a user interface, such as a display or a web server, need to include assets to be displayed, such as web pages, images, or language files. If these assets are not stored in external memory, but are statically linked into the firmware, the impact to the firmware size can be huge. Sometimes firmware includes more data than code.
emCompress-Embed can reduce the size of assets quite significantly. To minimize the overhead, the emCompress-Embed tools can be configured to select one compression codec which achieves the best results for all assets, instead of choosing the best codec for each individual one.
When multiple assets need to be compressed, emCompress-Embed's group mode can achieve an even better result. By using group mode, all input data is linked together and compressed as a whole, enabling the compressor to compress the linked data much more effectively. This proves particularly effective when compressing small, static HTML files for embedded web servers. Decompression in group mode works essentially the same as single-file compression.