May 2008 Entries

Platform Builder: Using Environment Variables to Control Macro Definition
It is not uncommon to need to build the same BSP with different projects, or the same driver under different BSPs. Often this means needing to build the code in different ways for different needs. Of course any good C/C++ programmer knows to use macros to control how the code is built, and any good Platform Builder user knows to use environment variables to control the build. The dilemma is how to tie the environment variables together with the macros. Unfortunately this is not automatic, you can't ......

Posted On Friday, May 30, 2008 8:16 PM | Comments (0)

Windows CE 6.0: Exporting a BSP
Ever since Windows Embedded CE 6.0 with Platform Builder shipped, questions about how to export a BSP have arisen. This is because previous versions included an Export BSP wizard. Microsoft included the Export BSP Wizard because importing a BSP required the user to manually load the Catalog File (CEC) into the Platform Builder Catalog. So the wizard helped by eliminating the possibility of user error. The wizard would create an installation file (MSI) that would copy the BSP files to the disk and ......

Posted On Friday, May 30, 2008 1:59 PM | Comments (0)

Platform Builder: Using RES files to modify a Control Panel Applet
Important Update: As was pointed out in the comments, this doesn't always work. I had the opportunity to begin looking into that today when one of our engineers had the same problem, which is that the dialogs don't show up correctly and sometimes not at all. After trying several things, what we now think that we know is that editing the RES files in Visual Studio causes the problem, which means Platform Builder 6.0. Editing the RES files with Platform Builder 5.0 works well. I know that many of you ......

Posted On Wednesday, May 28, 2008 9:56 PM | Comments (7)

Platform Builder: Glossary of Terms
Platform Builder Help will do a more complete job of documenting much of these terms. This is meant to be a quick start glossary of terms, and will fill in some blanks that Help doesn't cover. Platform Builder - The software development tool used for developing a Windows CE system. This tool is typically used by OEMS who create devices like PDAs, Automated Teller Machines (ATM), medical devices and much more. Board Support Package (BSP) - A BSP is a set of files used to support the chips on a board. ......

Posted On Saturday, May 24, 2008 1:12 AM | Comments (0)

Platform Builder: Pulling it all together with Makeimg
The source code is built, the files needed for the OS have been collected in the _FLATRELEASEDIR, so now it is time to create the OS Image or nk.bin. The tool for this is Makeimg.exe. Makeimg uses some other tools to do this including fmerge.exe, res2res.exe and romimage.exe. If I wanted to keep this very simple, I could just tell you to run makeimg from the command line. There are no command line arguments, so this would be done. After running makeimg, you will have the nk.bin that you need for ......

Posted On Friday, May 23, 2008 11:13 PM | Comments (1)

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)

Platform Builder: Using Buildrel
Buildrel is a batch file that populates the _FLATRELEASEDIR. That is, it builds the release directory. It does this by copying files from different folders into one folder. This step is needed because the next build step is makeimg, which uses files in the _FLATRELEASEDIR to create the OS. This is what Buildrel does: Cleans the _FLATRELEASEDIR by deleting all files and sub-folders. This step can be disabled by setting the environment variable ___BLDRELNOCLEAN=1. Creates PBUserProjects files by pulling ......

Posted On Tuesday, May 20, 2008 8:38 AM | Comments (0)

Platform Builder: Using Build.exe
Build.exe is the tool tool that builds a source code tree. Build.exe traverses a source tree by reading DIRS and SOURCES files to find the code that needs to be built. DIRS files indicate the sub-folders that build.exe should move down into to build. Note that the DIRS file can only be used to indicate direct sub-folders, that means it cannot be used to descend multiple sub-folders or to move up in the tree. SOURCES files are the leaves on the tree. When build.exe finds a SOURCES file, it stops and ......

