Saturday, January 02, 2016

Things

Last year I worked my first (and probably last) IoT gig. I was brought in to build a prototype of the product's iOS companion app and then asked to work on the firmware for the (still-NDA'd) product itself. It was definitely an experience.

Firstly, working with hardware engineers in very different from working with software engineers. For one thing, their desks are so much messier. They tend to have far more pointy and/or hot tools to hand, and generally do at least one thing each day which could potentially burn down the build.

Product planning also takes on a very different flavour. Brainstorming meetings typically follow this kind of pattern:

SOFTWARE GUY: Here's an idea. Why don't we do [thing involving computing]

HARDWARE GUY: Well, yes, we could. But it would have a detrimental effect on battery life.

SOFTWARE GUY: Then how about we do [another thing involving computing]

HARDWARE GUY: Maybe. But it would mean drawing an extra [ridiculously small amount of power] from the battery.

SOFTWARE GUY: Or we could —

HARDWARE GUY: No. Battery.

SOFTWARE GUY: Okay. Would anyone like a cup of —

HARDWARE GUY: BATTERY!

The hardware guys I worked with were wonderful chaps, utterly boffiny types, but boy were they obsessed with batteries.

My second observation involves embedded toolchains, and how they are utter shit. Seriously. I was never one of those complain-about-Xcode guys, but from now on, I shall stifle even the smallest gripe should it threat to escape my lips. What's that? Xcode's crashed? Well at least it hasn't caused a kernel panic, like MP-fucking-Labs kept doing.

(Or at least that was the plan before I started working with Swift… But that's a story for another day.)

I don't really want to go too in-depth into exactly how shite the MPLabs IDE is. I'm trying to put the whole experience behind me. I won't bitch about how the compiler's a modified version of GCC which they've somehow managed to make worse. Or how Microchip want to charge you money for allowing you to write in C++. Or even C99. I am completely over the stress-induced headaches which come from it optimising-away entire blocks of code I had set breakpoints in, even at the lowest setting (or that the higher settings were a paid upgrade).

Let me just make a single observation about the IDE: it doesn't feature any kind of code autocompletion, but it does spellcheck your comments.

Finally, let's deal with the important stuff: the hardware and software. What OS did we use? Ha! Where we're going, we don't need no OS! Okay, this isn't entirely true. The hardware doesn't require an OS (this is embedded microcontroller programming, after all), but after a couple of months of random flailing around it because quite obvious that I did. My years wasted writing assembly language on the Atari ST hadn't properly prepared me for getting this close to the metal. In the end there was some considerable re-tooling and we settled on FreeRTOS to provide a sheen of civilisation to the otherwise register-level barbarity. Tasks! Queues! If felt like someone who went camping and ended up booking into a hotel as soon as it started raining, but sod it, I was comfortable again.

There was a little concern that adding the decadent excess of an OS would fritter away our limited resources, and I must admit I got caught up in this until the point where a took a step back and realised that the chip in question — based on the 32-bit MIPS M4K core running at 40Mhz — was more powerful then the first half dozen computers I owned combined. Sure, it only had 32k RAM and 256k ROM, but we were only asking it to perform some very basic coordination between peripherals. The hardware they'd used to make Jurassic Park wasn't that much more powerful. We could manage.

I left the project when yet another shift in hardware was on the cards. It seemed like a natural break. I'd been telling them from day one that they would be better served by hiring an embedded specialist, and eventually I just felt I had to make a move and force them to take that step. I would have liked to stay on to see The Thing go into production and onto the market. Imagine: seeing neatly shrink-wrapped boxes containing a product that you helped take from an idea to a finished item, rolling off the production line and onto the shelves. I'm keeping an eye open for when it does.

No comments: