Skip navigation

emCompress—Embedded Compression Tool

  • Highly efficient compression for embedded devices
  • Small decompressor ROM footprint
  • Fixed decompressor RAM use, chosen when compressing
  • Wide range of codecs to choose from
  • Automatic selection of best codec for each file
  • Easy-to-understand, and simple-to-use
  • Group mode compression boosts small file compression ratios
  • Simple to configure, and integrate
  • Royalty free
  • Ideal for embedded systems

emCompress—The Smart Compression System

emCompress is a compression system that is able to reduce the storage requirements of data that must be embedded into an application. Compress on the host in advance, decompress in the target on demand. A compressed version of the data is stored in the flash memory of the target system. In the target a small, fast decompressor can decompress the data on-the-fly, whenever it is required.

The emCompress decompressor can decompress into RAM or send the output to an application defined function on any embedded device. It can be used with little RAM on the target side for decompression; the amount of RAM available to the decompressor is taken into account during compression and an appropriate compression algorithm is automatically selected. Compress and decompress the smarter way — use emCompress by The Embedded Experts for any embedded system.

Introduction to emCompress

Software Only Grows in One Direction

With increasing complexity of today's embedded devices, customers expect firmware updates over the life of an embedded device. It's important to be able to replace both, firmware images and FPGA configuration bitstreams in the field. Typically, firmware upgrades and other static content are only growing in size over the lifetime of a device: features are added to the software and not taken away. Using quickly-written ad-hoc utilities to convert content directly to compilable code (possibly with some form of simple compression) is usual, but it's towards the end of a project when you realize that the static content just won't fit into your device with the baggage of new firmware features.

Typical Applications of emCompress are:

  • Configuration bitstreams to program FPGA and CPLD embedded devices.
  • Permanent files for the embedded web servers static content.
  • Upgrading firmware, using a compressed image for an embedded target.
  • Storing user interface messages for multiple languages.

Advantages of emCompress

In contrast to many compression utilities, emCompress does not seek to provide the ultimate in compression ratios and decompression speeds. Rather, emCompress focuses on the memory available to run decompression on the embedded target and choose the best compressor that will work to meet those constraints. It's easy to use, it's simple to integrate and as with many other SEGGER software products, SEGGER has the confidence to build it into our own hardware products which are in daily use by hundreds of thousands of satisfied users worldwide. Making it a professional and unique embedded compression tool for multiple use cases.

The smart embedded compression tool emCompress is able to significantly reduce the amount of storage required for data in embedded systems, by compressing it during compile time. This can save flash, cost, data transmission times, or even make it possible to fit the application into the available space on the embedded device.

emCompress Offers a Professional Solution!

This is where emCompress can help. emCompress will compress your data on a workstation so that it takes much less space on the target device. The decompressors are tiny in ROM, but the benefits of compression mean you reclaim more space in your device for the features you're trying to add. Because emCompress decompressors can be tailored for RAM use, you can decompress static content early in your application and not devote RAM to decompression buffers. For instance, configuring an FPGA is one of the first things that an application will do, decompressing a bitstream and sending it to the FPGA. In this case, a small decompression buffer can be held on the stack, even though the compressed bitstream is hundreds of kilobytes in size: the temporary buffer is a known size that is configured at compression time and therefore  RAM is free to be reused the moment any decompression is completed. Of course, emCompress is not limited to these applications, it is very effective at reducing any type of stored content.

emCompress Sample Applications

emCompress includes a sample application project which shows the comparison of handling uncompressed data in contrast to compressing data with emCompress. The sample application project is available for evaluation upon request. Contact us at

Sample Project

The sample project is a SEGGER Embedded Studio solution, with an application that processes an uncompressed and compressed example bitstream. The project shows how much memory emCompress can save while processing the data—it is similar for compressed and uncompressed data. It can be run in the SEGGER Embedded Studio Simulator as well as on real Cortex-M3 / Cortex-M4 hardware. The application is simple. The compressed or uncompressed bitstream is processed and a checksum of the decompressed data is calculated. The result is printed in the debug terminal. Running both applications will result in the same checksum, while the compressed application is much smaller.

