August 2008 Entries

Books on My Shelf: Windows Embedded CE 6.0 Fundamentals
Windows Embedded CE 6.0 Fundamentals by Stanislav Pavlov and Pavel Belevsky is one of the first books about developing a Windows CE device using Platform Builder available in several years. As the name states, this book contains the fundamentals of developing using Platform Builder. It does not venture into too many details though, so this is a book for beginners, not beginning programmers, but beginners with Platform Builder. This book is fairly short at 230 pages, as technical books go, so reading ......

Posted On Tuesday, August 26, 2008 11:10 PM | Comments (0)

Platform Builder: Sources.cmn
Sources.cmn is a build configuration system file that allows you to set common variables. This can be useful if more than one directory in the build tree need the a variable set to the same value because it can reduce your maintenance efforts. Each build tree can use one sources.cmn file. When build.exe runs, it will determine the root of the build tree by looking for the top most folder with a Dirs file. Build.exe then sets BUILDROOT to the top most folder with a Dirs files. Makefile.def in Public\Common\OAK\Misc ......

Posted On Saturday, August 23, 2008 10:56 PM | Comments (4)

Platform Builder: Sources Files 2
I was looking over my original post about sources files (Platform Builder: Sources Files) today and it occurred to me that there is room to improve. That post provided basic information to create a sources file that will build a driver. The following are other things that you can do within a sources file: Set CFLAGS and AFLAGS CFLAGS and AFLAGS cannot be set in a sources file. Instead, you will need to set CDEFINES and ADEFINES to set compiler and assembler command line flags. Set CDEFINES, LDEFINES ......

Posted On Friday, August 22, 2008 6:22 PM | Comments (0)

Windows CE: Running Batch Files
Every once in a while I am asked about running batch files on Windows CE. My first response of course to ask why? But let’s assume that you are set on using a batch file. I know you probably think that batch files are easy to modify, but really I don’t think that they are and you may find that batch files for Windows CE aren’t that easy. The first thing that you are going to need is a Command window, or DOS shell, to run your batch file in. It is likely that your system doesn’t have one, but if you ......

Posted On Thursday, August 21, 2008 7:53 PM | Comments (13)

Platform Builder: Cloning an MDD Lib
I have written about cloning code from the Public tree to a platform in the past, but someone recently asked about cloning an MDD lib build directory. More specifically the question was about cloning ufnmdd.lib in Windows CE 5.0, which is actually created by linking three separate libs together. In this article, I will walk through the process by cloning one of those libs. Ufnmdd.lib is created by linking ufnmddbase.lib, ceosutil.lib and defbuslib.lib. I suspect that most people don’t really need ......

Posted On Thursday, August 21, 2008 12:10 AM | Comments (2)

Windows CE: Automatically setting the Object Store Size
A customer asked me an interesting question today. He wanted to know how to know how much space his system needed for the Object Store. That had me thinking that there could be a way to monitor the size and automatically adjust it, Windows Mobile does that. Of course Windows Mobile probably has a better way to manage the Object Store size than this, I am guessing that it monitors the size within FileSys and adjusts it as requests come in. I wrote the following code just to see what could be done. ......

Posted On Wednesday, August 20, 2008 9:40 PM | Comments (0)

Windows CE: Device Driver Summary
Posts About Stream Interface Drivers Windows CE: A Stream Interface Driver Shell This post contains all of the code necessary to create a driver which will actually be loaded by the device manager. It gives a simple starting point for developing a Stream Interface driver. Windows CE: Stream Interface Driver, DllEntry() A short post about what the DllEntry() function does in a device driver. Windows CE: Stream Interface Driver, XXX_Init() A discussion of what can and should be done by the driver XXX_Init() ......

Posted On Wednesday, August 13, 2008 10:02 PM

Windows CE: Stream Interface Driver Power Management
The DriverShell source code can be downloaded from: Download DriverShell Source Code Windows CE runs on many battery powered devices and therefore needs to be able to minimize the power consumption to maximize battery life. To do this Windows CE has a power manager that can be used to notify device drivers when the system power state changes. Drivers can then respond to the notification by powering down the hardware that they manage. Basic Power Management The most basic power handling that a driver ......

Posted On Wednesday, August 13, 2008 9:05 PM | Comments (9)

