您的位置:首页 > 产品设计 > UI/UE

Using a batch file to automatically build a Windows CE 5.0 and 6.0 project

2010-05-02 13:30 811 查看


http://geekswithblogs.net/BruceEitman/archive/2008/05/07/using-a-batch-file-to-automatically-build-a-windows-ce.aspx

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
set __PLATFORMNAME__=MyBSP
set _WINCEROOT=C:/WINCE500
set PBWORKSPACEROOT=%_WINCEROOT%/PBWorkspaces/%__PROJECTNAME__%
REM Added _PROJECTROOT to get wince.bat to set the paths correctly
set _PROJECTROOT=%PBWORKSPACEROOT%/WINCE500/%__PLATFORMNAME__%_ARMV4I
REM Set up some variables to shorten the lines that follow
set PBWORKSPACE=%PBWORKSPACEROOT%/%__PROJECTNAME__%.pbxml
set WINCE_BAT=%_WINCEROOT%/Public/Common/Oak/misc/wince.bat
set PBXMLUTILS="C:/Program Files/Windows CE Platform Builder/5.00/CEPB/BIN/pbxmlutils.exe"
REM You could call %PBXMLUTILS% /listconfigs
REM and parse to find "release" to get the number from the file
REM this will build the first configuration found
set __CONFIG__=0
REM Run Wince.bat to set up the basic environment
call %WINCE_BAT% ARMV4I %__PROJECTNAME__% %__PLATFORMNAME__%
REM Now use PBXMLUtils to get the catalog variables
REM Could this be done differently, yes, but this captures all of the variables for future reference
%PBXMLUTILS% /config %__CONFIG__% /getbuildenv > %_WINCEROOT%/Build%__PROJECTNAME__%.bat
call %_WINCEROOT%/Build%__PROJECTNAME__%.bat
REM Do a clean build of the project
blddemo clean -q

With a few minor changes, this can be used for Windows CE 6.0:

@ECHO on
set __PROJECTNAME__=MyWorkspace
set __PLATFORMNAME__=MyBSP
set CPU=ARMV4I

set _WINCEROOT=C:/WINCE600
set PBWORKSPACEROOT=%_WINCEROOT%/OSDesigns/%__PROJECTNAME__%
REM Added _PROJECTROOT to get wince.bat to set the paths correctly
set _PROJECTROOT=%PBWORKSPACEROOT%/WINCE600/%__PLATFORMNAME__%_%CPU%

REM Set up some variables to shorten the lines that follow
set PBWORKSPACE=%PBWORKSPACEROOT%/%__PROJECTNAME__%.pbxml
set WINCE_BAT=%_WINCEROOT%/Public/Common/Oak/misc/wince.bat
set PBXMLUTILS="C:/Program Files/Microsoft Platform Builder/6.00/cepb/IdeVS/pbxmlutils.exe"
REM You could call %PBXMLUTILS% /listconfigs
REM and parse to find "release" to get the number from the file
REM this will build the first configuration found
set __CONFIG__=0
REM Run Wince.bat to set up the basic environment
call %WINCE_BAT% %CPU% %__PROJECTNAME__% %__PLATFORMNAME__%

REM Now use PBXMLUtils to get the catalog variables
REM Could this be done differently, yes, but this captures all of the variables for future reference
%PBXMLUTILS% /config %__CONFIG__% /getbuildenv > %_WINCEROOT%/Build%__PROJECTNAME__%.bat
call %_WINCEROOT%/Build%__PROJECTNAME__%.bat
REM Do a clean build of the project
blddemo clean -q

Your Comments.

# re: Using a batch file to automatically build a Windows CE 5.0 project


Hi... I'm new in WinCE 6.0.
May I know is it the script above have save in a batch file?
Any specific folder have to place in?
Can I run directly in Window Command Prompt?
Can you give me some idea about the automated build script important steps?
Thanks.

Left by May at 1/8/2009 9:09 AM


# re: Using a batch file to automatically build a Windows CE 5.0 project


May:

As the title states, this is a batch file. As such, all batch file rules apply, so place it in a folder that you can run it from.

Yes, run it from a command prompt, it will set up the environment, as the article states.

I agree, a little more information about what the steps are would be good. When I have time I will look into that. But quickly this scripts does:

1. Sets up some important environment variables
2. Calls wince.bat
3. Calls pbxmlutils to get sysgen and other environment variables
3. Sets the environment variables returned from pbxmlutils.
4. Runs buildrel.bat to build the OS

Bruce

Left by Bruce Eitman at 1/8/2009 10:20 AM


# re: Using a batch file to automatically build a Windows CE 5.0 project


Hi:
I have a qustion, can you help me?
After running "blddemo clean -q" this command, i want to do other things, and how can i check whether happened errors in that process by command line?

Left by Charsh at 1/13/2009 8:32 AM


# re: Using a batch file to automatically build a Windows CE 5.0 project


Charsh:

There has been plenty written about DOS over the years. I am sure that with some research you can find out how to redirect the output to a file and figure out a way to parse it for the word error.

Bruce

Left by Bruce Eitman at 1/13/2009 10:01 PM


# re: UsinHg a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi,

I just wanted to know how to specify the build mode. I mean how to build the workspce in release or debug mode?

Thanks,
Hari

Left by Hari at 3/30/2009 9:07 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hari

The /config option is used to select the configuration to build. In these examples, I have __CONFIG__ set to 0. I manage my projects so that config 0 is always the retail build.

Bruce

Left by Bruce Eitman at 3/30/2009 11:25 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Bruce, Thanks for the infrmation

Left by Hsri at 4/1/2009 1:20 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi,

