网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> 技术文库 >> 嵌入式 >> 文章正文
  在vxworks中如何使用启动脚本startup script           ★★★ 【字体:
在vxworks中如何使用启动脚本startup script
作者:互联网    文章来源:本站原创    点击数:    更新时间:2006-12-31    

1  选择一个合适的bsp,创建一个bootable vxworks image project,包含shell startup script组件。

   usrAppInit()中添加代码:

 printf("\nusrAppInit\n");

   这条语句的作用就是为了比较usrAppInit()和startup script谁先执行。  

2  写一个demo.c,文件内容如下:

 #include "vxworks.h"

 void demo(void)

 {

  int x;

  for(x=0;x<5;x++)

   printf("x=%d\n",x);

 }

   把它加入到vxworks的工程中。这是一个简单的用户函数例子。

3  vxworks文件所在的目录下,创建一个文件myscripts.txt,其内容为:

 printf("hello\n")

 demo()

 routeShow()

 i

   为了能够调用routeShowvxworks配置中需要包含网络调试组件。

4  启动目标机,在bootrom引导vxworks时,指定startup script参数,如:

 boot device          : cpm

 unit number          : 0

 processor number     : 0

 host name            : chenqi

 file name            : vxWorks

 inet on ethernet (e) : 192.168.0.200

 host inet (h)        : 192.168.0.118

 user (u)             : target

 ftp password (pw)    : target

 flags (f)            : 0x0

 target name (tn)     : 850pc

 startup script (s)   : myscript.txt

5   如果一切正常,vxworks启动完毕之后,会有:

 Executing startup script myscript.txt ...

 printf("hello\n")

 hello

 value = 6 = 0x6

 demo()

 x=0

 x=1

 x=2

 x=3

 x=4

 value = 4 = 0x4

 routeShow()

 

 ROUTE NET TABLE

 Destination      Gateway          Flags  Refcnt Use        Interface

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

 192.168.0.0      192.168.0.200    0x101  1      0          cpm0

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

 

 ROUTE HOST TABLE

 Destination      Gateway          Flags  Refcnt Use        Interface

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

 127.0.0.1        127.0.0.1        0x5    0      0          lo0

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

 value = 69 = 0x45 = 'E'

 i(0)

 Show routine of this object not configured into system.

 value = 56 = 0x38 = '8'

 

 

 Done executing startup script myscript.txt

 

 usrAppInit

   由此可见,startup scriptusrAppInit函数之前执行。

   在上述试验中,需要注意最好让vxworks文件和myscript.txt文件在同一位置。

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    VxWorks在AT91RM9200上的BSP…
    基于VxWorks的网络接口设计
    基于VxWorks的飞机配电自动化…
    嵌入式系统优先级反转问题的…
    VxWorks汉字显示解决方案
    VXWorks的堆栈布局
    VxWorks for X86的输入输出定…
    vxWorks在线升级技术
    BSP配置文件及生成下载
    串口通信vxworks
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号