I have written about cloning code from the Public tree to a platform in the past, but someone recently asked about cloning an MDD lib build directory. More specifically the question was about cloning ufnmdd.lib in Windows CE 5.0, which is actually created by linking three separate libs together. In this article, I will walk through the process by cloning one of those libs.
Ufnmdd.lib is created by linking ufnmddbase.lib, ceosutil.lib and defbuslib.lib. I suspect that most people don’t really need to clone ceosutils.lib and defbuslib.lib, but instead really need to just clone ufnmddbase.lib for debugging purposes. So I will clone ufnmddbase.lib and show two different ways to then link the new lib with a USB function driver.
Because this is a statically linked library, the easiest way to clone it is to simply copy the folder to the platform and then make some changes to the sources file. For this example, I will clone ufnmddbase.lib into the MainstoneII platform. I point this out because you can refer to the MainstoneII platform in the WINCE500 build tree. The USB function driver in MainstoneII is a single directory that builds some source code and links with ufnmdd.lib among other libs.
The steps to add ufnmddbase.lib to the MainstoneII:
1.       Move the current code down a folder from Drivers\USBFN to Drivers\USBFN\DLL (or any name you choose.) This makes way for us to add a new folder under USBFN for ufnmddbase.lib to build in.
2.       Create a Dirs file in Drivers\USBFN and add the following to it:
       DIRS =DLL
3.       Test building the driver just to be sure that this didn’t break it already
5.       Add MDD to the Drivers\USBFN\Dirs before DLL:
6.       Add RELEASETYPE=PLATFORM to the Drivers\USBFN\MDD\sources file
7.       Test build again and check that ufnmddbase.lib is in MainstoneII\Lib sub folders
Now that ufnmddbase.lib has been cloned to the platform, there are two choices for using it within the USB function driver; link directly with the three libs in ufnmdd.lib or create a new folder to link the libs and create a new ufnmdd.lib.
Link Directly with UFNMDDBase.lib
For this option, edit Drivers\USBFN\DLL\sources to change the from linking with ufnmdd.lib to linking with the three separate libraries. Change the SOURCELIBS from:
        $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\pxa27x_usbfn.lib \
        $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\pxa27x_usbfn.lib \
        $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\ceosutil.lib \
        $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\defbuslib.lib \
Then rebuild the driver.
Create a New UFNMDD.LIB
For this option, create a new folder to link the three libraries to create a new ufnmdd.lib. The steps are:
1.       Create a new folder: Drivers\USBFN\UFNMDD
2.       Create a sources file in the new folder and include:
                $(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\ufnmddbase.lib \
                $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\ceosutil.lib \
3.       Change the SOURCELIBS from:
        $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\pxa27x_usbfn.lib \
        $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\pxa27x_usbfn.lib \
4.        Add UFNMDD to Drivers\USBFN\Dirs after MDD and before DLL:
This should give the bases for cloning an MDD lib file for a driver. If you wanted to also clone the other libraries, the technique is the same.
Copyright © 2008 – Bruce Eitman
All Rights Reserved