Platform Builder: Getting the Emulator to Resume
Maybe someone knows a better way to get the device emulator to suspend and resume, but since that wasn't my end goal this is a story of what I did to get the emulator to resume. I am sitting in a hotel room with nothing much to do so I thought it would be a good time to add power management capabilities to my Windows CE: A Stream Interface Driver Shell. I brought a device with me, and I have everything I need to use it, except a cable to connect to the serial debug port which I need. So since I already ......

Posted On Monday, August 11, 2008 10:54 PM | Comments (0)

Platform Builder: My Stream Interface Driver Does Not Load
You just created a new Stream Interface driver, but it isn’t being loaded. I hear this a lot and thought it would be good to look into the possible causes. Hopefully, if you are here you have already reviewed Windows CE: A Stream Interface Driver Shell which provides a very basic driver an all of code and other files to demonstrate a driver that actually loads. The first things to check: 1. Is the driver in you OS image? Check to see that it is in %_FLATRELEASEDIR%\ce.bib. 2. Do all of the functions ......

Posted On Friday, August 8, 2008 1:07 PM | Comments (8)

Windows CE: Stream Interface Driver, XXX_Init()
In the DriverShell Example that I posted (Windows CE: A Stream Interface Driver Shell), I included an XXX_Init() function that didn’t do very much. This post will discuss the things that you can do with XXX_Init(). For reference, this is the function as I originally posted it. DWORD XXX_Init(LPCTSTR RegistryPath, DWORD dwBusContect) { HKEY hKey; RETAILMSG( 1, (TEXT("XXX_Init\n"))); hKey = OpenDeviceKey(RegistryPath); if ( !hKey ) { RETAILMSG(1, (TEXT("Failed to open devkeypath,\r\n"))); } else { ......

Posted On Thursday, August 7, 2008 9:56 PM | Comments (6)

Windows CE: Number of Processes and Threads
Once in a while I am asked how many processes can run at any time in a Windows CE system. It is also one of my interview questions when interviewing a candidate with Windows CE experience, and the follow on question is how many threads can run at one time? Number of Processes: Then number of processes is controlled by the kernel and was changed for Windows CE 6.0 to be 32K processes. Pretty impressive, but I suspect that the limit is much smaller because on most, if not all, Windows CE systems you ......

Posted On Wednesday, August 6, 2008 10:37 PM | Comments (1)

C#: My Picture Frame Application
The Picture Frame source code can be downloaded from: Download the Picture Frame Source Code As promised here is the source code for my Picture Frame application. For a desciption of how I wrote this see Why this C/C++ programmer struggled with writing a simple C# application This application runs full screen, although I haven’t spent any time or thought into hiding the task bar since I run it without the Explorer shell. It then displays JPEG or BMP files found in the root folder of either \Storage ......

Posted On Wednesday, August 6, 2008 9:24 PM | Comments (0)

Why this C/C++ programmer struggled with writing a simple C# application
As a developer of single board computers, we at Eurotech Inc, have some single board computers lying around the office, and a few LCD panels. I thought that it might be fun to put one to use as an electronic picture frame. My goal is to hang it on the wall to show picture of some of the work that we do. This is also an opportunity to work on my C# skills. I am not an application developer, so of course I am no expert on the .NET Compact Framework or C#. I have been working with C# to maintain an ......

Posted On Tuesday, August 5, 2008 10:49 PM | Comments (4)

Windows CE: Why is reading from the driver so slow?
I was working with a customer today and discovered that their application was calling into one of my drivers repeatedly to read 4 bytes at a time, each time reading the next 4 bytes of data. The driver reads a minimum of 4 bytes, or they probably would have read less, but the driver is capable of reading large quantities of data on each call from the application. This really isn’t all that uncommon though and it actually will read the data correctly. The problem is that each call to the driver has ......

Posted On Tuesday, August 5, 2008 8:41 PM | Comments (6)

Platform Builder: Sources Files
Earlier I posted about dirs files and stated that dirs files are the direction signs for build.exe. Sources files are the destinations. When build.exe finds a sources file, it stops and runs nmake to build the source code in the directory. Sources files set environment variables that are then used by nmake when interpreting the makefile. Of course if you have looked at the makefiles, you see that they typically only include the makefile.def in Public\Common\Oak\Misc. Setting variables in a sources ......

Posted On Monday, August 4, 2008 8:48 PM | Comments (9)