Friday, November 30, 2007

Creation of nk.nb0 file (nb0)

The nk.bin file is the Windows CE binary image that is usually transfered from Platform Builder to the Windows CE device, but for platforms you need to provide the nk.nb0 files. The nb0 files is a raw version of an bin file, that means that this file can be directly loaded in the SDRAM and executed from there.

Manual generation of an nb0 :
Platform builder environment provide two tools for the generation of the nb0 files. The first one Viewbin used to see the properties of the bin file, the second one Cvrtbin used to convert the bin file into an nb0 file using the information provided by viewbin.
So open your OSDesign and go to Build -> Open Release Directory in Build Window, it will show up a command line window setup for your project.
Use : viewbin nk.bin
ViewBin... nk.bin
Image Start = 0x00220000, length = 0x00AC136C
Start address = 0x0023D618
Checking record #72 for potential TOC (ROMOFFSET = 0x80000000)
Found pTOC = 0x80ce02c0
ROMOFFSET = 0x80000000
Done.

Using this output, the following code example shows the syntax used to create an nk.nb0 file, using the values found in the Image Start and length lines:
cvrtbin -r -a 00220000 -l 00ac136c -w 32 nk.bin

Values may vary for your nk.bin as those information are related to the settings of your BSP and OSDesign.

- Nicolas

8 comments:

Anonymous said...

Hi, Nicholas.

Thanks for showing the method of conversion.

I loaded the image of NK.nb0 to NOR flash but it failed to start up Windows CE 5.0 on the device. However there is no problem to run Windows CE 5.0 on the device using eboot.nb0 and NK.bin.

May I know what is the problem and how can I solve it?

Thank you in advance.

Regards,
Tiong

Nicolas BESSON [MVP] said...

Tiong,

It make sens that you cannot directly run your nk.nb0 from the NOR directly. The XIP (Execute In Place) is supported by Windows CE, but require some modifications. The two key things tolook at are :
- do the initialization of your platform, that is usually done by eboot, in the startup.s of the OAL
- set the configuration file (config.bib) to map the nk and RAM in the correct memory area.

Anonymous said...

Thanks for your reply, Nicholas.

I am sorry that I don't have any idea to carry out the suggested methods. I don't know much about Windows CE and all I could do with it is to develop application program on it. I hardly understand what is going on beneath the Windows CE.

I would like to ask for your favor to show me the details steps on the methods. Can you explain more on them?

I am sorry for my unreasonable request. It is that I don't have confident to overcome this problem within these 2 days before the Platform Builder ended up it's evaluation duration.

I sincerely appreciate your kindness. Thank you.

Regards,
Tiong

Anonymous said...

Hi, Nicholas.

This is an additional post to my previous reply.

As for your information, I hope to run Windows CE 5.0 on the development board of ARM Versatile PB926EJ-S. The BSP is provided by ARM company from http://www.arm.com/products/os/windowsce_downloads.html.

Thank you.

Regards,
Tiong

Anonymous said...

Hi Nicholas,

I didn't understand what you meant by:

"but for platforms you need to provide the nk.nb0"

Can you please explain when do I need to use the nk.nb0 instead of the nk.bin file?

Thanks,
Ron

Nicolas BESSON [MVP] said...

Some Windows CE platforms are using only .nb0 files instead of .bin files.
bin files cannot be directly executed from memory, at a time the bootloader have to 'uncompress' them in memory to be able to execute the code embedded.
If the bootloader is based on BLCommon, the bootloader will 'uncompress' the bin file received from platform builder and will store this 'uncompress' version on the storage device for the next boot. On next boot the bootloader will just have to load the content of the storage device in memory and jump on it.
On some platform you have the possibility through JTAG probe to store the runtime images directly on the storage. In those configuration user should exactly know what kind of data to store and where to store those data.

Regards,
Nicolas

Unknown said...

For start application at booting time,
i have to make changes as follows on registry:-
[HKEY_LOCAL_MACHINE\Init]


> Launchxx = "MyShell.EXE"
> Dependsxx = hex:14, 00, 1e, 00


but problem is i given below.
i have hard disk with primary partition 32mb. I have 3 files
boot.ini, splash.bmx and eboot.bix. and also nk.bin on active
partition. when i start the device, image is loaded from hard disk
to ram. then how to edit the registry, because it is loaded on ram. I
place the application exe on \windows\startup folder, but these
folder
are created on ram, when i restart the target device, this file are
removed. Then how to start application at startup of booting time.

Nicolas BESSON [MVP] said...

Abhi,

You are right by default, the registry is sotred in RAM and the content is created at startup using the content of your Runtime Image (nk.bin). If you want to launch your application at startup using the Init key, you have two solutions :
- Set this LaunchXX and DependsXX values in the registry of your Runtime Image using the Project.reg or a subproject of your OSDesign. This value will be in this case available at startup but you would not be able to modify its value without rebuilding the Runtime Image.
- By enabling a persistent registry on your device, the content of the registry will be stored on a storage device (you hard drive for instance). Enabling the Hive registry require some additional registry settings to load the storage driver in the early step of the boot (flags=0x1000) and specifying to the hive module that the registry have to be stored on this storage device.

Regards,
Nicolas