📄 platforms - tinyos documentation wiki.htm
字号:
configuration PlatformLedsC {
provides interface GeneralIO as Led0;
provides interface GeneralIO as Led1;
provides interface GeneralIO as Led2;
uses interface Init;
}
implementation
{
components
HplMsp430GeneralIOC as GeneralIOC
, new Msp430GpioC() as Led0Impl
, new Msp430GpioC() as Led1Impl
, new Msp430GpioC() as Led2Impl
;
components PlatformP;
Init = PlatformP.LedsInit;
Led0 = Led0Impl;
Led0Impl -> GeneralIOC.Port54;
Led1 = Led1Impl;
Led1Impl -> GeneralIOC.Port55;
Led2 = Led2Impl;
Led2Impl -> GeneralIOC.Port56;
}
</PRE>
<P>We refer the reader to the TinyOS Programming Guide cited below for more
explanations on how the above confiuration uses generics (ie with the "new"
keyword). For the purpose of this lesson, the key point is that we are wiring to
ports 5.4, 5.5, and 5.6 -- we shall suppose that these are the MSP430
microcontroller pins to which the three Leds are connected on the yamp platform.
</P>
<P>With the above file in place, we can now compile Blink for the yamp platform.
How do we test that the application actually works? We have thus far presented
yamp as an imaginary platform, but it turns out that the above application
should work on any platform with the MSP430x1611 microcontroller and where the
Leds are connected to microcontroller ports 5.4-5.6. Not entirely
coincidentally, these are exactly the Led wirings used by the telos/tmote
platforms. So those readers that have a telos/tmote at hand can test this
application on it. (Testing on a tinynode or eyes mote is also easy and only
requires changing the pin wirings in PlatformLedsC to follow those of that
platform; running this application on mica-family motes will require more
changes since they use a different microcontroller). </P>
<P>Now, enter the following command (where you have suitably replaced
/dev/ttyXXX by the appropriate serial port), </P><PRE> make yamp install bsl,/dev/ttyXXX
</PRE>
<P>and you will see the Leds of your impersonated (by a telos) yamp node
Blinking! </P><A name=Conclusion></A>
<H1><SPAN class=mw-headline>Conclusion</SPAN></H1>
<P>This lesson has introduced the notion of per-platform support in TinyOS using
as a guiding example the development of a platform port to an imaginary "yamp"
platform. We have seen how introducing support for a new platform requires
touching not only nesc code but also adding some rules to the build system. This
tutorial also touched upon the notions of Hardware Abstraction Architecture
(HAA) that is central to the clean and modular support of different platforms
and chips in TinyOS. </P>
<P>The steps outlined here did not cover what is the hardest part of a platform
port: developping the components to drive a radio transceiver or MCU (which are
necessary if the platform uses chips that are not currently supported in
TinyOS). Developping such drivers is an advanced topic that is beyond the scope
of the tutorials; for those curious to gain some insight we recommend perusing
the code for a chip (e.g the CC2420 radio in tos/chips/cc2420 or the xe1205
radio in tos/chips/xe1205) armed with that chips datasheet and the platform
schematics. </P><A name=Related_Documentation></A>
<H1><SPAN class=mw-headline>Related Documentation</SPAN></H1>
<UL>
<LI><A class="external text" title=https://sourceforge.net/projects/nescc
href="https://sourceforge.net/projects/nescc" rel=nofollow>nesc at
sourceforge</A>
<LI><A class="external text"
title=http://nescc.sourceforge.net/papers/nesc-ref.pdf
href="http://nescc.sourceforge.net/papers/nesc-ref.pdf" rel=nofollow>nesC
reference manual</A>
<LI><A class="external text"
title=http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf
href="http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf"
rel=nofollow>TinyOS Programming Guide</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep102.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep102.html" rel=nofollow>TEP
2: Hardware Abstraction Architecture</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep106.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep106.html" rel=nofollow>TEP
106: Schedulers and Tasks</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep107.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep107.html" rel=nofollow>TEP
107: TinyOS 2.x Boot Sequence</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep117.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep117.html" rel=nofollow>TEP
117: Low-level I/O</A>
<LI><A class="external text"
title=http://tinyos.cvs.sourceforge.net/*checkout*/tinyos/tinyos-2.x/doc/html/tep131.html
href="http://tinyos.cvs.sourceforge.net/*checkout*/tinyos/tinyos-2.x/doc/html/tep131.html"
rel=nofollow>TEP 131: Creating a New Platform for TinyOS 2.x</A> </LI></UL>
<HR>
<P><BR></P>
<HR>
<CENTER>
<P>< <B><A class=new title=Concurrency
href="http://docs.tinyos.net/index.php?title=Concurrency&action=edit">Previous
Lesson</A></B> | <B><A title=""
href="http://docs.tinyos.net/index.php/Platforms#Introduction">Top</A></B> |
<B><A title=TOSSIM href="http://docs.tinyos.net/index.php/TOSSIM">Next
Lesson</A> ></B> </P></CENTER><!-- Saved in parser cache with key tinyosdocs:pcache:idhash:15-0!1!0!!en!2!edit=0 and timestamp 20080401225550 -->
<DIV class=printfooter>Retrieved from "<A
href="http://docs.tinyos.net/index.php/Platforms">http://docs.tinyos.net/index.php/Platforms</A>"</DIV><!-- end content -->
<DIV class=visualClear></DIV></DIV></DIV></DIV>
<DIV id=column-one>
<DIV class=portlet id=p-cactions>
<H5>Views</H5>
<DIV class=pBody>
<UL>
<LI class=selected id=ca-nstab-main><A title="View the content page [c]"
accessKey=c href="http://docs.tinyos.net/index.php/Platforms">Article</A>
<LI class=new id=ca-talk><A title="Discussion about the content page [t]"
accessKey=t
href="http://docs.tinyos.net/index.php?title=Talk:Platforms&action=edit">Discussion</A>
<LI id=ca-viewsource><A
title="This page is protected. You can view its source. [e]" accessKey=e
href="http://docs.tinyos.net/index.php?title=Platforms&action=edit">View
source</A>
<LI id=ca-history><A title="Past versions of this page. [h]" accessKey=h
href="http://docs.tinyos.net/index.php?title=Platforms&action=history">History</A>
</LI></UL></DIV></DIV>
<DIV class=portlet id=p-personal>
<H5>Personal tools</H5>
<DIV class=pBody>
<UL>
<LI id=pt-login><A
title="You are encouraged to log in, it is not mandatory however. [o]"
accessKey=o
href="http://docs.tinyos.net/index.php?title=Special:Userlogin&returnto=Platforms">Log
in / create account</A> </LI></UL></DIV></DIV>
<DIV class=portlet id=p-logo><A title="Visit the Main Page [z]"
style="BACKGROUND-IMAGE: url(/images/tos-jwall-small.jpg)" accessKey=z
href="http://docs.tinyos.net/index.php/Main_Page"></A></DIV>
<SCRIPT type=text/javascript> if (window.isMSIE55) fixalpha(); </SCRIPT>
<DIV class=portlet id=p-navigation>
<H5>Navigation</H5>
<DIV class=pBody>
<UL>
<LI id=n-mainpage><A title="Visit the Main Page [z]" accessKey=z
href="http://docs.tinyos.net/index.php/Main_Page">Main Page</A>
<LI id=n-portal><A
title="About the project, what you can do, where to find things"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Community_Portal">Community
portal</A>
<LI id=n-currentevents><A
title="Find background information on current events"
href="http://docs.tinyos.net/index.php/Current_events">Current events</A>
<LI id=n-recentchanges><A title="The list of recent changes in the wiki. [r]"
accessKey=r
href="http://docs.tinyos.net/index.php/Special:Recentchanges">Recent
changes</A>
<LI id=n-randompage><A title="Load a random page [x]" accessKey=x
href="http://docs.tinyos.net/index.php/Special:Random">Random page</A>
<LI id=n-help><A title="The place to find out."
href="http://docs.tinyos.net/index.php/Help:Contents">Help</A>
<LI id=n-sitesupport><A title="Support us"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Site_support">Donations</A>
</LI></UL></DIV></DIV>
<DIV class=portlet id=p-search>
<H5><LABEL for=searchInput>Search</LABEL></H5>
<DIV class=pBody id=searchBody>
<FORM id=searchform action=/index.php/Special:Search>
<DIV><INPUT id=searchInput title="Search TinyOS Documentation Wiki [f]"
accessKey=f name=search> <INPUT class=searchButton id=searchGoButton type=submit value=Go name=go> <INPUT class=searchButton id=mw-searchButton type=submit value=Search name=fulltext>
</DIV></FORM></DIV></DIV>
<DIV class=portlet id=p-tb>
<H5>Toolbox</H5>
<DIV class=pBody>
<UL>
<LI id=t-whatlinkshere><A title="List of all wiki pages that link here [j]"
accessKey=j
href="http://docs.tinyos.net/index.php/Special:Whatlinkshere/Platforms">What
links here</A>
<LI id=t-recentchangeslinked><A
title="Recent changes in pages linked from this page [k]" accessKey=k
href="http://docs.tinyos.net/index.php/Special:Recentchangeslinked/Platforms">Related
changes</A>
<LI id=t-upload><A title="Upload images or media files [u]" accessKey=u
href="http://docs.tinyos.net/index.php/Special:Upload">Upload file</A>
<LI id=t-specialpages><A title="List of all special pages [q]" accessKey=q
href="http://docs.tinyos.net/index.php/Special:Specialpages">Special pages</A>
<LI id=t-print><A title="Printable version of this page [p]" accessKey=p
href="http://docs.tinyos.net/index.php?title=Platforms&printable=yes">Printable
version</A>
<LI id=t-permalink><A title="Permanent link to this version of the page"
href="http://docs.tinyos.net/index.php?title=Platforms&oldid=290">Permanent
link</A> </LI></UL></DIV></DIV></DIV><!-- end of the left (by default at least) column -->
<DIV class=visualClear></DIV>
<DIV id=footer>
<DIV id=f-poweredbyico><A href="http://www.mediawiki.org/"><IMG
alt="Powered by MediaWiki"
src="Platforms - TinyOS Documentation Wiki.files/poweredby_mediawiki_88x31.png"></A></DIV>
<UL id=f-list>
<LI id=lastmod>This page was last modified 21:41, 28 December 2007.
<LI id=viewcount>This page has been accessed 586 times.
<LI id=privacy><A title="TinyOS Documentation Wiki:Privacy policy"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Privacy_policy">Privacy
policy</A>
<LI id=about><A title="TinyOS Documentation Wiki:About"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:About">About
TinyOS Documentation Wiki</A>
<LI id=disclaimer><A title="TinyOS Documentation Wiki:General disclaimer"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:General_disclaimer">Disclaimers</A>
</LI></UL></DIV>
<SCRIPT type=text/javascript>if (window.runOnloadHook) runOnloadHook();</SCRIPT>
</DIV><!-- Served in 0.303 secs. --></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -