March 2009 Entries

Windows CE: What is a Bootloader?
A bootloader is a small program that handles the reset vector and starts up a system. Bootloaders are not all equal, so writing about them is difficult to do without discussing the optional things that a bootloader might do. The only reasons to have a bootloader is to provide a mechanism for updating the software on a device or to retrieve the OS from some storage medium and move it to RAM to run which are the “loader” parts of the bootloader. Anything else that a bootloader might do are optional. ......

Posted On Monday, March 30, 2009 8:50 PM | Comments (4)

Windows CE: How to Break a System with Two Lines of Code
I was recently working on a driver that would fail to work about 50% of the time when the system booted. The driver used to work, and it hadn’t been changed. I started reviewing the change log for the entire BSP, not too many changes to existing files and a few new drivers were added. None of the changes looked like they could affect the problem, or at least not when I was reviewing the code quickly. After some work, I decided to probe the reset line to the chip that the driver controlled. To my ......

Posted On Tuesday, March 24, 2009 12:50 PM | Comments (0)

Windows CE: ERROR: function @ Ordinal 342 missing
You try to run your application on a new Windows CE device for the first time and BAM you get hit with the following debug output: ERROR: function @ Ordinal 342 missing !!! Please Check your SYSGEN variable !!! So you are wondering what that means. Ordinal? SYSGEN variable? Sounds ominous doesn’t it? The first line says that the function at ordinal 342 is missing. What that means is that a function that your application or DLL plans to call is missing from the OS. If you are new to Windows CE, it ......

Posted On Monday, March 23, 2009 9:27 PM | Comments (0)

Windows CE: Determining if an API is Available
Many Windows CE systems are kiosk type devices, where the Software running on the systems starts when the system boots. This causes a new problem for some software developers: the API may not be ready to be used when the software starts. To add to the fun, not all Windows CE systems are equal so some APIs may never become available. Early versions of Windows CE provide a simple method to determine if an API is available, the function IsAPIReady(). IsAPIReady() is a handy method to determine if an ......

Posted On Sunday, March 22, 2009 10:34 PM | Comments (2)

Windows CE: Accessing a Stream Interface Driver from an Application
This week I was asked how to access a stream interface driver from an application. The request came from someone who was trying to call the XXX_Open, XXX_Write… functions directly from his application. By directly, I mean using LoadLibrary() and GetProcAddress(). Let’s start with stating that calling the functions directly is not the way to call the functions in a driver. In fact, a Windows CE 6.0 kernel driver cannot be accessed at all by applications directly. Let us think about that for a moment ......

Posted On Saturday, March 21, 2009 9:53 PM | Comments (3)

Platform Builder: error C2220: warning treated as error - no 'object' file generated
The error message “C2220: warning treated as error - no 'object' file generated” is output when the compiler option -WX is enabled and the code being compiled has a warning. When building with Platform Builder, the –WX compiler option is added when the environment variable WARNISERROR is set. WARNISERROR is a handy environment variable for managing compiler warnings. With WARNISERROR set, warnings will cause the build to fail and therefore causes Software Engineers to clean up their code. The error ......

Posted On Saturday, March 21, 2009 6:15 PM | Comments (2)

“Crash” is not a Technical Term
I receive emails and read newsgroup posts where the author talks about a “crash”, “lockup”, “hang”… as if the reader should know what those terms mean. Let me tell you that in almost all cases these terms are well defined to the author, but have no meaning to the reader. Why is that? It is because there is no technical definition of any of those terms. Ask a dozen engineers what crash means, and I would be willing to bet that you will hear many definitions. Some of them might even be in the context ......

Posted On Friday, March 20, 2009 1:01 PM | Comments (0)

Platform Builder: Where to set Environment Variables
Quite often someone will ask where to set an environment variable for their Platform Builder project. That is really a difficult question to answer without knowing a lot about the project, the BSP and the environment variable. So I thought that I would look into the many ways that an environment variable can be set. My hope is that with an understanding of how to set environment variables that choosing the best way will be easier. The following are ways that I can think of to set environment variables, ......

Posted On Monday, March 16, 2009 10:36 PM | Comments (0)

Platform Builder: Catalog Id ":MS:pccard:mainstoneiii" duplicated
It is not unusual to receive the error “Catalog Id ":MS:pccard:mainstoneiii" duplicated” after cloning a Windows CE 6.0 BSP. Of course the value duplicated may be different depending on which BSP was cloned. NOTE: If you haven’t checked for errors, you should be sure to view the Error List. To do this, select View\Other Windows\Error List then select the Error button. The reason for the message is that the catalog file contains the same entries as the original BSP. It is important to update the catalog ......

Posted On Monday, March 16, 2009 9:02 PM | Comments (4)

Platform Builder: OEMIoControl: Unsupported Code
There are several KernelIoControl() IOCTLS that are called during boot up that are optional. That is the OEM can choose to implement them or not depending on whether the IOCTLs add value to the system. The problem comes when running a debug build of the kernel. Any KernelIoControl() that is passed to OEMIoControl() and not handled will be noted in the debug output. Example: OEMIoControl: Unsupported Code 0x10100b4 - device 0x0101 func 45 While not specifically outputting that these are error or warning ......

Posted On Friday, March 13, 2009 11:18 PM | Comments (0)

Windows CE: Writing to the Registry and Deleting Registry Keys
I needed to update the registry on many devices in the field this week, so I wrote a little application to delete some registry keys and add some new keys and values. The requirements were simple; take a well defined set of registry keys and values and add them to the registry, takes some well defined registry keys and delete them and make it simple for the user. I started by creating a few data structures that I could use to set up some static data to define the registry changes. RegDelete will ......

Posted On Wednesday, March 11, 2009 9:51 PM | Comments (0)