-
Notifications
You must be signed in to change notification settings - Fork 49
/
00b_Development_Environment
275 lines (177 loc) · 9.15 KB
/
00b_Development_Environment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
Installing a development environment for TinyOS (TinyProd).
State:
2012-12-03:
Ubuntu 10.04 - 12.04. Debian Squeeze works as well.
Tested directly on 10.04 and 11.10, (12.04 in progress)
T2 (TinyProd) github:tp-freeforall/prod(tp-master),
mspdebug JTAG debugging. 4.6.3 based msp430 toolchain
Toolchain from http://tinyprod.net/repos/debian
**************************************************************************************
This brief is written assuming that there is a common root directory,
we'll call it "top" and it is usually at the top level of a working
directory. ie. ~/top. You can put this directory anywhere, environment
variables are used to tell the tools where things live.
Most commands are entered from a terminal window.
**************************************************************************************
1) OS Install.
Development is only supported on Linux hosts, in particular the Ubuntu and/or Debian
strains. Ubuntu 10.04 and 11.10 have been directly tested (on Apple MacBookPro laptops).
Ubuntu 12.04 is currently being tested. Mac support can be added to 10.04 and 10.10 and
is included directly in 11.10 and later versions. (MacBookPro 3,1 has been directly
tested).
Obtain an ISO image from releases/ubuntu.com or alternatively from tinyprod.net/downloads.
Burn the iso to a CD and install on your box. A simple install is fine and will
take less time.
When the install is complete, boot the system, and use "apt-get" to install the following
packages:
build-essential stow automake autoconf libtool libc6-dev
git-core git-daemon-run git-doc git-email git-gui gitk gitmagic
openssh-client openssh-server
The following will do the trick:
sudo -s
apt-get install build-essential stow automake autoconf libtool libc6-dev
apt-get install git-core git-daemon-run git-doc git-email git-gui gitk gitmagic
apt-get install openssh-client openssh-server
exit
**************************************************************************************
2) Install the TinyOS toolset (msp430)
We want the tinyos toolset for msp430 based motes (ie, telosb, msp430f1611). Debian packages
are available from Stanford and TinyProd.net. The toolchain at TinyProd.Net as of
(April 4, 2012) is more up to date.
We want the following packages:
nesc
msp430-binutils-tinyos
msp430-gcc-tinyos
msp430-gdb-tinyos
msp430-libc-tinyos
msp430-tinyos
msp430mcu-tinyos
mspdebug-tinyos
tinyos-tools
You want to follow the instructions at: http://tinyprod.net/repos/debian.
The following should be equivilent. With some additions...
#
# add the keys for Razvan, the package signer
#
gpg --keyserver subkeys.pgp.net --recv-keys F99BE531
gpg -a --export F99BE531 | sudo apt-key add -
sudo -s
#
# teach dpkt/apt-get/aptitude about where to find the tinyprod tools repository
#
echo "deb http://tinyprod.net/repos/debian squeeze main" >> /etc/apt/sources.list.d/tinyprod-debian.list
apt-get update
apt-get install nesc msp430-tinyos mspdebug-tinyos tinyos-tools
exit
**************************************************************************************
3) TinyOS 2.x tree checkout
This is a basic check out of the tp-master branch of the github repository
tp-freeforall/prod.git. This repo tracks the main tinyos SVN repository used
for development. It has modifications to support newer TI MSP430 processors.
This basic checkout gives you a read-only copy of the tp-master branch. It
is a fully functional local repository that can be commited into (locally only).
cd ~/top
mkdir t2_cur
cd t2_cur
git clone -v git://github.com/tp-freeforall/prod tinyos-2.x
cd tinyos-2.x
git checkout -b <your_initials>
This will create a new branch named <your_intials> and will check you into that branch.
It will be branched off of the main branch from the remote, gh:tp-freeforall/prod
(tp-master).
This will keep your changes locally grouped. You will have a remote named 'origin'
that points at the repository that you cloned from namely,
git://github.com/tp-freeforall/prod.git. Your branch <your_initials> will be rooted
at the default branch of tp-freeforall/prod, msp430-int.
To set up for contibuting to the main repository, the instructions in
00c_Getting_Started_Git and 00d_Contribution_Process should be followed.
**************************************************************************************
4) Set up build environment settings
The following environment variables must be set to build.
TOSROOT
TOSDIR
MAKERULES
CLASSPATH
for example: working dir ~/top
#!/bin/sh
MOTECOM="serial@/dev/ttyUSB0:telosb"
TOSROOT=~/top/t2_cur/tinyos-2.x
TOSDIR=$TOSROOT/tos
MAKERULES=$TOSROOT/support/make/Makerules
CLASSPATH=.:$TOSROOT/support/sdk/java/tinyos.jar
PYTHONPATH=$TOSROOT/support/sdk/python:$PYTHONPATH
export MAKERULES TOSDIR TOSROOT CLASSPATH PYTHONPATH
export MOTECOM
**************************************************************************************
5) Do a test compile.
For telosb hardware: (assumes pluged in to a USB port)
cd ~/top/t2_cur/tinyos-2.x/apps/Blink
make telosb install
The Leds should start to blink.
**************************************************************************************
6) Build SerialForwarder and libmote library. (optional)
WARNING: This should get replaced with libmotenet. Superset of the SF but also
allows using AM sockets or IPv6 sockets for connections. Note: currently libmotenet
is a work in progress and should be considered experimental.
Build the serial forwarder and associated library (also includes direct serial access)
cd $TOSROOT/support/sdk/c/sf
./bootstrap
./configure --prefix=/opt/stow/sf_c
make
sudo -s
make install
("sudo make install" for some reason doesn't pick up the value of $TOSROOT properly so
the make install doesn't work write unless you are root first)
This will install bin/{sf, sflisten, sfsend, seriallisten, serialsend}, include/{message.h,
serialsource.h, sfsource.h}, and lib/libmote.a. These will be installed into /opt/stow/sf_c.
Install into /opt/{bin,include,lib} using stow.
cd /opt/stow
stow sf_c
**************************************************************************************
7) We use GIT as the SCM. Here are some pointers to get you started:
Start here: http://book.git-scm.com/2_setup_and_initialization.html
Everyday GIT: http://www.kernel.org/pub/software/scm/git/docs/everyday.html
Cheat Sheet: http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html
SVN to GIT: http://git-scm.com/course/svn.html
GIT Book: http://book.git-scm.com/
Another Book: http://progit.org/book/
Documentation on getting started with T2 can be found at:
http://docs.tinyos.net
http://docs.tinyos.net/index.php/Getting_started
**************************************************************************************
8) Using the serialforwarder/seriallistener
a) make sure that tinyos.jar has been built. It should live in $TOSROOT/support/sdk/java/tinyos.jar
b) to rebuild:
cd $TOSROOT/support/sdk/java/
make tinyos.jar
c) Install TOSComm JNI support if needed. Did java bitch about not finding TOSComm JNI support?
assuming tinyos-tools is installed run:
tos-install-jni
d) To watch raw bytes coming from the serial port
Make sure CLASSPATH includes $TOSROOT/support/sdk/java/tinyos.jar, ie:
CLASSPATH=.:/home/joe/mm/t2_cur/tinyos-2.x/support/sdk/java/tinyos.jar
execute:
java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
And you should see packets that look something like this: (depends on what the mote is sending)
00 FF FF 00 00 12 00 A1 00 12 07 09 00 0C 9E 23 00 0C 9E 30 F6 2C FF D7 FF FF
00 FF FF 00 00 12 00 A1 00 12 07 05 00 0C 9E 24 00 0C 9E 3F E5 AF B1 6F 9E D4
00 FF FF 00 00 0E 00 A1 00 0E 07 06 00 0C 9E 33 00 0C 9E 46 78 80
00 FF FF 00 00 0E 00 A1 00 0E 07 07 00 0C 9E 33 00 0C 9E 52 FF FF
00 FF FF 00 00 10 00 A1 00 10 07 08 00 0C 9E 33 00 0C 9E 61 FF FF FF FF
00 FF FF 00 00 10 00 A1 00 10 07 08 00 0C 9E 33 00 0C 9E 61 FF FF FF FF
^ ^ ^ ^ ^ ^ ^ ^ ^ | -- sensor 8 data
| | | | | | | | |- sensor id
| | | | | | | |- sensor data type
| | | | | | |-- length of data block
| | | | | |-- AM type MM_DT (data, typed)
| | | | |-- AM group
| | | |-- serial length
| | |-- src addr
| |-- dest addr
|-- dispatch byte - 0 says AM
If you define MOTECOM you won't need to specify the -comm parameter. ie:
MOTECOM=serial@/dev/ttyUSB1:telosb
**************************************************************************************
9) Repos:
See $(TOSROOT)/00a_Repo_Notes for details about how the TinyProd/prod repo is organized.
github:tinyprod/prod or github:tp-freeforall/prod hold the main t2 repository.