Skip to Content
Programming Embedded Systems in C and C++
book

Programming Embedded Systems in C and C++

by Michael Barr
January 1999
Beginner to intermediate
200 pages
7h 43m
English
O'Reilly Media, Inc.
Content preview from Programming Embedded Systems in C and C++
139
Chapter 10
In this chapter:
Increasing Code
Efficiency
Decreasing Code Size
Reducing Memory
Usage
Limiting the Impact
of C++
10
10. Optimizing Your
Code
Things should be made as simple as possible,
but not any simpler.
—Albert Einstein
Though getting the software to work correctly seems like the logical last step for a
project, this is not always the case in embedded systems development. The need
for low-cost versions of our products drives hardware designers to provide just
barely enough memory and processing power to get the job done. Of course, dur-
ing the software development phase of the project it is more important to get the
program to work correctly. And toward that end there are usually one or more
“development” boards around, each with additional memory, a faster processor, or
both. These boards are used to get the software working correctly, and then the
final phase of the project becomes code optimization. The goal of this final step is
to make the working program run on the lower-cost “production” version of the
hardware.
Increasing Code Efficiency
Some degree of code optimization is provided by all modern C and C++ compil-
ers. However, most of the optimization techniques that are performed by a com-
piler involve a tradeoff between execution speed and code size. Your program can
be made either faster or smaller, but not both. In fact, an improvement in one of
these areas can have a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

You might also like

Embedded Systems Object-Oriented Programming in C and C++

Embedded Systems Object-Oriented Programming in C and C++

Israel Gbati

Publisher Resources

ISBN: 1565923545Catalog PageErrata