July 2008 Entries

Platform Builder: Windows CE 6.0 Development Certification
Some of you have noticed that I have passed the Windows Embedded CE 6.0 Development exam and therefor am a Microsoft Certified Technology Specialist. As a result, I have received requests for information about the exam. I cannot tell you any more details about the exam than Microsoft publicly publishes about the exam. Why can't I tell you anything more? For two reasons; as a condition of taking he exam you will be required to sign an NDA, and well I can't tell you the other reason because that is ......

Posted On Thursday, July 31, 2008 12:14 AM | Comments (2)

Platform Builder: RETAILMSG vs. DEBUGMSG
What is the difference between RETAILMSG and DEBUGMSG? This question comes up once in a while, so I thought it might be interesting to discuss it. The first thing that we should think about is what are these? The first clue, assuming that we don’t read the documentation, is that they are both in all capital letters. This is usually a clue that they are macros. If they are macros, they cannot be hidden away in a binary, they must be in a header file that we can look at to figure out what they do. ......

Posted On Wednesday, July 23, 2008 10:33 PM | Comments (4)

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)

Profile: Software Development Tools
I am not all that fancy, as you will see, with the development tools that I use. I keep it simple, but use the tools that make me productive. The following are the tools that I use in order of importance for me: Examine32 – a graphical tool that works like grep. This tool enhances grep by allowing me to click on the results and open files. I find that the results that I get are much better than the results from using Visual Studio or Windows Explorer to search for strings inside files. (www.examine32.com) ......

Posted On Friday, July 18, 2008 12:51 PM

Platform Builder: Dirs Files
Dirs files are the direction signs for building your platform. They show the way for build.exe to find your code to build it. Dirs files are probably the best named files in the build system because what they do is tell build.exe which sub directories to descend into to build. If you have looked around at the files in your platform, then you probably are familiar with the basic form of a dirs file, here is an example: DIRS=\ Serial \ USB \ Wave This dirs file tells build to descend into three folders; ......

Posted On Wednesday, July 16, 2008 9:31 PM | Comments (4)

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)

Platform Builder: Formatting Output with DEBUGMSG and RETAILMSG
For those of you who have done a lot of output using printf the following will be familiar, but I think that there are a lot of programmers who have done most of their user interface code with a GUI. I have been getting questions about the format string in DEBUGMSG and RETAILMSG lately. I will not try to be the full documentation on format strings, but I thought that I would explain a few things about the format string that can be useful. You may have seen some of my examples using %s, %8s and %-*s ......

Posted On Monday, July 14, 2008 10:00 PM | Comments (2)

Windows CE: Loading a Driver with ActivateDeviceEx
In my post about a basic driver shell, I assumed that the driver was built into the system including the registry settings to cause the device manager to load the driver when the system booted. Sometimes there is a reason to load a driver when an application starts. For that there are several functions that can be used including; RegisterDevice, ActivateDevice and ActivateDeviceEx. RegisterDevice is maintained for backward compatibility, but for future compatibility you probably should start using ......

Posted On Monday, July 14, 2008 9:16 PM | Comments (28)

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: Using STR Files
One way to customize your project configuration files is to use string replacement with STR files. Technically, the STR files are for language localization, but that doesn’t exclude using them for customization. In fact, when you create a new project using Platform Builder for Windows CE 6.0, your project will contain a cebase.str for you to set your device name in. STR files are plain text files stored in your FILES\INTLTRNS\<Local> folder. If you aren’t sure which folder you are using, open ......

Posted On Tuesday, July 8, 2008 8:22 PM | Comments (0)

Windows CE: Stream Interface Driver, DllEntry()
Previously, I introduce a Stream Interface Driver that was just a shell of a driver or a driver that didn’t do anything useful. I thought that it would be good to flesh it out a little and add some code to demonstrate some driver features that are fairly common. To get started, let’s flesh out the first function that gets called when the driver loads; DllEntry(). DllEntry() is typically fairly basic, but does some important things. First, I will fill in the function, and then I will discuss what ......

Posted On Monday, July 7, 2008 10:00 PM | Comments (15)

Platform Builder: Internal File Systems
Windows CE stores data in RAM using an Internal Files System called the Object Store. The Object Store stores blobs of data. The blobs of data can be files, like a database or document, or the blob can be your thread’s heap or stack. Since the Object Store is in RAM, if power is lost to the device that data will be lost. That includes the files that you so carefully created in RAM. In the Platform Builder Catalog, you can choose the way the Internal File System works. The options that you have for ......

Posted On Thursday, July 3, 2008 12:48 PM | Comments (3)

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)

Platform Builder: Clone Public Code
I recently wrote an article about modifying the behavior of KernelIoControl when called by User Mode code. In that article, I stated that you need to clone the Public oemioctl code to your platform. Sounds so simple doesn’t it, and really it isn’t that difficult if you know what you are doing, but for the rest of you I thought that I would walk through the process of cloning code. Many of us use the term “clone code” but what does it really mean? Cloning code means to copy the code to another build ......

Posted On Wednesday, July 2, 2008 2:32 PM | Comments (29)

Windows CE 6.0: User Mode KernelIoControl
Windows CE 6.0 introduces some new security features including new meaning for User Mode and Kernel Mode. Loosely speaking, Kernel Mode has access to the system’s resources and User Mode is greatly restricted. One of the new restrictions on User Mode code is that calls to KernelIoControl are limited to the following OEMIoControl IOCTLs: IOCTL_HAL_GET_CACHE_INFO IOCTL_HAL_GET_DEVICE_INFO IOCTL_HAL_GET_DEVICEID IOCTL_HAL_GET_UUID IOCTL_PROCESSOR_INFORMATION As an OEM you can change this to allow access ......

Posted On Tuesday, July 1, 2008 2:21 AM | Comments (5)