启动rational,存放目录不一定是固定的。
[root@sdstc01 root]# cd Rational
[root@sdstc01 Rational]# cd releases/
[root@sdstc01 releases]# cd TestRealTime.v2002R2/
[root@sdstc01 TestRealTime.v2002R2]# ./start_testrt.sh
Temp下是自己的程序,此处的测试程序是test2,test2就是在ration中用配置好的编译器(c hharm24401)编译hello.c生成的可执行文件,注意编辑时,他们因为只有服务器上有license,所以就得换网段连到服务器上,编译此文件,编译完成后,再换回原来的网段。
[root@sdstc01 TestRealTime.v2002R2]# cd /home/temp
[root@sdstc01 temp]# ls
hello.o products.h test2 test2.spt test2.tpf TP.o
[root@sdstc01 temp]# file test2
test2: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0 , dynamically linked (uses shared libs), not stripped
解压文件作系统,将刚才编译好的文件放到系统中,然后卸下系统,压缩文件系统,传到RAM板上。
[root@sdstc01 temp]# cd /
[root@sdstc01 /]# ls
bin etc initrd lost+found opt root tmp
boot HHARM2440 inittab misc proc sbin usr
dev home lib mnt ramdisk.image.gz tftpboot var
[root@sdstc01 /]# gunzip ramdisk.image.gz //解压系统文件
[root@sdstc01 /]# mount -o loop ramdisk.image mnt //mount系统文件
[root@sdstc01 /]# cd /mnt
[root@sdstc01 mnt]# ls
app cramfs etc home lib lost+found proc tmp var
bin dev hhtech jffs2 linuxrc mnt sbin usr
[root@sdstc01 mnt]# cd home
[root@sdstc01 home]# ls
temp
[root@sdstc01 temp]# cd /home/temp
[root@sdstc01 temp]# ls
hello.o products.h test2 test2.spt test2.tpf TP.o
[root@sdstc01 temp]# cp test2 /mnt/home/temp //将生成的可执行文件考到此文件系统中的同pc上的同一路径下
[root@sdstc01 temp]# cd/mnt
bash: cd/mnt: ûÓÐÄǸöÎļþ»òĿ¼
[root@sdstc01 temp]# cd /mnt
[root@sdstc01 mnt]# ls
app cramfs etc home lib lost+found proc tmp var
bin dev hhtech jffs2 linuxrc mnt sbin usr
[root@sdstc01 home]# cd temp
[root@sdstc01 temp]# ls
test2
[root@sdstc01 temp]# cd /
[root@sdstc01 /]# umount /mnt //卸下文件系统
[root@sdstc01 /]# gzip ramdisk.image //压缩文件系统
[root@sdstc01 /]# ls
bin etc initrd lost+found opt root tmp
boot HHARM2440 inittab misc proc sbin usr
dev home lib mnt ramdisk.image.gz tftpboot var
[root@sdstc01 /]# cp ramdisk.image.gz /tftpboot //上传文件
在arm板上的使用及运行
[root@sdstc01 /]# minicom //进入arm系统
重启arm板的时候,按空格,就转到
SMDK2440 # tftp 0x30800000 ramdisk.image.gz //下载上一步压缩好的文件系统
SMDK2440 # fl 0x200000 0x30800000 0x300000 //重新烧写程序,如果不烧写不好用
再次重新arm板来到arm系统中,就可以看到同路径下,我们自己编译好的文件了。此时运行文件test2,可以看到生成了test2.spt,spt采集了该程序运行的一些数据,将此spt文件上传到pc上,用rational来进行分析,就可得到测试结果了(分析的过程没有给做演示)
~ # ls
app dev home linuxrc proc usr
bin etc jffs2 lost+found sbin var
cramfs hhtech lib mnt tmp
~ # cd home
/home # ls
httpd temp
/home # cd temp/
/home/temp # ls
test2
/home/temp # ./test2
Hello world!
/home/temp # ls
test2 test2.spt