For novel ideas about building embedded systems (both hardware and firmware), join the 35,000 engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.

This month's giveaway is a Cypress CY8KIT-044 PSoC 4 M-series Pioneer kit. Enter here.

Published 12/13/2005

I came across two engineers vehemently arguing about buying a commercial RTOS. “It’s too big,” one complained, “we’re already short on flash.”


Engineering isn’t about achieving some sort of technology perfection. And it’s only consequentially about building products.

Engineering is a business proposition. We’re paid to help the company generate profits and increase shareholder value. So a wise developer uses that context to evaluate every decision he makes.

Can’t squeeze some commercial product, say an RTOS or protocol stack, into memory? Don’t start salivating at the chance of writing that code yourself (“I’ve always wanted to write an OS!”). Take your hands off the keyboard and consider the business impact of buying a smaller product from a different vendor… or adding more flash.

We deal with two kinds of costs. Bits and pieces, ICs, PCBs and labor form the cost of goods sold (COGS). Additional memory will indeed inflate the COGS and thus increase the product’s price.

But NRE (non-recurring engineering) is every bit as significant as COGS. NRE is us: our salary, desks, scopes and tools. It’s incurred once, hopefully, during product development.

There’s a tradeoff between NRE and COGS. If you’re building an electronic greeting card even $0.0001 in recurring cost is hugely important. It’s wise to invest lots of engineering to shave every microcent. But other products require different tradeoffs.

Firmware is the most expensive thing in the universe, with most companies spending some $15 to $30 per line of code. The space shuttle’s software runs about $1000/line. Jean LaBrosse’s very popular uC/OS comprises about 6000 lines of C, representing an effort worth well over $100k… assuming average practices. I imagine the cost of this OS to be far more, since it has been used in products certified to DO-178B level A. Jean tells me <i>thousands</i> of pages of documentation were generated to meet that onerous safety-critical standard.

But even at $100k, if you’re building a thousand widgets you’ll save the company serious dough by adding ten bucks worth of memory, rather than rolling your own OS.

A few years ago an engineer emailed me that they were coding their own Internet stack. Management had choked on the $15,000 cost of the commercial package they’d considered. I called the vendor, who confirmed the package had over 100,000 lines of code.

That’s 15 cents per line. A Blue Light Special.

The right business decision would have been to present the vendor with a $15,000 check and a huge grin. That purchase is so lopsided in the customer’s favor it’s akin to robbery.

What do you think? Does your company make reasonable business tradeoffs between NRE and COGS?