Compatibility, Implementation details, New platform ports – Comtrol eCos User Manual

Page 322

Advertising
background image

Chapter 11. Porting Guide

}

Beware that if doing something like the above, you should only do it to a channel which does not have GDB at the
other end: GDB ignores raw data, so you would not see the output.

Compatibility

The use of this service is controlled by the option

CYGSEM_HAL_VIRTUAL_VECTOR_DIAG

which is disabled per

default on most older platforms (thus preserving backwards compatibility with older stubs). On newer ports, this
option should always be set.

Implementation Details

There is an array of procedure tables (raw comm channels) for each IO device of the platform which get initialized
by the ROM monitor, or optionally by a RAM startup configuration (allowing the RAM configuration to take full
control of the target). In addition to this, there’s a special table which is used to hold mangler procedures.

The vector table defines which of these channels are selected for console and debugging IO respectively: console
entry can be empty, point to mangler channel, or point to a raw channel. The debugger entry should always point
to a raw channel.

During normal console output (i.e., diagnostic output) the console table will be used to handle IO if defined. If not
defined, the debug table will be used.

This means that debuggers (such as GDB) which require text streams to be mangled (O-packetized in the case of
GDB), can rely on the ROM monitor install mangling IO routines in the special mangler table and select this for
console output. The mangler will pass the mangled data on to the selected debugging channel.

If the eCos configuration specifies a different console channel from that used by the debugger, the console entry
will point to the selected raw channel, thus overriding any mangler provided by the ROM monitor.

See hal_if_diag_* routines in hal_if.c for more details of the stream path of diagnostic output. See

cyg_hal_gdb_diag_*()

routines in

hal_stub.c

for the mangler used for GDB communication.

New Platform Ports

Define

CDL

options

CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS

,

CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL

, and

CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL

.

If

CYGSEM_HAL_VIRTUAL_VECTOR_DIAG

is set, make sure the infra diag code uses the hal_if diag functions:

#define HAL_DIAG_INIT() hal_if_diag_init()

#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_)

#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_)

In addition to the above functions, the platform HAL must also provide a function cyg_hal_plf_comms_init which
initializes the drivers and the channel procedure tables.

Most of the other functionality in the table is more or less possible to copy unchanged from existing ports. Some
care is necessary though to ensure the proper handling of interrupt vectors and timeouts for various devices handled
by the same driver. See PowerPC/Cogent platform HAL for an example implementation.

218

Advertising