TinyOS-2.1.1 Installation on Ubuntu 12.04 and Hello World

轉載自:http://xuepengxu.blogspot.com/2012/05/tinyos-211-installation-on-ubuntu-1204.html;

主要時我也遇到了這個問題,就是編譯make telosb時出現問題,現在按照這個方法可以解決,不過最後我下載的時adm64的MSP430編譯器,要具體看每個的配置而定

I am working on TinyOS and nesc recently, but installation confused me for a long time.

Finally, I found a way to make it.
Install TinyOS-2.1.1 on Ubuntu 12.04


  1. add TinyOS-2.1.1 to source list.
    You can open the /etc/apt/source.list to edit the file.
    sudo gedit /etc/apt/sources.list

    and add
     deb http://tinyos.stanford.edu/tinyos/dists/ubuntu natty main

    or you can open ubuntu software centre and choose edit, choose software sources, other software, add, put the above sentence in the dialog. 

  2. open your terminal, type in
    sudo apt-get update
  3. install tinyos
     sudo apt-get install tinyos
  4. add the following lines to ~/.bashrc
    source /opt/tinyos-2.1.1/tinyos.sh
    export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.


After you finish the above steps, you get TinyOS-2.1.1 successfully on your host. However, when you go to  /opt/tinyos-2.1.1/apps/Blink to compile your first program


make telosb


you may get error like this:

mkdir -p build/telosb
compiling BlinkAppC to a telosb binary
ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DDEFINED_TOS_AM_GROUP=0×22 -DIDENT_APPNAME=\”BlinkAppC\” -DIDENT_USERNAME=\”liruan\” -DIDENT_HOSTNAME=\”liruan-desktop\” -DIDENT_USERHASH=0x93f2e5efL -DIDENT_TIMESTAMP=0x4e98142bL -DIDENT_UIDHASH=0x40bf25adL BlinkAppC.nc -lm
In file included from /opt/tinyos-2.1.1/tos/platforms/telosa/PlatformLedsC.nc:38,
from /opt/tinyos-2.1.1/tos/system/LedsC.nc:38,
from BlinkAppC.nc:45:
In component `HplMsp430GeneralIOC’:
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:227: syntax error before `;’
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:321: cannot find `P30′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:322: cannot find `P31′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:323: cannot find `P31′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:324: cannot find `P32′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:325: cannot find `P33′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:326: cannot find `P33′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:327: cannot find `P34′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:328: cannot find `P35′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:330: cannot find `P50′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:331: cannot find `P51′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:332: cannot find `P52′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:333: cannot find `P53′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:334: cannot find `P36′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:335: cannot find `P37′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:337: cannot find `P60′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:338: cannot find `P61′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:339: cannot find `P62′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:340: cannot find `P63′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:341: cannot find `P64′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:342: cannot find `P65′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:343: cannot find `P66′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:344: cannot find `P67′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:346: cannot find `P66′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:347: cannot find `P67′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:349: cannot find `P67′
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:350: cannot find `P57′
In component `PlatformLedsC’:
/opt/tinyos-2.1.1/tos/platforms/telosa/PlatformLedsC.nc:48: cannot find `Port54′
/opt/tinyos-2.1.1/tos/platforms/telosa/PlatformLedsC.nc:51: cannot find `Port55′
/opt/tinyos-2.1.1/tos/platforms/telosa/PlatformLedsC.nc:54: cannot find `Port56′
make: *** [exe0] Error 1


It is the problem of msp430 packages. The 2.1.1 is good to compile mica, but not telos. 
So, we have to remove msp430 packages and install the old packages.


remove msp430

sudo apt-get autoremove --purge msp430-tinyos

sudo apt-get autoremove --purge msp430-gcc-tinyos

download old packages from here:
double click them in the following order:
tinyos-base
binutils-tinyos
gcc-tinyos
libc-tinyos
tinyos
optional-tinyos

or you can use the following commands(all for 32 bits):

sudo dpkg -i msp430-tinyos-base_2.1-20080806_all.deb 
sudo dpkg -i msp430-binutils-tinyos_2.17-20080806_i386.deb
sudo dpkg -i msp430-gcc-tinyos_3.2.3-20080806_i386.deb
sudo dpkg -i msp430-libc-tinyos_20060801cvs-20080806_i386.deb 
sudo dpkg -i msp430-tinyos_2.1-20080806_all.deb
sudo dpkg -i msp430-optional-tinyos_2.1-20090326_all.deb


Now, you can compile the packages successfully.

Well, when you trying to move the program to the chips, you may run the following command:


make telosb reinstall bsl,DEVICE

where DEVICE is the USB Device path provided from motelist command. example: make telosb reinstall bsl,/dev/ttyUSB0
you may still get errors. mainly because of the permission to access the Device. what you can do is to add the user to the group tty


sudo gpasswd -a username tty


and then give the user the permission to access to the Device

sudo chmod 666 /dev/ttyUSB0

if your Device is ttyUSB0

Now you can find your program copy to the chip.
發佈了23 篇原創文章 · 獲贊 29 · 訪問量 19萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章