现在的位置: 首页 > 综合 > 正文

WinCE 中,环境变量的添加,删除和查询以及BSP的快速编译

2013年02月26日 ⁄ 综合 ⁄ 共 6972字 ⁄ 字号 评论关闭

 

在WinCE中有很多的环境变量,那么如何设置/删除/查询这些环境变量呢:

1. 查询环境变量:无论是在WinCE5.0还是WinCE6.0,当我们在PB里打开或者创建一个工程以后,我们可以在菜单中点“build”->“Open Release Directory in Build Window”,然后会弹出命令行对话框。在对话框中输入“set”命令,然后回车,就会看到当前工程下所有的环境变量以及相应的值。

2. 添加环境变量:有两种方法添加环境变量,一种是点“build”->“Open Release Directory in Build Window”,再弹出的对话框中添加新的环境变量,例如:set WINCE_TEST=1。这句话的意思是添加一个环境变量叫WINCE_TEST,它的值为1。还有另一种方法添加环境变量,以WinCE6.0为例,在“Solution Explorer”窗口中,右击工程的名字,然后选择“Properties”。在弹出的对话框中选择“Configuration Properties”->“Enviroment”,然后在右侧的窗口中添加环境变量。

3. 删除环境变量:同样两种方法,一种是点“build”->“Open Release Directory in Build Window”,再弹出的对话框中删除已经定义的环境变量,例如:set WINCE_TEST=。这句话的意思是删除环境变量叫WINCE_TEST。另一种删除环境变量的方法是在“Solution Explorer”窗口中,右击工程的名字,然后选择“Properties”。在弹出的对话框中选择“Configuration Properties”->“Enviroment”,然后在右侧的窗口中删除已经定义的环境变量。

4. 通过环境变量对代码进行选择性编译:对代码进行选择性编译如下:

#ifdef NANDFLASH_ECC

.....

#endif

对platform.reg进行选择性加载如下:

IF NANDFLASH_ECC

......

ENDIF

 

-------------------------------------------------------------------------------------------------------------------------------------------

 

作者:ARM-WinCE

在WinCE下面,创建工程,然后编译是需要花很长时间的。当我们第一编译完工程以后,如果需要改我们的驱动或者BSP,我们是不需要重新编译整个工程的:

1. 如果更改了driver,以WinCE6.0为例,我们可以在菜单里面选择“build”->“Open Release Directory in Build Window” ,然后在弹出的命令行窗口中,通过dos命令切换到你要编译的driver的目录下面,然后运行“build”就可以了。也可以运行“build -c”会强制把所有的文件都编译一遍。被编译后的driver的dll会被自动拷贝到release目录下面,然后再切换的工程的release目录下面,运行一下“make image”就可以了。

2. 如果改变了OAL部分的代码,同样用上面介绍的方法,需要注意的是,OAL部分可能包含多个文件夹,如果改变了OAL里面的代码,不要进入OAL里面的文件夹去编译,一定要在OAL这层进行编译,这样OAL部分的lib,dll才会被重新编译并拷贝到release目录下面。

3. 如果改变了配置文件,比如config.bib,platform.reg文件,那么直接将这些文件拷贝到你的工程目录下面,然后运行一下“make image”就可以了。

4. 如果改变了eboot部分的代码,那按照步骤1的方法就可以了,可能你都不需要运行“make image”命令,因为可能你只需要eboot.bin或者eboot.nb0。

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

很多新手对Platform Builder 5.0(以下简称PB 5.0)的Build OS菜单有所疑惑,不知道实际使用中应该如何选择,在此结合本人平时的经验,略作一番解释。 首先第一组是编译命令,一共有三个:

        1.Sysgen 根据当前的系统设计,生成一个系统映像。该操作不会更改之前编译(Build)完成的文件。这里所说的文件,指的是OS的文件,也就是位于WINCE500文件夹下面的各种lib库。 有三点是必须要注意的: 1).在上一次调用Sysgen之后,如果你已经增加或移除文件以及相关的Catalog,强烈建议选中“Clean Before Building",然后再开始新的一次Sysgen。因为这样会最大程度上减少出错的机会。 2).该命令也会编译包含于系统设计工作区(Workspace)的工程(Project)。
