⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getting started with tinyos - tinyos documentation wiki.htm

📁 从官方网站上下载tinyos2.0的学习指南
💻 HTM
📖 第 1 页 / 共 4 页
字号:
reason make is invoking the wrong one. </P>
<P><TT>ncc</TT> is a script that invokes the full compiler, <TT>nescc</TT>. It 
lives in <TT>tinyos-2.x/tools/tinyos/ncc</TT>. If you've installed from an RPM, 
then the RPM put the new version of <TT>ncc</TT> in <TT>/usr/bin</TT>. You can 
see which version make is invoking by typing <TT>which ncc</TT>: </P><PRE>$ which ncc
/usr/local/bin/ncc
$ /usr/local/bin/ncc --version
Unknown target mica
Known targets for TinyOS directory /opt/tinyos-2.x/tos
and the specified include directories are:
none.
</PRE>
<P>In this case, the version of ncc is so old that it doesn't even respond to 
the <TT>--version</TT> flag. In contrast, </P><PRE>$ /usr/bin/ncc --version
ncc: 1.2.1
nescc: 1.2.5
</PRE>
<P>The best solution to this problem is to move the old ncc to a different name 
(keep in around in case you need to go back to your old setup): </P><PRE>$ mv /usr/local/bin/ncc /usr/local/bin/ncc.old
$ which ncc
/usr/bin/ncc
</PRE>
<P>You can apply the same process for <TT>nescc</TT>: </P><PRE>$ nescc --version
ncc: 1.1.2
$ which nescc
/usr/local/bin/nescc
$ /usr/bin/nescc --version
nescc: 1.2.5
$ mv /usr/local/bin/nescc /usr/local/bin/nescc.old
$ which nescc
/usr/bin/nescc
</PRE>
<P>Now that we've compiled the application it's time to program the mote and run 
it. The next step depends on what family of mote you are programming. </P>
<UL>
  <LI><A title="Getting Started with TinyOS" 
  href="http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS#Installing_on_a_mica-family_mote_.28micaz.2C_mica2.2C_mica2dot.29">Installing 
  on a mica-family mote (micaz, mica2, mica2dot)</A> 
  <LI><A title="Getting Started with TinyOS" 
  href="http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS#Installing_on_telos-family_mote_.28telosa.2C_telosb.29">Installing 
  on telos-family mote (telosa, telosb)</A> 
  <LI><A title="Getting Started with TinyOS" 
  href="http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS#Installing_on_a_TinyNode_mote">Installing 
  on a TinyNode mote</A> 
  <LI><A title="Getting Started with TinyOS" 
  href="http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS#Installing_on_an_eyesIFX-family_mote">Installing 
  on an eyesIFX-family mote</A> 
  <LI><A title="Getting Started with TinyOS" 
  href="http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS#Installing_on_an_IntelMote2">Installing 
  on an IntelMote2</A> </LI></UL><A 
name=Installing_on_a_mica-family_mote_.28micaz.2C_mica2.2C_mica2dot.29></A>
<H2><SPAN class=mw-headline>Installing on a mica-family mote (micaz, mica2, 
mica2dot)</SPAN></H2>
<P>This example uses a Mica2 mote and the serial-based programming board (<FONT 
face=monospace>mib510</FONT>). Instructions on how to use other programming 
boards are <A class="external text" 
title=http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/programmers.html 
href="http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/programmers.html" 
rel=nofollow>here</A>. To download your program onto the mote, place the mote 
board (or mote and sensor stack) into the bay on the programming board, as shown 
below. You can either supply a 3 or 5 volt supply to the connector on the 
programming board or power the node directly. The green LED (labeled PWR) on the 
programming board will be on when power is supplied. If you are using batteries 
to power the mote, be sure the mote is switched on (the power switch should be 
towards the connector). The ON/OFF switch on the mib510 board should normally be 
left in the OFF position. Only switch it to ON if you have problems programming 
the mote and when you are done programming, switch it back to OFF (when the 
switch is ON the mote cannot send data to the PC). </P>
<P>Plug the 9-pin connector into the serial port of a computer configured with 
the TinyOS tools, using a pass-through (not null-modem!) DB9 serial cable. If 
your computer does not have a serial port, you can easily obtain 
DB9-serial-to-USB cables. </P>
<CENTER>
<TABLE cellSpacing=2 cellPadding=3>
  <TBODY>
  <TR>
    <TD>
      <P><A class=image title=Image:mica-offboard.jpg 
      href="http://docs.tinyos.net/index.php/Image:Mica-offboard.jpg"><IMG 
      height=221 alt=Image:mica-offboard.jpg 
      src="Getting Started with TinyOS - TinyOS Documentation Wiki.files/Mica-offboard.jpg" 
      width=320 border=0></A> </P></TD>
    <TD>
      <P><A class=image title=Image:mica-onboard.jpg 
      href="http://docs.tinyos.net/index.php/Image:Mica-onboard.jpg"><IMG 
      height=235 alt=Image:mica-onboard.jpg 
      src="Getting Started with TinyOS - TinyOS Documentation Wiki.files/Mica-onboard.jpg" 
      width=320 border=0></A> </P></TD></TR>
  <TR>
    <TD><I>Mica2 mote next to the programming board</I> </TD>
    <TD><I>Mica2 mote connected to the programming board</I> 
