1.在Ubuntu系统下安装TinyOS
我安装的时TinyOS2.1.0,安装过程参考TinOS官网的安装指导,但有问题,具体步骤如下:
首先修改ubuntu的源,以便找到和获取TinyOS依赖包,修改如下:
1)在系统的“/etc/apt/sources.list”中,添加如下代码:
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu<distribution> main
<distribution>可以为(edgy,feisty,gutsy,hardy,jaunty,karmic,lucid)
例如 deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main
以上的源可能有问题,在安装是提示tinyos-2.1.0依赖的包找不到或无法安装,更新源如下解决此问题:
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main
deb http://hinrg.cs.jhu.edu/tinyos oneiric main 如果是大连理工的同学的话,可以直接更换成以下源: deb http://mirror.dlut.edu.cn/ubuntu/ natty main restricted universe multiverse deb http://mirror.dlut.edu.cn/ubuntu/ natty-security main restricted universe multiverse deb http://mirror.dlut.edu.cn/ubuntu/ natty-updates main restricted universe multiverse deb http://mirror.dlut.edu.cn/ubuntu/ubuntu natty-backports main restricted universe multiverse deb http://mirror.dlut.edu.cn/ubuntu/ natty-proposed main restricted universe multiverse deb-src http://mirror.dlut.edu.cn/ubuntu/ natty main restricted universe multiverse deb-src http://mirror.dlut.edu.cn/ubuntu/ natty-security main restricted universe multiverse deb-src http://mirror.dlut.edu.cn/ubuntu/ natty-updates main restricted universe multiverse deb-src http://mirror.dlut.edu.cn/ubuntu/ natty-backports main restricted universe multiverse deb-src http://mirror.dlut.edu.cn/ubuntu/ natty-proposed main restricted universe multiverse deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main deb http://hinrg.cs.jhu.edu/tinyos oneiric main
2)更新源,打开终端,输入
sudo apt-get update
3)安装TinyOS
sudo apt-get install tinyos
提示可选的tinyos的版本,选择最新的版本2.1.0
sudo apt-get install tinyos-2.1.0
4)设置环境变量
在~/.bashrc或者 ~/.profile中加入如下代码
#Sourcing the tinyos environment variable setup script
source /opt/tinyos-2.1.1/tinyos.sh
可用如下方法打开~/.bashrc或者 ~/.profile
gedit ~/.bashrc
添加成功后需要重新启动终端,或则 执行命令source /etc/profile ;<假如修改/etc/profile的话>
5)测试是否安装成功
cd /opt/tinyos-2.1.0/apps/Blink/
(若当前文件夹没有权限创建文件,将Blink复制到当前用户的目录进行运行)
make telosb
显示如下则安装成功:
mkdir -p build/telosbcompiling BlinkAppC to a telosb binary
ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"root\" -DIDENT_HOSTNAME=\"ubuntu\" -DIDENT_USERHASH=0xa3473ba6L -DIDENT_TIMESTAMP=0x4f8b865eL -DIDENT_UIDHASH=0x828a6c5cL BlinkAppC.nc -lm
compiled BlinkAppC to build/telosb/main.exe
2650 bytes in ROM
55 bytes in RAM
msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
writing TOS image
至此ubuntu下TinyOS-2.1.0安装成功。
此片文章借鉴:http://blog.csdn.net/guoxuequan/article/details/6037531 博主文章,在此感谢!