forked from tp-freeforall/prod
-
Notifications
You must be signed in to change notification settings - Fork 2
/
00b_Development_Environment
372 lines (236 loc) · 12.7 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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
Installing a development environment for TinyOS (TinyProd).
Focuses on installing a msp430/msp432 based development environment but can
easily be adapted to other cpus by changing what toolchain gets installed.
Linux only.
State:
2017-07-29: (add arm toolchain)
Ubuntu 16.04, T2 (TinyProd) github:tp-freeforall/prod(tp-master),
ARM toolchain, gcc 4.9.3, gdb 7.8.0 (32 bit), python support
J-link (Segger), V6.16j (6.16.10)
T2 (TinyProd) github:tp-freeforall/prod(tp-master),
mspdebug JTAG debugging. 4.6.3 based msp430 toolchain
Toolchain from http://tinyprod.net/repos/debian (msp430)
2014-09-08:
Ubuntu 14.04+ Debian Wheezy works as well.
Tested directly on 14.04
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) Host OS Install.
Development is only supported on Linux hosts, in particular the Ubuntu and/or Debian
strains.
Obtain an ISO image from releases/ubuntu.com or alternatively from tinyprod.net/downloads.
Put the iso on to a bootable media (dvd or usb stick). You can also use grub loopback
for installation on an exiting Linux installation. (How to do this is beyond the scope
of this document). 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
python3 python3-serial python python-serial
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
apt-get install python3 python3-serial python python-serial
exit
**************************************************************************************
Debian packages for the TinyOS toolsets are available from Stanford and
TinyPord.net. Stanford is no longer maintained. The toolchain at
TinyProd.Net as of (July 29, 2017) is more up to date.
2) Set up repository access:
You want to follow the instructions at: http://tinyprod.net/repos/debian.
#
# add the TinyProd signing key
#
wget -O - http://tinyprod.net/repos/debian/tinyprod.key | sudo apt-key add -
... or ...
gpg --keyserver keyserver.ubuntu.com --recv-keys A9B913B9
gpg -a --export A9B913B9 | sudo apt-key add -
sudo -s
#
# teach dpkg/apt-get/aptitude about where to find the tinyprod tools repository
#
echo "deb http://tinyprod.net/repos/debian wheezy main" >> /etc/apt/sources.list.d/tinyprod-debian.list
echo "deb http://tinyprod.net/repos/debian msp430-46 main" >> /etc/apt/sources.list.d/tinyprod-debian.list
apt-get update
exit
3) MSP430 toolset: Install the TinyOS toolset (msp430)
We want the following packages:
nesc
tinyos-tools-devel
mspdebug
msp430-46
msp430-binutils-46
msp430-gcc-46
msp430-gdb-46
msp430-libc-46
msp430mcu-46
To install:
sudo apt-get install nesc tinyos-tools-devel msp430-46 mspdebug
4) MSP432 toolset: Install the TinyOS toolset (msp432)
4a) Install the following packages:
nesc
tinyos-tools-devel
To install:
sudo apt-get install nesc tinyos-tools-devel
4b) Install ARM toolchain. TinyOS for the msp432 requires the
gcc-arm-none-eabi-4_9-2015q3 toolchain. Later toolchains have the nesc restrict issue.
ARM_TOOLS_BASE=https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download
ARM_TOOLS_TAR=gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
wget -nv -O gcc-arm-none-eabi.tar.bz2 $ARM_TOOLS_BASE/$ARM_TOOLS_TAR
echo "*** Installing ARM toolchain"
tar xf /home/vagrant/installs/gcc-arm-none-eabi.tar.bz2 -C /usr
this will install the arm toolchain into /usr/gcc-arm-none-eabi-4_9-2015q3. Your path
should include /usr/gcc-arm-none-eabi-4_9-2015q3/bin
4c) Install 32 bit libraries for the ARM toolchain
apt-get install -qy -V libc6:i386 libx11-6:i386 libasound2:i386 \
libatk1.0-0:i386 libcairo2:i386 libcups2:i386 libdbus-glib-1-2:i386 \
libgconf-2-4:i386 libgdk-pixbuf2.0-0:i386 libgtk-3-0:i386 \
libice6:i386 libncurses5:i386 libsm6:i386 liborbit2:i386 \
libudev1:i386 libusb-0.1-4:i386 libstdc++6:i386 libxt6:i386 \
libxtst6:i386 libgnomeui-0:i386 libusb-1.0-0-dev:i386 \
libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 unzip \
libpython2.7:i386
4d) Install Segger Jlink.
SUPPORT_ARCHIVE=http://tinyprod.net/dev-archive
JLINK_DEB=${SUPPORT_ARCHIVE}/JLink_Linux_V616j_x86_64.deb
wget -nv -O jlink.deb ${JLINK_DEB}
dpkg -i jlink.deb
**************************************************************************************
5) TinyOS 2.x tree checkout
GIT is used to manage the TinyOS trees. These trees are held in git repositories. You should
read 00c_Getting_Started_Git for details.
There are several repositories of note for TinyOS 2.1.2+. You should choose the one that makes
the most sense for what you are working on. These repositories are all related and pains have
been taken to track appropriately.
gh:tp-freeforall/prod(tp-master): This repository contains additional code beyond the current
development core that has been made public. See 00a_Repo_Notes for details on what the
repository contains. It actively tracks the main tinyos development repo.
gh:tinyos/tinyos-main(master): This is the main tinyos development repository.
gh:tinyos/tinyos-release(tinyos-2_1_2): This is the main tinyos release repository. Its
default branch (currently tinyos-2_1_2) will always point at the current release.
For example, to check out of the tp-master branch of the github repository
tp-freeforall/prod.git (aka: gh:tp-freeforall/prod(tp-master):
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>
>>>>>>>
Note: To get the current tinyos release (currently, tinyos-2_1_2) you should use the following:
git clone -v git://github.com/tinyos/tinyos-release tinyos-2.x
<<<<<<<
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.
**************************************************************************************
6) Set up build environment settings
The development (gh:tinyos/tinyos-main) and tinyprod trunk have been converted to
using the version 3 build system. The new build system no longer uses a set of
environment variables. See gh:tinyos/tinyos-main(master)/support/make/README.md
for details.
Set TINYOS_ROOT_DIR to point at the top of the tinyprod tree.
for example: working dir ~/top
#!/bin/sh
MOTECOM="serial@/dev/ttyUSB0:telosb"
TINYOS_ROOT_DIR=~/top/t2_cur/tinyos-2.x
CLASSPATH=.:$TINYOS_ROOT_DIR/support/sdk/java/tinyos.jar
PYTHONPATH=$TINYOS_ROOT_DIR/support/sdk/python:$PYTHONPATH
export TINYOS_ROOT_DIR CLASSPATH PYTHONPATH MOTECOM
**************************************************************************************
7) 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.
For msp432 launchpad hardware (MSP-EXP432P401R):
cd ~/top/t2_cur/tinyos-2.x/apps/Blink
make exp_msp432
**************************************************************************************
8) 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 $TINYOS_ROOT_DIR/tools/tinyos/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 $TINYOS_ROOT_DIR 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
**************************************************************************************
9) 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
**************************************************************************************
10) Using the serialforwarder/seriallistener
a) make sure that tinyos.jar has been built. It should live in $TINYOS_ROOT_DIR/support/sdk/java/tinyos.jar
b) to rebuild:
cd $TINYOS_ROOT_DIR/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 $TINYOS_ROOT_DIR/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
**************************************************************************************
11) Repos:
See $(TINYOS_ROOT_DIR)/00a_Repo_Notes for details about how the TinyProd/prod repo is organized.
TinyOS release trees can be found at gh:tinyos/tinyos-release, development trees at
gh:tinyos/tinyos-main. TinyProd release trees can be found at gh:tinyprod/prod and
development trees at gh:tp-freeforall/prod.