</TD></TR></TBODY></TABLE></CENTER>
<P>Type: </P><PRE>make mica2 reinstall mib510,<I>serialport</I>
</PRE>
<P>where <I>serialport</I> is the serial port device name. Under Windows, if 
your serial port is <TT>COM<I>n</I>:</TT>, you must use 
<TT>/dev/ttyS<I>n-1</I></TT> as the device name. On Linux, the device name is 
typically <TT>/dev/ttyS</TT><I>n</I> for a regular serial port and 
<TT>/dev/ttyUSB<I>n</I></TT> or <TT>/dev/usb/tts/<I>n</I></TT> for a USB-serial 
cable (the name depends on the Linux distribution). Additionally, on Linux, you 
will typically need to make this serial port world writeable. As superuser, 
execute the following command: </P><PRE>chmod 666 <I>serialport</I>
</PRE>
<P>If the installation is successful you should see something like the following 
(if you don't, try repeating the <TT>make</TT> command): </P><PRE>cp build/mica2/main.srec build/mica2/main.srec.out
    installing mica2 binary using mib510
uisp -dprog=mib510 -dserial=/dev/ttyUSB1 --wr_fuse_h=0xd9 -dpart=ATmega128
     --wr_fuse_e=ff  --erase --upload if=build/mica2/main.srec.out
Firmware Version: 2.1
Atmel AVR ATmega128 is found.
Uploading: flash

Fuse High Byte set to 0xd9

Fuse Extended Byte set to 0xff
rm -f build/mica2/main.exe.out build/mica2/main.srec.out
</PRE><A name=Installing_on_telos-family_mote_.28telosa.2C_telosb.29></A>
<H2><SPAN class=mw-headline>Installing on telos-family mote (telosa, 
telosb)</SPAN></H2>
<P>Telos motes are USB devices, and can be plugged into any USB port: </P>
<CENTER>
<TABLE cellSpacing=2 cellPadding=3>
  <TBODY>
  <TR>
    <TD>
      <P><A class=image title=Telos.jpg 
      href="http://docs.tinyos.net/index.php/Image:Telos.jpg"><IMG height=156 
      alt="" 
      src="Getting Started with TinyOS - TinyOS Documentation Wiki.files/240px-Telos.jpg" 
      width=240 border=0></A> </P></TD>
    <TD>
      <P><A class=image title=Telos2.jpg 
      href="http://docs.tinyos.net/index.php/Image:Telos2.jpg"><IMG height=172 
      alt="" 
      src="Getting Started with TinyOS - TinyOS Documentation Wiki.files/240px-Telos2.jpg" 
      width=240 border=0></A> </P></TD></TR>
  <TR>
    <TD><I>Telos mote</I> </TD>
    <TD><I>Telos mote plugged into a USB port</I> 
</TD></TR></TBODY></TABLE></CENTER>
<P>Because Telos motes are USB devices, they register with your OS when you plug 
them in. Typing <CODE>motelist</CODE> will display which nodes are currently 
plugged in: </P><PRE> $ motelist
 Reference  CommPort   Description
 ---------- ---------- ----------------------------------------
 UCC89MXV   COM4       Telos (Rev B 2004-09-27)
 
</PRE>
<P><I>motelist</I> tells you which ports have motes attached. Under Windows, it 
displays the mote's COM port (in this case 4), under Linux it displays just the 
USB serial port number (e.g., 2). Confusingly, the Windows version of the code 
installer (<TT>tos-bsl</TT>) takes the COM port number - 1 as it's argument (in 
this case 3); under Linux it takes the USB device name (e.g., /dev/ttyUSB2 or 
/dev/tts/usb/2 if motelist reports that the mote is device 2). On Linux, as with 
the mica programmers, you will typically need to make the USB serial port world 
writeable. As superuser, execute the following command: </P><PRE>chmod 666 <I>usb-device-name</I>
</PRE>
<P>Now you can install the application using one of: </P><PRE>  make telosb reinstall bsl,3            # Windows example
  make telosb reinstall bsl,/dev/ttyUSB2 # Linux example
