备注:
以下是在2012年下半年安装TinyOS的步骤,最新的已经有所变化。官方网站上的安装说明:http://tinyos.stanford.edu/tinyos-wiki/index.php/Automatic_installation
地址链接
基本平台
- 1.操作系统:Ubuntu12.04
- 2.硬件节点:Micaz节点
基本步骤
如果系统没有python开发环境支持和g++编译工具:
$sudo apt-get install python-dev
$sudo apt-get install g++
- 2.按照官方步骤进行操作,注意修改~/.bashrc文件中对应的tinyos版本 号:http://docs.tinyos.net/tinywiki/index.php/Installing_TinyOS_2.1.1#Two-step_install_on_your_host_OS_with_Debian_packages
- 3.在目前最新的2.1.2版本中,在/opt/tinyos-2.1.2/下缺少tinyos.sh文件,则需要编辑添加如下:
#installation by substituting /opt for the actual tinyos tree
#installation point
TOSROOT="/opt/tinyos-2.1.2"
TOSDIR="$TOSROOT/tos"
CLASSPATH="$TOSROOT/support/sdk/java/tinyos.jar:."
MAKERULES="$TOSROOT/support/make/Makerules"
export TOSROOT
export TOSDIR
export CLASSPATH
export MAKERULES
关闭并重启终端或者$source ~/.bashrc,使配置生效。
- 4.修改/opt/tinyos-2.1.2/文件夹权限,$chown -R username /opt/tinyos-2.1.2/
- 5.安装tos-install-jni,$sudo tos-install-jni
- 6.检查是否安装正确:$sudo tos-check-env ,一般会出现两个Warning,一个是你的Java版本不对,不是1.4或者1.5的;另一个是graphviz版本有问题,都可以忽略。
- 7.检查tinyos编译系统是否可用:$ printenv MAKERULES
出现“/opt/tinyos-2.1.2/support/make/Makerules”信息则可用正常使用。
- 8.最后进入/opt/tinyos-2.1.2/apps/Blink目录,编译Blink应用程序,输入如下命令进行仿真编译:$make micaz sim
得到“Successfully built micaz TOSSIM library”信息,则编译顺利,环境安装成功。
在micaz节点上进行下载测试
- 1.确定serial port device name:$ ls /dev/ttyU*
显示:
则我的USB端号为0。
- 2.将端口属性设置为可写:$ sudo chmod 666 /dev/ttyUSB0 (usb-device-name)
- 3.将将程序下载到节点:$ make micaz reinstall mib510,/dev/ttyUSB0显示结果为:
如果为每个节点进行标记则:$ make micaz reinstall.ID mib510,serialport
- 4.make tinynode reinstall device-type,serialport 与make tinynode install device-type,serialport的区别:reinstall直接将编译好的代码写入到串口中,而install先编译源文件为可执行代码,然后再写入串口。
- 5.程序下载好之后,节点的LED灯按照每2秒0-7的二进制数不断闪烁。
使nesC在vim中高亮显示
参考文档:http://www.vim.org/scripts/script.php?script_id=1847
- 1.下载Version 2.0的压缩包:vim.tar.gz;如果没有安装Vim,则$sudo apt-get install vim进行安装。
untar the the files to ~/.vim/
tar zxvf vim.tar.gz
add the following into the end of ~/.vimrc
augroup filetypedetect
au! BufRead,BufNewFile *nc setfiletype nc
augroup END
如果没有~/.vim/文件夹则新建,$mkdir ~/.vim/,如果没有~/.vimrc文件则同样新建文件。
PS:2013-09-27因为vim.tar.gz不能作为附件上传(提示说是非法文件类型),所以先解压然后再压缩为zip类型文件。 |