Following my earlier post I've found that setting
g_pOemGlobal->pfnWriteDebugString = NULL;
has an unfortunate side-effect during suspend & resume in that any debug prints during OEMPowerOff will use the NULL function pointer and cause the system to crash.
The solution is to restore the kernel to use the default serial debug during OEMPowerOff()...
VOID BSPPowerOff()
{
// If OEMInit() cleared g_pOemGlobal->pfnWriteDebugString to remove VID/PID
// from debug output, g_pNKGlobal->pfnWriteDebugString will now be NULL (see
// NKPowerOffSystem() in WINCE700\private\winceos\COREOS\nk\kernel\kwin32.c)
if (NULL == g_pNKGlobal->pfnWriteDebugString)
{
// Set kernel pfnWriteDebugString so that debug prints in OEMPowerOff()
// do not crash the system.
// NKPowerOffSystem() will restore the orginal value following return
// from OEMPowerOff()
g_pNKGlobal->pfnWriteDebugString = (PFN_WriteDebugString)OEMWriteDebugString;
}
}
Showing posts with label serial debug. Show all posts
Showing posts with label serial debug. Show all posts
Thursday, 29 November 2012
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
Labels:
CE 7.0,
PID,
Process ID,
serial debug,
Thread ID,
TID,
trace,
WEC7,
WinCE 7.0,
Windows Embedded Compact
Subscribe to:
Comments (Atom)
