Make With Ada
I subscribed to Make magazine for a year when it first came out but let the subscription lapse as the projects were all over the map. Electronics, mechanical, gardening – there really wasn’t much focus. Perhaps that has changed in the intervening decade.
What hasn’t changed is the “maker” movement, which every year seems to gain steam. Some of that is driven by the wide availability of cheap evaluation boards, and even full-blown Linux machines that priced at tens of dollars or less. Back when the first 8 bitters came out the simplest computer costs thousands to build. Today Freescale’s FRDM boards, ST’s Discovery, TI’s MSP430 boards and the like are widely available and cheap to the point of absurdity. Many tools are open source and even pro IDEs that cost thousands are often free for small projects.
Want to make something embedded? There’s really no barrier to entry. In fact, you could earn rich rewards by participating in a maker contest.
One that looks really cool is the recently-started Make With Ada challenge. Build a cool embedded system using the Ada language and you could win a variety of prizes; the grandest is 5000 Euros. It’s sponsored by AdaCore and runs from now till the end of September.
This a deeply-embedded tournament. You have to use a Cortex-M or –R processor.
I often hear from readers that, sure, Ada sounds interesting but it doesn’t work on microcontrollers. That simply isn’t true as the runtime has been ported to a number of MCUs and there are ports for various evaluation boards, for example ST’s Discovery series. Get a $20 board and the free GNAT compiler and you’re set to go.
But there’s a cooler platform. The $180 Crazyflie nanodrone weighs just 27 g and includes (among other things):
- STM32F405 main application MCU (Cortex-M4, 168MHz, 192kb SRAM, 1Mb flash)
- nRF51822 radio and power management MCU (Cortex-M0, 32Mhz, 16kb SRAM, 128kb flash)
- 3 axis gyro
- 3 axis accelerometer
- 3 axis magnetometer
- high precision pressure sensor
Just think about this for a minute: two 32-bit computers plus all of those sensors – in a 27 G package. It was about ten minutes ago that a 3-axis gyro needed spinning wheels and weighed a lot. Or a 32-bit computer sucked many amps and couldn’t be lifted by one person.
(I asked Seeed for permission to run their picture of the drone but got a baffling response that seemed to imply unpleasant legal action. Check out their web site for details.)
The gyro, accelerometer and magnetometer are all provided by a single MPU-9250 chip. These are under a buck in 5000 lots and come in tiny 3 x 3 mm QFN packages.
The Crazyflie’s code is written in Ada. Examining it is a great way to build familiarity with the language.
The contest’s web site states “The Ada programming language encourages a ‘think first, code later’ discipline that helps produce more readable, reliable and maintainable software.” That’s a noble aspiration. And, we have tons of data that shows that approach leads to more reliable code. And shorter schedules! You can have your cake and eat it too.
The contest is for Ada code but that includes anything written in SPARK. SPARK is a subset of Ada. However, it requires the developer to annotate the code, in the comments, with formal notation that describes the engineer’s intent. Free tools parse that with the code to make sure both align.
The problem with SPARK is that error rates are so low as to be almost immeasurable. The late Peter Amey said: “In my 10-plus years of using SPARK, I have never needed to use a debuggger. I have become so used to things working the first time that my debugging skills have almost completely atrophied.”
Now that’s something to aspire to!
(Full disclosure: I’m one of the judges for this competition. And you have no idea how much I’m looking forward to seeing the entries!)
Full information is here.
Jack G. Ganssle is a lecturer and consultant on embedded development issues. He conducts seminars on embedded systems and helps companies with their embedded challenges, and works as an expert witness on embedded issues. Contact him at firstname.lastname@example.org. His website is www.ganssle.com.