Mottek Archive 2019

Yak Shaving

The keen eye will have notice some small changes and disruptions on 40Hz and in the RSS feed. What was that about? Well, some good yak shaving, of course!

It all started with the desire to visualize data from some small sensor motes I deployed (another yak which got shaved - yes, you can buy these things, but where’s the fun in that!). Which obvioulsy needs some sort of database. And while it’s possible to just use an off the shelf database, I wanted to see how an optimized time series database could be implemented in OCaml. Turns out it’s not too difficult, but at some point, I ran into a hard to diagnose deadlock, and while debugging it, I searched for a short term replacement.

One candidate is InfluxDB, which comes with a nice Grafana data source plugin. One issue to resolve is memory consumption of the database, and while my current server would likely handle the load, I was already earlier thinking about migrating to a slightly beefier machine.

Migrating a server is never fun though, so I checked which services I would like to discard in the process. And one candidate was the PHP-based content managament system I put together a long time ago. So while the server is not migrated, I switched the content management already to Hugo. There are some rough edges, I really liked for example the ability to refer to pages in a Wiki-style, but it is also nice to simplify the server setup.

That was however not all of the Yak, stay tuned for more!

PS: Apologies for some still remaining breakage. I tried to catch broken links with redirect, and will fix issues as I’ll find them.

2019-08-05 | Yak Shaving

Surprising Combinations

After reading the report of the European Mars Lander Crash investigation (and growing frustration with C as an embedded programming language), I started to look into Ada about a year ago. The Make With Ada contest, the availability of runtimes and drivers for embedded systems, and the promise of a standardised framework for real-time programming made this a very interesting journey.

Unfortunately, my go-to MCU (STM32F051, cheap, easily available, good development boards) is very low end, and the tasking part of the AdaCore runtimes are not yet fully working on Cortex M0 MCUs: My remote sensor program would run into an error of a nested lock operation because of missing hardware spin lock support on M0 cores.

Fortunately, a solution which first seemed overly complex but which turned out to be very elegant turned up, a port of the higher level Ada runtime to FreeRTOS. FreeRTOS has very wide platform support, and runs without problem on the STM32F051.

Moving my existing code to Simon Wright’s work was surprisingly simple (proving the advantage of standardising real time concepts in the language level), only the stack sizes for the tasks had to be adjusted. After years of pointer arithmetic, buffer overflows, and casting, Ada is a refreshing change!

2019-01-20 | Surprising Combinations