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

1 comment:

MartinT said...

See my 29 Nov 2012 update for fix during OEMPowerOff() suspend & resume handling.