When Things Go Wrong

A collection of post about what to do when things go wrong
Windows CE: SDK Doesn’t Show up in Visual Studio 2008
A customer recently contacted me because after installing an SDK it didn’t show up in Visual Studio 2008. So being a good vendor I installed VS2008 and then installed the SDK – no problem the SDK showed up and I could create projects based on it. I let the customer know that the SDK definitely works with VS2008. The customer got back to me and asked what OS I was using. Hmm, how could that play into this? I told him that I use Windows XP, and it turned out that he is way more modern than I am and ......

Posted On Wednesday, April 7, 2010 8:22 PM | Comments (7)

Platform Builder: Target Processor 'Armv4I' not Installed
Platform Builder: Target Processor 'Armv4I' not Installed Recently a poster to the Platform Builder newsgroup posted an interesting solution to a not so uncommon problem when installing QFEs. The problem is that the error message “Target processor 'Armv4I' not installed” and the install stops. This happens even though ARMV41 is actually installed. I have seen this problem myself, although not recently, and have always been able to solve it by deleting C:\Windows\WinCEPB60.ini (change the number to ......

Posted On Wednesday, September 16, 2009 8:43 AM | Comments (3)

Windows CE: fatal error LNK1112:
I have seen questions about the Visual Studio error “fatal error LNK1112: module machine type 'THUMB' conflicts with target machine type 'ARM'” quite a bit lately. Tonight it happened to me. I was working on a project that I had targeded against the PocketPC 2003 SDK. Then I added a new SDK, in this case a Windows CE 5.0 ARMV4I SDK, to the project and had it copy settings from the PocketPC 2003 settings. Unfortunatly, not copying the settings makes things worse. Adding the SDK looks like: The problem ......

Posted On Thursday, July 30, 2009 9:32 PM | Comments (1)

Platform Builder: makeimg: FATAL ERROR: Out of buffer space
Here is an interesting makeimg error: makeimg: FATAL ERROR: Out of buffer space. Seems that if the folder path for the _FLATRELEASEDIR is too long, makeimg fails with this cryptic error. I to reproduce this error I changed my release folder from: C:\WINCE500\PBWorkspaces\xx... \xxxxxxxx_ARMV4I_Release To C:\WINCE500\PBWorkspaces\xx... And it failed. Notice the two folders named FolderWithLongNameToTryToCa... ......

Posted On Wednesday, June 17, 2009 10:18 PM | Comments (0)

Platform Builder: error C2065: 'dpCurSettings' : undeclared identifier
So you build your BSP and it fails with an error like: C2065: 'dpCurSettings' : undeclared identifier Or C2065: 'ZONE_INIT' : undeclared identifier The easy answer is that you haven’t declared the variables, but the last time you built the BSP it built okay, so how could it be that all of a sudden there are undeclared variables? The most likely reason is that you are building a debug build and you had previously been building a retail or release build. The difference is explained in Platform Builder: ......

Posted On Tuesday, June 9, 2009 6:58 PM | Comments (2)

Platform Builder: Buildrel and Hard Links
There was an interesting newsgroup post this week that I thought I would take some time to discuss. The question went something like this: I have ONE BSP for my board and I build several OSDesign projects against it. When I switch between OSDesigns and run makeimg it fails with the following message “Error: Mismatched time stamp on .rel file for module nk.exe” When I first read it, I was stumped. This is not an uncommon activity for me. I switch between projects that build against the same BSP often ......

Posted On Friday, June 5, 2009 4:48 PM | Comments (2)

Platform Builder: cl : Command line error D2004 : '/I' requires an argument
An engineer that I work with had the error “cl : Command line error D2004 : '/I' requires an argument” this week. He had copied a folder from a project that we received from third party and was working on integrating it into one of our projects, so he wasn’t familiar with the contents of the folder. If you are actually working on making changes to the project, this error is probably easier to figure out. The first hint at what the problem is and where to look for it is the two words, “Command line”. ......

Posted On Saturday, May 30, 2009 11:03 AM | Comments (0)

Platform Builder: Problems with .NET CF 3.5 and Windows CE 6.0
A customer contacted me a few weeks ago to tell me that their managed code application failed when running on Windows CE 6.0 with the .NET CompactFramework 3.5. It ran fine on Windows CE 5.0 with .NET CF 3.5 and on Windows CE 6.0 with .NET CF 2.0. The problem was really odd because it showed up in different ways, but usually there was an error message similar to: File or assembly name 'System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=3BE235DF1C8D... or one of its dependencies, ......

Posted On Friday, May 15, 2009 10:06 PM | Comments (5)

Platform Builder: Analyzing Build Result Deltas
After building your project, you find that the results are different from a previous build, or a build on a different computer. That can be disturbing, so you need to understand why the two results are different. The following are some things to look at: 1. First step should be to verify the source code is the same. 2. Check that the same QFEs are installed 3. Check the environment variables Open a build window, enter “set > Environement.txt” or any filename. Then diff the files between two build ......

Posted On Thursday, April 9, 2009 7:57 PM | Comments (1)

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)

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)

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)

