Loading…
CppCon 2020 has ended
Back To Schedule
Monday, September 14 • 10:30 - 11:30
Memory-Mapped Devices as Objects

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Most, if not all, modern CPUs communicate with external devices via memory-mapped device registers. A memory-mapped register is circuitry that connects to a CPU’s bus structure and responds to bus signals almost as if it were ordinary memory. Almost, but not quite.

C++ programs can use C features such as pointers and casts to access memory-mapped registers. This is still widespread practice. However, traditional C techniques tend to treat memory-mapped registers more as raw storage than as objects with constrained behaviors. C idioms for accessing memory-mapped devices leave too many opportunities for programming errors and late nights with a debugger.

This session explains various C++ techniques for placing objects into memory-mapped locations and for guaranteeing proper initialization and destruction. It shows how you can use base classes and templates to capture commonalities among different devices that use similar register layouts. By applying these techniques, you’ll be able to package memory-mapped devices as lightweight class objects that are easy to use correctly and hard to use incorrectly.

Speakers
avatar for Dan Saks

Dan Saks

President, Saks & Associates
Dan Saks is the president of Saks & Associates, which offers training and consulting in C and C++ and their use in developing embedded systems. Dan used to write the “Programming Pointers” column for embedded.com online. He has also written columns for numerous print publications... Read More →


Monday September 14, 2020 10:30 - 11:30 MDT
Embedded