Errata

Programming Embedded Systems in C and C++

Errata for Programming Embedded Systems in C and C++

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 000
task.cpp, in function TaskList::insert, line 62

I know this isn't actually in the book text, but in the example code downloadable
from this site, but in task.cpp, in function TaskList::insert at line 62 I
think the equality comparison operator '==' is a copy'n'paste-ism, and should
be the assignement operator '=', i.e.

60: if (*ppPrev == NULL)
61: {
62: *ppPrev == pTask;
62: return;
64: }

should read

60: if (*ppPrev == NULL)
61: {
62: *ppPrev = pTask;
62: return;
64: }

Anonymous   
Printed Page 52
Timer/Counters section of code

I think there may be a line of code missing.
I think the following line should be in there:
#define T2CMPB (PCB_BASE + 0x44)

I'm not sure about this, it just looks funny to me that all the other counters have a
line like this, but this one doesn't.
If that isn't the correct line of code, then is there something else that's available
at PCB_BASE + 0x44 that should be referenced?

[p. 61]: Table 6-1 lists "none" for NVRAM Erase Cycles. This should be
"unlimited" as for SRAM.

Anonymous   
Printed Page 69
Program fragment at bottom of the page

The line that reads:

datum antipattern = (datun) 0x55555555;

should read:

datum antipattern = (datum) 0x55555555;

IE: a single character typo in the cast changing "datum" to "datun"

Spotted in the [5/01] reprint

Anonymous   
Printed Page 69
The way memTestAddressBuss() is implemented, the region size

must be a power of two and the base address must be a multiple of the
region size. The Notes imply that these conditions are optional. Change
the Notes to

* Notes: The region size must be a power of two.
* The selected base address must be a multiple of the region
* size.

Anonymous   
Printed Page 70
2nd & 5th paragraphs

Michael, great book. I have the 1/01 printing.

I worked through memTestAddressBus() on paper and though it detects SA0, SA1, and shorts, the comments explaining which faults are
detected in each part of the test, appear to be incorrect.

It appears that in the first part of the test where the comment says "Check for address bits stuck high." it should instead state "
Check for address bits stuck high and low."

Also, it appears that in the second part of the test where the comment says "Check for address bits stuck low or shorted." it shoul
d instead state "Check for address bits shorted."

Anonymous   
Printed Page 97
timer.cpp

In the file timer.cpp (chapter 7), line number 157 in the remove member function, I
think the line needs to change to something like this:

if (*ppPrev != NULL)
(*ppPrev)->count += pTimer->count;

If there is only one timer in the list, and the remove member function removes it,
then line 157 would reference the count member of a NULL pointer. This would then
corrupt address 0 (plus the count offset) in the processors data space. In my case
(Atmel AVR), the general purpose register are incorrectly changed.

Anonymous   
Printed Page 104
Line 5 from the bottom states that the stack size parameter to

the Task constructor is optional, but I don't see the default value.

Also, in Chapter7/timer.cpp, remove(), the comment on lines 131-132 is

* Returns: A pointer to the removed timer, NULL if it wasn't
* found in the timer list.

but the code returns a pointer to the timer following the removed timer.
Line 162 should be

return (pTimer);

Anonymous   
Printed Page 104
1st paragraph

"the task enters the waiting state"
should be
"the task enters the ready state"

Anonymous   
Printed Page 113
I know contextSwitch() is just pseudocode, but the prototype

would be better as

contextSwitch(Context * pOldContext, Context * pNewContext)

Anonymous   
Printed Page 115
sample code "task.cpp" in ftp server (chapter 8)

The function TaskList::insert(Task *pTask) in task.cpp is incorrect. It leads to
accessing null pointer and wrong insertion position. I found that some link-list
classes have similar mistakes. Please check those functions.

Anonymous   
Printed Page 132
I had the same question as you describe in your footnote when I

first read The C Programming Language. The best explanation I can find
is in the middle of p. 173 of The Unix Programming Environment:

"getchar returns the next byte from the input, or the value EOF when it
encounters the end of file (or an error). By the way, EOF is _not_ a
byte from the file; ... The value of EOF is guaranteed to be different
from any value that occurs in a single byte so it can be distinguished
from real data; c is declared int, not char, so that it is big enough to
hold the EOF value."

Anonymous   
Printed Page 142
Within struct called serialparams_t

typedef struct
{
uint32_t dataBits;
uint32_t stopBits;
uint32_t baudRate;
parity_t parity;
} serialparams_t;

should be the following:


typedef struct
{
databits_t dataBits;
stopbits_t stopBits;
uint32_t baudRate;
parity_t parity;
} serialparams_t;

Justin Royce  Oct 06, 2021