〖Linux〗zigbee实验之cc2430移植tinyos2.x的步骤(Ubuntu13.10)

时间:2023-03-08 17:02:14
〖Linux〗zigbee实验之cc2430移植tinyos2.x的步骤(Ubuntu13.10)

开发环境:Ubuntu13.10

1. 添加源,并安装tinyos-2.11:
sudo gedit  /etc/apt/sources.list #往里边添加
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main
sudo apt-get update
sudo apt-get install -y tinyos-2.1.1

2. 安装好wine,及安装Keil:
sudo apt-get install wine #安装wine,在Linux上运行Windows程序

文件下载:Keil_C51_V8.09汉化.zip 
利用wine安装好Keil_C51_V8.09,之后的编译时会使用得到;

〖Linux〗zigbee实验之cc2430移植tinyos2.x的步骤(Ubuntu13.10)
3. 安装Ubuntu13.10编译过程中的一些依赖环境:
sudo apt-get install g++ python2.7-dev
安装jdk1.6(略过,网上搜索结果一大把)

4. 安装tinyos-2.x-contrib:
需要文件: TinyOS8051wg-0.1pre4.tgz
解压方法:
cd /opt
sudo tar zxf TinyOS8051wg-0.1pre4.tgz

5. 一些文件修改过程:
文件1:/opt/tinyos-2.1.1/support/make/sim.extra
将其中:PYTHON_VERSION=2.5
修改为:PYTHON_VERSION=2.7
将其中:PYDIR = $(shell python$(PYTHON_VERSION)-config –prefix)/usr/include/python$(PYTHON_VERSION)
修改为:PYDIR =/usr/include/python$(PYTHON_VERSION)
将其中:-L/$(PYDIR)/config
修改为:-L/bin
文件2:/opt/tinyos-2.x-contrib/diku/mcs51/support/make/mcs51/mcs51.rules
将其中:
  MCS51_WINE_IAR=env WINEPREFIX=$(MCS51_WINE_IAR_PATH) LC_ALL=en_US wine
  MCS51_WINE_KEIL=env WINEPREFIX=$(MCS51_WINE_KEIL_PATH) LC_ALL=en_US wine cmd /c
修改为:
  MCS51_WINE_IAR=env WINEPREFIX=$(MCS51_WINE_IAR_PATH) LC_ALL=en_US; wine
  MCS51_WINE_KEIL=env WINEPREFIX=$(MCS51_WINE_KEIL_PATH) LC_ALL=en_US; wine cmd /c
文件3:/opt/tinyos-2.x-contrib/diku/env
将其中:export TOSROOT=/opt/tinyos-2.x
修改为:export TOSROOT=/opt/tinyos-2.1.1

6. 编译过程:
source /opt/tinyos-2.x-contrib/diku/env
cd /opt/tinyos-2.x-contrib/diku/common/apps/BlinkNoTimerTask
make cc2430em

7. 输出结果:
〖Linux〗zigbee实验之cc2430移植tinyos2.x的步骤(Ubuntu13.10)

8. 生成的文件展示:

[scue@Link:BlinkNoTimerTask]$ ls -1 build/cc2430em/
APP
app.c
app.hex
app.lst
app.map
app.obj
app.preMangle.c
app.reg
APP.SBR
CC2430-F128.bat
ident_flags.txt
startup.a51
startup.bat
startup.LST
startup.OBJ

9. 烧写至开发板(这一步要在Windows上操作,可使用虚拟机):

〖Linux〗zigbee实验之cc2430移植tinyos2.x的步骤(Ubuntu13.10)

需要工具: Setup_SmartRFProgr_1.9.0.exe
安装好之后,操作步骤:
  1). System-on-Chip:要显有设备,不显示则下载驱动
  2). Flash image路径:选择好刚刚编译出来的app.hex文件;
  3). 点击Read IEEE,并勾选:Retain IEEE address when reprogramming the chip
  4). Actions:勾选第二项的Erase, program and verify
  5). 最后点击"Perform actions",完成刷入;

参考文档:

1. http://www.tinyos8051wg.net/install#toc15

2. http://hi.baidu.com/sendoc/item/ed7b2e351cc1d3c42e8ec2a0

3. http://www.cnblogs.com/yixiaoyang/archive/2010/12/30/1922548.html

4. http://blog.sina.com.cn/s/blog_4774da410100faam.html

5. http://blog.csdn.net/xiaobaicaihaochi/article/details/9170991

6. http://www.linuxidc.com/Linux/2011-09/42435.htm