XP, Quartus II 7.2 with SP1, Nios II 7.2 with SP1, MegaCore IP 7.2, Tinyos Toolchain
Step 1: Install Java 1.5 JDK
Windows Download and install Sun’s 1.5 JDK from http://java.sun.com.
Linux Download and install IBM’s 1.5 JDK from http://www-128.ibm.com/developerworks/java/jdk/.
Step 2: Install Cygwin Related Packages
- Check the version of Cygwin by using cygcheck -c, the newest version of Cygwin for SOPC Builder 7.2 should be 1.5.24-2, if older than this please patch it.
- Download the confirmed-compatible cygwin packages from the tinyos web site here .
- In a cygwin shell, unzip the above package into some directory. In these instructions the directory is /cygdrive/c/newcygpkgs.
$ cd /cygdrive/c/newcygpkgs
$ tar zxvf cygwin-1.2a.tgz
This unzips the packages.
- In Windows Explorer, navigate to /cygdrive/c/newcygpkgs and click on the file setup.exe. Setup.exe is the setup program distributed by Cygnus Solutions.
- Follow these steps when the Cygwin Setup windows appears:
- Opt to disable the virus scanner (it will be enabled when you’re finished).
- Opt to Install from Local Directory.
- Specify the Root directory to be where your current cygwin installation is. This would be the directory that directories like ‘opt’ and ‘usr’ are in. For example, mine is rooted at c:\tinyos\cygwin, so I enter that.
- Select to Install for All Users
- Select the Unix file type (very important!)
- For the Local Packages Directory, specify where you unzipped the cygwin packages tarfile. For example, I would specify c:\newcygpkgs. (The setup.exe program will probably select the right default directory.)
- The next window will allow you to select packages to install. You should see that most of the packages have an X-ed box next to them; these are the packages that are to be installed.
- Click install.
- You might see a message explaining that you need to reboot because some files are in use. This most likely means that your cygwin DLL is loaded and in-use and, therefore, cannot be replaced. When you reboot, the new DLL will be loaded.
- Related to the above warnings, if you see warnings about the cygwin1.dll not being found, don’t worry. All will be well once you reboot and the right DLL is loaded.
Step 3: Install native compilers
Not so sure what else should it be installed, cauz we build tinyos toolchain on Nios II. Just wait and see.
To test whether tinyos environment could work or not, I install TI MSP430 Tools on the NIOS SOPC Builder after step 5.
Install the appropriate version of the following (Windows or Linux, avr or msp430 or both) with the rpm command ‘rpm -ivh rpm>‘. On windows, if you get an error claiming that the rpm was build for an NT computer and you’re on a windows NT computer, bypass the erroneous error by using ‘rpm -ivh –ignoreos rpmname‘. (We have xscale compiler tools online at http://www.tinyos.net/dist-1.2.0/tools/ but they have not yet been extensively tested by a large community.)
TI MSP430 Tools
Step 4: Install TinyOS toolchain
The TinyOS-specific tools are the NesC compiler and a set of tools developed in the tinyos-2.x/tools source code repository. They are also installed using rpms. If you using the Cygwin version recommended in these install instructions, you should install the "Recommended" Windows/Cygwin nesC RPM. If you get strange errors when you try to compile TinyOS programs, such as the error message "the procedure entry point basename could not be located in the dynamic link library cygwin1.dll", this is likely due to a Cygwin version incompatibility: try the "Other" Windows/Cygwin RPM (1.2.7a). If you are using Cygwin and installing the nesC RPM causes an error that the RPM was built for Cygwin, add the
Tool : NesC
rpm -ivh --force (1.x tree)
rpm -Uvh (no 1.x tree)
error: Failed dependencies:
nesc >= 1.2.7 is needed by tinyos-tools-1.2.4-2
rpm -Uvh –nodeps tinyos-tools-1.2.4-2.cygwin.i386.rpm, but not sure whether could work normally.
In another installation, execute:
rpm -Uvh –nodeps tinyos-tools-1.2.4-2.cygwin.i386.rpm , sth wrong again, but could ignore first.
[SOPC Builder]$ rpm -Uvh –ignoreos tinyos-tools-1.2.4-2.cygwin.i386.rpm
Preparing… ########################################### [100%]
1:tinyos-tools ########################################### [100%]
/var/tmp/rpm-tmp.81844: ./giveio-install: permission denied
Installing Java JNI code in /cygdrive/c/Program Files/Java/jdk1.5.0_13/jre/bin .
In another installation, this error doesn’t appear.
Step 5: Install the TinyOS 2.x source tree
Now that the tools are installed, you need only install the tinyos 2.x source tree and then set your environment variables. Install the appropriate version of the following (Window or Linux) with the rpm command ‘rpm -ivh rpm‘. As with the previous rpms, if you get an error claiming that the rpm was built for an NT computer and you’re on a windows NT computer, bypass the erroneous error by using ‘rpm -ivh –ignoreos rpmname‘.
- Install tinyos-2.x
Note: The same prolem encountered, the error of this time is
error: Failed dependencies:
tinyos-tools >= 1.2.4 is needed by tinyos-2.0.2-2
rpm -Uvh –nodeps
tinyos-2.0.2-2.cygwin.noarch.rpm , and ignore the dependency.
Note: Could not find /opt/tinyos-2.x in Cygwin, is it because of access right???, stopped!!
When add –ignoreos parameter, these errors would not appear any more.
- Pending & Try another way: Installing uClinux on it first to see their solutions to build cross-tools on Nios II. —–It turns out that errors also exist in uClinux, anyway, since I have figured out part of the problems installing TinyOS in SOPC Builder, let me continue the above work.
- Configure your environment
Ideally, you’ll put these environment variables in a shell script that will run when your shell starts, but you needn’t put such a script under /etc/profile.d.
The example settings below assume that the tinyos-2.x installation is in /opt/tinyos-2.x. Change the settings to be correct for where you’ve put your tinyos-2.x tree. Note that the windows CLASSPATH must be a windows-style path, not a cygwin path. You can generate a windows style path from a cygwin-style path using ‘cygpath -w’. For example:
export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar` export CLASSPATH="$CLASSPATH;."
†Only necessary if you’re using the MSP430 platform/tools.
I added the scripts into Altera\72\nios2eds\nios2_sdk_shell_bashrc
# Added By Neil For TinyOS 2.x Environment
export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar`
echo TinyOS Toolchain Configured
Note: There’s no space between ‘=’.
Finally, if you have installed TinyOS 2.0.1, there is a bug in TOSSIM (which will be fixed in 2.0.2). The bug is in file tos/chips/atm128/sim/atm128_sim.h. Change these lines 22 and 23 from:
#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + 0x20) #define _SFR_IO16(io_addr) _MMIO_WORD((io_addr) + 0x20)
#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr)) #define _SFR_IO16(io_addr) _MMIO_WORD((io_addr))
If you do not do this, then timers will not work correctly.
Step 6: Installing Graphviz
Go to download page of the Graphviz project and download the appropriate RPM. You only need the basic graphviz RPM (graphviz-); you don’t need all of the add-ons, such as -devel, -doc, -perl, etc. If you’re not sure what version of Linux you’re running,
might give you some useful information. Install the rpm with rpm -i rpm-name. In the case of Windows, there is a simple install program, so you don’t need to deal with RPMs.
Note: Actually I don’t know what’s this for, since they suggest me to install, just do it;).
That’s all, I will write another article related with how to test this environment soon. Please wait and see^_^