At first glance, repurposing seems a no-brainer because of its potential for saving time and effort, but a closer look at the risks involved paints a different picture.
Risks of repurposing firmware include unknown bugs, uncorrected known bugs, poor programming practices, and "fragile" software that becomes unstable after change. And sometimes even though the software is well-written it just doesn't achieve its intended purpose.
Here are some criteria I find helpful when evaluating if I can reuse a firmware code base:
- Documentation: Does it exist and is it current? (Specifically, I ask for design documentation and test procedures.)
- Understandability: Simply read through the source code. Does the style and format conform to your standards?
- Testability: Has the code been unit tested? Can you duplicate the results?
- Availability of original developer: Can you contact the programmer(s) should you run into problems?
- Version and source control: Is the software under active management and control?
Unfortunately I have not found a failproof system to make this decision. However if more than half of the above points are answered in the negative I choose to start from scratch.