A note on failures, Debugging – Comtrol eCos User Manual

Page 388

Advertising
background image

Chapter 17. How to Write a Driver

[400 11:35:16] Binary data (Size:16, Flags:1).

[400 11:35:16] Sending CRC: ’170231!’, len: 7.

[400 11:35:16] Reading 16 bytes from target.

[400 11:35:16] Done. in_crc 170231, out_crc 170231.

[400 11:35:16] Responding with status OK

[400 11:35:16] Received DONE from target.

This tracing output is normally sent as O-packets to GDB which will display the tracing text. By using the

-c

option, the tracing text can be redirected to the console from which ser_filter was started.

A Note on Failures

A serial connection (especially when driven at a high baud rate) can garble the transmitted data because of noise
from the environment. It is not the job of the serial driver to ensure data integrity - that is the job of protocols
layering on top of the serial driver.

In the current implementation the serial tests and the serial filter are not resilient to such data errors. This means
that the test may crash or hang (possibly without reporting a

FAIL

). It also means that you should be aware of

random errors - a

FAIL

is not necessarily caused by a bug in the serial driver.

Ideally, the serial testing infrastructure should be able to distinguish random errors from consistent errors - the
former are most likely due to noise in the transfer medium, while the latter are more likely to be caused by faulty
drivers. The current implementation of the infrastructure does not have this capability.

Debugging

If a test fails, the serial filter’s output may provide some hints about what the problem is. If the option

-S

is used

when starting the filter, data received from the target is printed out:

[400 11:35:16] 0000 50 41 53 53 3a 3c 42 69 ’PASS:

<

Bi’

[400 11:35:16] 0008 6e 61 72 79 20 74 65 73 ’nary.tes’

[400 11:35:16] 0010 74 20 63 6f 6d 70 6c 65 ’t.comple’

[400 11:35:16] 0018 74 65 64 3e 0d 0a 49 4e ’ted

>

..IN’

[400 11:35:16] 0020 46 4f 3a 3c 42 49 4e 41 ’FO:

<

BINA’

[400 11:35:16] 0028 52 59 3a 31 32 38 3a 31 ’RY:128:1’

[400 11:35:16] 0030 21 3e 0d 0a 40 42 49 4e ’!..@BIN’

[400 11:35:16] 0038 41 52 59 3a 31 32 38 3a ’ARY:128:’

[400 11:35:16] 0040 31 21 .. .. .. .. .. .. ’1!’

In the case of an error during a testing command the data received by the filter will be printed out, as will the data
that was expected. This allows the two data sets to be compared which may give some idea of what the problem is.

284

Advertising