| |||||||||||||
On-Line Manuals RealView Linker and Utilities Guide | RW data compression
RW data areas typically contain a large number of repeated values, for example, zeros making them suitable for compression. RW data compression is enabled by default to minimize ROM size. The ARM libraries contain some decompression algorithms and the linker chooses the optimal one to add to your image to decompress the data areas when the image is executed. However, you can override the algorithm chosen by the linker. armlink gathers information about the content of data sections before choosing the most appropriate compression algorithm to generate the smallest image. If compression is appropriate, the linker can only use one data compressor for all the compressible data sections in the image and different compressions might be tried on these sections to produce the best overall size. Compression is applied automatically if: Compressed data size + Size of decompressor < Uncompressed data size Once a compressor has been chosen, armlink adds the decompressor to the code area of your image. If the final image does not contain any compressed data, no decompressor is added. You can override the compression used by the linker by either:
Use the command-line option Num Compression algorithm ======================================================== 0 Run‑length encoding 1 Run‑length encoding, with LZ77 on small‑repeats 2 Complex LZ77 compression Run-length compression encodes data as non repeated bytes and repeated zero-bytes. Non repeated bytes are output unchanged, followed by a count of zero-bytes. Limpel-Ziv 1977 (LZ77) compression keeps track of the last n bytes of data seen and, when a phrase is encountered that has already been seen, it outputs a pair of values corresponding to the position of the phrase in the previously-seen buffer of data, and the length of the phrase. To specify a compressor, use the required ID on the linker command line, for example:
armlink ‑‑datacompressor 2 ...
When choosing a compressor be aware that:
The linker prefers compressor 0 or 1 where the data contains mostly zero-bytes (>75%). Compressor 2 is chosen where the data contains few zero-bytes (<10%). If the image is made up only of ARM code, then ARM decompressors are used automatically. If the image contains any Thumb code, Thumb decompressors are used. If there is no clear preference, all compressors are tested to produce the best overall size (see Choosing a compressor). NoteIt is not possible to add your own compressors into the linker. The algorithms that are available, and how the linker chooses to use them, might change in the future. When working with RW data compression:
In RVCT v2.0 and earlier, only the If you are using a scatter-loading description file:
| ||||||||||||
| |||||||||||||