首页 文章

VxWorks用户脚本

提问于
浏览
2

我正在尝试创建一个在VxWorks中执行的脚本 . 该脚本应创建包含特定数据的输出文件 . 我想要以下内容:

saveFd = open("myoutput.txt",0x102, 0777 )
oldFd = ioGlobalStdGet(1)
ioGlobalStdSet(1, saveFd)

#I would like to use three variables
#I don't know if I should use them as environment variables

putenv("MYBUSA=0x000000") 
putenv("MYBUSD=0x000000") 
putenv("DATAA=0x000000") 

for(i=0;i<N;i++){
    #modify memory using my variables.
    m getenv("MYBUSA"), 4 getenv("DATAA")
    #display memory using my variables. This output should be redirected to the file.
    d getenv("MYBUSB"), 4 
    #update variable DATAA
    DATAA = DATAA + 1;
}

#recover old std output
ioGlobalStdSet(1, oldFd)

提前致谢 .

1 回答

  • 1

    根据您的文件系统,更改目录 . 在我的情况下,我们有真正的Flash文件系统

    • cd“/ tffs0 / cfg”

    创建脚本:

    • 脚本

    在此处添加所有其他相关命令

    iosDevShow

    要关闭文件:

    CTRL D.

    检查文件是否已创建 .

    • ls

    执行脚本,它将显示在控制台中:

    • <script

    要将脚本的所有内容记录到文件中,请使用:

    <script> script.log

相关问题