Thursday, July 11, 2013

WaitForMultipleObjects

Please take care while using WaitForMultipleObjects

Today I was trying one of the example given by Microsoft on Windows CE. 

Basically the code is written for Windows Desktop and the code can be seen at the following URL: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686927(v=vs.85).aspx.

In the above given example the main function is creating two threads and waiting for the threads to close using WaitForMultipleObjects API. 

As this example is for desktop in WaitForMultipleObjects API the third parameter fWaitAll is set to TRUE.

I made some modifications such as printf is changed to RETAILMSG and on entry and exit of main, thread function we have enable more RETAIL Messages.

After running the application we are not seeing any messages that are being printed from the worker threads. All we see is the main function entry and exit messages.

After debugging, we came to know that fWaitAll in WaitForMultipleObjects API shall be set to FALSE in Windows CE 6.0.

Hope This Helps.

Monday, July 8, 2013

File Persistence Issue Faced With Compact 7

This post talks about one of the issue that is faced during implementing the File and Registry Persistence on eMMC with Windows Compact 7 OS.

Issue Faced: Whenever OS is updated using Boot-loader it is observed theat entire eMMC area is erased so that old peristence data is erased. 

After the OS is booted completely copy a file to root directory to verify the file persistence. 

To test whether the file perists or not reboot the device and check whether the file is present or not. It is observed that the file copied on first boot disappears. 

Copy the same file on second boot, reboot again to see whether the file copied is persistent or not. It is observed that from second  reboot the files and registry persists where as the files or registry modified during first boot does not persists.

When we did the same experiment on a EVM the file persistence works across all the boots.

One difference we observed between eMMC present on EVM and eMMC present on our custom hardware is that, the default values on eMMC after erase are all 1's on our custom hardware where as on EVM the default erase value equals to all 0's.

So, in boot-loader we applied the following fix. 

When ever we erase persistence storage area on eMMC, the area is filled with all 0's. 

After applying this patch we hadn't observed the first boot persistence issue.

Hope This Helps

Thursday, March 28, 2013

Forcing a device driver to a power state for a power manager state

Many of you might already know that in Windows CE 6.0 one can set the device power state to a required power state other than default power state for a particular power manager state.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\useridle] 
"Default"=dword:1
The above entry will keep all the devices in D1 state while entering into User Idle power manager state 


In Windows CE 6.0 we have following default power manager states

ON, UserIdle, SystemIdle, Resuming, Suspend, Coldreboot and reboot.

Let's say one would like to set a stream interface driver XYZ to D4 while entering into D4 state.

Hence the below registry key has to be specified in platform.reg

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\useridle] 
"xyz1:"=dword:4



Please note that in PM the case for the entry is sensitive. Hence if you set XYZ1 inplace of xyz1 then it will not work. 

Thank You for reading the post.



Friday, January 18, 2013

How to flash images onto production hardware

This article discusses about the ways to flash binaries in production stage to hardware.

As of now I can think of three possibilities for updating binaries to Flash present on Hardware. 

SD Boot
  • Copy all the images to SD Card .
  • Implement boot-loader in such a way that whenever the system boots from SD Card to update the boot-loader images and Kernel image to Flash present on Hardware.
To have this feature the hardware shall support SD Card boot and the boot-loader shall support some file system handling code.

In this method at production stage the only requirement is one SD Card with production images copied onto it.

Using Platform Builder 

  • Flash the boot-loader images onto hardware using JTAG
  • Disconnect the JTAG and boot from Flash. 
  • Connect the hardware using ethernet cable or USB cable.
  • Download the image from Platform builder onto target and flash it.
The drawback of this is at production stage Host PC shall be supplied with Platform Builder Installed and expensive JTAG's might need to be purchased. More over the flashing procedure is a two step procedure.

Using CEDownloader
  • Flash the boot-loader images onto hardware using JTAG
  • Disconnect the JTAG and boot from Flash. 
  • Connect the hardware using ethernet cable or USB cable.
  • Instead of PB the user can install CEDownloader utility (Search for it in Google / Sourceforge.net)
In this method installation of PB onto production Host PC can be avoided.


Happy Flashing.