Analyze ROM Size (Compact 2013)

3/26/2014

This section discusses how to measure and analyze OS size and ROM usage.

 

Nk.bin and the ROM Image

The nk.bin file is a single, compressed binary file that the Romimage tool creates during the build process. This file contains the ROM image that includes the kernel and that you download to your device from the development computer. Because nk.bin is compressed, its file size is smaller than the OS image size in ROM.

Although nk.bin contains the ROM image, the size of the nk.bin file is not necessarily equal to the amount of space the ROM image occupies on your device. The OS size in ROM is typically larger than the size of nk.bin, in part because nk.bin contains compressed versions of files that the boot loader uncompresses when the OS is installed. Also, nk.bin consists of a set of records; it is not a byte-for-byte image of the data in ROM. The nk.nb0 file, on the other hand, is a byte-by-byte image of the OS, so its size accurately reflects the ROM size.

The nk.bin file offers faster downloads than nk.nb0 from the development machine to the device because it does not contain padding (of unused memory or for alignment). This faster download saves development time. For production systems, download the nk.nb0 file to the device.

The ROM image contains uncompressed files that execute in place (XIP), including system executable files and DLLs. It also contains support files that these applications use, such as fonts, waveform audio (.wav) files, and bitmaps. The support files may or may not be compressed.

Tip

Because the ROM image contains uncompressed files and parsed DLLs, it provides a more accurate measure of image size than the file size of nk.bin. Therefore, we recommend reading the nk.bin header to determine your final image size instead of estimating it based on the nk.bin file size.

Analysis Methods

Windows Embedded Compact 2013 enables you to measure various aspects of your ROM size and usage. For example, you might want to determine total OS size, or individual module or file size. You can use the following methods to do so:

  • View the file size of the nk.nb0 file.
  • View the nk.bin header information using the Viewbin tool or Platform Builder.
  • Examine the flat release directory for files and file sizes.

Each method has its advantages and disadvantages. For example, nk.nb0 might not be complete if you have other memory regions defined, such as for a boot loader, because these will have their own .nb0 files. (For more information, see Ce.bib File and the ROM Image.) You can extract the exact sizes from nk.bin, but because much of the information is stripped out during the Makeimg process, information about the original file size is limited.

The flat release directory contains nearly a complete set of all of the files included in the OS, in addition to configuration files used during the build process. (Common files such as fonts are not copied to the release directory.) However, in most cases, the file sizes in the flat release directory are not the same as the file sizes in ROM, because the Romimage tool removes unnecessary information and rearranges the files.

You may want to use a combination of analysis methods. The following topics on total OS size, module size, and file size discuss each method in greater detail.

In This Section

  • Analyze OS Configuration
    Describes how to analyze the OS configuration in order to eliminate unnecessary code and files.

 

See Also

Concepts

Optimize ROM Usage