Page 63 - The Art of Designing Embedded Systems
P. 63
50 THE ART OF DESIGNING EMBEDDED SYSTEMS
A hundred thousand lines of carefully written and documented code
is nothing more than worthless bits until it’s tested. We hear “It’s done” all
the time in this field, where “done” might mean “vaguely understood” or
“coded.” To me “done” has one meaning only: “tested.”
Incremental development and testing, especially of the high-risk
areas such as hardware and communications, reduces risk tremendously.
Even when we’re not honest with each other (“Sure, I can crank this puppy
out in a week, no sweat”), deep down we usually recognize risk well
enough to feel scared. Mastering the complexities up front removes the
fear and helps us work confidently and efficiently.
Conquer the Impossible
Firmware people are too often treated as the scum of the earth, be-
cause their development efforts tend to trail everyone else’s. When the
code can’t be tested until the hardware is ready-and we know the hard-
ware schedule is bound to slip-then the software, already starting late,
will appear to doom the ship date.
Engineering is all about solving problems, yet sometimes we’re im-
mobilized like deer in headlights by the problems that litter our path. We
simply have to invent a solution to this dysfunctional cycle of starting
firmware testing late because of unavailable hardware!
And there are a lot of options.
One of the cheapest and most available tools around is the desktop
PC. Use it! Here are a few ways to conquer the “I can’t proceed because
the hardware ain’t ready” complaint.
One compelling reason to use an embedded PC in non-cost-sensi-
tive applications is that you can do much of the development on a
standard PC. If your project permits, consider embedding a PC
and plan on writing the code using standard desktop compilers and
other tools.
Write in C or C++. Cross-develop the code on a PC until hardware
comes on line. It’s amazing how much of the code you can get
working on a different platform. Using a processor-specific timer
or serial channel? Include conditional compilation switches to dis-
able the target YO and enable the PC’s equivalent devices. One de-
veloper I know tests more than 95% of his code on the PC this
way-and he’s using a PIC processor, about as dissimilar from a
PC as you can get.

