Use zlib decompression in bootloader and IAP

Source: Internet
Author: User

The original bootloader scheme is on-chip flash on the above divided into 3 pieces, the bootloader area occupies a small block, and then the rest of the area is divided into two blocks, a piece is the operating area, a piece of the new firmware temporary storage area.

Fortunately, the proportion of flash in the system cost is getting lower, otherwise it would be extravagant and wasteful.

Based on this scenario, we can also use the compression feature so that the temporary storage can be smaller, freeing up more space for the runtime.

Compression algorithm format comprehensive consideration using GZIP, decompression program using Zlib.

Because the gzip format is more versatile, it is easy to compress and debug. and the resources consumed by decompression are acceptable.

Generally, the deflate compression algorithm used by GZ has a compression rate of about 75%.

Therefore, it is recommended to use a compressed runtime and a temporary storage size ratio of 4:3 is more appropriate.

But the compression rate is very much related to the original features,

Therefore, when you generate the firmware, you must limit the volume of the compressed to be larger than the size of the staging store, except that the original text cannot be larger than the size of the run area.

In addition, if the system transmits the use encryption technology, must first compress and then encrypt.

Because the data compression rate after encryption is very small, even the volume after compression is larger than the original situation.

Finally take a look at the zlib decompression consumption of resources:

Measured in a CORTEX-M3/4 system above, zlib only enable decompression function, CRC32 put table in RAM, at the end of other special optimization situation occupy flash around 15KB.

While extracting the files, the RAM used in the 32KB+9KB, but generally bootloader or IAP, other functions are disabled, so RAM is generally sufficient.

Therefore, as long as the firmware is compressed to a larger volume than 20~30kb, you can consider using compression algorithms.

Use zlib decompression in bootloader and IAP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.