int DECOMPRESS_HandleData(void *pUserContext, void *pData, unsigned NumBytesData) {
  U8* p;

  p = (U8*)pData;
  _NumBytesTotal += NumBytesData;
  while (NumBytesData--) {
    _CheckByte ^= *p++;
  return 0;

int main(void) {
  int Status;

  Status = ProcessData();
  if (Status >= 0) {
           "Processed %d bytes (Checksum: 0x%.2X).\n",
           _NumBytesTotal, _CheckByte);
  } else {
    printf("FAILED!\nProcessing error.\n");
  return 0;

Size Comparison

SEGGER Embedded Studio can show the memory usage of applications. After building it, the usage is displayed in the Output window and the Memory Usage window. The memory usage of the compressed and uncompressed application can easily be compared.




With emCompress 81.2 kByte of data can be saved while adding only 2.0 kByte code for the decompressor.

Take a look at "emCompress walkthrough"

Additional Examples

What's in emCompress?

emCompress ships with the compression application to run on Windows as well as the source code for all decompressors and a comprehensive user manual.
emCompress is written in well-commented ANSI C and is both compiler and target independent. In contrast to most compression libraries, emCompress is not covered by an open-source or required-attribution license and can be integrated in any commercial or proprietary product, without the obligation to disclose the combined source. Because the decompressors are provided as source code, emCompress decompressors can be inspected by auditors. The compression utility's source is available as an additional module.  

Supported Devices

Typical Example—Configuring an FPGA

In products, where an FPGA is used and programed via the microcontroller, the configuration bitstream has to be stored in the flash memory. Depending on the complexity of the FPGA configuration, the bistream can be a few hundred kilobytes which can be too much to fit into small microcontrollers with less internal flash.

A few hundred kilobytes can be too much for small microcontrollers with less internal flash, but for cost reasons we do not want to use a larger controller or add external memory to your product. The solution is to reduce the storage requirements of the bitstream.

Fitting Data Into Small Flash

The size of our uncompressed configuration bitstream is 360 kByte. Our FPGA supports a compressed configuration bitstream, resulting in 112 kByte of data. We already saved some memory here, but it is still to large for our small flash. Now emCompress can help us. We compress the 112 kByte bitstream with emCompress and include it into our application. Compressing and decompressing data requires a workspace in RAM. With emCompress we can select the workspace which is available for decompression while compressing the file. A larger workspace might result in higher compression rates, but in fact requires more RAM. We will test emCompress with a small workspace of 2 kByte and an unlimited workspace which will show the largest workspace size. The best compression we get for our bitstream is 23 kByte, requiring a workspace of 35 kByte to decompress it. With a limited workspace of 2 kByte we get a compressed output of 30.5 kByte, 27.3% of the original file. Since our RAM is limited too, 30.5 kByte will fit into our flash, we choose the 2 kByte workspace.


emCompress is great! Where can I find the compressor sources?

A: emCompress is designed for fast and effective decompression at runtime and the companion emCompress application is designed to run on a workstation or PC where memory is plentiful. Because the emCompress application is all that is required for preparing data to be decompressed, we do not ship the source code of the compressors built into the emCompress application.

I still need compression in my application, though...

A: Should you wish to take advantage of on-device compression in your application, please contact us to discuss your requirements and how we might be able to help.

Why are there so many compressors?

A: emCompress ships with compression algorithms that can be parameterized to tune decompressor memory. As each decompressor has different memory requirements and compression capabilities, emCompress covers a wide range of use from excellent compression using moderate amounts of RAM to good compression using tiny amounts of RAM. No one compression algorithm will be applicable across the wide range of inputs and workspace requirements of target applications.

What is the purpose of the STORE compressor?

A: The STORE compressor ensures that incompressible data does not expand, as it generally does using other lossless compressors. It allows incompressible data to be handled in the same manner as compressed data, freeing the client from treating uncompressed data differently from compressed data.