-
TinyOS
As I did with previous projects I had at my university, I’d like to share another one: it’s a project using TinyOS. It’s mainly intended for education purposes, so if you are trying to learn TinyOS, it’s a good example to look at.
What does it do?
It’s a platform to monitor temperature and humidity of various rooms in a house. All sensors must collect data every X seconds and send them to sink, a predefined node. Sink can also change the value X and sensors may not reach sink in a single hop, so nodes have to use their own routing protocol to send forward data from other nodes to sink.
If you are interested in this project, send me an email and so I could help you to understand it. I think it’s a good exercise to look at source code and discover which routing protocol I was talking about (before reading the README file).
As I think I won’t modify this code anymore, rather than put it in my git repository I made a .tar.bz2 which is available here: House Monitor source code.
-
Compiler’s compiler version
Today I was just wondering… what’s the version of the compiler which compiled my compiler. Quite a strange question to make myself and I really don’t know where this curiosity came from.
Looking in Wikipedia:
Early compilers were written in assembly language. The first self-hosting compiler — capable of compiling its own source code in a high-level language — was created for Lisp by Tim Hart and Mike Levin at MIT in 1962.[2] Since the 1970s it has become common practice to implement a compiler in the language it compiles, although both Pascal and C have been popular choices for implementation language. Building a self-hosting compiler is a bootstrapping problem — the first such compiler for a language must be compiled either by a compiler written in a different language, or (as in Hart and Levin’s Lisp compiler) compiled by running the compiler in an interpreter.
Interesting, don’t you think? So let’s see the version of your compiler’s compiler. If you use GCC, it will put a comment in section named (surprise!) .comment. Generate the assembly correspondent to a C source code and you are going to see in the end of the file an entry like this:
.size main, .-main
.ident “GCC: (GNU) 4.4.1″
.section .note.GNU-stack,”",@progbitsSo, let’s play with our already compiled compiler. First we have to check the compiler version:
[lucas@skywalker tmp]$ gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure –prefix=/usr –enable-shared –enable-languages=c,c++,fortran,objc,obj-c++ –enable-threads=posix –mandir=/usr/share/man –infodir=/usr/share/info –enable-__cxa_atexit –disable-multilib –libdir=/usr/lib –libexecdir=/usr/lib –enable-clocale=gnu –disable-libstdcxx-pch –with-tune=generic
Thread model: posix
gcc version 4.4.1 (GCC)Ok! Version 4.4.1. Let’s use the readelf command to see the content of .comment section:
[lucas@skywalker tmp]$ readelf -p .comment /usr/bin/gcc
String dump of section ‘.comment’:
[ 1] GCC: (GNU) 4.4.0 20090630 (prerelease)
[ 29] GCC: (GNU) 4.4.0 20090630 (prerelease)
[ 51] GCC: (GNU) 4.4.1[ 63] GCC: (GNU) 4.4.1
(…)
[ 237] GCC: (GNU) 4.4.1
[ 249] GCC: (GNU) 4.4.1
[ 25b] GCC: (GNU) 4.4.0 20090630 (prerelease)
[ 283] GCC: (GNU) 4.4.1
[ 295] GCC: (GNU) 4.4.0 20090630 (prerelease)I didn’t understand if it’s 4.4.1 or 4.4.0, i.e. if it was used a prior version to compile the current version or if current was recompiled afterwards with this new compiler produced. Testing random binaries in /usr/bin seems to produce similar effects, having more than one version.
So… no answers yet. Any clues?

