Platform Creation and Testing

From TinyOS Wiki
Revision as of 14:45, 28 November 2007 by Jgriessen (talk | contribs) (Lesson 10a: Platform Creation and Testing)
Jump to: navigation, search

Lesson 10a: Platform Creation and Testing

Last updated 15 August 2007 A new platform wiring debug tool with only three code files.

We have a fairly simple goal -- to harness GPIOs so we can control them and see what they are inputting on a MSP430 based platform. Seeing means displaying, so we will use the three LEDs found on many MSP430 platforms to display a 3 bit binary number corresponding to pin0 through Pin7 that we wish to test. This module is for MSP430 testing purposes so will never need Hardware Independent HIL modules -- we will come to that in 10b. The tests this code helps with are whether a new printed circuit board has traces going to the right MSP430 IO ports.

With a HAL, (hardware adaptation layer), configuration and code file plus a HPL, (hardware presentation layer), configuration and code file we would have 4 files. Since we reuse the GeneralIO interface with new names and add no new functions, we can do without a code file. So we have just three files, (beyond all the core tinyOS modules), for this exercise. The HPL configuration file maps connections from any port names predefined in the MSP430 chip directory to our desired group of eight ports named Pin0 - Pin7. The HPL file is part of a new platform, defined by a new directory added to the tinyos source code tree: /opt/tinyos-2.x/tos/platforms/ecosens1p. Some necessary parts for a new platform variant were copied from telosb: PlatformC.nc MoteClockC.nc MoteClockP.nc PlatformP.nc. They set up the clocks and initialize the MSP430. Also needed in this new platform is hardware.h, which was copied from telosb and modified to change names to leave off the humidity sensor, and rename some GeneralIO signal names.

Creating a new platform

There is plenty of ground work done for us, so the first steps of this process are copying -- This example code can run on an unmodified telosb hardware. Some details you will see are specific to an Ecosensory platform, but they don't stop you from learning by making the IO tester program below on any telosb derived platform. So copy from telosa and telosb and update .platform file and remember support/make/*.target -- see lesson 10. To use the tutorial as is, the name of the platform can be ecosens1p, p for prototype, but it will be better to use your own name and get the hang of it more. When you are done copying your new dir should look like this:

john@ecolab:/opt/tinyos-2.x/tos/platforms/ecosens1p$ ls ActiveMessageC.nc MoteClockP.nc SwitchToggleC.nc chips MotePlatformC.nc TelosSerialP.nc DemoSensorC.nc MSP430ADC12ChannelConfigM.nc UserButtonC.nc DemoSensorNowC.nc Msp430Timer32khzMapC.nc UserButton.h DemoSensorStreamC.nc PlatformC.nc UserButtonP.nc hardware.h platform.h VoltageC.nc HplNew8IOsC.nc PlatformLedsC.nc VoltageStreamC.nc HplUserButtonC.nc platform_message.h MoteClockC.nc PlatformP.nc

To simplify we will learn about the bottom, close to the hardware, HPL layer of tinyOS modules first, then add HAL and HIL top level and generic modules in lesson 10b.