Create and use a script in VxWorks (equivalent to autoexec. BAT in Windows)

Source: Internet
Author: User

First, the generated VxWorks must support the script startup component:

Next, in BSP/config. H, [the script to be started in Boot linestores, Which is suffixed with start.txt:

You must have a path name before start.txt of startup scripts. Otherwise, the script file cannot be found!

After the modification, create the bootrom. sys

At the end, create a start.txt text file with the following content (for example, input each command under the VX command line, but execute these commands together ):

 ld 1,0,”/ata0a/myLoad.out” myLoad(“/ata0a/apps.out”, “Test1”)

Copy the file to the boot drive root directory (same location as bootrom. sys)

Note supported in script files:

/*... Fast comments... */#... Line comment...

(The preceding script statement means: load a file named myload. the out executable file. A function named myload is opened in this file and two parameters are accepted. The first function can load another out executable file, the second parameter is the name of the executable function in the loaded out. The call of the above two statements is equivalent to executing the test1 function in apps. Out !)

Just like this start.txt, you can modify the VxWorks every time you compile it. Instead, you can modify the commands in start.txt!

 

Appendix: boot line structure:

typedef struct  {char bootDev [BOOT_DEV_LEN];   char hostName [BOOT_HOST_LEN];  char targetName [BOOT_HOST_LEN]; char ead [BOOT_ADDR_LEN];   char bad [BOOT_ADDR_LEN];   char had [BOOT_ADDR_LEN];   char gad [BOOT_ADDR_LEN];   char bootFile [BOOT_FILE_LEN];   char startupScript [BOOT_FILE_LEN];  char usr [BOOT_USR_LEN];    char passwd [BOOT_PASSWORD_LEN];  char other [BOOT_OTHER_LEN];   int procNum;   int unitNum;   int flags;   } BOOT_PARAMS;

bootDev(unitNum,procNum) hostname:bootFile e=ead b=bad h=had g=gad u=username pw=password f=flags tn=targetName s=startupScript o=other

This is why the preceding statement "s =/ata0a/start.txt" exists!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.