Wednesday, 18 August 2010

Page faults on resume from suspend with COMPRESSION=on

A short while ago we had a problem on a platform resuming from suspend, a page fault calling a standard function. The function in question was a Registry query function. The fault was tracked down to that fact that when the config.bib specifies compression like:
COMPRESSION=ON
This means that all files are put into the nk.bin image back to back without any space between them, even running the image from RAM most of these files cannot be executed in place as the file aren't aligned on a page boundary, these files need to be copied into ram on a boundary and executed.
In the project above we needed to use the API so a solution was to turn off the COMPRESSION, this increases the NK.BIN size but helps in lower RAM usage and faster response times due to no duplication of files into executable positions. 

Thursday, 8 July 2010

Transformations in WindowsCE using SetMapMode

Unfortunately Windows CE doesn't support transformation of the coordinate system using SetMapMode, SetViewPortExt and SetWindowExt even in Windows CE 7.0 which is rather unfortunate as we had an application just this week that would have benefited from this. The application I'm referring to would have been cross compiled for Win32 and CE so basically I had to support scaling for the PC end as well, no point in having two different systems when the app should be seemless across both platforms, maybe in CE8.0 eh?

Wednesday, 9 June 2010

Windows CE 7.0 Preview

Microsoft have unveiled a technology preview of Windows Embedded Compact Edition (windows CE) version 7.0, the preview can be downloaded from http://www.microsoft.com/windowsembedded/en-us/products/windowsce/compact7.mspx go check it out now!

Monday, 24 May 2010

Summer 2010 EmbeddedSPARK Competition

To all you embedded hobbyists. I Just want to highlight the latest Microsoft embeddedSPARK compitition on this summer. Given the latest release, this round of the competition is focused on Embedded Standard 7.

You can find all the information you need to enter at http://www.embeddedspark.com/

A video about this can also be seen at http://www.embeddedspark.com/public/videos/embeddedSPARKSUMMER_howto.wmv

FYI - Round 1 closes on June 8
Any questions or issues I can help with please let me know.

>> Nigel

Thursday, 20 May 2010

Setting up COM buffers

I was pointed to this today to set the size of serial buffers on WinCE:
 BOOL SetupComm(     HANDLE hFile,   DWORD dwInQueue,     DWORD dwOutQueue   );
This should control the internal buffer sizes for the COM port... but the amusing comment in MSDN says:
 Always returns FALSE because the FIFO queue size cannot be changed
Err... so does this work!?

Wednesday, 12 May 2010

Realtime CPU calculation for CE debugging

Quite often I've been in the situation where a process or thread has gone rogue and I've been trying to track down why the system has ground to a halt.

One of the things I find most helpful is the SnapShot tools, this allows you to take a snapshot of the system for its current running processes or threads, this can be useful in itself but using the GetThreadTimes API you can then print out any high CPU users, basically creating your own mini-task manager for Windows CE.

Firstly take a snapshot of the system:

HANDLE hSnapshot = CreateToolhelp32Snapshot (TH32CS_SNAPTHREAD, 0);

Secondly call Thread32First/Next on the snapshot to retrieve all the thread information:

THREADENTRY32 te[256]; // up to 256 threads
int used = 0;
te[used].dwSize = sizeof(THREADENTRY32);
if ( Thread32First(hSnapshot,&te[used]) )
{
do
{
..
..

used++;
te[used].dwSize = sizeof(THREADENTRY32);
}
while (Thread32Next(hSnapshot,&te[used]));
}

Finally iterate through the threads getting their thread times, creating times etc:


FILETIME creationTime,exitTime;
FILETIME ktTime[256];
FILETIME utTime[256];
GetThreadTimes ((HANDLE)te[used].th32ThreadID,
&creationTime,
&exitTime,
&ktTime[used],
&utTime[used]);

This can be done in the while loop above, you can also use the results from the snapshot over and over with a sleep(1000), compare the results and print out the top XX threads using CPU to give some realtime feedback on the system usage.

Commonly my applications and kernel development use this method to ensure that the system is using the expected CPU time when being developed.


Thursday, 6 May 2010

2010 Embedded Market Study shows Microsoft embedded OS's are on the way up...

The 2010 Embedded Market Study from EE Times group is out now, they reviewed 1,574 surveys on embedded designs.

This year we should be expecting the Wind River (VxWorks) to take the top 17% of upcoming embedded designs, followed by 13% for Debian (Linux), then Windows CE closely following at 13% and then Windows (XP Embedded) at 12%.

Windows CE and Windows XP Embedded are up 1% on last years survey, and between them take a whopping 25% of new designs, great news!

Check out the Webinar on http://www.techonline.com/learning/livewebinar/224000228 for on-demand playback.