Ada

GNAT 2012 for Debian Wheezy

For purposes known mostly within our company, I’ve created a magic makefile that takes care of most of the work involved with getting a GNAT 2012 (and up-to-date various support tools) up and running on a Debian.

The makefile requires you to download some files manually, but that’s okay, as it gives you a great opportunity to visit AdaCore’s libre webpage. The readme file explains it in more detail.

At this point, the makefile will build (and/or install) the following projects.

  • GNAT 2012 – binary
  • GNATCOLL (Gnatlib) – SVN build
  • AWS (Ada Web Server) – Git build
  • Florist GPL 2012 release
  • XML-Ada 4.3 (release)
  • Yolk (AWS support library)
In time, the makefile will be expanded to support more libraries and projects.

The makefile can be found at GitHub, hope you find it useful or want to contribute.

MBUS and Ada

I recently got my hand on a OM13006 Power Plug meter development kit from NXP Semiconductors. The entire process of actually getting the kit was a quite cumbersome one, and tale left for another time. Though I would like to thank the people at Future Electronics for their invaluable help.

So, now I have a kit which i have spent €200+ on, and no idea how to program it or use it. The smart metering website at NXP has an SDK zip file which you can download. It contains some diagrams and a lot of C/C# source code respectively. More importantly, it contains the (windows) software also depicted on their website.

The software is pretty functional, but lacks an automated log function (besides raw bus data), so you can grab usages and use them in a software model.

A challenge, then!

As the kit consisted of the a meter to plug between your outlet and device, and a USB dongle, the first step was to figure out how to communicate with the device.

After some spent digging through the supplied source code, I realized that the device was interfacing as a serial device. A quick check with minicom confirmed this.

By then, it was just a matter of parsing the line (ASCII encoded) based protocol.

The sources can be found here, or by going to the projects page.

To build the test application, you need to use gnatmake which is part of GNAT. It is part of any respectable Linux distributions repository. When it is installed, just run

gnatmake -P mbus_logger

To build the sample application