== Introduction ==#introduction
Learn how to use the GPIO tracing service and how to upload target images which are embedded into the test configuration.
The "Blink" app
The "Blink" app used in this tutorial is a TinyOS image that runs on Tmote Sky nodes. After startup of the target node, the image shows the uptime of the node in seconds as a binary count on the three external LEDs on the observer.
You can download the source code for apps, pre-compiled images and the test configurations for all tutorials from here. The app for this tutorial can be found in the folder 'flocklab_tinyos/apps/tutorials/3_GPIOTracing'.
After having downloaded the source code, have a look at it. As you can see, the code uses the FlockLab sensorboard definitions (see tutorial 1 for further info). You can either compile the app yourself or use the pre-compiled image in 'build/telosb/main.exe'.
The test configuration
Now take a look at the FlockLab configuration XML which can be found in 'FlockLab_Testconfiguration.xml'. The overall test configuration is the same as in tutorial 2. However, in this test we embed the target image directly into the test configuration XML. This is done with one block '<imageConf>' per used image (in this tutorial only one image is used). The block asks for the same information as the corresponding site on the FlockLab web interface, namely the name, description, platform and OS of the image. Furthermore you need to specify an ID ('<embeddedImageId>', you can make up a name for the ID yourself) which is then referenced in the '<targetConf>' block. The XML element '<data>' contains a base64 encoded representation of the target image ELF ('main.exe'). You can produce such a string e.g. on Linux with the tool 'base64'. Please do so for this tutorial and replace the content of the element '<data>' accordingly.
Since we want to exploit the GPIO tracing service in this tutorial, there needs to be at least one block '<gpioTracingConf>'. Each of these blocks needs to have the following elements:
'<obsIds>': A list of observers to which the configuration applies.
'<pinConf>': Configuration for a GPIO pin which is to be traced. There can be several of these blocks for several pins. Every pin configuration consists of:
'<pin>': Name of the GPIO pin to trace.
'<edge>': Which edge to trace. FlockLab can trace 'raising', 'falling' or 'both' edges.
'<mode>': FlockLab can either capture a 'single' trace or run in 'continuous' mode.
For additional elements, please consult the XML documentation.
For this tutorial we want to continuously trace the GPIO's 'LED1', 'LED2' and 'LED3' as they are the pins used in the image.
Running the test
You can run the test now. This is done the same way as in tutorial 2 with the only difference being that you do not need to upload the target image first but can proceed directly to uploading the test configuration XML with the embedded target image.
Evaluating the test
As in tutorial 2, you will get the test results by email and also over the web interface and WebDAV. In the archive, the file 'gpiotracing.csv' is the only file of interest to evaluate the test. As you can see, it contains one line for every GPIO edge change that the service detected, together with a timestamp of the event. You will also (as in tutorial 2) get GPIO traces for when the node was turned on/off (GPIO pin 'RST'). If you sort the list by observer, you should be able to see that there was a pin setting every second and that it is actually binary count which was performed.
GPIO traces can also be inspected in the preview page of the web interface. The preview page is accessible through the chart icon (<img src="http://www.flocklab.ethz.ch/user/pics/icons/chart.png" width="20" height="20" valign="bottom" style="padding:0px">), listed in the action column in the overview page.
Deleting tests and images
As a last step in this tutorial, delete the test configuration (and thus the test results) and the corresponding target image. Please proceed according to tutorial 2.