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