http://www.libertytimes.com.tw/2007/new/aug/22/today-work2.htm
2007/08/24
2007/08/20
2007/08/18
Build Octopus develop environment
What is Octopus?
1. Install Moteiv's Tmote Tools from http://www.moteiv.com/
If already installed Cygwin, I recommend uninstall Cygwin firstly. Secondly,
to run setup.msi from tmote-tools-2_0_5.zip. Finally, to upgrade or install
other Cygwin packages.
2. Copy and Modify target file
octopus.target
3. Create octopus directory
4. Modify hardware.h file
/opt/moteiv/tos/platform/octopus/hardware.h
5. Copy and Modify HPLUSART1M.nc file
/opt/moteiv/tos/platform/octopus/HPLUSART1M.nc
6. Copy and Modify Leds.nc file
/opt/moteiv/tos/platform/octopus/Leds.nc
7. Copy and Modify LedsC.nc file
/opt/moteiv/tos/platform/octopus/LedsC.nc
8. Copy MSP430ClockM.nc file
9. Copy and Modify MSP430GeneralIOM.nc file
/opt/moteiv/tos/platform/octopus/MSP430GeneralIOM.nc
10. Copy and Modify NoLeds.nc file
/opt/moteiv/tos/platform/octopus/NoLeds.nc
11. Modify and Compile SerialByteSource.java file
/opt/tinyos-1.x/tools/java/net/tinyos/packet/SerialByteSource.java
Complie SerialByteSource.java file
appendix 1. Make an example application
appendix 2. Run an example application
appendix 3. Set Node ID: 5
1. Install Moteiv's Tmote Tools from http://www.moteiv.com/
If already installed Cygwin, I recommend uninstall Cygwin firstly. Secondly,
to run setup.msi from tmote-tools-2_0_5.zip. Finally, to upgrade or install
other Cygwin packages.
2. Copy and Modify target file
shell> cd /opt/moteiv/tools/make/
shell:/opt/moteiv/tools/make/> cp tmote.target octopus.target
octopus.target
...
-PLATFORM ?= tmote
+PLATFORM ?= octopus
...
-CFLAGS += \
--I$(MOTEIV_DIR)/tos/platform/tmote \
--I$(MOTEIV_DIR)/tos/platform/tmote/util/uartdetect \
+CFLAGS += \
+-I$(MOTEIV_DIR)/tos/platform/octopus \
+-I$(MOTEIV_DIR)/tos/platform/octopus/util/uartdetect \
...
- BOOTLOADER ?= $(MOTEIV_DIR)/tos/lib/Deluge/TOSBoot/build/tmote/main.ihex
+ BOOTLOADER ?= $(MOTEIV_DIR)/tos/lib/Deluge/TOSBoot/build/octopus/main.ihex
...
-tmote: $(BUILD_DEPS)
+octopus: $(BUILD_DEPS)
...
3. Create octopus directory
shell> cp -r /opt/moteiv/tos/platform/tmote /opt/moteiv/tos/platform/octopus
4. Modify hardware.h file
/opt/moteiv/tos/platform/octopus/hardware.h
...
// LEDs
TOSH_ASSIGN_PIN(RED_LED, 5, 4);
TOSH_ASSIGN_PIN(GREEN_LED, 5, 5);
-TOSH_ASSIGN_PIN(YELLOW_LED, 5, 6);
+TOSH_ASSIGN_PIN(YELLOW_LED, 5, 3);
+TOSH_ASSIGN_PIN(BLUE_LED, 5, 6);
...
TOSH_ASSIGN_PIN(STE1, 5, 0);
+TOSH_ASSIGN_PIN(BUFFER_CS, 4, 3);
// ADC
TOSH_ASSIGN_PIN(ADC0, 6, 0);
...
// FLASH
-TOSH_ASSIGN_PIN(FLASH_PWR, 4, 3);
+TOSH_ASSIGN_PIN(FLASH_W, 4, 0);
TOSH_ASSIGN_PIN(FLASH_CS, 4, 4);
...
5. Copy and Modify HPLUSART1M.nc file
shell> cp /opt/moteiv/tos/platform/msp430/HPLUSART1M.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/HPLUSART1M.nc
...
async command result_t USARTControl.tx(uint8_t data){
atomic {
+ TOSH_CLR_BUFFER_CS_PIN();
U1TXBUF = data;
}
return SUCCESS;
}
...
6. Copy and Modify Leds.nc file
shell> cp /opt/tinyos-1.x/tos/interfaces/Leds.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/Leds.nc
interface Leds {
...
/**
* Toggle the yellow LED. If it was on, turn it off. If it was off,
* turn it on.
*
* @return SUCCESS always.
*
*/
async command result_t yellowToggle();
+ async command result_t blueOn();
+ async command result_t blueOff();
+ async command result_t blueToggle();
/**
* Get current Leds information
*
* @return A uint8_t typed value representing Leds status
*
*/
async command uint8_t get();
...
}
7. Copy and Modify LedsC.nc file
shell> cp /opt/tinyos-1.x/tos/system/LedsC.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/LedsC.nc
...
enum {
- RED_BIT = 1,
- GREEN_BIT = 2,
- YELLOW_BIT = 4
+ BLUE_BIT = 1,
+ GREEN_BIT = 2,
+ RED_BIT = 4,
+ YELLOW_BIT = 8
};
async command result_t Leds.init() {
atomic {
ledsOn = 0;
dbg(DBG_BOOT, "LEDS: initialized.\n");
TOSH_MAKE_RED_LED_OUTPUT();
TOSH_MAKE_YELLOW_LED_OUTPUT();
TOSH_MAKE_GREEN_LED_OUTPUT();
+ TOSH_MAKE_BLUE_LED_OUTPUT();
TOSH_SET_RED_LED_PIN();
TOSH_SET_YELLOW_LED_PIN();
TOSH_SET_GREEN_LED_PIN();
+ TOSH_SET_BLUE_LED_PIN();
}
return SUCCESS;
}
...
async command result_t Leds.yellowToggle() {
result_t rval;
atomic {
if (ledsOn & YELLOW_BIT)
rval = call Leds.yellowOff();
else
rval = call Leds.yellowOn();
}
return rval;
}
+ async command result_t Leds.blueOn() {
+ dbg(DBG_LED, "LEDS: Blue on.\n");
+ atomic {
+ TOSH_CLR_BLUE_LED_PIN();
+ ledsOn |= BLUE_BIT;
+ }
+ return SUCCESS;
+ }
+ async command result_t Leds.blueOff() {
+ dbg(DBG_LED, "LEDS: Blue off.\n");
+ atomic {
+ TOSH_SET_BLUE_LED_PIN();
+ ledsOn &= ~BLUE_BIT;
+ }
+ return SUCCESS;
+ }
+ async command result_t Leds.blueToggle() {
+ result_t rval;
+ atomic {
+ if (ledsOn & BLUE_BIT)
+ rval = call Leds.blueOff();
+ else
+ rval = call Leds.blueOn();
+ }
+ return rval;
+ }
async command uint8_t Leds.get() {
uint8_t rval;
atomic {
rval = ledsOn;
}
return rval;
}
async command result_t Leds.set(uint8_t ledsNum) {
atomic {
- ledsOn = (ledsNum & 0x7);
+ ledsOn = (ledsNum & 0xF);
if (ledsOn & GREEN_BIT)
TOSH_CLR_GREEN_LED_PIN();
else
TOSH_SET_GREEN_LED_PIN();
if (ledsOn & YELLOW_BIT )
TOSH_CLR_YELLOW_LED_PIN();
else
TOSH_SET_YELLOW_LED_PIN();
if (ledsOn & RED_BIT)
TOSH_CLR_RED_LED_PIN();
else
TOSH_SET_RED_LED_PIN();
+ if (ledsOn & BLUE_BIT)
+ TOSH_CLR_BLUE_LED_PIN();
+ else
+ TOSH_SET_BLUE_LED_PIN();
}
return SUCCESS;
}
...
8. Copy MSP430ClockM.nc file
shell> cp /opt/moteiv/tos/platform/msp430/timer/MSP430ClockM.nc /opt/moteiv/tos/platform/octopus/
9. Copy and Modify MSP430GeneralIOM.nc file
shell> cp /opt/tinyos-1.x/tos/platform/msp430/MSP430GeneralIOM.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/MSP430GeneralIOM.nc
...
- async command uint8_t Port12.getRaw() { return TOSH_READ_PORT12_PIN(); }
- async command bool Port12.get() { return TOSH_READ_PORT12_PIN() != 0; }
+ async command uint8_t Port12.getRaw() { TOSH_READ_PORT12_PIN(); return 1;}
+ async command bool Port12.get() { TOSH_READ_PORT12_PIN(); return 1;}
...
10. Copy and Modify NoLeds.nc file
shell> cp /opt/moteiv/tinyos-1.x/tos/system/NoLeds.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/NoLeds.nc
...
async command result_t Leds.yellowToggle() {
return SUCCESS;
}
+ async command result_t Leds.blueOn() {
+ return SUCCESS;
+ }
+ async command result_t Leds.blueOff() {
+ return SUCCESS;
+ }
+ async command result_t Leds.blueToggle() {
+ return SUCCESS;
+ }
async command uint8_t Leds.get() {
return 0;
}
...
11. Modify and Compile SerialByteSource.java file
/opt/tinyos-1.x/tools/java/net/tinyos/packet/SerialByteSource.java
...
public void openStreams() throws IOException {
...
try {
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
serialPort.setSerialPortParams(baudRate,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
+ // elva set COM port pin(DTR) to LOW
+ serialPort.setDTR(false);
+ // elva end of modify
serialPort.addEventListener(this);
serialPort.notifyOnDataAvailable(true);
}
...
is = serialPort.getInputStream();
os = serialPort.getOutputStream();
+ // elva delay for mote reboot
+ try {
+ Thread.sleep(1300);
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ // elva end of modify
}
...
Complie SerialByteSource.java file
shell> cd /opt/tinyos-1.x/tools/java/net/tinyos/packet
shell:/opt/tinyos-1.x/tools/java/net/tinyos/packet> javac SerialByteSource.java
appendix 1. Make an example application
shell> cd /opt/moteiv/apps/Count/CountLeds
shell:/opt/moteiv/apps/Count/CountLeds> make octopus
appendix 2. Run an example application
shell> export MOTECOM=serial@COM6:tmote
shell> cd /opt/tinyos-1.x/tools/java/net/tinyos/tools
shell:/opt/tinyos-1.x/tools/java/net/tinyos/tools> java net.tinyos.tools.Listen
appendix 3. Set Node ID: 5
shell:/opt/moteiv/apps/Count/CountLeds> /opt/tinyos-1.x/tools/make/msp/set-mote-id --objcopy msp430-objcopy --objdump msp430-objdump --target ihex build/octopus/main.ihex build/octopus/main.ihex.out-5 5
2007/08/17
NS2 Installation on UNIX based system (Daily Snapshot)
1. Download Tcl/Tk from http://www.tcl.tk/software/tcltk/
2. Download daily NS2 from http://www.isi.edu/nsnam/dist/daily/
3. De-compress all file in custom directory (ex: ~/ns-daily-2.31/)
4. Recommand touch a file for the version of ns2
5. Using following shell script to configure and make files
install.sh
[code]
#!/bin/bash
# tcl
cd tcl8.4.15/unix
./configure --enable-shared
make
cd ../..
# tk
cd tk8.4.15/unix
./configure --enable-shared
make
cd ../..
# otcl
cd otcl
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15
make
cd ..
# tclcl
cd tclcl
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15
make
cd ..
# ns-2
cd ns-2
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15 \
--with-otcl=../otcl --with-tclcl=../tclcl
make
cd ..
# nam-1
cd nam-1
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15 \
--with-otcl=../otcl --with-tclcl=../tclcl
make
cd ..
echo "Installation complete"
[/code]
If this fail, try Distribution Specific instructions
If this error for file pcap.h not existed, install libpcapX.X-dev
If this success, only needing to upgrade OTcl, TclCL, ns-2 and nam-1 in the future
6. Create soft link for needing files
7. Add following setting to set NS2 environment
.bashrc
[code]
# NS2 environment
PATH=/home/USER/ns-daily-2.31/bin:$PATH
LD_LIBRARY_PATH=/home/USER/ns-daily-2.31/bin:/home/USER/ns-daily-2.31/lib
TCL_LIBRARY=/home/USER/ns/ns-daily-2.31/tcl8.4.15/library
export PATH LD_LIBRARY_PATH TCL_LIBRARY
[/code]
8. Make Documentation
If you want to create html documentation, install latex2html firstly
shell> wget http://prdownloads.sourceforge.net/tcl/tcl8.4.15-src.tar.gz
shell> wget http://prdownloads.sourceforge.net/tcl/tk8.4.15-src.tar.gz
2. Download daily NS2 from http://www.isi.edu/nsnam/dist/daily/
shell> wget http://www.isi.edu/nsnam/dist/daily/nam-1-XXXXXXXX.tar.gz
shell> wget http://www.isi.edu/nsnam/dist/daily/ns-2-XXXXXXXX.tar.gz
shell> wget http://www.isi.edu/nsnam/dist/daily/otcl-XXXXXXXX.tar.gz
shell> wget http://www.isi.edu/nsnam/dist/daily/tclcl-XXXXXXXX.tar.gz
3. De-compress all file in custom directory (ex: ~/ns-daily-2.31/)
4. Recommand touch a file for the version of ns2
shell:~/ns-daily-2.31/> touch 20070815
5. Using following shell script to configure and make files
install.sh
[code]
#!/bin/bash
# tcl
cd tcl8.4.15/unix
./configure --enable-shared
make
cd ../..
# tk
cd tk8.4.15/unix
./configure --enable-shared
make
cd ../..
# otcl
cd otcl
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15
make
cd ..
# tclcl
cd tclcl
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15
make
cd ..
# ns-2
cd ns-2
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15 \
--with-otcl=../otcl --with-tclcl=../tclcl
make
cd ..
# nam-1
cd nam-1
./configure --disable-static --with-tcl-ver=8.4.15 --with-tk-ver=8.4.15 \
--with-otcl=../otcl --with-tclcl=../tclcl
make
cd ..
echo "Installation complete"
[/code]
If this fail, try Distribution Specific instructions
If this error for file pcap.h not existed, install libpcapX.X-dev
If this success, only needing to upgrade OTcl, TclCL, ns-2 and nam-1 in the future
6. Create soft link for needing files
shell:~/ns-daily-2.31/> mkdir bin
shell:~/ns-daily-2.31/> mkdir lib
shell:~/ns-daily-2.31/> cd bin
shell:~/ns-daily-2.31/bin/> ln -s ../ns-2/ns .
shell:~/ns-daily-2.31/bin/> ln -s ../nam-1/nam .
shell:~/ns-daily-2.31/bin/> cd ../lib/
shell:~/ns-daily-2.31/lib/> ln -s ../tcl8.4.15/unix/libtcl8.4.so .
shell:~/ns-daily-2.31/lib/> ln -s ../tk8.4.15/unix/libtk8.4.so .
7. Add following setting to set NS2 environment
.bashrc
[code]
# NS2 environment
PATH=/home/USER/ns-daily-2.31/bin:$PATH
LD_LIBRARY_PATH=/home/USER/ns-daily-2.31/bin:/home/USER/ns-daily-2.31/lib
TCL_LIBRARY=/home/USER/ns/ns-daily-2.31/tcl8.4.15/library
export PATH LD_LIBRARY_PATH TCL_LIBRARY
[/code]
8. Make Documentation
shell:~/ns-daily-2.31/ns-2/doc> make
If you want to create html documentation, install latex2html firstly
2007/08/16
Problems with installation ns-2.31 under Cygwin
Reference:
[ 1393985 ] validation fails under Cygwin
http://mailman.isi.edu/pipermail/ns-users/2006-December/058117.html
Error Message:
Solution:
Those tests currently fail on Cygwin.
[ 1393985 ] validation fails under Cygwin
http://mailman.isi.edu/pipermail/ns-users/2006-December/058117.html
Error Message:
validate overall report: some tests failed:
./test-all-smac-multihop ./test-all-simultaneous ./test-all-wireless-tdma
to re-run a specific test, cd tcl/test; ./test-all-TEST-NAME
Notice that some tests in webcache will fail on freebsd when -O is turned on.
This is due to some event reordering, which will disappear when -g is turned on.
Cygwin >= 1.3.19 detected (1.5.24), all tests should have passed.
Please see <http://www.isi.edu/nsnam/ns/ns-problems.html>
for potential solutions.
Solution:
Those tests currently fail on Cygwin.
Subscribe to:
Posts (Atom)