Serial testing with serfilter, Rationale, The protocol – Comtrol eCos User Manual

Page 385: Serial testing with ser_filter

Advertising
background image

Chapter 17. How to Write a Driver

Serial testing with ser_filter

Rationale

Since some targets only have one serial connection, a serial testing harness needs to be able to share the connection
with GDB (however, the test and GDB can also run on separate lines).

The serial filter (ser_filter) sits between the serial port and GDB and monitors the exchange of data between GDB
and the target. Normally, no changes are made to the data.

When a test request packet is sent from the test on the target, it is intercepted by the filter.

The filter and target then enter a loop, exchanging protocol data between them which GDB never sees.

In the event of a timeout, or a crash on the target, the filter falls back into its pass-through mode. If this happens
due to a crash it should be possible to start regular debugging with GDB. The filter will stay in the pass-though
mode until GDB disconnects.

The Protocol

The protocol commands are prefixed with an

"@"

character which the serial filter is looking for. The protocol

commands include:

PING

Allows the test on the target to probe for the filter. The filter responds with

OK

, while GDB would just ignore

the command. This allows the tests to do nothing if they require the filter and it is not present.

CONFIG

Requests a change of serial line configuration. Arguments to the command specify baud rate, data bits, stop
bits, and parity. [This command is not fully implemented yet - there is no attempt made to recover if the new
configuration turns out to cause loss of data.]

BINARY

Requests data to be sent from the filter to the target. The data is checksummed, allowing errors in the transfer
to be detected. Sub-options of this command control how the data transfer is made:

NO_ECHO

(serial driver receive test) Just send data from the filter to the target. The test verifies the checksum and
PASS/FAIL depending on the result.

EOP_ECHO

(serial driver half-duplex receive and send test) As

NO_ECHO

but the test echoes back the data to the filter.

The filter does a checksum on the received data and sends the result to the target. The test PASS/FAIL
depending on the result of both checksum verifications.

281

Advertising