Tinyos installation steps under Ubuntu

Tinyos system installation for Micaz nodes

Note: In order to keep the bottom line and exercise everyone's hands-on ability, I wrote this document, which contains the steps and problems that I need to pay attention to when I do it.

First of all, let’s introduce Tinyos, TinyOS is an open source operating system developed by UC Berkeley ( University of California, Berkeley ) , designed for embedded wireless sensor networks ; but unlike general systems, Tinyos cannot be installed in Winsows systems, It is a system developed under LINUX system, so its installation is divided into two types: (1) Install cgwin under WINDOWS XP, and then install Tinyos in cgwin, so the role of cgwin is only a platform (2) Install a LINUX system - ubuntu, install Tinyos under ubuntu, personally feel that the installation in cgwin is more complicated, and it is a good thing to contact ubuntu for LINUX development, so I choose the latter, the following introduction is also this method. My system is WIN7.

Closer to home, talk about the installation steps:

The first step: divide a new disk space, about 20G, create a new disk, that is, look at which disk has more free space, and take out some points to create a new compressed volume.

Note: ( 1) When dividing the disk space, it is necessary to first take out the space of the disk whether it is in NTFS format or not, if it is not in NTFS format, if it is in FAT32 format, after dividing the new disk space, the original disk will be formatted. , Do pay attention! ! ! ! If you are really worried, back up the disk to be divided.

For the conversion method, see http://jingyan.baidu.com/article/0eb457e57c08df03f1a905f0.html

     ( 2) Do not divide the system disk, otherwise the original system will be unstable.

Method of dividing disk space: http://jingyan.baidu.com/article/91f5db1bd31dec1c7f05e392.html

Step 2: Assuming that everyone has divided the disk space, the following is to install the LINUX system - Ubuntu

( 1) Ubuntu14.04 has been released now, but it is not easy to install. I am using Ubuntu12.04, the desktop version (desktop).  When downloading, please note that if your computer is 64 -bit, download http:// releases.ubuntu.com/precise/ubuntu-12.04-desktop-amd64.iso , if 32 -bit download http://releases.ubuntu.com/precise/ubuntu-12.04-desktop-i386.iso

     ( 2 ) You can use the mirror tool to open the mirror file, and extract the  Wubi.exe installer from it. After downloading, put the Wubi and Ubuntu 12.04 image files in the root directory of the same partition (must be in the same directory!), so we will start the installation.

     ( 3): Find the Wubi we just extracted, and double-click to run Wubi.exe. Choose what you want to install Ubuntu here. The first step is to allocate space for Ubuntu on the newly created partition on the disk , set the language environment, and set your user name and login password. The interface is as shown in the screenshot, but the content inside is based on your own Set it up according to the actual situation, and then click Install. Wubi will automatically find the image file you downloaded and install it automatically. Username and password should be remembered and used when logging in to the system .

 

       ( 4) After the installation is complete, restart the computer, you will see the following interface:

 

Select UBUNTU to start. After startup, you will see the gorgeous screen of Ubuntu. Personally, I feel that compared with Windows, it is a different scene. It's half done now!

( 4) At this time, Ubuntu is not sound and needs some configuration. The third step only talks about the configuration required to install the Tinyos system. Other configurations (such as video configuration, 3D configuration, and the configuration of various driver software can be experienced if you have time in the future). For a moment, refer to http://blog.csdn.net/zouxy09/article/details/7893175 ).    

   Step 3: Install and configure Tinyos2.1.1 (this step requires every step to be installed, and is the key to the subsequent operation of Tinyos. Even if every step is done, it is very likely that the installation will not be successful, because I can't guarantee it once. The installation is successful! You may encounter various problems at that time, and you may encounter unexpected problems, and then check the information to solve them. You must firmly believe that the future is bright, and the road is tortuous... ) OK, there are many versions of Tinyos system, and the one I installed is tinyos-2.1.1 , the following configuration is required:

       1) Open the terminal, enter sudo-i, the function is to use root to enter, it may pop up please enter the password, this password is your login password, and the cursor will flash in place when you enter the password, and will not go backwards, In fact, it has been entered, although it is enough to enter the password in sequence, this is the security action of the system.

Open etc/apt/sources.list with the gedit /etc/apt/sources.list command and add the following code:

deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main

deb http://hinrg.cs.jhu.edu/tinyos oneiric main

( 2) Update the knowledge base, open the terminal, and enter

sudo apt-get update

3)安装TinyOS  sudo apt-get install tinyos-2.1.1

( 4) Set the environment variable Open ~/.bashrc with the gedit ~/.bashrc command, and add the following code to it: #Sourcing the tinyos environment variable setup script source /opt/tinyos-2.1.1/tinyos.sh Required after successful addition restart terminal  

All commands to open files are gedit. . . . . .

( 5) Many blogs on the Internet have written that you need to reinstall jdk yourself, but the version of jdk according to the installation method I described above is as follows: java version "1.6.0_20" , so I did not reinstall jdk myself

( 6) Install the python development package: apt-get install python-dev This step is necessary, otherwise an error will be reported when running make micaz sim: The simulation cannot find Python.h. Once installed, open /opt/tinyos-2.1.1/support/make/sim.extra through the terminal, find the line PYTHON_VERSION=2.x, and change 2.x to the current python version number. Use python -V to view the result If it is "Python 2.6.6", you need to change to 2.6

