Thursday, 29 November 2012

Update to Removing Process & Thread IDs from WEC 7.0 Serial Debug Output

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;
    }
}

Thursday, 14 June 2012

Choosing the right ARM based System on Module (SOM)

I am regularly in the situation where the choice of processor, module and thus vendor selection is still a customer question. This should not be a great surprise as there are so many variants for consideration. So I’ll try and help with my thought process and highlight the major considerations when making this selection. Read more... Let me know your thoughts

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!

Wednesday, 28 March 2012

Debugging CE7 apps using VS2005

If you want to build apps for a CE7 system using visual studio 2005 you can (normally you’d use 2008) if you have an SDK for the Windows Embedded Compact 7 (WinCE7) platform and you follow these steps!

I was getting the following error on linking:

corelibc.lib(armsecgs.obj) : fatal error LNK1103: debugging information corrupt; recompile module


To work around this:

- Install the hot fix for VS2005 from http://support.microsoft.com/kb/949009

- Fix any build issues in the project arising from defines not available in VS2005, i.e.:

From imm.h for instance:

DWORD WINAPI ImmGetGuideLineW(HIMC, DWORD dwIndex, _Out_bytecap_(dwBufLen) LPWSTR, DWORD dwBufLen);

To

DWORD WINAPI ImmGetGuideLineW(HIMC, DWORD dwIndex, LPWSTR, DWORD dwBufLen);

Basically removing all “_Out_bytecap_(dwBufLen)” from anything that doesn’t build…

- In the top of one of my files I needed to set

#define __INLINEISEQUALGUID__

As there seem to be two defines for the same named GUID equality function and it causes a link issue.

As the meerkat would say…Simples!