lp0 on fire

My personal blog

Rant: Non-C(ense) embedded devices

Recently I came across a couple of embedded boards that had a java vm flashed on top of it. Same for javascript, python, lua and a couple of other languages. Most boast about their low 5MB runtimes and efficiency, but the cool kids on the block forgot that father C can do those numbers and have a very advanced application flashed in the same or less space.

Before anyone comments that non-C languages are simpler, adding bells and whistles to a language doens't make for a simpler language. Being less verbose doesn't have to result in simplicity either, hiding details can make things far more complex. No, it's the way we design and write our code. I do agree however that C's toolchains often are complicated to setup properly compared to most other languages, but this has nothing to do with the language itself.

An embedded device should have the lowest power consumption and storage requirements possible, have the code written as minimalistic and direct as possible, direct control over memory allocation, and absolutely not have costly layers of abstraction (oop, virtual machines, interpreters, etc). To that end, C89 is in my opinion the only language that fits the bill.

Most people forget that embedded devices are mission critical, meaning that they shouldn't fail under any circumstances. The more complex the device (more storage, a more advanced processor, etc) the more points of possible failure. Adding a relative large runtime to it for the sake of a "simpler" language only increases the possibility of failure.

Using C for system and embedded devices makes sense. Using Go for desktop applications makes sense. Using scripting languages for scripting makes sense. Using a scripting language for embedded devices doesn't, period.