3).没有任何文件拷贝到目标(Release)文件夹。

        2. Build and Sysgen 其实这是两个命令的组合,先是编译(Build),然后再调用Sysgen。该命令不仅编译公开(Public)代码,甚至连私有(Private)代码也不放过,所以耗费的时间会非常久。只有当你更改了OS的源文件,才建议选择该命令。 该命令和之前的Sysgen相同,也会编译包含于系统设计工作区(Workspace)的工程(Project)以及不将文件拷贝到目标(Release)文件夹。 接下来三个是命令标签,用来部分控制命令运行时的行为。

        3.Build and Sysgen Current BSP 编译(Build)然后Sysgen当前的BSP包。和之前的两个命令一样,该命令也不会将文件拷贝到目标(Release)文件夹。 需要注意的一点是,根据实际的使用经验,因为命令的参数不同,有时候即使你能成功调用调用Sysgen生成系统,也有可能调用本命令编译BSP包失败。遇到此情况,只能根据具体情况做相应的处理。

        4.Clean Before Building 如果选中该标签,那么在执行命令之前都会清除上一次Sysgen创建的文件。

        5.Copy Files to Release Directory 如果选中该标签,则在编译完毕之后,会把生成的文件拷贝到目标(Release)文件夹中。通常这个目标(Release)文件夹是你的工程所在的目录。 该标签默认是选中的。

        6.Make Run-Time Image After Build 如果选中该标签,在编译完毕之后,将生成一个运行映像(run-time image)。最典型的的运行映像(run-time image)便是NK.BIN。 在你建立一个新的工程之后,该标签默认是选中的。 最后是一组辅助的命令。

        7.Copy Files to Release Directory 将生成的文件拷贝到目标(Release)文件夹。

        8.Make Run-Time Image 生成运行映像(Run-Time Image)。最常见的,也就是将所编译生成的文件组合成nk.bin。

        9.Batch Build 用来选择多种配置来生成运行映像(Run-Time Image)。

       10.Open Release Directory 打开命令行窗口,默认路径为目标(Release)文件夹。

       11.Set Active Configuration 从现有的配置选择一个作为当前可用的。

       12.Configurations 你可以通过该命令增添或删除配置 在PB的文档中也有关于这些命令的说明,具体位置你可以查看: Platform Builder User's Guide > Platform Builder IDE > Platform Builder User Interface > Menu Descriptions

Build OS Menu of Platform Builder 5.0
Sysgen/Build and sysgen/Build and sysgen current BSP区别:
Sysgen: 更新Catalog后,生成NK.bin之前。不会更新之前Build完成的文件。(编译workspece中的Project)
Build and sysgen: 更新Public目录下代码后,打patch之后。编译Pubilc代码,Private代码。
Build and sysgen current BSP: 更新BSP部分代码后,编译后Sysgen当前BSP包。

下面的说明来自PB Help文档。

The Build OS menu provides a variety of options for your OS design, such as building run-time images. For information about the build process, see Build Phases.

This menu contains build commands and flags the modify these commands, resulting in more flexibility when determining the settings for a build.

This functionality is similar to the functionality available in a command-line prompt build window. The results of a build depend on the settings that you choose, and can vary widely.

You can customize the settings for a build according to your needs by selecting the build flags you want to set, then choosing a build command to begin the build.

The following build options are available on the Build OS menu.

Command Description
Sysgen Runs the Sysgen tool on files related to the OS design. This assumes that the files have not changed from a previous build process.

Note   If you have added or removed files or Catalog items after a previous Sysgen, it is recommended that you select Clean Before Building before running a new build. This reduces the chances of a build error appearing.
Projects in the workspace are included in the build process.

No files are copied to the release directory.
 
Build and Sysgen Builds, and then runs the Sysgen tool on files in the OS design.

Select this command when you modify files in the OS design.

Projects in the workspace are included in the build process.

No files are copied to the release directory.
 
Build Current BSP Builds and then runs the Sysgen tool on files in the directory for the current BSP.

No files are copied to the release directory.

The following flags are available on the Build OS menu.

Command Description
Clean Before Building Select to remove intermediate and output files built during a previous Sysgen phase before running a build. 

Copy Files to Release Directory After Build Select to use the Buildrel tool to copy output files to the release directory after the build completes.

By default, this menu option is selected when you create a new workspace.
 
Make Run-Time Image After Build Select to use the Makeimg tool to use files in the release directory to create the run-time image after the build completes.

By default, this menu option is selected when you create a new workspace.

The following other menu options are available on the Build OS menu.

Command Description
Copy Files to Release Directory Use to copy output files to the release directory after the build completes, using the Buildrel tool.

Make Run-Time Image Use files in the release directory to create the run-time image, using the Makeimg tool.

Stop Build Use to stop the build when the build system reaches the end of the current executing command or the next phase.

If you select Clean Before Building, it is recommended that you allow the build to complete.
 
Batch Build Use to select multiple configurations to build run-time images from.
Open Release Directory Use to open a command prompt build window in the release directory for your OS design.

Set Active Configuration Use to select an active configuration for your OS design.

Configurations Use to add or remove configurations for your OS design.

今天遇到一个很奇怪的问题,在使用命令Build and Sysgen Current BSP没有选中Clean Before Building

 发现PLATFORM\smdk2440\DRIVERS下的文件并没有被编译,但是PLATFORM\smdk2440\KERNEL下的文件是被编译了的

用命令Build and Sysgen Current BSP没有选中Clean Before Building 后才编译PLATFORM\smdk2440\DRIVERS下的文件,但编译出的NK下载运行到OEMINT()就死了。

 

在修改驱动文件以后也可以build project 然后勾选make run-time image,直接生成镜像文件,不用build os -》sysgen-》make run-time image。也可以在drivers文件点击右键build currect project.

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gaoyugaoyugaoyu/archive/2010/01/19/5208305.aspx

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhouyi86/archive/2009/06/09/4254224.aspx

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gooogleman/archive/2008/08/06/2776689.aspx

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/dengxin123/archive/2008/11/19/3330991.aspx

抱歉!评论已关闭.