{"id":2617,"date":"2010-10-22T21:29:30","date_gmt":"2010-10-22T12:29:30","guid":{"rendered":"http:\/\/yasu2.prosou.nu\/blog\/index.php\/2010\/10\/22\/tinyos_iris_mote_on_freebsd_ho\/"},"modified":"2010-10-22T21:29:30","modified_gmt":"2010-10-22T12:29:30","slug":"tinyos_iris_mote_on_freebsd_ho","status":"publish","type":"post","link":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2010\/10\/22\/2617\/","title":{"rendered":"TinyOS + iris mote on FreeBSD HOWTO"},"content":{"rendered":"<p>This is how to make our iris mote with MTS400 sensor board work with FreeBSD. Although it&#8217;s difficult to make the full feature of TinyOS toolkit (especially Java based tools on the host side) because of several limitations of the toolkit, it&#8217;s still possible to develop everything on the motes and host PC(s) with FreeBSD.<br \/>\nBefore getting started, the user must be join dialer group to &#8220;dialer&#8221; group to control \/dev\/cua*.<br \/>\n[ Step 1: ports setup ]<br \/>\nSince iris motes have Atmel&#8217;s AVR processors, we need avr cross compiler to make them work. I&#8217;ve installed following softwares from FreeBSD ports collection.<br \/>\n&#8211; devel\/avr-gcc<br \/>\n&#8211; devel\/avr-libc (without documentation)<br \/>\n&#8211; devel\/avr-gdb<br \/>\n&#8211; devel\/avarice<br \/>\n&#8211; devel\/avrdude (needs &#8220;cp \/usr\/local\/etc\/avrdude.conf  \/etc\/avrdude\/&#8221; after installation)<br \/>\n[ Step 2: NesCC installation ]<br \/>\nTo compile programs run on motes, we need NesC compiler (that calls avr-gcc for iris motes). However, NesC has a small incompatibility with the latest avr-gcc comes with FreeBSD ports. Simply edit src\/unparse.c and comment out line 812 and 813. Without this patch, avr-gcc will experience an &#8220;internal compiler error&#8221;, then terminates abruptly.<br \/>\nnesc-1.3.2\/src\/unparse.c<br \/>\n811:       \/* gcc wants the attributes here *\/<br \/>\n812: \/\/      prt_type_elements(CAST(type_element, d-&gt;attributes),<br \/>\n813: \/\/                      flag_gccize ? 0 : psd_no_target_attributes);<br \/>\nThen just:<br \/>\n% .\/configure &#8211;prefix=${HOME}\/work\/xbow\/tools<br \/>\n% gmake<br \/>\n% gmake install<br \/>\nthis will install nescc in ~\/work\/xbow\/tools.<br \/>\n[ Step 3: Build TinyOS environment ]<br \/>\nSince I couldn&#8217;t build latest trunk (revision at r5194) for iris motes and TinyOS-2.1.1.3 doesn&#8217;t have mts400 driver, I&#8217;ve checked out trunk at revision r5166 and it builds.<br \/>\n% cd ~\/work\/xbow\/<br \/>\n% svn checkout http:\/\/tinyos-main.googlecode.com\/svn\/trunk tinyos-5166 -r 5166<br \/>\n% ln -s tinyos-5166 tinyos<br \/>\n% set path = ( \/usr\/local\/diablo-jdk1.6.0\/bin ~\/work\/xbow\/tools\/bin $path )<br \/>\n% setenv TOSROOT ~\/work\/xbow\/tinyos\/<br \/>\n% setenv TOSDIR ~\/work\/xbow\/tinyos\/tos<br \/>\n% setenv CLASSPATH ~\/work\/xbow\/tinyos\/support\/sdk\/java\/tinyos.jar:.<br \/>\n% setenv MAKERULES ~\/work\/xbow\/tinyos\/support\/make\/Makerules<br \/>\nNext, we need some patches to build TinyOS on FreeBSD before building the tools:<br \/>\n% cd tinyos\/tools<br \/>\n% vi configure (change #!\/bin\/sh on the first line to #!\/usr\/local\/bin\/bash. That&#8217;s because FreeBSD&#8217;s Bourne shell can&#8217;t run the script&#8230;)<br \/>\n% vi misc\/tos-locate-jre (replace &#8220;readlink -q&#8221; by &#8220;readlink&#8221;. The command doesn&#8217;t require -q option.)<br \/>\n% .\/configure &#8211;prefix=${HOME}\/work\/xbow\/tools<br \/>\n% gmake &#038;&#038; gmake install<br \/>\nThis will install uisp and many other programs in ~\/work\/xbow\/tools\/bin. Unfortunately I still can&#8217;t run Java based tools, I can use C based SDKs.<br \/>\n[ Step 4: Program the Mote NOW! ]<br \/>\nThe first one is the &#8220;Blink&#8221; application. Assume that the programmer appears on \/dev\/cuaU0 (and the mote interface on \/dev\/cuaU1).<br \/>\n% cd ~\/work\/xbow\/tinyos\/apps\/Blink<br \/>\n% gmake iris<br \/>\n% gmake iris reinstall mib520,\/dev\/cuaU0<br \/>\nThe LEDs will blink!<br \/>\nNext thing is test with radio&#8230; The client ID must be specified at gmake reinstall.<br \/>\nCompile for client:<br \/>\n% cd ~\/work\/xbow\/tinyos\/apps\/tutorials\/BlinkToRadio<br \/>\n% gmake iris<br \/>\nInstall for client 0x1234:<br \/>\n% gmake iris reinstall,0x1234 mib520,\/dev\/cuaU0<br \/>\nInstall for client 0xabcd:<br \/>\n% gmake iris reinstall,0xabcd mib520,\/dev\/cuaU0<br \/>\nSet up the basestation:<br \/>\n% cd ~\/work\/xbow\/tinyos\/apps\/tutorials\/Basestation<br \/>\n% gmake iris<br \/>\n% gmake iris reinstall mib520,\/dev\/cuaU0<br \/>\nCompile C based serial forwarder:<br \/>\n% cd ~\/work\/xbow\/tinyos\/support\/sdk\/c\/sf<br \/>\n% sh bootstrap &#038;&#038; .\/configure &#038;&#038; gmake<br \/>\n% .\/seriallisten \/dev\/cuaaU1 57600<br \/>\nThe packets are displayed by serial forwarer:<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 01<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 02<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 03<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 04<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 05<br \/>\n00 ff ff 12 34 04 00 06 12 34 00 01<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 06<br \/>\n00 ff ff 12 34 04 00 06 12 34 00 02<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 07<br \/>\n00 ff ff 12 34 04 00 06 12 34 00 03<br \/>\n00 ff ff ab cd 04 00 06 ab cd 00 08<br \/>\nOK, cool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is how to make our iris mote with MTS400 sensor board work with FreeBSD. Although it&#8217;s difficult to &hellip; <a href=\"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2010\/10\/22\/2617\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;TinyOS + iris mote on FreeBSD HOWTO&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[6,4],"tags":[],"class_list":["post-2617","post","type-post","status-publish","format-standard","hentry","category-unix-","category-4"],"_links":{"self":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=2617"}],"version-history":[{"count":0,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2617\/revisions"}],"wp:attachment":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=2617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=2617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=2617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}