Platform Builder: Cannot open include file: 'windows.h': No such file or directory
The following is unique to Platform Builder, and applies to any version. The problem is that when building a driver, BSP or sub-project, the compiler fails with the error message “Cannot open include file: 'windows.h': No such file or directory.” There are probably many ways to cause this error. Many of these are simple user error, like accidently deleting or moving windows.h. But let’s focus on the most likely problems that can cause this. 1. The most common cause that I have run into is that the ......

Posted On Friday, January 23, 2009 12:23 PM | Comments (0)

Windows CE: Finding an Out of Control Thread
Last week I was working on a system would stop responding to the user after many hours of running. All we knew was that the CPU was still running software, and we only knew that because RAM was still being accessed. The other thing we knew was that the customer was not happy and we needed to learn more and fast. To make it more interesting, the problem was occurring on systems that we could not use traditional tools to work on. These systems were not sitting in a cozy office, heck we didn’t even ......

Posted On Wednesday, January 21, 2009 10:54 PM | Comments (21)

Platform Builder: Error: Ram Start Overlaps ROM Binary
In embedded systems, like Windows CE, it is possible to have more bytes in the Operating System (OS) than there is space to store the OS on the device. It is also possible to have more bytes in the OS than you have allocated for saving the OS on the device. The first could be a bigger problem than the second. The Board Support Package (BSP) contains a file that allocates space for the OS. The file is config.bib (for more on config.bib see Platform Builder: Config.bib.) The space for the OS is allocated ......

Posted On Thursday, January 1, 2009 8:25 PM | Comments (0)

Windows CE: LoadLibrary Fails with Error Code 193
Your app is trying to load a DLL either explicitly by calling LoadLibrary or implicitly by linking with the associated static linked library and it fails with error code 193, "The specified module could not be found" or a message that indicates that the app isn't a Windows CE application. The possible causes of this are: The dll isn't a built for Windows CE This happens when taking a dll from Big Windows (NT, XP, Vista) and trying to use it on a Windows CE device. The dll isn't built for the processor ......

Posted On Tuesday, December 23, 2008 7:11 PM | Comments (7)

Platform Builder 6.0: Project Creation Failed
I received an interesting question from an Engineer today. It read like this: "I have an issue that has cropped up with using Platform Builder 6.0. I installed a newer version of a CE BSP on my system and now Platform Builder will not open my old project nor create a new one. When creating a new project I get an error message on the status bar that only says “…project creation failed”. If I restore the old BSP I can create new projects so I think the problem is somehow related to the new BSP. " So ......

Posted On Wednesday, November 19, 2008 5:00 PM | Comments (3)

Platform Builder: Bluetooth Component Inconsistencies
Subtitle: Why adding Bluetooth Stack with USB doesn’t always add Bluetooth USB Argh, one of my junior engineers just gleefully exclaimed to me “Anyway, I WIN! :-)” Now that just burns, but I take comfort in the fact that she got lucky. We were both adding Bluetooth support to different workspaces that supported the same board. My project finished building before hers so I asked her to test my project. The USB Dongle that she was using didn’t work with my OS image; it popped up the little dialog asking ......

Posted On Thursday, November 6, 2008 5:10 PM | Comments (4)

Windows CE: The Case of the Missed Interrupt
I was recently working on an interrupt that was asserted, but the system didn’t respond by handling the interrupt. The interrupt that wasn’t being handled came from a CPLD into a GPIO pin. The CPLD asserts the interrupt in response to several external events. I thought that this would make a good example of what not to do in an ISR. If only one of the external events was triggering, then the interrupt seemed to work well. If more than one triggered, not necessarily at the same time, then eventually ......

Posted On Thursday, November 6, 2008 1:49 PM | Comments (2)

Windows CE: Closing Invalid Handles
I pulled some old source code off the shelf recently, dusted it off and started modifying it. Okay, that was my first mistake… I really should have tested it first but that actually would not have helped this time. When the system booted up, it successfully loaded drivers and then when it came to loading Explorer.exe all heck broke loose. Sometime the desktop would appear and other times it would not. When the desktop would appear, GWES would data abort. The system was a mess, and needed to be fixed. ......

Posted On Thursday, October 23, 2008 12:59 PM | Comments (0)

