Thursday, 3 September 2009

Omg, my image is too large!

Limitted recources on Windows CE devices cause a lot of trouble.
I want to give you some hints to find out why your image is twice the expected size.
It's not so easy to find out what OS components can be removed for a specific project.
  • NK.nb0 vs. NK.bin: The BIN-File is roughly the size you need on Flash and additionally on RAM. If you use a NB0-File and your BIN-File is much smaller, just review your config.bib and check the ROMSIZE value. And set AUTOSIZE=ON if possible.
  • Catalog View: Review the Catalog Items under "Core OS". The Platform Builder adds Catalog Items to your project if it depends on another item. Select the filter "User-selected Cataloge Items and Dependencies" and review the small green squares. Select "Reasons for Inclusion of Item" from the context menu.
  • SYSGEN_*: In the properties of the Catalog Items you can see the corresponding SYSGEN variable. The build process "translates" the SYSGEN variables to a list of OS components in CE_MODULES, IE_MODULES ... You find these "rules" in the batch files under Public/CeBase/Oak/Misc. In the most cases each OS component corresponds with a DLL or EXE file in your release directory.
  • CeConfig.h: In each release directory and on each device you find a CeConfig.h file with the complete list of OS components in your image. Review this file to find obsolete components.
  • DLL-Size: Sort your DLLs and EXE files in your release directory by size and try to remove the largest files.
  • ViewBin: With the tool "ViewBin -t nk.bin" you see a list of MODULES and FILES and it's sizes.
Large files are Internet Explorer components, VBScript, JScript and fonts. Sometimes there are MFC DLLs in an image but no MFC applications. Standard SDK compatibility is deprecated and it adds a lot of dependent components.
But don't try to remove each unknown 20kByte file, it will make your image very special.
After changing your OS extend you have to rebuild your Platform SDK.
I hope my hints are helpful to make your OS image smaller.

Tschüß Holger

No comments: