前言:最近一段时间需要快速上手telosB节点,从零学习了下WSN的相关知识,梳理下目前总结的方法
0.(可选项)$ sudo apt-get install flex $ sudo apt-get install bison $ sudo apt-get install graphviz $ sudo apt-get install build-essential python python-dev swig python-pygame sudo $ apt-get install default-jre $ sudo apt-get install default-jdk
1.$ echo “deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main” >> /etc/apt/sources.list.d/tinyprod-debian.list
【=系统设置/软件及更新/其他软件/添加源】
2.$ sudo apt-get update
3.$ sudo apt-get install tinyos-2.1.2
4.$ cd /opt/tinyos-2.1.2 【默认安装路径】
5.$ sudo gedit tinyos.sh 【设置环境变量】
#! /usr/bin/env bash
# Here we setup the environment
# variables needed by the tinyos
# make system
export TOSROOT="/opt/tinyos-2.1.2"
export TOSDIR="$TOSROOT/tos"
export CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:.:$TOSROOT/support/sdk/java/tinyos.jar
export MAKERULES="$TOSROOT/support/make/Makerules"
export PYTHONPATH=$PYTHONPATH:$TOSROOT/support/sdk/python
export PATH=/opt/msp430/bin:$PATH
export APP="$TOSROOT/apps"
复制到profile.d
sudo cp tinyos.sh /etc/profile.d/
6.$ sudo gedit ~/.bashrc【使得每次启动bash时都能执行tinyos.sh脚本】
#Sourcing the tinyos environment variable setup script
source /opt/tinyos-2.1.2/tinyos.sh
$ sudo chmod 777 /opt/tinyos-2.1.2/apps/Blink #非常重要!!不然可能导致虚拟机崩溃重装等等问题(较小概率)
$ cd /opt/tinyos-2.1.2/apps/Blink
$ make micaz sim
$ cd /opt/tinyos-2.1.2/apps/Blink
$ make telsob
# 插上telosB节点,并在虚拟机-可移动设备-xxxx内勾选节点进行连接
$ motelist
==============================================================================================================================================
Reference Device Description
---------- ---------------- --------------------------------------------
AH01J3OY /dev/ttyUSB0 FTDI FT232R USB UART
==============================================================================================================================================
$ sudo chmod 666 /dev/ttyUSB0(即上面motelist得到的设备名) //修改端口权限,不然会显示连接错误 #非常重要!!不然可能导致虚拟机崩溃重装等等问题(较小概率)
$ make telosb reinstall bsl,/dev/ttyUSB0
如若观测到telosB节点三个灯开始不断来回闪烁即为success~
可选项:
1.将java降版本至1.5 [可以暂时忽略]
Java versions: Requires older versions :1.4 or 1.5
Multiple versions can be installed on Unbuntu and users can switch between versions
using the command: $ sudo update-alternatives --config java
For installing older versions and using check the following link:
http://askubuntu.com/questions/469259/downgrade-java-1-7-to-java-1-5
2.使用最新版的http://tinyprod.net/repos/debian数据源
[目前我登不上去,怀疑已经dead了]
3.升级msp430-gcc至4.6.3 [需要tinyprod.net数据源,但不升级也没遇到问题]
WARNING: Minimum recommended msp430-gcc version for this TinyOS release is 4.6.3!!!
学习参考资料推荐:
http://tinyos.stanford.edu/tinyos-wiki/index.php/Installing_TinyOS
http://tinyos.stanford.edu/tinyos-wiki/index.php/Getting_Started_with_TinyOS
还有其他问题,欢迎讨论