Consultant Summary

RTOS Book 2 - Example Code Units

.The code units provided here are for information and help; they are definitely not to be treated as being prescriptive. They describe merely one way to solve the problems raised by the exercises, and all are functionally correct. Note that only the key language files are supplied, not the full project set. Here the key guiding principles in producing source code are that such code:

  • Should be easy to read.
  • Should be easy to understand and
  • Should avoid complex or obscure language constructs.

As a result some of you may consider the outcome to be unsophisticated and/or verbose. So be it.

To finish: a final (personal) comment. I have never understood why so many programmers strive to minimize the size of their source code. Experience has shown that there can be a real downside to taking such an approach. Because, in many cases, the outcome is text that is complex and difficult to understand. And this, unfortunately, can make it a challenging task to maintain such code through the lifetime of a project.

The real issue for the embedded system designer is the size of the object code (not the source code). This is especially important where the available memory is limited, an important issue in MCU-based designs. Two factors help keep object code down: using simple source code constructs and employing an optimizing compiler.

Example Code Units

All links will open in a new browser tab.

Chapter 2:

Chapter 3:

Chapter 4:

Chapter 6:

Chapter 7:

Chapter 8:

Chapter 10:

Chapter 11:

Chapter 12:

Chapter 13: