Windows CE 5.0 – Include some files in the O/S


This question has come up a number of times recently – You’ve built your Windows CE 5.0 operating system, you’ve written the worlds coolest Windows CE application in eMbedded Visual C++ or Visual Studio .NET 2003 and now want to include the applicaiton and a bunch of support files into the final operating system image – but how to make this happen ?


There are a number of steps needed to add a new file or application to the operating system.


First, the file(s) need to be in your _FLATRELEASEDIR, this is the build release directory – typically C:\Wince500\PBWorkspaces\<Your_Workspace>\RelDir\ – you would normally expect to find a Debug and Release subfolder here – so you need some way to copy your files into this folder.


Second, you *may* have registry information associated with your application or driver, so you need to be able to add your own .REG file or modify the existing project.reg


Next, you might want to have specific O/S dependencies for your application – what if your application is a C# .NET Compact Framework application, in this case you would want to set dependencies on SYSGEN_DOTNET – and possibly other O/S dependencies – you could add these dependencies through the Platform | Setitngs menu option, but this would set the dependencies for this build of the O/S – if you generate another platform that also included this application then you would also need to remember to set the environment variables for the new platform.


And what about setting the startup location of the application – by default all application binaries for the O/S are in the \windows folder, you might want to auto-start your application at boot time, in this case you can either add a [HKLM\Init] key to the registry or map the application to the \Windows\Startup folder – and this needs modifications to a .DAT file.


So, right now you need to modify .BIB, .REG, .DAT files, set SYSGEN dependencies through Platform | Settings, and also somehow copy your applicaiton and support files to the _FLATRELEASEDIR – sounds like a ton of work to accomplish what would appear to be a simple task, right ?


Wouldn’t it be SO much easier to have an ‘atomic’ stand-alone component that contained it’s own BIB, REG, DAT, DB files, that also contained the set of O/S dependencies needed on the O/S, and lived in the catalog so it was portable between operating system platforms ? (and could be shared with other developers). You Bet !


As mentioned earlier, I had a number of questions about adding an application to a Windows CE 5.0 O/S image that I decided to write an FAQ around this process – I got about 30 minutes into the process and then decided to give up ! – Was this because I’d not had my Grande Vanilla Latte for the day ? – no, it’s because I decided the best way to do would be to create a tool that makes this process simple.


Introducing CEFileWiz – a “Skunk” development project that will hopefully save you a ton of time when adding files or applications to a Windows CE 5.0 O/S image.


Here’s how the UI looks…



Simply add your files (notice how the application will automatically show the files/applications in FILES or MODULES sections) – Also note how, when you add a .NET Compact Framework application that the application is added to the FILES section – this is needed for the .NET Compact Framework application to run correctly on the Windows CE device.



That’s the files added to the “component” – what about setting dependencies on the O/S ? – simple, click the “Add SYSGEN’s” button and start adding SYSGEN variables – what ? – you don’t know what the SYSGEN is that you need ? – go take a look at the catalog in Platform Builder – right click on a component and hit the SYSGEN tab – here’s the SYSGEN information for the .NET Compact Framework



The CEFileWiz application detects that an application is .NET Compact Framework and automatically adds the appropriate SYSGEN’s to the project, like so – you can see that SYSGEN_DOTNET, DOTNET_SUPPORT, and VS_SD_AUTH (the Visual Studio .NET 2003 Smart Device Authentication Utilities) have all been added to the project – you can also add your own SYSGEN’s to the project, for example adding SYSGEN_HTTPD would add the HTTP Web Server to your O/S image.



So, that leaves three items to complete.


Component Name – This is the, errr, ummm, name of the component as you want it to appear in the Windows CE 5.0 Catalog.


Platform – Select the Windows CE 5.0 Platform you want to add this project folder to


Device Folder – Where you want the files to be mapped in the O/S image (by default this is the \Windows folder) – if you want your application in the \Windows\Startup Folder then simply change the text to be \Windows\Startup – the project will create any folders that don’t exist in the O/S image.



and now, hit Build… That’s it ! – your component is now created… Here’s how the output folder looks.



Notice the list of files that have been created in the output folder.


Foo.bib – the files to be added to the O/S image
Foo.cec – the .CEC file to be added to Platform Builder
Foo.dat – Folders to be created in the O/S
Foo.db – Database (normally empty)
Foo.pbpxml – the workspace file (pointed to by the .CEC file)
Foo.reg – the registry file (add your custom registry information here)
makefile – Makefile
postlink.bat – This batch file is called in the build process and copies all the files in this component to the _FLATRELEASEDIR
prelink.bat – Empty (dummy) batch file
projsysgen.bat – the projsysgen.bat file adds the O/S dependencies to the O/S (through the SYSGEN variables)
readme.txt – a list of what’s been added to this component.
sources – makefile for the component