Platform Builder: Debugging the Boot Hive
One of my engineers was working on a new system today and was having a problem setting up a NAND flash disk. The problem was that while he had made a change to the registry to set up the start address and size of the disk, the changes just were not visible in when the OS ran. We both have a lot of experience developing and building Windows CE systems, so we checked the obvious things: 1. He saved Platform.reg where he made the changes 2. He copied Platform.reg to the _FLATRELEASEDIR 3. When makeimg ......

Posted On Monday, October 13, 2008 10:00 PM | Comments (3)

Platform Builder: Data Misalignment
I ran into a problem today with data misalignment. The problem would have taken a lot of time to find if I wasn’t already familiar with the problem (kicking myself now.) I was porting an existing driver into an old platform to update the platform. So I know that the driver works, but when it started it would data abort. This particular driver is quite large and complex, so a simple read of the code would not be possible in a reasonable amount of time. I have some experience with tracking the cause ......

Posted On Wednesday, September 3, 2008 4:04 PM | Comments (2)

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: 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: Changing Memory Divisions Causes the System to Fail
So your system is running well, and then someone decides to change the memory divisions using the System Control Panel Applet and BAM something in your system data aborts. This can be difficult to solve, if you don’t have any idea what the cause is, and a challenge even if you do know. If you follow the data abort back to the code that failed (Windows CE: Finding the cause of a Data Abort) you will find yourself confused because the code there most likely did not cause the data abort, but instead ......

Posted On Wednesday, July 23, 2008 8:23 PM | Comments (0)

Platform Builder: IXP46x, 128 MB RAM, CEBaseCESysgen.bat - System Fails to Boot
It has been another one of those days. Several months ago we discovered that one of our systems wouldn’t boot if we did a clean build, but if we built the kernel separately and then ran makeimg the system would boot. What a mystery, that just didn’t make any sense. So, the engineer on the project modified PreMakeimg.bat to rebuild the kernel when we run makeimg. All was good, but this increases build time. If you have followed this blog, you know that I don’t like long build times but we all tolerated ......

Posted On Tuesday, July 22, 2008 9:02 PM | Comments (2)

Platform Builder: Interpreting GetLastError()
When Win32 API functions fail it is possible to learn more about the cause of the error by calling GetLastError(). GetLastError() returns an error number that is set by the API by calling SetLastError(). It is important to read the documentation before using GetLastError() to ensure that the API actually sets a error, if it doesn’t GetLastError() will happily return an error number set by a different function call. Of course the next step is to figure out what that number means. It is important to ......

Posted On Monday, July 14, 2008 11:11 PM | Comments (0)

Windows CE 6.0: VMProcessPageFault Error: Page Fault during Resume
When we first ported our BSP to Windows CE 6.0 we started to see this VMProcessPageFault Error: Page Fault message in our debug output during resume from sleep. The system seemed to be working okay, but this message seemed ominous so as we continued to work on the port we kept an eye on the problem and investigated the possible cause of the message. Others had reported this message and they discovered the cause was that they had a driver that was calling a system API in XXX_PowerUp. Microsoft has ......

Posted On Wednesday, July 9, 2008 10:27 PM | Comments (3)

Summary of When Things Go Wrong
· Windows CE: Finding the cause of a Data Abort How to find the line of code that caused the data abort. · Platform Builder: Find the Source of a Data Abort; an Example An example of finding the source of a data abort · Windows CE: Prefetch Aborts, why they are difficult to locate A discussion of the causes of prefetch aborts · Platform Builder: Why can’t I call the Function in my DLL? A discussion of why functions might not be accessible outside of your dll · Platform Builder: It Worked in Debug, ......

Posted On Tuesday, July 8, 2008 10:21 PM

Platform Builder: Your Changes aren’t in the OS Image
Another engineer just called me for help to figure out why her changes to a dll were not reflected in the nk.bin. I have always found this to a user error problem and started to list the causes that I could think of, but in the end she found a new one. Causes that we came up with are listed below. You may know of others, if you do please share those with us in a comment. · You didn’t build your code before running makeimg · The build failed, but you didn’t notice and ran makeimg anyway · You didn’t ......

Posted On Wednesday, July 2, 2008 2:33 PM | Comments (3)

Windows CE: volatile and PBYTE, PDWORD…
Microsoft has been nice enough to supply us with many typedefs that we can use when writing code that should simplify development, especially when our code may be used to target different Microsoft OSs. On the other hand, these typedefs can also cause problems for us when using them to write device drivers. The typedefs that can cause problems are the ones that are pointers, like PBYTE, PDWORD… The reason that they can cause problems is that modifiers like volatile don’t modify in the way that we ......

Posted On Monday, June 30, 2008 10:10 AM | Comments (3)

