contiki 参考

文章出处

http://www.amobbs.com/thread-5515866-1-1.html


搞zigbee算是国内第一批了,很早就知道6lowpan。用cc2430时,从研究http://www.tinyos8051wg.net,找寻资料了解到 Nanostack1.0.0,直到Nanostack1.1.0 之后就转为contiki了。好久没发帖了,发个帖Mark一下,先!

1. Download Instant Contiki


1. Download Instant Contiki
http://sourceforge.net/projects/contiki/files/Instant%20Contiki/
2. Install VMWare Player
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0
3. Log into Instant Contiki. 
password is: user
4. 编译~/contiki/examples/cc2530dk下例子,需要先安装SDCC.
  参考文档
  
https://github.com/contiki-os/contiki/wiki/8051-Requirements
  4.1)下载SDCC
  cd /opt
  sudo svn co -r 7100 
https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc/
  4.2) 更改配置
  sudo vi /opt/sdcc/device/libs/incl.mk
  将最后一行
  MODELS = small medium large
  替换为
  MODELS = small large huge
  sudo vi /opt/sdcc/device/libs/Makefile.in
  将最后一行
  TARGETS += models small-mcs51-stack-auto
  替换为
  TARGETS += models model-mcs51-stack-auto
  cd /opt/sdcc
  •Run this:
  
sudo ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port \
  --disable-ds400-port --disable-pic14-port --disable-pic16-port \
  --disable-hc08-port --disable-r2k-port --disable-z180-port \
  --disable-sdcdb --disable-ucsim

  此过程若出现 
  configure: error: boost library not found (boost/graph/adjacency_list.hpp)
  执行
  sudo apt-get install libboost-graph-dev
  完成后,重新执行
    sudo ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port \
  --disable-ds400-port --disable-pic14-port --disable-pic16-port \
  --disable-hc08-port --disable-r2k-port --disable-z180-port \
  --disable-sdcdb --disable-ucsim

  4.3)编译,安装
  sudo make
  sudo make install

  4.4)完成
  sdcc -v
  显示
  SDCC : mcs51 3.1.1 #7100 (Jan 10 2013) (Linux)
5. 编译cc2530dk
  5.1) hello world
  cd ~/contiki/examples/cc2530dk
  make hello-world
  编译完成
  
user@instant-contiki:~/contiki/examples/cc2530dk$  ls
  blink-hello.c         hello-world.c         obj_cc2530dk           timer-test.c
  blink-hello.cc2530dk  hello-world.cc2530dk  sensors-demo.c         timer-test.cc2530dk
  blink-hello.cdb       hello-world.cdb       sensors-demo.cc2530dk  timer-test.cdb
  blink-hello.hex       hello-world.hex       sensors-demo.cdb       timer-test.hex
  blink-hello.lk        hello-world.lk        sensors-demo.hex       timer-test.lk
  blink-hello.map       hello-world.map       sensors-demo.lk        timer-test.map
  blink-hello.mem       hello-world.mem       sensors-demo.map       timer-test.mem
  blink-hello.omf       hello-world.omf       sensors-demo.mem       timer-test.omf
  border-router         Makefile              sensors-demo.omf       udp-ipv6
  contiki-cc2530dk.lib  Makefile.target       sniffer
  5.2) udp-ipv6
  cd ~/contiki/examples/cc2530dk/udp-ipv6
  make
  报错,缺少srecord
  Pack hex file
  ===============
  srec_cat -disable_sequence_warnings client.banked-hex -intel -crop 0x18000 0x1FFFF -offset -65536 -o bank1.hex -intel
  /bin/sh: 5: srec_cat: not found
  srec_cat -disable_sequence_warnings client.banked-hex -intel -crop 0x28000 0x2FFFF -offset -98304 -o bank2.hex -intel
  /bin/sh: 5: srec_cat: not found
  srec_cat -disable_sequence_warnings client.banked-hex -intel -crop 0x38000 0x3FFFF -offset -131072 -o bank3.hex -intel
  /bin/sh: 5: srec_cat: not found
  srec_cat -disable_sequence_warnings client.banked-hex -intel -crop 0x48000 0x4FFFF -offset -163840 -o bank4.hex -intel
  /bin/sh: 5: srec_cat: not found
  make: *** [client.hex] Error 127
  执行
  sudo apt-get install srecord
6. TI SmartRF Flash Programmer 烧录 *.hex
  已烧录hello-world.hex为例,CC2530 UART0 会打印输出如下信息:
  ##########################################
  Contiki-2.6
  TI SmartRF05 EB
  cc2530-F256, 08KB SRAM
  SDCC Build:
    --model-large
    --stack-auto
   Net: Rime
   MAC: CSMA
   RDC: nullrdc
  ##########################################
  Rime is 0x02 bytes long
  Reading MAC from Info Page
  Rime configured with address c6:1c
  Rime is 0x02 bytes long
  Reading MAC from Info Page
  Rime configured with address 67:af
  Hello World!
7. 建立自己的硬件平台[我的是:edutech]和工程[我的是:edutech]
  7.1) cpu
  
cd ~/contiki/cpu/cc253x
  cp Makefile.cc253x Makefile.cc253x-edutech
  cp bank-alloc.py bank-alloc-edutech.py

  vi Makefile.cc253x-edutech
  编辑第14行
  BANK_ALLOC = $(CONTIKI_CPU)/bank-alloc.py
  为
  BANK_ALLOC = $(CONTIKI_CPU)/bank-alloc-edutech.py
  保存
:wq
  vi bank-alloc-edutech.py
  编辑第101行
  file_pat = re.compile('obj_cc2530dk[^ ]+\.')
  为
file_pat = re.compile('obj_edutech[^ ]+\.')
  将文中4处,157、158、172、173行中
  bank-alloc.py 替换为 bank-alloc-edutech.py 
  保存
:wq
  7.2) platform
  cd ~/contiki/platform
  cp cc2530dk edutech -R
  cd edutech
  mv Makefile.cc2530dk  Makefile.edutech
  vi Makefile.edutech

  编辑第1行[非必须]
  # cc2530dk platform makefile
  为
  # edutech platform makefile
  编辑第19行
  CLEAN += *.cc2530dk
  为
  CLEAN += 
*.edutech *.native
  编辑第52行,最后一行
  include $(CONTIKI_CPU)/Makefile.cc253x
  为
  include $(CONTIKI_CPU)/Makefile.cc253x-edutech
  保存
  :wq
  接下来根据实际硬件情况,编辑或创建驱动文件
  7.3) project
  cd ~/contiki/examples
  cp cc2530dk/ edutech -R
  cd edutech
  vi Makefile.target
 
  编辑第1行
  TARGET = cc2530dk
  为
  TARGET = edutech
  保存
  :wq
  make 
  之后,根据实际情况,继续。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值