Friday 20 April 2012

Removing Process & Thread IDs from WEC 7.0 Serial Debug Output

One nice feature in Windows Embedded Compact 7.0 is that, unlike earlier versions of Windows CE, the kernel prepends serial debug output with the process and thread identifiers:
PID:00400002 TID:00C4000A Device Power State = NdisDeviceStateD3.


In many cases this is useful and the output is now more like KITL debug output than before. 

With KITL debug output the Platform Builder Debug Message Options dialog gives you control of which information is prepended to the debug messages:


So, what happens if you want to remove the PID and TID from the serial debug trace to reduce the volume of information and/or increase speed?  There's no Platform Builder option to help.

The answer is to modify the OAL and set

g_pOemGlobal->pfnWriteDebugString = NULL;

Setting this pointer to NULL makes the kernel call g_pNKGlobal->pfnWriteDebugString directly instead of prepending the PID/TID information and calling OEMWriteDebugString().

You should be aware that this also bypasses thread synchronization but if you are happy to remove the PID/TID you are probably experienced enough to cope!

For more information refer to NKOutputDebugString and DoODS in WINCE700\PRIVATE\winceos\COREOS\nk\kernel\printf.c

Res2Res Errors During CE 6.0 Makeimg

Once again we are hitting problems during makeimg with

ERROR: Res2Res: WriteResFile: xxxxxxxxxxxxx

The problem can be “fixed” by either

1.       Disabling virus scanning of the temporary directory

2.       Emptying the temporary directory

My temp dir was full of rubbish so I used option 2.  The command line below is much quicker than using Explorer

del /q /f /s %temp%\*

This worked for me.  However, if the problem persists then try option 1.  It worked for a colleague.

Hope this helps!