7) Environment variable configuration Edit the /opt/tinyos-2.1.1/tinyos.sh file, modify the CLASSPATH environment variable, and modify the 13th line to: CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/tinyos.jar: . The method to open the tinyos.sh file is the same as above gedit /opt/tinyos-2.1.1/tinyos.sh

( 8) Set the TinyOS environment variable to be automatically set when the shell is started. Add the following statement to the .bashrc file under $HOME:

source /opt/tinyos-2.1.1/tinyos.sh export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:. Last . Don't lose!

 The method of opening the ~/.bashrc file is the same as the above gedit ~/.bashrc

(9) Install the JNI and compilation environment g++ that TinyOS will use in the future

Enter the command: tos-install-jni   

sudo apt-get install g++

( 10) Run tos-check-env to check if you have installed it correctly

However, remember to close all terminals and restart the shell for the new environment variables to take effect. WARNING about graphvis can be ignored.

At this point, the configuration is theoretically complete. If there is no problem, we are 90% successful, but whether there is a problem depends on the results of the next step. Restart the computer for the fourth step.

Step 4: Burn the test program Blink of the node . The Blink program is the node test program that comes with Tinyos, in order to verify whether the node is normal and whether the system is installed correctly. The following is the moment to witness the miracle, if it fails, we have to continue to fiddle with the third part =,=!!

(1) Insert the node on the burning board, set the USB to serial port, refer to http://www.docin.com/p-95252341.html

( 2) Second, enter the terminal and enter the following command:

$make iris sim

$make iris

(3)$make micaz install.0 mib510,/dev/ttyS0

Among them, the ttyS4 port number -1 is obtained, the port number is passed, and the computer is different, the assigned port number is different, you need to try several times, the default is 0.

if it appears

 

And the three small lights on the node flash in binary, even if it is successful!

The above is what I have done before. It is just a basic introduction. It didn't take long at that time. If you really want to use the nodes to send and receive data, you will have to work harder! For the future research, I may not be able to help, and I have to rely on everyone to search for materials and study, because I was looking for materials everywhere, and even the doctoral students of Northeastern University who I asked for help from my classmates, but this can also exercise Everyone's problem-solving skills! For example , for the content analysis of the Blink program, please refer to http://blog.csdn.net/jacoxu/article/details/7745296 . There are also experimental steps about the communication between two nodes in his blog. This is further research, and There are many, many, you need to program and develop under the LINUX system. Now we are recruiting to see that LINUX development is very hot. Those who plan to engage in this field in the future can study hard, and it is also very helpful for finding a job!

 

 

 

 

with test

The easiest installation steps I have used so far, and the speed is quite fast. Pro test is easy to use.

Solemn reminder: install ubuntu12.04 system, do not update things, 14.04 has been used but shamefully failed. Therefore, 12.04 is recommended. For the installation process, please refer to my previous article http: //blog.csdn .NET /u012322855/article/details/50813071 .

 

tinyos environment build:

1 ) Configure the source source, modify /etc/apt/sources.list

Command sudo gedit /etc/apt/sources.list

Add deb http://hinrg.cs.jhu.edu/tinyos karmic main at the end.

2 ) Update the list of catalog packages. Enter sudo apt-get update  in the console

3) Install the latest version of tinyos and its related tools.

Command line input: sudo apt-get install tinyos

4) Version selection may be prompted, so we choose a version, recommend 2.1.1

Command line input: sudo apt-get install tinyos-2.1.1

A few hours I spent more than 1 hour.

5) Enter the /opt/tinyos2.1.1 directory, modify the tinyos.sh file, and modify the CLASSPATH line to:

CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/Java:.:$TOSROOT/support/sdk/java/tinyos.jar

In fact, the first half is already there from ":. : "You can start adding it. (The content in "" is replaced by the English input method)

6 ) Go to /homeyourname . In fact, this is the path to open the console by default. Type: sudo gedit .bashrc . Opened the .bashrc file. (The actual path cannot see this file, it is hidden)

Add below the file:

#Source the tinyos environment variable setup script

source /opt/tinyos-2.1.1/tinyos.sh

these two lines

7 ) Run the bashrc file and enter in the console:

source .bashrc

Then it will print out Setting up for TinyOS 2.1.1

8) Run the tos-install-jni command:

sudo tos-install-jni

If the prompt is similar to [: 31:=:unexpected operator error, edit /usr/bin/tos-install-jni and change the first line from "#!/bin/sh" to "#!bin/bash"

9) Check the environment

tos-check-env

WARNING is reported below , don't worry, it's fine without ERROR .

10 tests

Go to the Blink directory under the apps in the tinyos directory

cd /.../tinyos2.1.1/apps/Blink/ don't forget the final slash

Command line input:

make telosb

Then there will be a lot of output, and it will succeed without errors.

 

Test LED lights

Start with a specific experiment

Preparation: telosb node with usb input

1 ) Connect.

Connect the node to the usb port, and then enter the console: motelist

You will see three columns of Reference Device Description . /dev/ttyUSB0 under Device is the port number. Indicates that the firing was successful.

2 ) Go to the Blink directory, remember to add / at the end of the path , and enter sudo make telosb install . If this command does not work, first enter su to get the privileged command permission. Then enter: make telosb install The light is on and it is successful.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324853685&siteId=291194637