Posted On Monday, May 19, 2008 10:32 PM | Comments (2)

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: Using ToolHelpAPI to get more information about running processes
In earlier posts, I developed a function that uses ToolHelpAPI to list the currently running processes. That was just the beginning of what can be done with the ToolHelpAPI, so in this post I will extend that to create a Process Viewer. The first thing that I will do is modify my Serial Debug Menu to remove the ShowRunningProcesses() call and replace it with a call to a sub-menu named ProcessViewerMenu(). void MainMenu() { TCHAR *MenuStrings[] = { TEXT( "Get Tick Count"), TEXT( "Process Viewer"), ......

Posted On Monday, May 19, 2008 1:04 PM | Comments (0)

Platform Builder: Creating an nk.nb0
Many BSPs include a config.bib that is configured to create an nk.bin, but not an nk.nb0. The nk.bin is handy during development, or for upgrading in the field. But it isn't so useful for programming your board using a JTAG tool. Let's look at what the difference is between the two nk files are and how to create an nk.nb0. An nk.bin is a set of records. Each record includes an address, length and data to be stored at the address. By using these records, the file size can often be reduced which makes ......

Posted On Saturday, May 17, 2008 6:44 PM | Comments (13)

Platform Builder: Using BldDemo
BldDemo is an interesting batch file. I suspect that it was originally created to demonstrate how to build a Windows CE project. Today, it is the used by the Platform Builder IDE to build projects. I don't really use it very often, except through Platform Builder, but it is a good source of information and is useful when I do use it. What is BldDemo? It is a batch file that can be used to build a Windows CE image. It hides the real tools that do the job. You can find it in %_WINCEROOT%\Public\Common\... ......

Posted On Saturday, May 17, 2008 5:43 PM | Comments (10)

Platform Builder: Build Tools, Opening a Build Window
Platform Builder for Windows CE 5.0 and 6.0 allows you to build from the command line and get the same results as building from the IDE. Platform Builder for Windows CE 4.x does not necessarily give the same results, but that depends on what you are doing. The question is, how do we get to a command prompt that has the correct environment set up for us to build? There are a few ways: The most obvious way is to open the "Build OS" menu and select "Open Release Directory". When you do this, a command ......

Posted On Thursday, May 15, 2008 12:05 PM | Comments (4)

Platform Builder: Build Tools Intro
Platform Builder for Windows CE has become a very useful tool for developing a Windows CE platform. It does a lot of things well, but for building it can be slow. The reason is that as an IDE it has an obligation to idiot proof the build process. In doing so, it sometimes does more work than is actually necessary to take your changes and output an OS that you can run. I don't know that I would want it any other way because it makes it easier for new Windows CE developers to get started. If you want ......

Posted On Wednesday, May 14, 2008 8:09 PM | Comments (1)

Windows CE: Using ToolHelpAPI to list running processes
In previous post I constructed a menu driven application for use with the serial debug port. In that I called ShowRunningProcess() which I promised to define later. The following defines that and uses the ToolHelpAPI to get the list of running processes. As I review this, it does look like I need to update it for Windows CE 6.0, I will point out where below. ShowRunningProcesses is simple, but that is only because it calls on other functions to do the work of getting the process list. Since it is ......

Posted On Wednesday, May 14, 2008 5:42 PM | Comments (16)

Windows CE: Bootloader Splash Screen
I am sitting here at my desk experiencing some local network problems and thought I would take this time to discuss creating and using a splash screen in a bootloader. My target OS is Windows CE, but this applies to any code that needs to draw to a display without the use of an OS since this is a bootloader. What is a bootloader splash screen? The bootloader is a small peice of code that runs when the reset vector is processed. This code's primary purpose is the initialize some hardware and look ......

Posted On Wednesday, May 14, 2008 10:50 AM | Comments (4)

Profile of Bruce Eitman

Bruce is Director of the Windows CE Technology Group at EuroTech Inc where he not only manages the Software Engineers, but keeps busy doing engineering. Bruce works out the Akron, OH office and travels frequently to the home office in Columbia, MD.

Posted On Tuesday, May 13, 2008 12:55 AM

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)

Windows CE: Putting some control behind the serial debug menu
Now we have a way to display a menu on the serial debug port and are getting user input to select from the menu. So it is time to actually do something, like put some control behind the menu. I like to start with a main function, in this case WinMain(). I am going to keep it simple, not parsing command line options and just calling MainMenu() which will handle the menu from here. int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ MainMenu();} MainMenu ......

Posted On Monday, May 12, 2008 5:46 PM | Comments (0)

Windows CE: Displaying a simple menu driven app using serial debug
In a previous post, I showed how to read input from the debug serial port on a Windows CE device. As promised then, I will now use that to create a simple menu driven application. When I say simple, I really mean that there are better ways to do it. What I am going to develop here works, but quite frankly it is a little cumbersome to maintain, more on that later. My plan here is to have a generic function that will display the menu and wait for valid user input. It will then return the menu selection ......

Posted On Sunday, May 11, 2008 4:46 PM | Comments (2)

Windows CE: Using the debug serial port for input
I work on a lot of different Windows CE projects. Some of them have a display, while others do not. Sometimes I just have a board laying on my desk with power and a debug serial connection. So I thought it would be handy to have a simple little app that I could use for testing my drivers. Given my constraints, the debug port would be useful for presenting the user interface. Sure I could use a serial driver for this, but would mean using two serial ports, which I don't always have available. Of course ......

Posted On Friday, May 9, 2008 9:39 AM | Comments (5)

Windows CE Platform Builder: Automatically putting files in the SDK during build
So you have created a new DLL that implements a set of APIs. This creates value for your system by adding important functionality. Now you want to add the header files and libraries to your SDK. Of course you can configure your SDK to add the files, but let's add to the requirement. The new DLL is part of your BSP, and your BSP is used by multiple OS designs. Or, like me, you use this same code across multiple BSPs each with multiple OS designs. So, configuring the SDK for each is a manual process, ......

Posted On Thursday, May 8, 2008 10:50 AM | Comments (0)

Using a batch file to automatically build a Windows CE 5.0 and 6.0 project
Automating a build of Windows CE starts with answering the question "How do I set up a command line build?" Of course there are ways to do this that require human intervention, but that doesn't automate very well. There are ways to write code to use Platform Builder itself, but I only know a couple of engineers who have tried that, and they have struggled. The following is a little batch file that will setup a Platform Builder 5.0 build environment and build the project: @ECHO on set __PROJECTNAME__=MyWorkspace ......

Posted On Wednesday, May 7, 2008 2:38 PM | Comments (27)