Many BSPs include a config.bib that is configured to create an nk.bin, but not an nk.nb0.  The nk.bin is handy during development, or for upgrading in the field.  But it isn't so useful for programming your board using a JTAG tool.  Let's look at what the difference is between the two nk files are and how to create an nk.nb0.

An nk.bin is a set of records.  Each record includes an address, length and data to be stored at the address.  By using these records, the file size can often be reduced which makes downloading the file to a device quicker.  It can be smaller because often the data does not fill the entire space allocated for the OS.

An nk.nb0 is raw file that contains the data to be stored.  By comparison to an nk.bin, the nk.nb0 contains data for the unused areas of the OS.

I use two methods for creating the nk.nb0.  One is to convert the nk.bin to an nk.nb0, which can introduce some user error.  The other is to modify the config.bib to automatically output the nk.nb0, which eliminates user error.

  • Converting an nk.bin to an nk.nb0:
    Included with the Platform Builder tools are two utilities; viewbin and cvrtbin.  Together these tools can be used to convert the nk.bin to an nk.nb0.  The steps are:
    1.  1.  Run "viewbin nk.bin" which will output information about the OS contained in the nk.bin.  Example output:
    2.  Using the information that you know about your system and the output from viewbin, run cvrtbin.  I never remember the command line arguments for cvrtbin, so I run "cvtbin -?" first to remind me what they are:
    3.  From that I need to know:
       - Do I need an SRE or ROM file?  An SRE file is a Motorola S record, but we are looking for a raw ROM file.  So we need the -r option
       - What is the starting address?  The start address was in the output from viewbin:
            Image Start = 0x8030D000, length = 0x01D04664
       and is 0x8030D000.
       - What is the ROM width?  You need to know this one yourself.  For this example I have a pair of flash that are 32 bit wide.
       - What is the ROM length?  Like the start address, the length is in the viewbin output:
        Image Start = 0x8030D000, length = 0x01D04664
        and is 0x01D04664.
    4.  Now we can run "cvrtbin -r -a 0x8030D000 -l 0x01D04664 -w 32 nk.bin" which will output the nk.nb0 in the current directory.
  • Configuring config.bib to automatically output an nk.nb0

 You already have defined the address and size of the OS in the MEMORY section of config.bib:

        NK      8028D000  02900000 RAMIMAGE     ; 32Meg image space

 Now, you need to set ROMSTART, ROMSIZE and ROMWIDTH.  Note that these are the same things that we needed for cvrtbin.  So add the following to the CONFIG section:


Note from Bruce:  This is the most popular post on my BLOG, which quite frankly surprised me.  That tells me that many of you are searching for answers about nk.nb0 files, viewbin and cvrtbin.  I am interested in hearing from you if this didn't answer your questions, or if it did.  You can either add a comment, or if you prefer you can contact me privately.

Go to Summary of Building Windows CE

Copyright © 2008 – Bruce Eitman
All Rights Reserved