Platform Builder: It Worked in Debug, but doesn’t in Release
A common problem that developers run into is that when they change the build from debug to release, their application or dll no longer works, or doesn’t run at all. Here are some of the causes that I can think of: 1. The application or driver wasn’t actually in the OS image. This happens a lot because of a handy feature of KITL and the CEShell, which is the Release folder. The Release folder is a folder on the device which is linked to the _FLATRELEASEDIR on your development workstation. When a dll ......

Posted On Friday, June 27, 2008 5:35 PM | Comments (3)

Platform Builder: Don’t use Build and Sysgen
Ever since the release of Platform Builder for Windows CE 5.0, there has been an item in the Build OS menu labeled “Build and Sysgen” which causes problems for developers. I believe that this item is very useful for Microsoft’s Software Engineers, but it causes problems for the rest of us. The problem is that Build and Sysgen, especially with the Clean Before Building set, will delete binary files that you don’t have the source to rebuild. Once you have run Build and Sysgen and discover that it created ......

Posted On Thursday, June 19, 2008 12:56 PM | Comments (1)

Platform Builder: Build error “Bad database entry:”
I clicked on the wrong thing this evening while creating a new file using Windows Explorer. Instead I created a new folder with the default name of “New Folder”. Not giving it any thought, I just left the folder where it was. This created an error when I built the code that I was working on. The error was: BUILD: [00:0000000004:ERRORI] Bad database entry: New Folder\ 40000 10 0. This clearly told me that New Folder was creating a problem, and experience tells me that the problem is because there ......

Posted On Tuesday, June 17, 2008 10:49 PM | Comments (0)

Platform Builder: Why can’t I call the Function in my DLL?
So you added a function to your dll, but your application can’t call the function. This can happen for several reasons: You didn’t build the your source code This is sort of the “did you plug in the device?” kind of question, but worth checking. This can include are you building the right directory? I have been know to work in a folder on someone else’s computer by mistake, but only after working remotely with someone else and looking at files on their computer. You didn’t put the new version of ......

Posted On Friday, June 13, 2008 2:20 PM | Comments (2)

Platform Builder: When to do a clean build?
The rule of thumb, and this applies to any OS and compiler, when using make (or nmake) is that if you change a file that is being built then you can generally just build. But if you are changing something that make doesn't do a dependency check on, like a makefile or an environment variable, then you need to do a clean build. The reason is that make does dependency checks based on file timestamps to decide what to rebuild. Changing environment variables does not change timestamps. Selecting different ......

Posted On Tuesday, June 3, 2008 3:59 PM | Comments (0)

Platform Builder: Find the Source of a Data Abort; an Example
Previously I posted instructions for finding the source of a data abort, see Windows CE: Finding the cause of a Data Abort. This will walk through those steps to find the source in a real application for. This is specific to Windows CE and later. I have this data abort: AKY=00000005 PC=02c138ac(lan91c111.dll+0... RA=02c138a8(lan91c111.dll+0... BVA=06000000 FSR=00000007 From this, I can see that it is in lan91c111.dll. Lan91c111.dll is my Ethernet driver. I was just making changes to ......

Posted On Monday, June 2, 2008 5:56 PM | Comments (20)

Windows CE: Prefetch Aborts, why they are difficult to locate
Prefetch aborts can be difficult to locate and fix. To understand why, we first need to understand what a prefetch abort is. A prefetch abort occurs when the CPU runs out of instructions in its pipeline. But that can also mean that a zero instruction is in the pipeline. Possible causes of prefetch aborts: The CPU really can't get instructions to run. This could indicate a hardware problem. An uninitialized function pointer. I have seen this used as a way to indicate a problem, although I can think ......

Posted On Friday, May 23, 2008 6:15 PM | Comments (20)

Windows CE: Finding the cause of a Data Abort
For Windows CE 5.0 and 6.0 looking up the instructions that caused the Data Abort is easier than in previous versions. The module name and offset are included in the Data Abort output. Take the following case: Exception 'Data Abort' (4): Thread-Id=00df0002(pth=87e3... Proc- Id=00400002(pprc=81118308) 'NK.EXE', VM-active=015f0002(pprc=87e... 'udevice.exe' PC=c098704c(usbfn.dll+0x000... RA=c09880b0(usbfn.dll+0x000... SP=d03ce2d8, BVA=00000000 This output gives us some valuable information ......

Posted On Monday, May 19, 2008 9:43 PM | Comments (10)

Windows CE: Why does my system halt for 20 minutes?
I don't know how many systems are affected by this problem, but apparently there are still some. I do know that the reference BSP for the Intel PXA25x processor boards has a problem. This problem is still biting people because there have recently been questions about it in the Platform Builder newsgroup. The cause is really quite simple. A shared resource with nothing to protect it from interrupts during read-modify-write operations. In this case, there are two sets of code that access the time match ......

Posted On Monday, May 12, 2008 6:26 PM | Comments (0)