All we need to do now is add the .CEC file that’s been created to Platform Builder – in Platform builder, go to File | Manage Catalog Items, add the .CEC file you’ve just created, then, under Third Party Components either drag your new component over to your platform workspace or right click and “add”.


Now build your platform – that’s it ! – A couple of clicks, add some dependency information and you’re all set to have a stand-alone component that exposes it’s own set of registry information, folders, BIB, etc…


Let me know if this tool is at all useful…


– Mike



 


 


Comments (15)

  1. Michael says:

    Looks like a long missed tool.

    Does this work for 4.2 too?

  2. Mike says:

    Hi,

    This tool only works with Windows CE 5.0, I did write something similar for Windows CE 4.2, this is the CEWSDLGen tool, which generates WSDL/WSML files for an XML Web Service being hosted in Windows CE – the tool also generated the CEC, BIB, DAT, REG, and BAT files needed to host the XML Web Service as a stand alone component in the catalog – the source (C#) for the CEWSDLGen application can be found here – C:WINCE420PUBLICSERVERSSDKSAMPLESSOAPUTILSCEWSDLGen – you will need Visual Studio .NET to compile the code (and of course modify the code).

    Alternatively, let’s take a quick vote – how many people would like to see the CEFileWiz application modified to also create CE 4.2 components ?

    – Mike

  3. mishooax says:

    Hello Mike!

    Will CEFileWiz work just as well with embedded vc++ applications?

    Thanks a lot!

    Mihai

  4. Mike says:

    Hi mishoax! (interesting name)

    Yes, CEFileWiz will work with any application or file.

    – Mike

  5. source code for CEWiz says:

    Hi Mike!

    Is there any source code available for the CEFileWiz application? I’m intending to use CEFileWiz asa a part of a tutorial on Windows CE 5.0 and I would like to look thorugh the source code – just to explain it a little so it won’t seem as a "black-box" that does what you want, but how it does it remains a secret. I’m glad that this application will ease part of my work with WinCE, but unfortunately I’ll also have to present the "long & ugly" method you described at the beginning of your first post. Do you have a link to some document that explains (with sufficient amount of details) the steps of adding an app to a winCE image?

    Thanks a lot.

    Mihai (aka mishooax)

  6. Mike says:

    Hi Mihai,

    I should be able to provide both sets of items you request – the source to CEFileWiz and a description of how to add a file or application to the operating system.

    I’m interested to find out more about the tutorial you are giving – can you tell me more about this ?

    – Mike

  7. WinCE tutorial says:

    Hi Mike!

    It’s an university project sponsored by Microsoft Research :) and I am one of the students participating.

    It’s not exactly a tutorial about windows CE, instead it is meant to be a course: "Understanding Hardware/Software Interface by using Windows CE"

    with a wider audience range – it teaches students (undergraduates are the project’s target audience). The materials I requested are going to be used in a CETK tutorial.

    I can’t disclose the details concerning the course’s final content, but you can find out more about our efforts at:

    http://wince.knowledge.cs.pub.ro/Community

    Note that registering is for project members only.

    One more thing… I found somewhere on your site (I think) the application that generates code for a stream driver and for a TUX test (you used it in the CETK presentation for WinCE 5) – something like a driver wizard… I don’t exactly recall. The trouble is I lost the file and I can’t seem to find the link to it again. Can you help me?

    Looking forward to your link(s) and source code.

    Mihai.

  8. DrvWiz says:

    Hi!

    I found the link to DrvWiz.zip

    It was on this site :)

    Mihai.

  9. source code for DrvWiz says:

    Mike,

    The source code for DrvWiz would also come in handy, if it’s free that is.

    Best regards,

    Mihai.

  10. DrvWiz again says:

    OK… so DrvWiz generates the source code for a "demo stream driver" that exposes a fixed API. Great, but what about the TUX DLL test for it? Would be very nice to have that too (with or without source code).

    Thanks.

    Looking forward to hear from you,

    Mihai.

  11. Mike says:

    yep – I will post the TUX test code to the blog shortly…

    – Mike

  12. Mihai says:

    Hi Mike,

    I’d appreciate it if you were to post the TUX code (or app) asap.

    Thanks.

    Mihai