Wednesday, 26 January 2011

Image compression considerations under Windows Embedded CE

Hi folks,

You can compress your Windows Embedded CE image (nk.bin) as a whole, only selected components, or only the resources of selected components.

Before we discuss how to compress your Windows Embedded CE image, let’s first have a look at the pros and cons of having a compressed Windows Embedded CE image.

Your nk.bin is smaller in size

Your Windows Embedded CE image runs slower and needs more RAM at runtime since you loose the “execution in place” advantage: every access to a compressed DLL causes a page fault exception. The respective DLL is then copied and decompressed into RAM.

Compressing only the resources of a component is not quite as critical; in most cases resources need to be relocated and are accessed multiple times anyways, one more access (decompressing) does not really matter. However, the space you save when compressing the resources is minimal.

Now that we established that you shouldn’t use image compression, let’s have a look at how we would accomplish it anyways.

Image compression is configured in .bib files:
  • Global image compression is set in the CONFIG section of the .bib file (normally config.bib):

  • Compression of selected components is set via the C flag in the MODULES or FILES section. This flag is overwritten by the global compression setting.

  • Resource compression of selected components is set via the R flag in the MODULES or FILES section.

Have fun!

1 comment:

SntNick said...

Don't worry!
"By default, the writable sections in the MODULES section, as well as all files in the FILES section, are compressed" (COMPRESSION topic) Those section and files will be relocated anyway.
So you should use image compression!