</PRE>
<P>This would compile an image suitable for the telosb platform and install it 
with a mote ID of 2 on a mote connected to COM4 on Windows or /dev/ttyUSB2 on 
Linux. If you have a single mote installed, you can skip the bsl and device 
name/number arguments. Again, see the Getting Started Guide for your chosen 
platform for the exact make parameters. </P>
<P>You should see something like this scroll by: </P><PRE>    installing telosb binary using bsl
tos-bsl --telosb -c 16 -r -e -I -p build/telosb/main.ihex.out
MSP430 Bootstrap Loader Version: 1.39-telos-8
Mass Erase...
Transmit default password ...
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
Program ...
2782 bytes programmed.
Reset device ...
rm -f build/telosb/main.exe.out-2 build/telosb/main.ihex.out
</PRE><A name=Installing_on_a_TinyNode_mote></A>
<H2><SPAN class=mw-headline>Installing on a TinyNode mote</SPAN></H2>
<P>There are different ways to program a TinyNode mote depending on how it is 
connected to your computer. The most common case is to connect it to a serial 
port using either the standard extension board (SEB) or the MamaBoard. <I>(The 
other possible methods are to use a Mamaboard with a Digi Connect ethernet 
adaptor and program a node over the network, or to use a JTAG adaptor. These are 
not covered in this tutorial; please refer to the Tinynode documentation for 
further details.)</I> </P>
<P>To install an application on a TinyNode mote using the serial port, enter the 
following command, taking care to replace <TT>/dev/ttyXXX</TT> with the file 
device corresponding to the serial port that the tinynode is plugged into. </P><PRE>  make tinynode reinstall bsl,/dev/XXX
</PRE>
<P>As with the telos and eyesIFX platforms, this command will reprogram your 
mote using the <TT>tos-bsl</TT> utility, and you will see similar output on your 
screen as given above for telos. </P><A 
name=Installing_on_an_eyesIFX-family_mote></A>
<H2><SPAN class=mw-headline>Installing on an eyesIFX-family mote</SPAN></H2>
<P>The eyesIFX motes have a mini-B USB connector, allowing easy programming and 
data exchange over the USB. The on-board serial-to-USB chip exports two separate 
serial devices: a lower-numbered one used exclusively for serial data 
communication, and a higher-numbered one used for programming of the 
microcontroller. </P>
<CENTER>
<TABLE cellSpacing=2 cellPadding=3>
  <TBODY>
  <TR>
    <TD>
      <P><A class=image title=EyesIFX.jpg 
      href="http://docs.tinyos.net/index.php/Image:EyesIFX.jpg"><IMG height=61 
      alt="" 
      src="Getting Started with TinyOS - TinyOS Documentation Wiki.files/140px-EyesIFX.jpg" 
      width=140 border=0></A> </P></TD>
    <TD>
      <P><A class=image title="EyesIFX usb.jpg" 
      href="http://docs.tinyos.net/index.php/Image:EyesIFX_usb.jpg"><IMG 
      height=180 alt="" 
      src="Getting Started with TinyOS - TinyOS Documentation Wiki.files/240px-EyesIFX_usb.jpg" 
      width=240 border=0></A> </P></TD></TR>
  <TR>
    <TD><I>eyesIFXv2 mote</I> </TD>
    <TD><I>eyesIFXv2 mote attached to a USB cable</I> 
</TD></TR></TBODY></TABLE></CENTER>
<P>The actual programming is performed by the <I>msp430-bsl</I> script, 
conveniently invoked using the same <I>make</I> rules as for the telos motes. In 
the most basic form: </P><PRE>  make eyesIFX install bsl
</PRE>
<P>the install script defaults to programming using the /dev/ttyUSB1 device on 
Linux and COM1 on Windows, giving output similar to this: </P><PRE>    installing eyesIFXv2 binary using bsl
msp430-bsl --invert-test --invert-reset --f1x -c /dev/ttyUSB1 -r -e -I -p build/eyesIFXv2/main.ihex.out
MSP430 Bootstrap Loader Version: 2.0
Mass Erase...
Transmit default password ...
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Program ...
2720 bytes programmed.
Reset device ...
rm -f build/eyesIFXv2/main.exe.out build/eyesIFXv2/main.ihex.out
</PRE>
<P>The programming device can also be explicitly set as a parameter of the 
<I>bsl</I> command using shorthand or full notation: </P><PRE>  make eyesIFX install bsl,USB3
  make eyesIFX install bsl,/dev/ttyUSB3
</PRE>
<P>The eyesIFX motes can be programmed over the provided JTAG interface with the 
help of the msp430-jtag script: </P><PRE>  make eyesIFX install jtag
</PRE>
<P>producing output as in the following: </P><PRE>    installing eyesIFXv2 binary using the parallel port jtag adapter
msp430-jtag  -Iepr build/eyesIFXv2/main.ihex.out
MSP430 parallel JTAG programmer Version: 2.0
Mass Erase...
Program...
2720 bytes programmed.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -