Search This Blog

Sunday, January 24, 2010

How to install TinyOS 2 on MacOSX 10.6 (Snow Leopard)

by machine@9#
(please contact me via email machine@net9.org)

Pre-requirements:
XCode ( install from either DVD or http://developer.apple.com/tools/xcode/ )


1. Installing MacPorts ( Darwin Ports )
Download MacPorts from http://www.macports.org/ and install

2. Installing NesC and avr/msp430 tools
There is something incompatible with SL. (Actually, it is a script error.)
Thanks to Razvan's ports.git, we can install NesC like this:
  • cd /Users/user and run git clone git://hinrg.cs.jhu.edu/git/ports.git
  • Edit /opt/local/etc/macports/sources.conf to include a line: file:///Users/user/ports (This line should be put before all other lines)
  • sudo port install msp430-binutils-tinyos msp430-gcc-tinyos msp430-libc-tinyos (for MSP430)
  • sudo port install avr-binutils-tinyos avr-gcc-tinyos avr-libc-tinyos avrdude-tinyos (for AVR)

3. Installing FTDI Drivers
Download and install drivers from http://www.ftdichip.com/Drivers/VCP.htm


4. Installing tinyos2.x
Enter your work directory and run git clone git://hinrg.cs.jhu.edu/git/tinyos-2.x.git
This copy is imported from TinyOS CVS and updated.
Then we need to set environmental variables about TinyOS.
Tinyos.sh is officially provided. We can place it in tinyos source directory and add a line "source @your_path@/tinyos.sh" into the '.profile' file home directory. This script would be run any time we open a new terminal. Also, remember to replace  "@your_path@" with real path both in tinyos.sh and this line of code.

5. Installing the tinyos2.x toolset
Run commands like following:
  • cd tools
  • ./Bootstrap
  • ./configure
  • make
  • sudo make install 
  • sudo tos-install-jni 
  • cd $TOSROOT/support/sdk/java 
  • make
In this step we may encounter several compiling errors.
a)The first one is "file not found: PrintMsg.java"
I don't know why, but thefile "support\sdk\java\net\tinyos\message\SerialPacket.java" is missing in the newest version of TinyOS
Just copy it from and an older repository and run again. 

b)The second one is "/usr/include/stdlib.h:272 syntax error before '^'"
If it happens, one solution is to install gcc4.3 by macports and execute above commands again.
  • sudo port install gcc43 (It may take hours...)
  • sudo port install gcc_select (Gcc_select is a useful tool to readily change default gcc.)


6. Compiling an Application
  • cd $TOSROOT/apps/Blink
  • make telosb 

Finally, we come to the end.
Of course you can try more applications as described in official website.

Reference :
3. A large amount of helpful resources from google.

2 comments:

  1. I get the following at the end. Any idea why?
    javac PrintfMsg.java
    javac: file not found: PrintfMsg.java
    Usage: javac
    use -help for a list of possible options
    make[3]: *** [PrintfMsg.class] Error 2

    ReplyDelete