Building and running the targetside code, Building and running the hostside code, Building and running the target-side code – Comtrol eCos User Manual

Page 718: Building and running the host-side code

Advertising
background image

Testing

Building and Running the Target-side Code

The target-side component of the USB testing software consists of a single program usbtarget which contains
support for a range of different tests, under the control of host-side software. This program is not built by default
alongside other eCos test cases since it will only operate in certain environments, specifically when the target
board’s connector is plugged into a Linux host, and when the appropriate host-side software has been installed
on that host. Instead the user must enable a configuration option

CYGBLD_IO_USB_SLAVE_USBTEST

to add the

program to the list of tests for the current configuration.

Starting the usbtarget program does not require anything unusual, so it can be run in a normal gdb session just
like any eCos application. After initialization the program will wait for activity from the host. Depending on the
hardware, the Linux host will detect that a new USB peripheral is present on the bus either when the usbtarget
initialization is complete or when the cable between target and host is connected. The host will perform the normal
USB enumeration sequence and discover that the peripheral does not match any known vendor or product id and
that there is no device driver for

"Red Hat eCos USB test"

, so it will ignore the peripheral. When the usbhost

program is run on the host it will connect to the target-side software, and testing can now commence.

Building and Running the Host-side Code

Note: In theory the host-side software should be built when the package is installed in the component repos-
itory, and removed when a package is uninstalled. The current eCos administration tool does not provide this
functionality.

The host-side software should be built via the usual sequence of "configure/make/make install". It can only be built
on a Linux host and the configure script contains an explicit test for this. Because the eCos component repository
should generally be treated as a read-only resource the configure script will also prevent you from trying to build
inside the source tree. Instead a separate build tree is required. Hence a typical sequence for building the host-side
software would be as follows:

$ mkdir usbhost_build

$ cd usbhost_build

$

<

repo

>

packages/io/usb/slave/current/host/configure

➊ ➋

<

args

>

$ make

<

output from make

>

$ su

$ make install

<

output from make install

>

$

The location of the eCos component repository should be substituted for

<

repo

>

.

If the package has been obtained via CVS or anonymous CVS then the package version will be

current

, as

per the example. If instead the package has been obtained as part of a full eCos release or as a separate

.epk

file then the appropriate package version should be used instead of

current

.

The configure script takes the usual arguments such as

--prefix=

to specify where the executables and

support files should be installed. The only other parameter that some users may wish to specify is the location
of a suitable Tcl installation. By default usbhost will use the existing Tcl installation in

/usr

, as provided by

your Linux distribution. An alternative Tcl installation can be specified using the parameter

--with-tcl=

,

614

Advertising