I have used the script to build the image.But I am facing some problems.
While downloading the image it stops in between and I have to press the "F5" key multiple times to continue the dowloading process.
While running the CETK tests also I am facing the same problem .
Can you please provide some suggestions?

Thanks,
Harish

Left by Hari at 4/8/2009 2:03 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Harish:

Really you told me almost nothing, and I suspect that some of what you told me is inaccurate.

1. This article contains two distinct scripts, you state that you used "the script".

2. You say that when downloading "it" stops "in between". What is "it" and "in between" what?

3. You say that you have to press the "F5" key when "downloading". What exactly does the F5 key do when downloading?

4. You say that you face "the same problem" when running the CETK, but you haven't told me about any problems, have you?

My questions to you are:

1. Is the same behavior when building in Platform Builder?

2. Is this the same behavior if you open a build window and run "blddemo clean -q"?

Bruce

Left by Bruce Eitman at 4/8/2009 10:15 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi Bruce,
Sorry for not providing the details.

1)Yes I have used the above script to build my project.
2)While downloading means, while flashing the image "NK,bin" to my board, it stops and If I press F5 it continues.
3)I am not sure what is the function of F5 key while downloading NK.bin to my board. F5 we useually use while debugging(run through).
4)In CETK if I run some test , it will start the test but in between it stops execution and it expects "F5" key to be pressed.afterthat test continues.
5) I am not seeing this behaviour if I build using Platform builder (sysgen) or build window(blldemo clean -q).

Left by Hari at 4/9/2009 5:15 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Harish:

***WHICH*** of the ***two*** scripts are you using? What is your target OS version? You do not seem to have noticed that there are ***Two*** scripts in the article, one is for CE 5.0 and the other is for CE 6.0, neither is for any other OS or OS version like Mobile.

Bruce

Left by Bruce Eitman at 4/9/2009 7:50 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Harish:

Take a look at http://geekswithblogs.net/BruceEitman/archive/2009/04/09/platform-builder-analyzing-build-result-deltas.aspx
Try diffing the environment variables to see if there are any differences. I check the 6.0 environment for one of my projects, other than the variable set by the script and some case differences mine were the same.

Bruce

Left by Bruce Eitman at 4/9/2009 11:00 PM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi Bruce,

sorry for the delayed response.
I am using the script for CE 5.0.

I will try your suggestions and get back to you.

Thanks,
Harish

Left by Hari at 4/15/2009 5:09 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi,

This is great info. We are trying to setup parallel builds and a build server for our platform and our application. I was able to get the platform to compile to an arbitrary location (including the base Windows CE source code). However I am trying to achieve the same thing for an application. My main problem is that I want to avoid having to install the SDK to compile my application. I want the SDK to live in my Source Control with my application. So I would checkout my project and build it independently of the current SDK installed. Because our platform is evolving at the same time as our application (adding new extension cards, new services, etc), we want to associate a version of the source code with a version of the SDK. We want to localize the SDK with the application source code. Do you have any experience with that and could you give me any pointers?
So far, what I have been able to do is install one version of the SDK. Move the SDK header and libs from the SDK install directory to my project folder. Add the relative path to the headers and libs to my project. However, I don't know if there is more to an SDK than headers and libs (there must be as the development environment is configured according to the selected SDK) and if using this method will create any problems if I compile against an old version of the SDK headers and libs with a newer SDK installed (or newer headers and files with older SDK installed).

Thanks,

Alexis

Left by Alexis at 9/10/2009 3:22 PM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Alexis:

Sorry, I don't really have any advice for you. You may want to broaden your audience a little and post your question to one of the Windows CE newsgroups.

See http://geekswithblogs.net/BruceEitman/archive/2008/06/24/windows-ce-newsgroups.aspx
Bruce

Left by Bruce Eitman at 9/10/2009 10:00 PM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi,

Instead of setting these env variables would it be possible to just call PBInitEnv.bat from the WINCE600 directory of the OSDesign you are using? The script gets generated when the OSDesign solution is first opened, which I automate by calling "devenv /runexit". Any thoughts?

Thanks.

Left by Patrick Flanagan at 12/23/2009 3:45 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Patrick:

That might work, give it a try - export the environment and compare it.

Brue

Left by Bruce Eitman at 12/23/2009 3:57 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Hi Bruce,

I was able to build using that method. Any disadvantages you can think of vs your script?

Thanks.

Left by Patrick Flanagan at 12/23/2009 5:08 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Patrick:

As long as you create that file each time, I see no disadvantage. But if the file is old, it might not include the same settings as the PBXML file.

Bruce

Left by Bruce Eitman at 12/23/2009 5:40 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Bruce,

I am using the script to build a CE 6.0 OSDesign and find it very useful. However, I have found that software in the Subproject folders of the solution does not get rebuilt and included in the image. Since updates from our BSP vendor are installed in this folder, this effectively prevents me from using this approach.

BTW - manual builds from VS2005 build and include the software properly.

Do you have any suggestions?

Thanks
BillT

Left by BillT at 4/13/2010 9:30 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Bruce,

I have run the script to build our CE 6.0 OSDesign and it is very useful. However, I have found that software in the Supproject folder of the OSDesign Solution does not get built and included in the CE image by the script build. The software is built and included in the image when built manually from VS2005.

Do you have any suggestions in this regard?

Thanks

Bill

Left by BillT at 4/13/2010 11:55 AM


# re: Using a batch file to automatically build a Windows CE 5.0 and 6.0 project


Bill:

If your sub-projects were not built, then you probably don't have a %_PROJECTOAKROOT%/PBPostSysgenCustomBuildActions.bat to tell the build system how to build them.

Bruce

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